diff options
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_brs.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_lsa.c | 20 | ||||
-rw-r--r-- | source3/rpc_server/srv_netlog.c | 136 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 703 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe_hnd.c | 111 | ||||
-rw-r--r-- | source3/rpc_server/srv_reg.c | 10 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr.c | 86 | ||||
-rwxr-xr-x | source3/rpc_server/srv_spoolss.c | 236 | ||||
-rw-r--r-- | source3/rpc_server/srv_srvsvc.c | 14 | ||||
-rw-r--r-- | source3/rpc_server/srv_svcctl.c | 14 | ||||
-rw-r--r-- | source3/rpc_server/srv_wkssvc.c | 4 |
11 files changed, 739 insertions, 599 deletions
diff --git a/source3/rpc_server/srv_brs.c b/source3/rpc_server/srv_brs.c index c2abd28cf8..cde5a79beb 100644 --- a/source3/rpc_server/srv_brs.c +++ b/source3/rpc_server/srv_brs.c @@ -66,7 +66,7 @@ static void brs_reply_query_info(BRS_Q_QUERY_INFO *q_u, /******************************************************************* api_brs_query_info ********************************************************************/ -static void api_brs_query_info( pipes_struct *p, prs_struct *data, +static void api_brs_query_info( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { BRS_Q_QUERY_INFO q_u; @@ -91,7 +91,7 @@ struct api_struct api_brs_cmds[] = /******************************************************************* receives a browser pipe and responds. ********************************************************************/ -BOOL api_brs_rpc(pipes_struct *p, prs_struct *data) +BOOL api_brs_rpc(rpcsrv_struct *p, prs_struct *data) { return api_rpcTNP(p, "api_brssvc_rpc", api_brs_cmds, data); } diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index 9b6a98e9a6..fbe83b02c8 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -140,7 +140,7 @@ static void lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, prs_struct *rdata, { /* set up the LSA QUERY INFO response */ - r_q.undoc_buffer = 0x1; /* bizarre */ + r_q.undoc_buffer = 0x1; r_q.info_class = q_q->info_class; make_dom_query(&r_q.dom.id5, dom_name, dom_sid); @@ -448,7 +448,7 @@ static void lsa_reply_lookup_names(prs_struct *rdata, /*************************************************************************** api_lsa_open_policy ***************************************************************************/ -static void api_lsa_open_policy2( pipes_struct *p, prs_struct *data, +static void api_lsa_open_policy2( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_OPEN_POL2 q_o; @@ -467,7 +467,7 @@ static void api_lsa_open_policy2( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_open_policy ***************************************************************************/ -static void api_lsa_open_policy( pipes_struct *p, prs_struct *data, +static void api_lsa_open_policy( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_OPEN_POL q_o; @@ -486,7 +486,7 @@ static void api_lsa_open_policy( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_enum_trust_dom ***************************************************************************/ -static void api_lsa_enum_trust_dom( pipes_struct *p, prs_struct *data, +static void api_lsa_enum_trust_dom( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_ENUM_TRUST_DOM q_e; @@ -503,7 +503,7 @@ static void api_lsa_enum_trust_dom( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_query_info ***************************************************************************/ -static void api_lsa_query_info( pipes_struct *p, prs_struct *data, +static void api_lsa_query_info( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_QUERY_INFO q_i; @@ -545,7 +545,7 @@ static void api_lsa_query_info( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_lookup_sids ***************************************************************************/ -static void api_lsa_lookup_sids( pipes_struct *p, prs_struct *data, +static void api_lsa_lookup_sids( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_LOOKUP_SIDS q_l; @@ -561,7 +561,7 @@ static void api_lsa_lookup_sids( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_lookup_names ***************************************************************************/ -static void api_lsa_lookup_names( pipes_struct *p, prs_struct *data, +static void api_lsa_lookup_names( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { LSA_Q_LOOKUP_NAMES q_l; @@ -578,7 +578,7 @@ static void api_lsa_lookup_names( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_close ***************************************************************************/ -static void api_lsa_close( pipes_struct *p, prs_struct *data, +static void api_lsa_close( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { LSA_R_CLOSE r_c; @@ -607,7 +607,7 @@ static void api_lsa_close( pipes_struct *p, prs_struct *data, /*************************************************************************** api_lsa_open_secret ***************************************************************************/ -static void api_lsa_open_secret( pipes_struct *p, prs_struct *data, +static void api_lsa_open_secret( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { /* XXXX this is NOT good */ @@ -648,7 +648,7 @@ static struct api_struct api_lsa_cmds[] = /*************************************************************************** api_ntLsarpcTNP ***************************************************************************/ -BOOL api_ntlsa_rpc(pipes_struct *p, prs_struct *data) +BOOL api_ntlsa_rpc(rpcsrv_struct *p, prs_struct *data) { return api_rpcTNP(p, "api_ntlsa_rpc", api_lsa_cmds, data); } diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c index f8d7fe5718..22788508eb 100644 --- a/source3/rpc_server/srv_netlog.c +++ b/source3/rpc_server/srv_netlog.c @@ -341,7 +341,7 @@ static BOOL get_md4pw(char *md4pw, char *mach_name, char *mach_acct) /************************************************************************* api_net_req_chal: *************************************************************************/ -static void api_net_req_chal( pipes_struct *p, +static void api_net_req_chal( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { @@ -351,12 +351,7 @@ static void api_net_req_chal( pipes_struct *p, fstring mach_acct; fstring mach_name; - user_struct *vuser; - - DEBUG(5,("api_net_req_chal(%d): vuid %d\n", __LINE__, (int)p->vuid)); - - if ((vuser = get_valid_user_struct(p->vuid)) == NULL) - return; + DEBUG(5,("api_net_req_chal(%d)\n", __LINE__)); /* grab the challenge... */ net_io_q_req_chal("", &q_r, data, 0); @@ -368,23 +363,23 @@ static void api_net_req_chal( pipes_struct *p, fstrcat(mach_acct, "$"); - if (get_md4pw((char *)vuser->dc.md4pw, mach_name, mach_acct)) + if (get_md4pw((char *)p->dc.md4pw, mach_name, mach_acct)) { /* copy the client credentials */ - memcpy(vuser->dc.clnt_chal.data , q_r.clnt_chal.data, sizeof(q_r.clnt_chal.data)); - memcpy(vuser->dc.clnt_cred.challenge.data, q_r.clnt_chal.data, sizeof(q_r.clnt_chal.data)); + memcpy(p->dc.clnt_chal.data , q_r.clnt_chal.data, sizeof(q_r.clnt_chal.data)); + memcpy(p->dc.clnt_cred.challenge.data, q_r.clnt_chal.data, sizeof(q_r.clnt_chal.data)); /* create a server challenge for the client */ /* Set these to random values. */ - generate_random_buffer(vuser->dc.srv_chal.data, 8, False); + generate_random_buffer(p->dc.srv_chal.data, 8, False); - memcpy(vuser->dc.srv_cred.challenge.data, vuser->dc.srv_chal.data, 8); + memcpy(p->dc.srv_cred.challenge.data, p->dc.srv_chal.data, 8); - bzero(vuser->dc.sess_key, sizeof(vuser->dc.sess_key)); + bzero(p->dc.sess_key, sizeof(p->dc.sess_key)); /* from client / server challenges and md4 password, generate sess key */ - cred_session_key(&(vuser->dc.clnt_chal), &(vuser->dc.srv_chal), - (char *)vuser->dc.md4pw, vuser->dc.sess_key); + cred_session_key(&(p->dc.clnt_chal), &(p->dc.srv_chal), + (char *)p->dc.md4pw, p->dc.sess_key); } else { @@ -394,14 +389,14 @@ static void api_net_req_chal( pipes_struct *p, /* construct reply. */ net_reply_req_chal(&q_r, rdata, - &(vuser->dc.srv_chal), status); + &(p->dc.srv_chal), status); } /************************************************************************* api_net_auth: *************************************************************************/ -static void api_net_auth( pipes_struct *p, +static void api_net_auth( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { @@ -411,27 +406,22 @@ static void api_net_auth( pipes_struct *p, DOM_CHAL srv_cred; UTIME srv_time; - user_struct *vuser; - - if ((vuser = get_valid_user_struct(p->vuid)) == NULL) - return; - srv_time.time = 0; /* grab the challenge... */ net_io_q_auth("", &q_a, data, 0); /* check that the client credentials are valid */ - if (cred_assert(&(q_a.clnt_chal), vuser->dc.sess_key, - &(vuser->dc.clnt_cred.challenge), srv_time)) + if (cred_assert(&(q_a.clnt_chal), p->dc.sess_key, + &(p->dc.clnt_cred.challenge), srv_time)) { /* create server challenge for inclusion in the reply */ - cred_create(vuser->dc.sess_key, &(vuser->dc.srv_cred.challenge), srv_time, &srv_cred); + cred_create(p->dc.sess_key, &(p->dc.srv_cred.challenge), srv_time, &srv_cred); /* copy the received client credentials for use next time */ - memcpy(vuser->dc.clnt_cred.challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data)); - memcpy(vuser->dc.srv_cred .challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data)); + memcpy(p->dc.clnt_cred.challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data)); + memcpy(p->dc.srv_cred .challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data)); } else { @@ -445,7 +435,7 @@ static void api_net_auth( pipes_struct *p, /************************************************************************* api_net_auth_2: *************************************************************************/ -static void api_net_auth_2( pipes_struct *p, +static void api_net_auth_2( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { @@ -455,27 +445,22 @@ static void api_net_auth_2( pipes_struct *p, DOM_CHAL srv_cred; UTIME srv_time; - user_struct *vuser; - - if ((vuser = get_valid_user_struct(p->vuid)) == NULL) - return; - srv_time.time = 0; /* grab the challenge... */ net_io_q_auth_2("", &q_a, data, 0); /* check that the client credentials are valid */ - if (cred_assert(&(q_a.clnt_chal), vuser->dc.sess_key, - &(vuser->dc.clnt_cred.challenge), srv_time)) + if (cred_assert(&(q_a.clnt_chal), p->dc.sess_key, + &(p->dc.clnt_cred.challenge), srv_time)) { /* create server challenge for inclusion in the reply */ - cred_create(vuser->dc.sess_key, &(vuser->dc.srv_cred.challenge), srv_time, &srv_cred); + cred_create(p->dc.sess_key, &(p->dc.srv_cred.challenge), srv_time, &srv_cred); /* copy the received client credentials for use next time */ - memcpy(vuser->dc.clnt_cred.challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data)); - memcpy(vuser->dc.srv_cred .challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data)); + memcpy(p->dc.clnt_cred.challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data)); + memcpy(p->dc.srv_cred .challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data)); } else { @@ -489,7 +474,7 @@ static void api_net_auth_2( pipes_struct *p, /************************************************************************* api_net_srv_pwset: *************************************************************************/ -static void api_net_srv_pwset( pipes_struct *p, +static void api_net_srv_pwset( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { @@ -499,19 +484,15 @@ static void api_net_srv_pwset( pipes_struct *p, pstring mach_acct; struct smb_passwd *smb_pass; BOOL ret; - user_struct *vuser; - - if ((vuser = get_valid_user_struct(p->vuid)) == NULL) - return; /* grab the challenge and encrypted password ... */ net_io_q_srv_pwset("", &q_a, data, 0); /* checks and updates credentials. creates reply credentials */ - if (deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred), + if (deal_with_creds(p->dc.sess_key, &(p->dc.clnt_cred), &(q_a.clnt_id.cred), &srv_cred)) { - memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred), sizeof(vuser->dc.clnt_cred)); + memcpy(&(p->dc.srv_cred), &(p->dc.clnt_cred), sizeof(p->dc.clnt_cred)); DEBUG(5,("api_net_srv_pwset: %d\n", __LINE__)); @@ -536,7 +517,7 @@ static void api_net_srv_pwset( pipes_struct *p, } DEBUG(100,("\n")); - cred_hash3( pwd, q_a.pwd, vuser->dc.sess_key, 0); + cred_hash3( pwd, q_a.pwd, p->dc.sess_key, 0); /* lies! nt and lm passwords are _not_ the same: don't care */ smb_pass->smb_passwd = pwd; @@ -571,7 +552,7 @@ static void api_net_srv_pwset( pipes_struct *p, /************************************************************************* api_net_sam_logoff: *************************************************************************/ -static void api_net_sam_logoff( pipes_struct *p, +static void api_net_sam_logoff( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { @@ -580,11 +561,6 @@ static void api_net_sam_logoff( pipes_struct *p, DOM_CRED srv_cred; - user_struct *vuser; - - if ((vuser = get_valid_user_struct(p->vuid)) == NULL) - return; - /* the DOM_ID_INFO_1 structure is a bit big. plus we might want to dynamically allocate it inside net_io_q_sam_logon, at some point */ q_l.sam_id.ctr = &ctr; @@ -593,9 +569,9 @@ static void api_net_sam_logoff( pipes_struct *p, net_io_q_sam_logoff("", &q_l, data, 0); /* checks and updates credentials. creates reply credentials */ - deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred), + deal_with_creds(p->dc.sess_key, &(p->dc.clnt_cred), &(q_l.sam_id.client.cred), &srv_cred); - memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred), sizeof(vuser->dc.clnt_cred)); + memcpy(&(p->dc.srv_cred), &(p->dc.clnt_cred), sizeof(p->dc.clnt_cred)); /* construct reply. always indicate success */ net_reply_sam_logoff(&q_l, rdata, &srv_cred, 0x0); @@ -604,27 +580,23 @@ static void api_net_sam_logoff( pipes_struct *p, /************************************************************************* api_net_sam_sync: *************************************************************************/ -static void api_net_sam_sync( pipes_struct *p, +static void api_net_sam_sync( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { NET_Q_SAM_SYNC q_s; DOM_CRED srv_creds; - user_struct *vuser; uint32 status = 0x0; - if ((vuser = get_valid_user_struct(p->vuid)) == NULL) - return; - /* grab the challenge... */ net_io_q_sam_sync("", &q_s, data, 0); /* checks and updates credentials. creates reply credentials */ - if (deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred), + if (deal_with_creds(p->dc.sess_key, &(p->dc.clnt_cred), &(q_s.cli_creds), &srv_creds)) { - memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred), - sizeof(vuser->dc.clnt_cred)); + memcpy(&(p->dc.srv_cred), &(p->dc.clnt_cred), + sizeof(p->dc.clnt_cred)); } else { @@ -632,7 +604,7 @@ static void api_net_sam_sync( pipes_struct *p, } /* construct reply. */ - net_reply_sam_sync(&q_s, rdata, vuser->dc.sess_key, &srv_creds, status); + net_reply_sam_sync(&q_s, rdata, p->dc.sess_key, &srv_creds, status); } @@ -641,7 +613,7 @@ static void api_net_sam_sync( pipes_struct *p, *************************************************************************/ static uint32 net_login_interactive(NET_ID_INFO_1 *id1, struct sam_passwd *smb_pass, - user_struct *vuser) + struct dcinfo *dc) { uint32 status = 0x0; @@ -650,7 +622,7 @@ static uint32 net_login_interactive(NET_ID_INFO_1 *id1, unsigned char key[16]; memset(key, 0, 16); - memcpy(key, vuser->dc.sess_key, 8); + memcpy(key, dc->sess_key, 8); memcpy(lm_pwd, id1->lm_owf.data, 16); memcpy(nt_pwd, id1->nt_owf.data, 16); @@ -698,7 +670,7 @@ static uint32 net_login_interactive(NET_ID_INFO_1 *id1, *************************************************************************/ static uint32 net_login_network(NET_ID_INFO_2 *id2, struct sam_passwd *sam_pass, - user_struct *vuser, + struct dcinfo *dc, char sess_key[16]) { fstring user; @@ -723,7 +695,7 @@ static uint32 net_login_network(NET_ID_INFO_2 *id2, unsigned char key[16]; memset(key, 0, 16); - memcpy(key, vuser->dc.sess_key, 8); + memcpy(key, dc->sess_key, 8); #ifdef DEBUG_PASSWORD DEBUG(100,("key:")); @@ -749,8 +721,9 @@ static uint32 net_login_network(NET_ID_INFO_2 *id2, /************************************************************************* api_net_sam_logon: *************************************************************************/ -static uint32 reply_net_sam_logon( NET_Q_SAM_LOGON *q_l, user_struct *vuser, - DOM_CRED *srv_cred, NET_USER_INFO_3 *usr_info) +static uint32 reply_net_sam_logon(NET_Q_SAM_LOGON *q_l, + struct dcinfo *dc, + DOM_CRED *srv_cred, NET_USER_INFO_3 *usr_info) { struct sam_passwd *sam_pass = NULL; UNISTR2 *uni_samusr = NULL; @@ -781,13 +754,13 @@ static uint32 reply_net_sam_logon( NET_Q_SAM_LOGON *q_l, user_struct *vuser, DOM_GID *gids = NULL; /* checks and updates credentials. creates reply credentials */ - if (!deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred), + if (!deal_with_creds(dc->sess_key, &(dc->clnt_cred), &(q_l->sam_id.client.cred), srv_cred)) { return 0xC0000000 | NT_STATUS_INVALID_HANDLE; } - memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred), sizeof(vuser->dc.clnt_cred)); + memcpy(&(dc->srv_cred), &(dc->clnt_cred), sizeof(dc->clnt_cred)); /* find the username */ @@ -864,13 +837,13 @@ static uint32 reply_net_sam_logon( NET_Q_SAM_LOGON *q_l, user_struct *vuser, case INTERACTIVE_LOGON_TYPE: { /* interactive login. */ - status = net_login_interactive(&q_l->sam_id.ctr->auth.id1, sam_pass, vuser); + status = net_login_interactive(&q_l->sam_id.ctr->auth.id1, sam_pass, dc); break; } case NET_LOGON_TYPE: { /* network login. lm challenge and 24 byte responses */ - status = net_login_network(&q_l->sam_id.ctr->auth.id2, sam_pass, vuser, sess_key); + status = net_login_network(&q_l->sam_id.ctr->auth.id2, sam_pass, dc, sess_key); enc_user_sess_key = sess_key; break; } @@ -941,7 +914,7 @@ static uint32 reply_net_sam_logon( NET_Q_SAM_LOGON *q_l, user_struct *vuser, /************************************************************************* api_net_sam_logon: *************************************************************************/ -static void api_net_sam_logon( pipes_struct *p, +static void api_net_sam_logon( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { @@ -951,17 +924,10 @@ static void api_net_sam_logon( pipes_struct *p, uint32 status = 0x0; DOM_CRED srv_cred; - user_struct *vuser = get_valid_user_struct(p->vuid); - - if (vuser == NULL) - { - return; - } - q_l.sam_id.ctr = &ctr; net_io_q_sam_logon("", &q_l, data, 0); - status = reply_net_sam_logon(&q_l, vuser, &srv_cred, &usr_info); + status = reply_net_sam_logon(&q_l, &p->dc, &srv_cred, &usr_info); net_reply_sam_logon(&q_l, rdata, &srv_cred, &usr_info, status); } @@ -969,7 +935,7 @@ static void api_net_sam_logon( pipes_struct *p, /************************************************************************* api_net_trust_dom_list: *************************************************************************/ -static void api_net_trust_dom_list( pipes_struct *p, +static void api_net_trust_dom_list( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { @@ -1003,7 +969,7 @@ static void api_net_trust_dom_list( pipes_struct *p, /************************************************************************* api_net_logon_ctrl2: *************************************************************************/ -static void api_net_logon_ctrl2( pipes_struct *p, +static void api_net_logon_ctrl2( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { @@ -1049,7 +1015,7 @@ static struct api_struct api_net_cmds [] = /******************************************************************* receives a netlogon pipe and responds. ********************************************************************/ -BOOL api_netlog_rpc(pipes_struct *p, prs_struct *data) +BOOL api_netlog_rpc(rpcsrv_struct *p, prs_struct *data) { return api_rpcTNP(p, "api_netlog_rpc", api_net_cmds, data); } diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index ca87cafcf7..73a06b208c 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -43,7 +43,7 @@ extern int DEBUGLEVEL; -static void NTLMSSPcalc_p( pipes_struct *p, unsigned char *data, int len) +static void NTLMSSPcalc_p( rpcsrv_struct *p, unsigned char *data, int len) { unsigned char *hash = p->ntlmssp_hash; unsigned char index_i = hash[256]; @@ -71,27 +71,40 @@ static void NTLMSSPcalc_p( pipes_struct *p, unsigned char *data, int len) } /******************************************************************* + frees all temporary data used in construction of pdu + ********************************************************************/ +void rpcsrv_free_temp(rpcsrv_struct *l) +{ + mem_free_data(l->rhdr .data); + mem_free_data(l->rfault .data); + mem_free_data(l->rdata_i.data); + mem_free_data(l->rauth .data); + mem_free_data(l->rverf .data); + mem_free_data(l->rntlm .data); +} + +/******************************************************************* turns a DCE/RPC request into a DCE/RPC reply this is where the data really should be split up into an array of headers and data sections. ********************************************************************/ -BOOL create_rpc_reply(pipes_struct *p, - uint32 data_start, uint32 data_end) +BOOL create_rpc_reply(rpcsrv_struct *l, uint32 data_start) { char *data; - BOOL auth_verify = IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SIGN); - BOOL auth_seal = IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SEAL); + BOOL auth_verify = IS_BITS_SET_ALL(l->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SIGN); + BOOL auth_seal = IS_BITS_SET_ALL(l->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SEAL); uint32 data_len; uint32 auth_len; + uint32 data_end = l->rdata.offset + (l->ntlmssp_auth ? (8 + 16) : 0); DEBUG(5,("create_rpc_reply: data_start: %d data_end: %d max_tsize: %d\n", - data_start, data_end, p->hdr_ba.bba.max_tsize)); + data_start, data_end, l->hdr_ba.bba.max_tsize)); - auth_len = p->hdr.auth_len; + auth_len = l->hdr.auth_len; - if (p->ntlmssp_auth) + if (l->ntlmssp_auth) { DEBUG(10,("create_rpc_reply: auth\n")); if (auth_len != 16) @@ -100,63 +113,63 @@ BOOL create_rpc_reply(pipes_struct *p, } } - prs_init(&p->rhdr , 0x18, 4, 0, False); - prs_init(&p->rauth, 1024, 4, 0, False); - prs_init(&p->rverf, 0x10, 4, 0, False); + prs_init(&l->rhdr , 0x18, 4, 0, False); + prs_init(&l->rauth, 1024, 4, 0, False); + prs_init(&l->rverf, 0x10, 4, 0, False); - p->hdr.pkt_type = RPC_RESPONSE; /* mark header as an rpc response */ + l->hdr.pkt_type = RPC_RESPONSE; /* mark header as an rpc response */ /* set up rpc header (fragmentation issues) */ if (data_start == 0) { - p->hdr.flags = RPC_FLG_FIRST; + l->hdr.flags = RPC_FLG_FIRST; } else { - p->hdr.flags = 0; + l->hdr.flags = 0; } - p->hdr_resp.alloc_hint = data_end - data_start; /* calculate remaining data to be sent */ + l->hdr_resp.alloc_hint = data_end - data_start; /* calculate remaining data to be sent */ - if (p->hdr_resp.alloc_hint + 0x18 <= p->hdr_ba.bba.max_tsize) + if (l->hdr_resp.alloc_hint + 0x18 <= l->hdr_ba.bba.max_tsize) { - p->hdr.flags |= RPC_FLG_LAST; - p->hdr.frag_len = p->hdr_resp.alloc_hint + 0x18; + l->hdr.flags |= RPC_FLG_LAST; + l->hdr.frag_len = l->hdr_resp.alloc_hint + 0x18; } else { - p->hdr.frag_len = p->hdr_ba.bba.max_tsize; + l->hdr.frag_len = l->hdr_ba.bba.max_tsize; } - if (p->ntlmssp_auth) + if (l->ntlmssp_auth) { - p->hdr_resp.alloc_hint -= auth_len + 8; + l->hdr_resp.alloc_hint -= auth_len + 8; } - if (p->ntlmssp_auth) + if (l->ntlmssp_auth) { - data_len = p->hdr.frag_len - auth_len - (auth_verify ? 8 : 0) - 0x18; + data_len = l->hdr.frag_len - auth_len - (auth_verify ? 8 : 0) - 0x18; } else { - data_len = p->hdr.frag_len - 0x18; + data_len = l->hdr.frag_len - 0x18; } - p->rhdr.data->offset.start = 0; - p->rhdr.data->offset.end = 0x18; + l->rhdr.data->offset.start = 0; + l->rhdr.data->offset.end = 0x18; /* store the header in the data stream */ - smb_io_rpc_hdr ("hdr" , &(p->hdr ), &(p->rhdr), 0); - smb_io_rpc_hdr_resp("resp", &(p->hdr_resp), &(p->rhdr), 0); + smb_io_rpc_hdr ("hdr" , &(l->hdr ), &(l->rhdr), 0); + smb_io_rpc_hdr_resp("resp", &(l->hdr_resp), &(l->rhdr), 0); /* don't use rdata: use rdata_i instead, which moves... */ /* make a pointer to the rdata data, NOT A COPY */ - p->rdata_i.data = NULL; - prs_init(&p->rdata_i, 0, p->rdata.align, p->rdata.data->margin, p->rdata.io); - data = mem_data(&(p->rdata.data), data_start); - mem_create(p->rdata_i.data, data, 0, data_len, 0, False); - p->rdata_i.offset = data_len; + l->rdata_i.data = NULL; + prs_init(&l->rdata_i, 0, l->rdata.align, l->rdata.data->margin, l->rdata.io); + data = mem_data(&(l->rdata.data), data_start); + mem_create(l->rdata_i.data, data, 0, data_len, 0, False); + l->rdata_i.offset = data_len; if (auth_len > 0) { @@ -168,44 +181,44 @@ BOOL create_rpc_reply(pipes_struct *p, if (auth_seal) { crc32 = crc32_calc_buffer(data_len, data); - NTLMSSPcalc_p(p, (uchar*)data, data_len); + NTLMSSPcalc_p(l, (uchar*)data, data_len); } if (auth_seal || auth_verify) { - make_rpc_hdr_auth(&p->auth_info, 0x0a, 0x06, 0x08, (auth_verify ? 1 : 0)); - smb_io_rpc_hdr_auth("hdr_auth", &p->auth_info, &p->rauth, 0); + make_rpc_hdr_auth(&l->auth_info, 0x0a, 0x06, 0x08, (auth_verify ? 1 : 0)); + smb_io_rpc_hdr_auth("hdr_auth", &l->auth_info, &l->rauth, 0); } if (auth_verify) { char *auth_data; - p->ntlmssp_seq_num++; - make_rpc_auth_ntlmssp_chk(&p->ntlmssp_chk, NTLMSSP_SIGN_VERSION, crc32, p->ntlmssp_seq_num++); - smb_io_rpc_auth_ntlmssp_chk("auth_sign", &(p->ntlmssp_chk), &p->rverf, 0); - auth_data = mem_data(&p->rverf.data, 4); - NTLMSSPcalc_p(p, (uchar*)auth_data, 12); + l->ntlmssp_seq_num++; + make_rpc_auth_ntlmssp_chk(&l->ntlmssp_chk, NTLMSSP_SIGN_VERSION, crc32, l->ntlmssp_seq_num++); + smb_io_rpc_auth_ntlmssp_chk("auth_sign", &(l->ntlmssp_chk), &l->rverf, 0); + auth_data = mem_data(&l->rverf.data, 4); + NTLMSSPcalc_p(l, (uchar*)auth_data, 12); } } /* set up the data chain */ - if (p->ntlmssp_auth) + if (l->ntlmssp_auth) { - prs_link(NULL , &p->rhdr , &p->rdata_i); - prs_link(&p->rhdr , &p->rdata_i, &p->rauth ); - prs_link(&p->rdata_i, &p->rauth , &p->rverf ); - prs_link(&p->rauth , &p->rverf , NULL ); + prs_link(NULL , &l->rhdr , &l->rdata_i); + prs_link(&l->rhdr , &l->rdata_i, &l->rauth ); + prs_link(&l->rdata_i, &l->rauth , &l->rverf ); + prs_link(&l->rauth , &l->rverf , NULL ); } else { - prs_link(NULL , &p->rhdr , &p->rdata_i); - prs_link(&p->rhdr, &p->rdata_i, NULL ); + prs_link(NULL , &l->rhdr , &l->rdata_i); + prs_link(&l->rhdr, &l->rdata_i, NULL ); } - return p->rhdr.data != NULL && p->rhdr.offset == 0x18; + return l->rhdr.data != NULL && l->rhdr.offset == 0x18; } -static BOOL api_pipe_ntlmssp_verify(pipes_struct *p) +static BOOL api_pipe_ntlmssp_verify(rpcsrv_struct *l) { uchar *pwd = NULL; uchar null_pwd[16]; @@ -220,23 +233,15 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p) struct smb_passwd *smb_pass = NULL; - user_struct *vuser = get_valid_user_struct(p->vuid); - memset(null_pwd, 0, sizeof(null_pwd)); DEBUG(5,("api_pipe_ntlmssp_verify: checking user details\n")); - if (vuser == NULL) - { - DEBUG(0,("get user struct %d failed\n", p->vuid)); - return False; - } - - lm_owf_len = p->ntlmssp_resp.hdr_lm_resp.str_str_len; - nt_owf_len = p->ntlmssp_resp.hdr_nt_resp.str_str_len; - usr_len = p->ntlmssp_resp.hdr_usr .str_str_len; - dom_len = p->ntlmssp_resp.hdr_domain .str_str_len; - wks_len = p->ntlmssp_resp.hdr_wks .str_str_len; + lm_owf_len = l->ntlmssp_resp.hdr_lm_resp.str_str_len; + nt_owf_len = l->ntlmssp_resp.hdr_nt_resp.str_str_len; + usr_len = l->ntlmssp_resp.hdr_usr .str_str_len; + dom_len = l->ntlmssp_resp.hdr_domain .str_str_len; + wks_len = l->ntlmssp_resp.hdr_wks .str_str_len; if (lm_owf_len == 0 && nt_owf_len == 0 && usr_len == 0 && dom_len == 0 && wks_len == 0) @@ -247,65 +252,65 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p) { if (lm_owf_len == 0) return False; if (nt_owf_len == 0) return False; - if (p->ntlmssp_resp.hdr_usr .str_str_len == 0) return False; - if (p->ntlmssp_resp.hdr_domain .str_str_len == 0) return False; - if (p->ntlmssp_resp.hdr_wks .str_str_len == 0) return False; + if (l->ntlmssp_resp.hdr_usr .str_str_len == 0) return False; + if (l->ntlmssp_resp.hdr_domain .str_str_len == 0) return False; + if (l->ntlmssp_resp.hdr_wks .str_str_len == 0) return False; } if (lm_owf_len > sizeof(lm_owf)) return False; if (nt_owf_len > sizeof(nt_owf)) return False; - memcpy(lm_owf, p->ntlmssp_resp.lm_resp, sizeof(lm_owf)); - memcpy(nt_owf, p->ntlmssp_resp.nt_resp, sizeof(nt_owf)); + memcpy(lm_owf, l->ntlmssp_resp.lm_resp, sizeof(lm_owf)); + memcpy(nt_owf, l->ntlmssp_resp.nt_resp, sizeof(nt_owf)); #ifdef DEBUG_PASSWORD DEBUG(100,("lm, nt owfs, chal\n")); dump_data(100, lm_owf, sizeof(lm_owf)); dump_data(100, nt_owf, sizeof(nt_owf)); - dump_data(100, p->ntlmssp_chal.challenge, 8); + dump_data(100, l->ntlmssp_chal.challenge, 8); #endif - memset(p->user_name, 0, sizeof(p->user_name)); - memset(p->domain , 0, sizeof(p->domain )); - memset(p->wks , 0, sizeof(p->wks )); + memset(l->user_name, 0, sizeof(l->user_name)); + memset(l->domain , 0, sizeof(l->domain )); + memset(l->wks , 0, sizeof(l->wks )); - if (IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) + if (IS_BITS_SET_ALL(l->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { - unibuf_to_ascii(p->user_name, p->ntlmssp_resp.user, - MIN(p->ntlmssp_resp.hdr_usr .str_str_len/2, - sizeof(p->user_name)-1)); - unibuf_to_ascii(p->domain , p->ntlmssp_resp.domain, - MIN(p->ntlmssp_resp.hdr_domain.str_str_len/2, - sizeof(p->domain )-1)); - unibuf_to_ascii(p->wks , p->ntlmssp_resp.wks, - MIN(p->ntlmssp_resp.hdr_wks .str_str_len/2, - sizeof(p->wks )-1)); + unibuf_to_ascii(l->user_name, l->ntlmssp_resp.user, + MIN(l->ntlmssp_resp.hdr_usr .str_str_len/2, + sizeof(l->user_name)-1)); + unibuf_to_ascii(l->domain , l->ntlmssp_resp.domain, + MIN(l->ntlmssp_resp.hdr_domain.str_str_len/2, + sizeof(l->domain )-1)); + unibuf_to_ascii(l->wks , l->ntlmssp_resp.wks, + MIN(l->ntlmssp_resp.hdr_wks .str_str_len/2, + sizeof(l->wks )-1)); } else { - fstrcpy(p->user_name, p->ntlmssp_resp.user ); - fstrcpy(p->domain , p->ntlmssp_resp.domain); - fstrcpy(p->wks , p->ntlmssp_resp.wks ); + fstrcpy(l->user_name, l->ntlmssp_resp.user ); + fstrcpy(l->domain , l->ntlmssp_resp.domain); + fstrcpy(l->wks , l->ntlmssp_resp.wks ); } if (anonymous) { DEBUG(5,("anonymous user session\n")); - mdfour(vuser->dc.user_sess_key, null_pwd, 16); + mdfour(l->user_sess_key, null_pwd, 16); pwd = null_pwd; - p->ntlmssp_validated = True; + l->ntlmssp_validated = True; } else { - DEBUG(5,("user: %s domain: %s wks: %s\n", p->user_name, p->domain, p->wks)); + DEBUG(5,("user: %s domain: %s wks: %s\n", l->user_name, l->domain, l->wks)); become_root(True); - smb_pass = getsmbpwnam(p->user_name); - p->ntlmssp_validated = pass_check_smb(smb_pass, p->domain, - (uchar*)p->ntlmssp_chal.challenge, + smb_pass = getsmbpwnam(l->user_name); + l->ntlmssp_validated = pass_check_smb(smb_pass, l->domain, + (uchar*)l->ntlmssp_chal.challenge, lm_owf, lm_owf_len, nt_owf, nt_owf_len, - NULL, vuser->dc.user_sess_key); + NULL, l->user_sess_key); unbecome_root(True); if (smb_pass != NULL) @@ -314,7 +319,7 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p) } } - if (p->ntlmssp_validated && pwd != NULL) + if (l->ntlmssp_validated && pwd != NULL) { uchar p24[24]; NTLMSSPOWFencrypt(pwd, lm_owf, p24); @@ -331,47 +336,47 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p) for (ind = 0; ind < 256; ind++) { - p->ntlmssp_hash[ind] = (unsigned char)ind; + l->ntlmssp_hash[ind] = (unsigned char)ind; } for( ind = 0; ind < 256; ind++) { unsigned char tc; - j += (p->ntlmssp_hash[ind] + k2[ind%8]); + j += (l->ntlmssp_hash[ind] + k2[ind%8]); - tc = p->ntlmssp_hash[ind]; - p->ntlmssp_hash[ind] = p->ntlmssp_hash[j]; - p->ntlmssp_hash[j] = tc; + tc = l->ntlmssp_hash[ind]; + l->ntlmssp_hash[ind] = l->ntlmssp_hash[j]; + l->ntlmssp_hash[j] = tc; } - p->ntlmssp_hash[256] = 0; - p->ntlmssp_hash[257] = 0; + l->ntlmssp_hash[256] = 0; + l->ntlmssp_hash[257] = 0; } - p->ntlmssp_seq_num = 0; + l->ntlmssp_seq_num = 0; } else { - p->ntlmssp_validated = False; + l->ntlmssp_validated = False; } - return p->ntlmssp_validated; + return l->ntlmssp_validated; } -static BOOL api_pipe_ntlmssp(pipes_struct *p, prs_struct *pd) +static BOOL api_pipe_ntlmssp(rpcsrv_struct *l, prs_struct *pd) { /* receive a negotiate; send a challenge; receive a response */ - switch (p->auth_verifier.msg_type) + switch (l->auth_verifier.msg_type) { case NTLMSSP_NEGOTIATE: { - smb_io_rpc_auth_ntlmssp_neg("", &p->ntlmssp_neg, pd, 0); + smb_io_rpc_auth_ntlmssp_neg("", &l->ntlmssp_neg, pd, 0); break; } case NTLMSSP_AUTH: { - smb_io_rpc_auth_ntlmssp_resp("", &p->ntlmssp_resp, pd, 0); - if (!api_pipe_ntlmssp_verify(p)) + smb_io_rpc_auth_ntlmssp_resp("", &l->ntlmssp_resp, pd, 0); + if (!api_pipe_ntlmssp_verify(l)) { pd->offset = 0; } @@ -381,7 +386,7 @@ static BOOL api_pipe_ntlmssp(pipes_struct *p, prs_struct *pd) { /* NTLMSSP expected: unexpected message type */ DEBUG(3,("unexpected message type in NTLMSSP %d\n", - p->auth_verifier.msg_type)); + l->auth_verifier.msg_type)); return False; } } @@ -393,7 +398,7 @@ struct api_cmd { char * pipe_clnt_name; char * pipe_srv_name; - BOOL (*fn) (pipes_struct *, prs_struct *); + BOOL (*fn) (rpcsrv_struct *, prs_struct *); }; static struct api_cmd **api_fd_commands = NULL; @@ -480,7 +485,7 @@ void close_msrpc_command_processor(void) void add_msrpc_command_processor(char* pipe_name, char* process_name, - BOOL (*fn) (pipes_struct *, prs_struct *)) + BOOL (*fn) (rpcsrv_struct *, prs_struct *)) { struct api_cmd cmd; cmd.pipe_clnt_name = pipe_name; @@ -490,269 +495,281 @@ void add_msrpc_command_processor(char* pipe_name, add_api_cmd_to_array(&num_cmds, &api_fd_commands, &cmd); } -static BOOL api_pipe_bind_auth_resp(pipes_struct *p, prs_struct *pd) +static BOOL api_pipe_bind_auth_resp(rpcsrv_struct *l, prs_struct *pd) { DEBUG(5,("api_pipe_bind_auth_resp: decode request. %d\n", __LINE__)); - if (p->hdr.auth_len == 0) return False; + if (l->hdr.auth_len == 0) return False; /* decode the authentication verifier response */ - smb_io_rpc_hdr_autha("", &p->autha_info, pd, 0); + smb_io_rpc_hdr_autha("", &l->autha_info, pd, 0); if (pd->offset == 0) return False; - if (!rpc_hdr_auth_chk(&(p->auth_info))) return False; + if (!rpc_hdr_auth_chk(&(l->auth_info))) return False; - smb_io_rpc_auth_ntlmssp_verifier("", &p->auth_verifier, pd, 0); + smb_io_rpc_auth_ntlmssp_verifier("", &l->auth_verifier, pd, 0); if (pd->offset == 0) return False; - if (!rpc_auth_ntlmssp_verifier_chk(&(p->auth_verifier), "NTLMSSP", NTLMSSP_AUTH)) return False; + if (!rpc_auth_ntlmssp_verifier_chk(&(l->auth_verifier), "NTLMSSP", NTLMSSP_AUTH)) return False; - return api_pipe_ntlmssp(p, pd); + return api_pipe_ntlmssp(l, pd); } -static BOOL api_pipe_fault_resp(pipes_struct *p, prs_struct *pd, uint32 status) +static BOOL api_pipe_fault_resp(rpcsrv_struct *l, prs_struct *pd, uint32 status) { DEBUG(5,("api_pipe_fault_resp: make response\n")); - prs_init(&(p->rhdr ), 0x18, 4, 0, False); - prs_init(&(p->rfault ), 0x8 , 4, 0, False); + prs_init(&(l->rhdr ), 0x18, 4, 0, False); + prs_init(&(l->rfault ), 0x8 , 4, 0, False); /***/ /*** set up the header, response header and fault status ***/ /***/ - p->hdr_fault.status = status; - p->hdr_fault.reserved = 0x0; + l->hdr_fault.status = status; + l->hdr_fault.reserved = 0x0; - p->hdr_resp.alloc_hint = 0x0; - p->hdr_resp.cancel_count = 0x0; - p->hdr_resp.reserved = 0x0; + l->hdr_resp.alloc_hint = 0x0; + l->hdr_resp.cancel_count = 0x0; + l->hdr_resp.reserved = 0x0; - make_rpc_hdr(&p->hdr, RPC_FAULT, RPC_FLG_NOCALL | RPC_FLG_FIRST | RPC_FLG_LAST, - p->hdr.call_id, + make_rpc_hdr(&l->hdr, RPC_FAULT, RPC_FLG_NOCALL | RPC_FLG_FIRST | RPC_FLG_LAST, + l->hdr.call_id, 0x20, 0); - smb_io_rpc_hdr ("hdr" , &(p->hdr ), &(p->rhdr), 0); - smb_io_rpc_hdr_resp ("resp" , &(p->hdr_resp ), &(p->rhdr), 0); - smb_io_rpc_hdr_fault("fault", &(p->hdr_fault), &(p->rfault), 0); - mem_realloc_data(p->rhdr.data, p->rhdr.offset); - mem_realloc_data(p->rfault.data, p->rfault.offset); + smb_io_rpc_hdr ("hdr" , &(l->hdr ), &(l->rhdr), 0); + smb_io_rpc_hdr_resp ("resp" , &(l->hdr_resp ), &(l->rhdr), 0); + smb_io_rpc_hdr_fault("fault", &(l->hdr_fault), &(l->rfault), 0); + mem_realloc_data(l->rhdr.data, l->rhdr.offset); + mem_realloc_data(l->rfault.data, l->rfault.offset); /***/ /*** link rpc header and fault together ***/ /***/ - prs_link(NULL , &p->rhdr , &p->rfault); - prs_link(&p->rhdr, &p->rfault, NULL ); + prs_link(NULL , &l->rhdr , &l->rfault); + prs_link(&l->rhdr, &l->rfault, NULL ); return True; } -static BOOL api_pipe_bind_and_alt_req(pipes_struct *p, prs_struct *pd, enum RPC_PKT_TYPE pkt_type) +static BOOL srv_pipe_bind_and_alt_req(rpcsrv_struct *l, prs_struct *pd, + const char* ack_pipe_name, + enum RPC_PKT_TYPE pkt_type) { uint16 assoc_gid; - fstring ack_pipe_name; - int i = 0; - - p->ntlmssp_auth = False; - - DEBUG(5,("api_pipe_bind_req: decode request. %d\n", __LINE__)); - - for (i = 0; i < num_cmds; i++) - { - if (strequal(api_fd_commands[i]->pipe_clnt_name, p->name) && - api_fd_commands[i]->fn != NULL) - { - DEBUG(3,("api_pipe_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n", - api_fd_commands[i]->pipe_clnt_name, - api_fd_commands[i]->pipe_srv_name)); - fstrcpy(p->pipe_srv_name, api_fd_commands[i]->pipe_srv_name); - break; - } - } - if (api_fd_commands[i]->fn == NULL) return False; + l->ntlmssp_auth = False; /* decode the bind request */ - smb_io_rpc_hdr_rb("", &p->hdr_rb, pd, 0); + smb_io_rpc_hdr_rb("", &l->hdr_rb, pd, 0); if (pd->offset == 0) return False; - if (p->hdr.auth_len != 0) + if (l->hdr.auth_len != 0) { /* decode the authentication verifier */ - smb_io_rpc_hdr_auth ("", &p->auth_info , pd, 0); + smb_io_rpc_hdr_auth ("", &l->auth_info , pd, 0); if (pd->offset == 0) return False; - p->ntlmssp_auth = p->auth_info.auth_type = 0x0a; + l->ntlmssp_auth = l->auth_info.auth_type = 0x0a; - if (p->ntlmssp_auth) + if (l->ntlmssp_auth) { - smb_io_rpc_auth_ntlmssp_verifier("", &p->auth_verifier, pd, 0); + smb_io_rpc_auth_ntlmssp_verifier("", &l->auth_verifier, pd, 0); if (pd->offset == 0) return False; - p->ntlmssp_auth = strequal(p->auth_verifier.signature, "NTLMSSP"); + l->ntlmssp_auth = strequal(l->auth_verifier.signature, "NTLMSSP"); } - if (p->ntlmssp_auth) + if (l->ntlmssp_auth) { - if (!api_pipe_ntlmssp(p, pd)) return False; - } - } - - switch (pkt_type) - { - case RPC_BINDACK: - { - /* name has to be \PIPE\xxxxx */ - fstrcpy(ack_pipe_name, "\\PIPE\\"); - fstrcat(ack_pipe_name, p->pipe_srv_name); - break; - } - case RPC_ALTCONTRESP: - { - /* secondary address CAN be NULL - * as the specs says it's ignored. - * It MUST NULL to have the spoolss working. - */ - fstrcpy(ack_pipe_name, ""); - break; - } - default: - { - return False; + if (!api_pipe_ntlmssp(l, pd)) return False; } } DEBUG(5,("api_pipe_bind_req: make response. %d\n", __LINE__)); - prs_init(&(p->rdata), 1024, 4, 0, False); - prs_init(&(p->rhdr ), 0x18, 4, 0, False); - prs_init(&(p->rauth), 1024, 4, 0, False); - prs_init(&(p->rverf), 0x08, 4, 0, False); - prs_init(&(p->rntlm), 1024, 4, 0, False); + prs_init(&(l->rdata), 1024, 4, 0, False); + prs_init(&(l->rhdr ), 0x18, 4, 0, False); + prs_init(&(l->rauth), 1024, 4, 0, False); + prs_init(&(l->rverf), 0x08, 4, 0, False); + prs_init(&(l->rntlm), 1024, 4, 0, False); /***/ /*** do the bind ack first ***/ /***/ - if (p->ntlmssp_auth) + if (l->ntlmssp_auth) { assoc_gid = 0x7a77; } else { - assoc_gid = p->hdr_rb.bba.assoc_gid; + assoc_gid = l->hdr_rb.bba.assoc_gid; } - make_rpc_hdr_ba(&p->hdr_ba, - p->hdr_rb.bba.max_tsize, - p->hdr_rb.bba.max_rsize, + make_rpc_hdr_ba(&l->hdr_ba, + l->hdr_rb.bba.max_tsize, + l->hdr_rb.bba.max_rsize, assoc_gid, ack_pipe_name, 0x1, 0x0, 0x0, - &(p->hdr_rb.transfer)); + &(l->hdr_rb.transfer)); - smb_io_rpc_hdr_ba("", &p->hdr_ba, &p->rdata, 0); - mem_realloc_data(p->rdata.data, p->rdata.offset); + smb_io_rpc_hdr_ba("", &l->hdr_ba, &l->rdata, 0); + mem_realloc_data(l->rdata.data, l->rdata.offset); /***/ /*** now the authentication ***/ /***/ - if (p->ntlmssp_auth) + if (l->ntlmssp_auth) { uint8 challenge[8]; generate_random_buffer(challenge, 8, False); /*** authentication info ***/ - make_rpc_hdr_auth(&p->auth_info, 0x0a, 0x06, 0, 1); - smb_io_rpc_hdr_auth("", &p->auth_info, &p->rverf, 0); - mem_realloc_data(p->rverf.data, p->rverf.offset); + make_rpc_hdr_auth(&l->auth_info, 0x0a, 0x06, 0, 1); + smb_io_rpc_hdr_auth("", &l->auth_info, &l->rverf, 0); + mem_realloc_data(l->rverf.data, l->rverf.offset); /*** NTLMSSP verifier ***/ - make_rpc_auth_ntlmssp_verifier(&p->auth_verifier, + make_rpc_auth_ntlmssp_verifier(&l->auth_verifier, "NTLMSSP", NTLMSSP_CHALLENGE); - smb_io_rpc_auth_ntlmssp_verifier("", &p->auth_verifier, &p->rauth, 0); - mem_realloc_data(p->rauth.data, p->rauth.offset); + smb_io_rpc_auth_ntlmssp_verifier("", &l->auth_verifier, &l->rauth, 0); + mem_realloc_data(l->rauth.data, l->rauth.offset); /* NTLMSSP challenge ***/ - make_rpc_auth_ntlmssp_chal(&p->ntlmssp_chal, + make_rpc_auth_ntlmssp_chal(&l->ntlmssp_chal, 0x000082b1, challenge); - smb_io_rpc_auth_ntlmssp_chal("", &p->ntlmssp_chal, &p->rntlm, 0); - mem_realloc_data(p->rntlm.data, p->rntlm.offset); + smb_io_rpc_auth_ntlmssp_chal("", &l->ntlmssp_chal, &l->rntlm, 0); + mem_realloc_data(l->rntlm.data, l->rntlm.offset); } /***/ /*** then do the header, now we know the length ***/ /***/ - make_rpc_hdr(&p->hdr, pkt_type, RPC_FLG_FIRST | RPC_FLG_LAST, - p->hdr.call_id, - p->rdata.offset + p->rverf.offset + p->rauth.offset + p->rntlm.offset + 0x10, - p->rauth.offset + p->rntlm.offset); + make_rpc_hdr(&l->hdr, pkt_type, RPC_FLG_FIRST | RPC_FLG_LAST, + l->hdr.call_id, + l->rdata.offset + l->rverf.offset + l->rauth.offset + l->rntlm.offset + 0x10, + l->rauth.offset + l->rntlm.offset); - smb_io_rpc_hdr("", &p->hdr, &p->rhdr, 0); - mem_realloc_data(p->rhdr.data, p->rdata.offset); + smb_io_rpc_hdr("", &l->hdr, &l->rhdr, 0); + mem_realloc_data(l->rhdr.data, l->rdata.offset); /***/ /*** link rpc header, bind acknowledgment and authentication responses ***/ /***/ - if (p->ntlmssp_auth) + if (l->ntlmssp_auth) { - prs_link(NULL , &p->rhdr , &p->rdata); - prs_link(&p->rhdr , &p->rdata, &p->rverf); - prs_link(&p->rdata, &p->rverf, &p->rauth); - prs_link(&p->rverf, &p->rauth, &p->rntlm); - prs_link(&p->rauth, &p->rntlm, NULL ); + prs_link(NULL , &l->rhdr , &l->rdata); + prs_link(&l->rhdr , &l->rdata, &l->rverf); + prs_link(&l->rdata, &l->rverf, &l->rauth); + prs_link(&l->rverf, &l->rauth, &l->rntlm); + prs_link(&l->rauth, &l->rntlm, NULL ); } else { - prs_link(NULL , &p->rhdr , &p->rdata); - prs_link(&p->rhdr, &p->rdata, NULL ); + prs_link(NULL , &l->rhdr , &l->rdata); + prs_link(&l->rhdr, &l->rdata, NULL ); } return True; } +static BOOL api_pipe_bind_and_alt_req(rpcsrv_struct *l, prs_struct *pd, + const char* name, + enum RPC_PKT_TYPE pkt_type) +{ + fstring ack_pipe_name; + fstring pipe_srv_name; + int i = 0; + + DEBUG(5,("api_pipe_bind_req: decode request. %d\n", __LINE__)); + + for (i = 0; i < num_cmds; i++) + { + if (strequal(api_fd_commands[i]->pipe_clnt_name, name) && + api_fd_commands[i]->fn != NULL) + { + DEBUG(3,("api_pipe_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n", + api_fd_commands[i]->pipe_clnt_name, + api_fd_commands[i]->pipe_srv_name)); + fstrcpy(pipe_srv_name, api_fd_commands[i]->pipe_srv_name); + break; + } + } + + if (api_fd_commands[i]->fn == NULL) return False; + + switch (pkt_type) + { + case RPC_BINDACK: + { + /* name has to be \PIPE\xxxxx */ + fstrcpy(ack_pipe_name, "\\PIPE\\"); + fstrcat(ack_pipe_name, pipe_srv_name); + break; + } + case RPC_ALTCONTRESP: + { + /* secondary address CAN be NULL + * as the specs says it's ignored. + * It MUST NULL to have the spoolss working. + */ + fstrcpy(ack_pipe_name, ""); + break; + } + default: + { + return False; + } + } + return srv_pipe_bind_and_alt_req(l, pd, ack_pipe_name, pkt_type); +} + /* * The RPC Alter-Context call is used only by the spoolss pipe * simply because there is a bug (?) in the MS unmarshalling code * or in the marshalling code. If it's in the later, then Samba * have the same bug. */ -static BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *pd) +static BOOL api_pipe_bind_req(rpcsrv_struct *l, prs_struct *pd, + const char* name) { - return api_pipe_bind_and_alt_req(p, pd, RPC_BINDACK); + return api_pipe_bind_and_alt_req(l, pd, name, RPC_BINDACK); } -static BOOL api_pipe_alt_req(pipes_struct *p, prs_struct *pd) +static BOOL api_pipe_alt_req(rpcsrv_struct *l, prs_struct *pd, + const char* name) { - return api_pipe_bind_and_alt_req(p, pd, RPC_ALTCONTRESP); + return api_pipe_bind_and_alt_req(l, pd, name, RPC_ALTCONTRESP); } -static BOOL api_pipe_auth_process(pipes_struct *p, prs_struct *pd) +static BOOL api_pipe_auth_process(rpcsrv_struct *l, prs_struct *pd) { - BOOL auth_verify = IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SIGN); - BOOL auth_seal = IS_BITS_SET_ALL(p->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SEAL); + BOOL auth_verify = IS_BITS_SET_ALL(l->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SIGN); + BOOL auth_seal = IS_BITS_SET_ALL(l->ntlmssp_chal.neg_flags, NTLMSSP_NEGOTIATE_SEAL); int data_len; int auth_len; uint32 old_offset; uint32 crc32 = 0; - auth_len = p->hdr.auth_len; + auth_len = l->hdr.auth_len; if (auth_len != 16 && auth_verify) { return False; } - data_len = p->hdr.frag_len - auth_len - (auth_verify ? 8 : 0) - 0x18; + data_len = l->hdr.frag_len - auth_len - (auth_verify ? 8 : 0) - 0x18; DEBUG(5,("api_pipe_auth_process: sign: %s seal: %s data %d auth %d\n", BOOLSTR(auth_verify), BOOLSTR(auth_seal), data_len, auth_len)); @@ -761,7 +778,7 @@ static BOOL api_pipe_auth_process(pipes_struct *p, prs_struct *pd) { char *data = mem_data(&pd->data, pd->offset); DEBUG(5,("api_pipe_auth_process: data %d\n", pd->offset)); - NTLMSSPcalc_p(p, (uchar*)data, data_len); + NTLMSSPcalc_p(l, (uchar*)data, data_len); crc32 = crc32_calc_buffer(data_len, data); } @@ -771,18 +788,18 @@ static BOOL api_pipe_auth_process(pipes_struct *p, prs_struct *pd) if (auth_seal || auth_verify) { pd->offset += data_len; - smb_io_rpc_hdr_auth("hdr_auth", &p->auth_info, pd, 0); + smb_io_rpc_hdr_auth("hdr_auth", &l->auth_info, pd, 0); } if (auth_verify) { char *req_data = mem_data(&pd->data, pd->offset + 4); DEBUG(5,("api_pipe_auth_process: auth %d\n", pd->offset + 4)); - NTLMSSPcalc_p(p, (uchar*)req_data, 12); - smb_io_rpc_auth_ntlmssp_chk("auth_sign", &(p->ntlmssp_chk), pd, 0); + NTLMSSPcalc_p(l, (uchar*)req_data, 12); + smb_io_rpc_auth_ntlmssp_chk("auth_sign", &(l->ntlmssp_chk), pd, 0); - if (!rpc_auth_ntlmssp_chk(&(p->ntlmssp_chk), crc32, - p->ntlmssp_seq_num)) + if (!rpc_auth_ntlmssp_chk(&(l->ntlmssp_chk), crc32, + l->ntlmssp_seq_num)) { return False; } @@ -793,13 +810,13 @@ static BOOL api_pipe_auth_process(pipes_struct *p, prs_struct *pd) return True; } -static BOOL api_pipe_request(pipes_struct *p, prs_struct *pd) +static BOOL api_pipe_request(rpcsrv_struct *l, prs_struct *pd, const char* name) { int i = 0; - if (p->ntlmssp_auth && p->ntlmssp_validated) + if (l->ntlmssp_auth && l->ntlmssp_validated) { - if (!api_pipe_auth_process(p, pd)) return False; + if (!api_pipe_auth_process(l, pd)) return False; DEBUG(0,("api_pipe_request: **** MUST CALL become_user() HERE **** \n")); #if 0 @@ -809,61 +826,116 @@ static BOOL api_pipe_request(pipes_struct *p, prs_struct *pd) for (i = 0; i < num_cmds; i++) { - if (strequal(api_fd_commands[i]->pipe_clnt_name, p->name) && + if (strequal(api_fd_commands[i]->pipe_clnt_name, name) && api_fd_commands[i]->fn != NULL) { DEBUG(3,("Doing \\PIPE\\%s\n", api_fd_commands[i]->pipe_clnt_name)); - return api_fd_commands[i]->fn(p, pd); + return api_fd_commands[i]->fn(l, pd); } } return False; } -BOOL rpc_command(pipes_struct *p, prs_struct *pd) +BOOL rpc_add_to_pdu(prs_struct *ps, const char *data, int len) { - BOOL reply = False; - DEBUG(10,("rpc_command\n")); + int prev_size; + int new_size; + char *to = NULL; - if (p->m != NULL) + ps->offset = 0; + + if (ps->data == NULL) { - DEBUG(10,("msrpc redirect\n")); - if (!msrpc_send_prs(p->m, pd)) + DEBUG(10,("rpc_add_to_pdu: new_size: %d\n", len)); + prs_init(ps, len, 4, 0, True); + prev_size = 0; + new_size = len; + if (ps->data == NULL) { - DEBUG(2,("msrpc redirect send failed\n")); return False; } - if (!msrpc_receive_prs(p->m, &p->rhdr)) + } + else + { + prev_size = ps->data->data_used; + new_size = prev_size + len; + DEBUG(10,("rpc_add_to_pdu: prev_size: %d new_size: %d\n", + prev_size, new_size)); + if (!mem_realloc_data(ps->data, new_size)) { - DEBUG(2,("msrpc redirect receive failed\n")); return False; } - prs_link(NULL, &p->rhdr, NULL); - prs_debug_out(&p->rhdr, 10); - return True; } - if (pd->data == NULL) return False; + DEBUG(10,("ps->data->start: %d\n", ps->data->offset.start)); + ps->data->offset.start = 0x0; + + to = mem_data(&ps->data, prev_size); + if (to == NULL) + { + DEBUG(10,("rpc_add_to_pdu: data could not be found\n")); + return False; + } + if (ps->data->data_used != new_size) + { + DEBUG(10,("rpc_add_to_pdu: ERROR: data used %d new_size %d\n", + ps->data->data_used, new_size)); + return False; + } + memcpy(to, data, len); + return True; +} + +static BOOL rpc_redir_remote(pipes_struct *p, prs_struct *req, prs_struct *resp) +{ + DEBUG(10,("rpc_redirect\n")); + + if (!msrpc_send_prs(p->m, req)) + { + DEBUG(2,("msrpc redirect send failed\n")); + return False; + } + if (!msrpc_receive_prs(p->m, resp)) + { + DEBUG(2,("msrpc redirect receive failed\n")); + return False; + } + prs_link(NULL, resp, NULL); + prs_debug_out(resp, "redirect", 100); + return True; +} +static BOOL rpc_redir_local(rpcsrv_struct *l, prs_struct *req, prs_struct *resp, + const char* name) +{ + BOOL reply = False; + + if (req->data == NULL) return False; + + /* lkclXXXX still assume that the first complete PDU is always + in a single request!!! + */ /* process the rpc header */ - smb_io_rpc_hdr("", &p->hdr, pd, 0); + req->offset = 0x0; + smb_io_rpc_hdr("", &l->hdr, req, 0); - if (pd->offset == 0) return False; + if (req->offset == 0) return False; - switch (p->hdr.pkt_type) + switch (l->hdr.pkt_type) { case RPC_BIND : { - reply = api_pipe_bind_req(p, pd); + reply = api_pipe_bind_req(l, req, name); break; } case RPC_ALTCONT: { - reply = api_pipe_alt_req(p, pd); + reply = api_pipe_alt_req(l, req, name); break; } case RPC_REQUEST: { - if (p->ntlmssp_auth && !p->ntlmssp_validated) + if (l->ntlmssp_auth && !l->ntlmssp_validated) { /* authentication _was_ requested and it failed. sorry, no deal! @@ -873,41 +945,87 @@ BOOL rpc_command(pipes_struct *p, prs_struct *pd) else { /* read the rpc header */ - smb_io_rpc_hdr_req("req", &(p->hdr_req), pd, 0); - reply = api_pipe_request(p, pd); + smb_io_rpc_hdr_req("req", &(l->hdr_req), req, 0); + reply = api_pipe_request(l, req, name); } break; } case RPC_BINDRESP: /* not the real name! */ { - reply = api_pipe_bind_auth_resp(p, pd); - p->ntlmssp_auth = reply; + reply = api_pipe_bind_auth_resp(l, req); + l->ntlmssp_auth = reply; break; } } if (!reply) { - reply = api_pipe_fault_resp(p, pd, 0x1c010002); + reply = api_pipe_fault_resp(l, req, 0x1c010002); + } + + if (reply) + { + /* flatten the data into a single pdu */ + reply = prs_copy(resp, &l->rhdr); } + /* delete intermediate data used to set up the pdu. leave + rdata alone because that's got the rest of the data in it */ + rpcsrv_free_temp(l); + return reply; } +BOOL rpc_send_and_rcv_pdu(pipes_struct *p) +{ + DEBUG(10,("rpc_send_and_rcv_pdu\n")); + + if (p->m != NULL) + { + return rpc_redir_remote(p, &p->smb_pdu, &p->rsmb_pdu); + } + else if (p->l != NULL) + { + return rpc_redir_local(p->l, &p->smb_pdu, &p->rsmb_pdu, + p->name); + } + return False; +} + +/******************************************************************* + entry point from msrpc to smb. adds data received to pdu; checks + pdu; hands pdu off to msrpc, which gets a pdu back (except in the + case of the RPC_BINDCONT pdu). + ********************************************************************/ +BOOL rpc_to_smb(pipes_struct *p, char *data, int len) +{ + BOOL reply = rpc_add_to_pdu(&p->smb_pdu, data, len); + + if (reply && is_complete_pdu(&p->smb_pdu)) + { + p->smb_pdu.offset = p->smb_pdu.data->data_size; + prs_link(NULL, &p->smb_pdu, NULL); + reply = rpc_send_and_rcv_pdu(p); + mem_free_data(p->smb_pdu.data); + prs_init(&p->smb_pdu, 0, 4, 0, True); + + } + return reply; +} /******************************************************************* receives a netlogon pipe and responds. ********************************************************************/ -static BOOL api_rpc_command(pipes_struct *p, +static BOOL api_rpc_command(rpcsrv_struct *l, char *rpc_name, struct api_struct *api_rpc_cmds, prs_struct *data) { int fn_num; - DEBUG(4,("api_rpc_command: %s op 0x%x - ", rpc_name, p->hdr_req.opnum)); + DEBUG(4,("api_rpc_command: %s op 0x%x - ", rpc_name, l->hdr_req.opnum)); for (fn_num = 0; api_rpc_cmds[fn_num].name; fn_num++) { - if (api_rpc_cmds[fn_num].opnum == p->hdr_req.opnum && api_rpc_cmds[fn_num].fn != NULL) + if (api_rpc_cmds[fn_num].opnum == l->hdr_req.opnum && api_rpc_cmds[fn_num].fn != NULL) { DEBUG(3,("api_rpc_command: %s\n", api_rpc_cmds[fn_num].name)); break; @@ -921,18 +1039,18 @@ static BOOL api_rpc_command(pipes_struct *p, } /* start off with 1024 bytes, and a large safety margin too */ - prs_init(&p->rdata, 1024, 4, SAFETY_MARGIN, False); + prs_init(&l->rdata, 1024, 4, SAFETY_MARGIN, False); /* do the actual command */ - api_rpc_cmds[fn_num].fn(p, data, &(p->rdata)); + api_rpc_cmds[fn_num].fn(l, data, &(l->rdata)); - if (p->rdata.data == NULL || p->rdata.offset == 0) + if (l->rdata.data == NULL || l->rdata.offset == 0) { - mem_free_data(p->rdata.data); + mem_free_data(l->rdata.data); return False; } - mem_realloc_data(p->rdata.data, p->rdata.offset); + mem_realloc_data(l->rdata.data, l->rdata.offset); DEBUG(10,("called %s\n", rpc_name)); @@ -943,7 +1061,7 @@ static BOOL api_rpc_command(pipes_struct *p, /******************************************************************* receives a netlogon pipe and responds. ********************************************************************/ -BOOL api_rpcTNP(pipes_struct *p, char *rpc_name, struct api_struct *api_rpc_cmds, +BOOL api_rpcTNP(rpcsrv_struct *l, char *rpc_name, struct api_struct *api_rpc_cmds, prs_struct *data) { if (data == NULL || data->data == NULL) @@ -953,16 +1071,39 @@ BOOL api_rpcTNP(pipes_struct *p, char *rpc_name, struct api_struct *api_rpc_cmds } /* interpret the command */ - if (!api_rpc_command(p, rpc_name, api_rpc_cmds, data)) + if (!api_rpc_command(l, rpc_name, api_rpc_cmds, data)) { return False; } /* create the rpc header */ - if (!create_rpc_reply(p, 0, p->rdata.offset + (p->ntlmssp_auth ? (16 + 8) : 0))) + if (!create_rpc_reply(l, 0)) { return False; } return True; } + +BOOL is_complete_pdu(prs_struct *ps) +{ + RPC_HDR hdr; + int len = ps->data->data_size; + + DEBUG(10,("is_complete_pdu - len %d\n", len)); + ps->offset = 0x0; + + if (!ps->io) + { + /* writing. oops!! */ + DEBUG(4,("is_complete_pdu: write set, not read!\n")); + return False; + } + + if (!smb_io_rpc_hdr("hdr", &hdr, ps, 0)) + { + return False; + } + /* check that the fragment length is equal to the data length so far */ + return hdr.frag_len == len; +} diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index a7e451e6da..8a28674d3d 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -84,14 +84,40 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name, pipes_struct *p; static int next_pipe; struct msrpc_state *m = NULL; + struct rpcsrv_struct *l = NULL; + user_struct *vuser = get_valid_user_struct(vuid); + struct user_creds usr; + + ZERO_STRUCT(usr); DEBUG(4,("Open pipe requested %s (pipes_open=%d)\n", pipe_name, pipes_open)); + if (vuser == NULL) + { + DEBUG(4,("invalid vuid %d\n", vuid)); + return NULL; + } + + /* set up unix credentials from the smb side, to feed over the pipe */ + make_creds_unix(&usr.uxc, vuser->name, vuser->requested_name, + vuser->real_name, vuser->guest); + usr.ptr_uxc = 1; + make_creds_unix_sec(&usr.uxs, vuser->uid, vuser->gid, + vuser->n_groups, vuser->groups); + usr.ptr_uxs = 1; + + /* set up nt credentials from the smb side, to feed over the pipe */ + /* lkclXXXX todo! + make_creds_nt(&usr.ntc); + make_creds_nt_sec(&usr.nts); + */ + /* not repeating pipe numbers makes it easier to track things in log files and prevents client bugs where pipe numbers are reused over connection restarts */ - if (next_pipe == 0) { + if (next_pipe == 0) + { next_pipe = (getpid() ^ time(NULL)) % MAX_OPEN_PIPES; } @@ -111,13 +137,33 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name, if (strequal(pipe_name, "lsarpc")) { - m = msrpc_use_add(pipe_name, NULL, False); + m = msrpc_use_add(pipe_name, &usr, False); if (m == NULL) { DEBUG(5,("open pipes: msrpc redirect failed\n")); return NULL; } } + else + { + l = malloc(sizeof(*l)); + if (l == NULL) + { + DEBUG(5,("open pipes: local msrpc malloc failed\n")); + return NULL; + } + ZERO_STRUCTP(l); + l->rhdr.data = NULL; + l->rdata.data = NULL; + l->rhdr.offset = 0; + l->rdata.offset = 0; + + l->ntlmssp_validated = False; + l->ntlmssp_auth = False; + + memcpy(l->user_sess_key, vuser->user_sess_key, + sizeof(l->user_sess_key)); + } p = (pipes_struct *)malloc(sizeof(*p)); if (!p) return NULL; @@ -132,6 +178,7 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name, p->pnum = i; p->m = m; + p->l = l; p->open = True; p->device_state = 0; @@ -139,20 +186,15 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name, p->conn = conn; p->vuid = vuid; - p->rhdr.data = NULL; - p->rdata.data = NULL; - p->rhdr.offset = 0; - p->rdata.offset = 0; - p->file_offset = 0; p->prev_pdu_file_offset = 0; p->hdr_offsets = 0; - p->ntlmssp_validated = False; - p->ntlmssp_auth = False; - fstrcpy(p->name, pipe_name); + prs_init(&p->smb_pdu, 0, 4, 0, True); + prs_init(&p->rsmb_pdu, 0, 4, 0, False); + DEBUG(4,("Opened pipe %s with handle %x (pipes_open=%d)\n", pipe_name, i, pipes_open)); @@ -175,29 +217,13 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name, ****************************************************************************/ ssize_t write_pipe(pipes_struct *p, char *data, size_t n) { - prs_struct pd; - struct mem_buf data_buf; - DEBUG(6,("write_pipe: %x", p->pnum)); - DEBUG(6,("name: %s open: %s len: %d", p->name, BOOLSTR(p->open), n)); dump_data(50, data, n); - /* fake up a data buffer from the write_pipe data parameters */ - mem_create(&data_buf, data, 0, n, 0, False); - data_buf.offset.start = 0; - data_buf.offset.end = n; - - /* fake up a parsing structure */ - pd.data = &data_buf; - pd.align = 4; - pd.io = True; - pd.error = False; - pd.offset = 0; - - return rpc_command(p, &pd) ? ((ssize_t)n) : -1; + return rpc_to_smb(p, data, n) ? ((ssize_t)n) : -1; } @@ -232,8 +258,8 @@ int read_pipe(pipes_struct *p, char *data, uint32 pos, int n) } - if (p->rhdr.data == NULL || p->rhdr.data->data == NULL || - p->rhdr.data->data_used == 0) + if (p->rsmb_pdu.data == NULL || p->rsmb_pdu.data->data == NULL || + p->rsmb_pdu.data->data_used == 0) { return 0; } @@ -246,12 +272,12 @@ int read_pipe(pipes_struct *p, char *data, uint32 pos, int n) pdu_data_sent = p->file_offset - p->prev_pdu_file_offset; this_pdu_data_pos = (pdu_data_sent == 0) ? 0 : (pdu_data_sent - 0x18); - if (!IS_BITS_SET_ALL(p->hdr.flags, RPC_FLG_LAST)) + if (!IS_BITS_SET_ALL(p->l->hdr.flags, RPC_FLG_LAST)) { /* intermediate fragment - possibility of another header */ DEBUG(5,("read_pipe: frag_len: %d data_pos: %d pdu_data_sent: %d\n", - p->hdr.frag_len, data_pos, pdu_data_sent)); + p->l->hdr.frag_len, data_pos, pdu_data_sent)); if (pdu_data_sent == 0) { @@ -263,11 +289,11 @@ int read_pipe(pipes_struct *p, char *data, uint32 pos, int n) data_pos -= 0x18; /* create and copy in a new header. */ - create_rpc_reply(p, data_pos, p->rdata.offset); + create_rpc_reply(p->l, data_pos); } } - pdu_len = mem_buf_len(p->rhdr.data); + pdu_len = mem_buf_len(p->rsmb_pdu.data); num = pdu_len - this_pdu_data_pos; DEBUG(6,("read_pipe: pdu_len: %d num: %d n: %d\n", pdu_len, num, n)); @@ -284,7 +310,7 @@ int read_pipe(pipes_struct *p, char *data, uint32 pos, int n) DEBUG(5,("read_pipe: warning - data read only part of a header\n")); } - mem_buf_copy(data, p->rhdr.data, pdu_data_sent, num); + mem_buf_copy(data, p->rsmb_pdu.data, pdu_data_sent, num); p->file_offset += num; pdu_data_sent += num; @@ -294,7 +320,7 @@ int read_pipe(pipes_struct *p, char *data, uint32 pos, int n) DEBUG(6,("read_pipe: just header read\n")); } - if (pdu_data_sent == p->hdr.frag_len) + if (pdu_data_sent == p->l->hdr.frag_len) { DEBUG(6,("read_pipe: next fragment expected\n")); p->prev_pdu_file_offset = p->file_offset; @@ -359,8 +385,8 @@ BOOL close_rpc_pipe_hnd(pipes_struct *p, connection_struct *conn) return False; } - mem_buf_free(&(p->rdata.data)); - mem_buf_free(&(p->rhdr .data)); + mem_buf_free(&(p->smb_pdu .data)); + mem_buf_free(&(p->rsmb_pdu.data)); bitmap_clear(bmap, p->pnum - pipe_handle_offset); @@ -384,8 +410,17 @@ BOOL close_rpc_pipe_hnd(pipes_struct *p, connection_struct *conn) } } - ZERO_STRUCTP(p); + if (p->l != NULL) + { + DEBUG(4,("closed msrpc local: OK\n")); + + mem_free_data(p->l->rdata .data); + rpcsrv_free_temp(p->l); + free(p->l); + } + + ZERO_STRUCTP(p); free(p); return True; diff --git a/source3/rpc_server/srv_reg.c b/source3/rpc_server/srv_reg.c index 22314d9c5e..ea3150fd3c 100644 --- a/source3/rpc_server/srv_reg.c +++ b/source3/rpc_server/srv_reg.c @@ -61,7 +61,7 @@ static void reg_reply_close(REG_Q_CLOSE *q_r, /******************************************************************* api_reg_close ********************************************************************/ -static void api_reg_close( pipes_struct *p, prs_struct *data, +static void api_reg_close( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { REG_Q_CLOSE q_r; @@ -100,7 +100,7 @@ static void reg_reply_open(REG_Q_OPEN_HKLM *q_r, /******************************************************************* api_reg_open ********************************************************************/ -static void api_reg_open( pipes_struct *p, prs_struct *data, +static void api_reg_open( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { REG_Q_OPEN_HKLM q_u; @@ -165,7 +165,7 @@ static void reg_reply_open_entry(REG_Q_OPEN_ENTRY *q_u, /******************************************************************* api_reg_open_entry ********************************************************************/ -static void api_reg_open_entry( pipes_struct *p, prs_struct *data, +static void api_reg_open_entry( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { REG_Q_OPEN_ENTRY q_u; @@ -223,7 +223,7 @@ static void reg_reply_info(REG_Q_INFO *q_u, /******************************************************************* api_reg_info ********************************************************************/ -static void api_reg_info( pipes_struct *p, prs_struct *data, +static void api_reg_info( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { REG_Q_INFO q_u; @@ -251,7 +251,7 @@ static struct api_struct api_reg_cmds[] = /******************************************************************* receives a reg pipe and responds. ********************************************************************/ -BOOL api_reg_rpc(pipes_struct *p, prs_struct *data) +BOOL api_reg_rpc(rpcsrv_struct *p, prs_struct *data) { return api_rpcTNP(p, "api_reg_rpc", api_reg_cmds, data); } diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index 894e8f2e2c..738623ec4d 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -145,7 +145,7 @@ static void samr_reply_close_hnd(SAMR_Q_CLOSE_HND *q_u, /******************************************************************* api_samr_close_hnd ********************************************************************/ -static void api_samr_close_hnd( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_close_hnd( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_CLOSE_HND q_u; samr_io_q_close_hnd("", &q_u, data, 0); @@ -200,7 +200,7 @@ static void samr_reply_open_domain(SAMR_Q_OPEN_DOMAIN *q_u, /******************************************************************* api_samr_open_domain ********************************************************************/ -static void api_samr_open_domain( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_open_domain( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_OPEN_DOMAIN q_u; samr_io_q_open_domain("", &q_u, data, 0); @@ -243,7 +243,7 @@ static void samr_reply_unknown_2c(SAMR_Q_UNKNOWN_2C *q_u, /******************************************************************* api_samr_unknown_2c ********************************************************************/ -static void api_samr_unknown_2c( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_unknown_2c( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_UNKNOWN_2C q_u; samr_io_q_unknown_2c("", &q_u, data, 0); @@ -312,7 +312,7 @@ static void samr_reply_unknown_3(SAMR_Q_UNKNOWN_3 *q_u, /******************************************************************* api_samr_unknown_3 ********************************************************************/ -static void api_samr_unknown_3( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_unknown_3( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_UNKNOWN_3 q_u; samr_io_q_unknown_3("", &q_u, data, 0); @@ -370,7 +370,7 @@ static void samr_reply_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_u, /******************************************************************* api_samr_enum_dom_users ********************************************************************/ -static void api_samr_enum_dom_users( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_enum_dom_users( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_ENUM_DOM_USERS q_e; samr_io_q_enum_dom_users("", &q_e, data, 0); @@ -429,7 +429,7 @@ static void samr_reply_add_groupmem(SAMR_Q_ADD_GROUPMEM *q_u, /******************************************************************* api_samr_add_groupmem ********************************************************************/ -static void api_samr_add_groupmem( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_add_groupmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_ADD_GROUPMEM q_e; samr_io_q_add_groupmem("", &q_e, data, 0); @@ -487,7 +487,7 @@ static void samr_reply_del_groupmem(SAMR_Q_DEL_GROUPMEM *q_u, /******************************************************************* api_samr_del_groupmem ********************************************************************/ -static void api_samr_del_groupmem( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_del_groupmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_DEL_GROUPMEM q_e; samr_io_q_del_groupmem("", &q_e, data, 0); @@ -553,7 +553,7 @@ static void samr_reply_add_aliasmem(SAMR_Q_ADD_ALIASMEM *q_u, /******************************************************************* api_samr_add_aliasmem ********************************************************************/ -static void api_samr_add_aliasmem( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_add_aliasmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_ADD_ALIASMEM q_e; samr_io_q_add_aliasmem("", &q_e, data, 0); @@ -619,7 +619,7 @@ static void samr_reply_del_aliasmem(SAMR_Q_DEL_ALIASMEM *q_u, /******************************************************************* api_samr_del_aliasmem ********************************************************************/ -static void api_samr_del_aliasmem( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_del_aliasmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_DEL_ALIASMEM q_e; samr_io_q_del_aliasmem("", &q_e, data, 0); @@ -684,7 +684,7 @@ static void samr_reply_enum_domains(SAMR_Q_ENUM_DOMAINS *q_u, /******************************************************************* api_samr_enum_domains ********************************************************************/ -static void api_samr_enum_domains( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_enum_domains( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_ENUM_DOMAINS q_e; @@ -764,7 +764,7 @@ static void samr_reply_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS *q_u, /******************************************************************* api_samr_enum_dom_groups ********************************************************************/ -static void api_samr_enum_dom_groups( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_enum_dom_groups( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_ENUM_DOM_GROUPS q_e; @@ -861,7 +861,7 @@ static void samr_reply_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES *q_u, /******************************************************************* api_samr_enum_dom_aliases ********************************************************************/ -static void api_samr_enum_dom_aliases( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_enum_dom_aliases( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_ENUM_DOM_ALIASES q_e; @@ -1033,7 +1033,7 @@ static void samr_reply_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_u, /******************************************************************* api_samr_query_dispinfo ********************************************************************/ -static void api_samr_query_dispinfo( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_query_dispinfo( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_QUERY_DISPINFO q_e; @@ -1095,7 +1095,7 @@ static void samr_reply_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP *q_u, /******************************************************************* api_samr_delete_dom_group ********************************************************************/ -static void api_samr_delete_dom_group( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_delete_dom_group( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_DELETE_DOM_GROUP q_u; samr_io_q_delete_dom_group("", &q_u, data, 0); @@ -1190,7 +1190,7 @@ static void samr_reply_query_groupmem(SAMR_Q_QUERY_GROUPMEM *q_u, /******************************************************************* api_samr_query_groupmem ********************************************************************/ -static void api_samr_query_groupmem( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_query_groupmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_QUERY_GROUPMEM q_u; samr_io_q_query_groupmem("", &q_u, data, 0); @@ -1253,7 +1253,7 @@ static void samr_reply_query_groupinfo(SAMR_Q_QUERY_GROUPINFO *q_u, /******************************************************************* api_samr_query_groupinfo ********************************************************************/ -static void api_samr_query_groupinfo( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_query_groupinfo( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_QUERY_GROUPINFO q_e; samr_io_q_query_groupinfo("", &q_e, data, 0); @@ -1307,7 +1307,7 @@ static void samr_reply_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO *q_u, /******************************************************************* api_samr_query_aliasinfo ********************************************************************/ -static void api_samr_query_aliasinfo( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_query_aliasinfo( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_QUERY_ALIASINFO q_e; samr_io_q_query_aliasinfo("", &q_e, data, 0); @@ -1429,7 +1429,7 @@ static void samr_reply_query_useraliases(SAMR_Q_QUERY_USERALIASES *q_u, /******************************************************************* api_samr_query_useraliases ********************************************************************/ -static void api_samr_query_useraliases( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_query_useraliases( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_QUERY_USERALIASES q_u; ZERO_STRUCT(q_u); @@ -1492,7 +1492,7 @@ static void samr_reply_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS *q_u, /******************************************************************* api_samr_delete_dom_alias ********************************************************************/ -static void api_samr_delete_dom_alias( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_delete_dom_alias( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_DELETE_DOM_ALIAS q_u; samr_io_q_delete_dom_alias("", &q_u, data, 0); @@ -1587,7 +1587,7 @@ static void samr_reply_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_u, /******************************************************************* api_samr_query_aliasmem ********************************************************************/ -static void api_samr_query_aliasmem( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_query_aliasmem( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_QUERY_ALIASMEM q_u; samr_io_q_query_aliasmem("", &q_u, data, 0); @@ -1659,7 +1659,7 @@ static void samr_reply_lookup_names(SAMR_Q_LOOKUP_NAMES *q_u, /******************************************************************* api_samr_lookup_names ********************************************************************/ -static void api_samr_lookup_names( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_lookup_names( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_LOOKUP_NAMES q_u; samr_io_q_lookup_names("", &q_u, data, 0); @@ -1700,7 +1700,7 @@ static void samr_reply_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u, /******************************************************************* api_samr_chgpasswd_user ********************************************************************/ -static void api_samr_chgpasswd_user( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_chgpasswd_user( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_CHGPASSWD_USER q_u; samr_io_q_chgpasswd_user("", &q_u, data, 0); @@ -1729,7 +1729,7 @@ static void samr_reply_unknown_38(SAMR_Q_UNKNOWN_38 *q_u, /******************************************************************* api_samr_unknown_38 ********************************************************************/ -static void api_samr_unknown_38( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_unknown_38( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_UNKNOWN_38 q_u; samr_io_q_unknown_38("", &q_u, data, 0); @@ -1795,7 +1795,7 @@ static void samr_reply_lookup_rids(SAMR_Q_LOOKUP_RIDS *q_u, /******************************************************************* api_samr_lookup_rids ********************************************************************/ -static void api_samr_lookup_rids( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_lookup_rids( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_LOOKUP_RIDS q_u; ZERO_STRUCT(q_u); @@ -1867,7 +1867,7 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u, /******************************************************************* api_samr_open_user ********************************************************************/ -static void api_samr_open_user( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_open_user( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_OPEN_USER q_u; samr_io_q_open_user("", &q_u, data, 0); @@ -2151,7 +2151,7 @@ static BOOL set_user_info_16(SAM_USER_INFO_16 *id16, uint32 rid) /******************************************************************* api_samr_query_userinfo ********************************************************************/ -static void api_samr_query_userinfo( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_query_userinfo( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_QUERY_USERINFO q_u; samr_io_q_query_userinfo("", &q_u, data, 0); @@ -2224,14 +2224,13 @@ static void samr_reply_set_userinfo2(SAMR_Q_SET_USERINFO2 *q_u, /******************************************************************* api_samr_set_userinfo2 ********************************************************************/ -static void api_samr_set_userinfo2( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_set_userinfo2( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { - user_struct *vuser = get_valid_user_struct(p->vuid); SAMR_Q_SET_USERINFO2 q_u; ZERO_STRUCT(q_u); samr_io_q_set_userinfo2("", &q_u, data, 0); - samr_reply_set_userinfo2(&q_u, rdata, vuser->dc.user_sess_key); + samr_reply_set_userinfo2(&q_u, rdata, p->user_sess_key); if (q_u.info.id != NULL) { @@ -2321,18 +2320,17 @@ static void samr_reply_set_userinfo(SAMR_Q_SET_USERINFO *q_u, /******************************************************************* api_samr_set_userinfo ********************************************************************/ -static void api_samr_set_userinfo( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_set_userinfo( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { - user_struct *vuser = get_valid_user_struct(p->vuid); SAMR_Q_SET_USERINFO q_u; ZERO_STRUCT(q_u); #ifdef DEBUG_PASSWORD DEBUG(100,("set user info: sess_key: ")); - dump_data(100, vuser->dc.user_sess_key, 16); + dump_data(100, p->user_sess_key, 16); #endif samr_io_q_set_userinfo("", &q_u, data, 0); - samr_reply_set_userinfo(&q_u, rdata, vuser->dc.user_sess_key); + samr_reply_set_userinfo(&q_u, rdata, p->user_sess_key); if (q_u.info.id != NULL) { @@ -2416,7 +2414,7 @@ static void samr_reply_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, /******************************************************************* api_samr_query_usergroups ********************************************************************/ -static void api_samr_query_usergroups( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_query_usergroups( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_QUERY_USERGROUPS q_u; samr_io_q_query_usergroups("", &q_u, data, 0); @@ -2527,7 +2525,7 @@ static void samr_reply_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS *q_u, /******************************************************************* api_samr_create_dom_alias ********************************************************************/ -static void api_samr_create_dom_alias( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_create_dom_alias( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_CREATE_DOM_ALIAS q_u; samr_io_q_create_dom_alias("", &q_u, data, 0); @@ -2639,7 +2637,7 @@ static void samr_reply_create_dom_group(SAMR_Q_CREATE_DOM_GROUP *q_u, /******************************************************************* api_samr_create_dom_group ********************************************************************/ -static void api_samr_create_dom_group( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_create_dom_group( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_CREATE_DOM_GROUP q_u; samr_io_q_create_dom_group("", &q_u, data, 0); @@ -2731,7 +2729,7 @@ static void samr_reply_query_dom_info(SAMR_Q_QUERY_DOMAIN_INFO *q_u, /******************************************************************* api_samr_query_dom_info ********************************************************************/ -static void api_samr_query_dom_info( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_query_dom_info( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_QUERY_DOMAIN_INFO q_e; samr_io_q_query_dom_info("", &q_e, data, 0); @@ -2839,7 +2837,7 @@ static void samr_reply_create_user(SAMR_Q_CREATE_USER *q_u, /******************************************************************* api_samr_create_user ********************************************************************/ -static void api_samr_create_user( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_create_user( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_CREATE_USER q_u; @@ -2893,7 +2891,7 @@ static void samr_reply_connect_anon(SAMR_Q_CONNECT_ANON *q_u, /******************************************************************* api_samr_connect_anon ********************************************************************/ -static void api_samr_connect_anon( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_connect_anon( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_CONNECT_ANON q_u; samr_io_q_connect_anon("", &q_u, data, 0); @@ -2942,7 +2940,7 @@ static void samr_reply_connect(SAMR_Q_CONNECT *q_u, /******************************************************************* api_samr_connect ********************************************************************/ -static void api_samr_connect( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_connect( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_CONNECT q_u; samr_io_q_connect("", &q_u, data, 0); @@ -3008,7 +3006,7 @@ static void samr_reply_open_alias(SAMR_Q_OPEN_ALIAS *q_u, /******************************************************************* api_samr_open_alias ********************************************************************/ -static void api_samr_open_alias( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_open_alias( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_OPEN_ALIAS q_u; @@ -3055,7 +3053,7 @@ static void samr_reply_open_group(SAMR_Q_OPEN_GROUP *q_u, /******************************************************************* api_samr_open_group ********************************************************************/ -static void api_samr_open_group( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_open_group( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_OPEN_GROUP q_u; @@ -3114,7 +3112,7 @@ static void samr_reply_lookup_domain(SAMR_Q_LOOKUP_DOMAIN *q_u, /******************************************************************* api_samr_lookup_domain ********************************************************************/ -static void api_samr_lookup_domain( pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_samr_lookup_domain( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SAMR_Q_LOOKUP_DOMAIN q_u; samr_io_q_lookup_domain("", &q_u, data, 0); @@ -3172,7 +3170,7 @@ static struct api_struct api_samr_cmds [] = /******************************************************************* receives a samr pipe and responds. ********************************************************************/ -BOOL api_samr_rpc(pipes_struct *p, prs_struct *data) +BOOL api_samr_rpc(rpcsrv_struct *p, prs_struct *data) { return api_rpcTNP(p, "api_samr_rpc", api_samr_cmds, data); } diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c index a3760587cd..aff896edfd 100755 --- a/source3/rpc_server/srv_spoolss.c +++ b/source3/rpc_server/srv_spoolss.c @@ -428,7 +428,7 @@ static void spoolss_reply_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_stru * * called from the spoolss dispatcher ********************************************************************/ -static void api_spoolss_open_printer_ex(pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_spoolss_open_printer_ex(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_OPEN_PRINTER_EX q_u; @@ -653,7 +653,7 @@ static void spoolss_reply_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, prs_struct * * called from the spoolss dispatcher ********************************************************************/ -static void api_spoolss_getprinterdata(pipes_struct *p, prs_struct *data, +static void api_spoolss_getprinterdata(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_GETPRINTERDATA q_u; @@ -696,7 +696,7 @@ static void spoolss_reply_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *rd * * called from the spoolss dispatcher ********************************************************************/ -static void api_spoolss_closeprinter(pipes_struct *p, prs_struct *data, +static void api_spoolss_closeprinter(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_CLOSEPRINTER q_u; @@ -731,7 +731,7 @@ static void spoolss_reply_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, prs_struct *rdata) * * in fact ReplyOpenPrinter is the changenotify equivalent on the spoolss pipe ********************************************************************/ -static void api_spoolss_rffpcnex(pipes_struct *p, prs_struct *data, +static void api_spoolss_rffpcnex(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_RFFPCNEX q_u; @@ -767,7 +767,7 @@ static void api_spoolss_rffpcnex(pipes_struct *p, prs_struct *data, /******************************************************************* * fill a notify_info_data with the servername ********************************************************************/ -static void spoolss_notify_server_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_server_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { pstring temp_name; @@ -781,7 +781,7 @@ static void spoolss_notify_server_name(connection_struct *conn, int snum, SPOOL_ * fill a notify_info_data with the servicename * jfmxxxx: it's incorrect should be long_printername ********************************************************************/ -static void spoolss_notify_printer_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_printer_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { /* data->notify_data.data.length=strlen(lp_servicename(snum)); @@ -796,7 +796,7 @@ static void spoolss_notify_printer_name(connection_struct *conn, int snum, SPOOL /******************************************************************* * fill a notify_info_data with the servicename ********************************************************************/ -static void spoolss_notify_share_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_share_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen(lp_servicename(snum)); ascii_to_unistr(data->notify_data.data.string, @@ -807,7 +807,7 @@ static void spoolss_notify_share_name(connection_struct *conn, int snum, SPOOL_N /******************************************************************* * fill a notify_info_data with the port name ********************************************************************/ -static void spoolss_notify_port_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_port_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { /* even if it's strange, that's consistant in all the code */ @@ -822,7 +822,7 @@ static void spoolss_notify_port_name(connection_struct *conn, int snum, SPOOL_NO * jfmxxxx: it's incorrect, should be lp_printerdrivername() * but it doesn't exist, have to see what to do ********************************************************************/ -static void spoolss_notify_driver_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_driver_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen(printer->info_2->drivername); ascii_to_unistr(data->notify_data.data.string, @@ -833,7 +833,7 @@ static void spoolss_notify_driver_name(connection_struct *conn, int snum, SPOOL_ /******************************************************************* * fill a notify_info_data with the comment ********************************************************************/ -static void spoolss_notify_comment(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_comment(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen(lp_comment(snum)); ascii_to_unistr(data->notify_data.data.string, @@ -846,7 +846,7 @@ static void spoolss_notify_comment(connection_struct *conn, int snum, SPOOL_NOTI * jfm:xxxx incorrect, have to create a new smb.conf option * location = "Room 1, floor 2, building 3" ********************************************************************/ -static void spoolss_notify_location(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_location(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen(printer->info_2->location); ascii_to_unistr(data->notify_data.data.string, @@ -858,7 +858,7 @@ static void spoolss_notify_location(connection_struct *conn, int snum, SPOOL_NOT * fill a notify_info_data with the device mode * jfm:xxxx don't to it for know but that's a real problem !!! ********************************************************************/ -static void spoolss_notify_devmode(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_devmode(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { } @@ -867,7 +867,7 @@ static void spoolss_notify_devmode(connection_struct *conn, int snum, SPOOL_NOTI * jfm:xxxx just return no file could add an option to smb.conf * separator file = "separator.txt" ********************************************************************/ -static void spoolss_notify_sepfile(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_sepfile(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen(printer->info_2->sepfile); ascii_to_unistr(data->notify_data.data.string, @@ -879,7 +879,7 @@ static void spoolss_notify_sepfile(connection_struct *conn, int snum, SPOOL_NOTI * fill a notify_info_data with the print processor * jfm:xxxx return always winprint to indicate we don't do anything to it ********************************************************************/ -static void spoolss_notify_print_processor(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_print_processor(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen(printer->info_2->printprocessor); ascii_to_unistr(data->notify_data.data.string, @@ -891,7 +891,7 @@ static void spoolss_notify_print_processor(connection_struct *conn, int snum, SP * fill a notify_info_data with the print processor options * jfm:xxxx send an empty string ********************************************************************/ -static void spoolss_notify_parameters(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_parameters(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen(printer->info_2->parameters); ascii_to_unistr(data->notify_data.data.string, @@ -903,7 +903,7 @@ static void spoolss_notify_parameters(connection_struct *conn, int snum, SPOOL_N * fill a notify_info_data with the data type * jfm:xxxx always send RAW as data type ********************************************************************/ -static void spoolss_notify_datatype(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_datatype(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen(printer->info_2->datatype); ascii_to_unistr(data->notify_data.data.string, @@ -916,7 +916,7 @@ static void spoolss_notify_datatype(connection_struct *conn, int snum, SPOOL_NOT * jfm:xxxx send an null pointer to say no security desc * have to implement security before ! ********************************************************************/ -static void spoolss_notify_security_desc(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_security_desc(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=0; data->notify_data.data.string[0]=0x00; @@ -926,7 +926,7 @@ static void spoolss_notify_security_desc(connection_struct *conn, int snum, SPOO * fill a notify_info_data with the attributes * jfm:xxxx a samba printer is always shared ********************************************************************/ -static void spoolss_notify_attributes(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_attributes(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.value[0] = PRINTER_ATTRIBUTE_SHARED \ | PRINTER_ATTRIBUTE_NETWORK \ @@ -936,7 +936,7 @@ static void spoolss_notify_attributes(connection_struct *conn, int snum, SPOOL_N /******************************************************************* * fill a notify_info_data with the priority ********************************************************************/ -static void spoolss_notify_priority(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_priority(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.value[0] = printer->info_2->priority; } @@ -944,7 +944,7 @@ static void spoolss_notify_priority(connection_struct *conn, int snum, SPOOL_NOT /******************************************************************* * fill a notify_info_data with the default priority ********************************************************************/ -static void spoolss_notify_default_priority(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_default_priority(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.value[0] = printer->info_2->default_priority; } @@ -952,7 +952,7 @@ static void spoolss_notify_default_priority(connection_struct *conn, int snum, S /******************************************************************* * fill a notify_info_data with the start time ********************************************************************/ -static void spoolss_notify_start_time(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_start_time(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.value[0] = printer->info_2->starttime; } @@ -960,7 +960,7 @@ static void spoolss_notify_start_time(connection_struct *conn, int snum, SPOOL_N /******************************************************************* * fill a notify_info_data with the until time ********************************************************************/ -static void spoolss_notify_until_time(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_until_time(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.value[0] = printer->info_2->untiltime; } @@ -968,7 +968,7 @@ static void spoolss_notify_until_time(connection_struct *conn, int snum, SPOOL_N /******************************************************************* * fill a notify_info_data with the status ********************************************************************/ -static void spoolss_notify_status(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_status(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { int count; print_queue_struct *q=NULL; @@ -976,7 +976,7 @@ static void spoolss_notify_status(connection_struct *conn, int snum, SPOOL_NOTIF bzero(&status,sizeof(status)); - count=get_printqueue(snum, conn, &q, &status); + count=get_printqueue(snum, NULL, &q, &status); data->notify_data.value[0]=(uint32) status.status; if (q) free(q); @@ -985,21 +985,21 @@ static void spoolss_notify_status(connection_struct *conn, int snum, SPOOL_NOTIF /******************************************************************* * fill a notify_info_data with the number of jobs queued ********************************************************************/ -static void spoolss_notify_cjobs(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_cjobs(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { print_queue_struct *q=NULL; print_status_struct status; bzero(&status,sizeof(status)); - data->notify_data.value[0]=get_printqueue(snum, conn, &q, &status); + data->notify_data.value[0]=get_printqueue(snum, NULL, &q, &status); if (q) free(q); } /******************************************************************* * fill a notify_info_data with the average ppm ********************************************************************/ -static void spoolss_notify_average_ppm(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_average_ppm(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { /* always respond 8 pages per minutes */ /* a little hard ! */ @@ -1009,7 +1009,7 @@ static void spoolss_notify_average_ppm(connection_struct *conn, int snum, SPOOL_ /******************************************************************* * fill a notify_info_data with ********************************************************************/ -static void spoolss_notify_username(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_username(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen(queue->user); ascii_to_unistr(data->notify_data.data.string, queue->user, sizeof(data->notify_data.data.string)-1); @@ -1018,7 +1018,7 @@ static void spoolss_notify_username(connection_struct *conn, int snum, SPOOL_NOT /******************************************************************* * fill a notify_info_data with ********************************************************************/ -static void spoolss_notify_job_status(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_job_status(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.value[0]=queue->status; } @@ -1026,7 +1026,7 @@ static void spoolss_notify_job_status(connection_struct *conn, int snum, SPOOL_N /******************************************************************* * fill a notify_info_data with ********************************************************************/ -static void spoolss_notify_job_name(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_job_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen(queue->file); ascii_to_unistr(data->notify_data.data.string, queue->file, sizeof(data->notify_data.data.string)-1); @@ -1035,7 +1035,7 @@ static void spoolss_notify_job_name(connection_struct *conn, int snum, SPOOL_NOT /******************************************************************* * fill a notify_info_data with ********************************************************************/ -static void spoolss_notify_job_status_string(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_job_status_string(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.data.length=strlen("En attente"); ascii_to_unistr(data->notify_data.data.string, "En attente", sizeof(data->notify_data.data.string)-1); @@ -1044,7 +1044,7 @@ static void spoolss_notify_job_status_string(connection_struct *conn, int snum, /******************************************************************* * fill a notify_info_data with ********************************************************************/ -static void spoolss_notify_job_time(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_job_time(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.value[0]=0x0; } @@ -1052,7 +1052,7 @@ static void spoolss_notify_job_time(connection_struct *conn, int snum, SPOOL_NOT /******************************************************************* * fill a notify_info_data with ********************************************************************/ -static void spoolss_notify_job_size(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_job_size(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.value[0]=queue->size; } @@ -1060,7 +1060,7 @@ static void spoolss_notify_job_size(connection_struct *conn, int snum, SPOOL_NOT /******************************************************************* * fill a notify_info_data with ********************************************************************/ -static void spoolss_notify_job_position(connection_struct *conn, int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) +static void spoolss_notify_job_position(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer) { data->notify_data.value[0]=queue->job; } @@ -1219,7 +1219,7 @@ static void construct_info_data(SPOOL_NOTIFY_INFO_DATA *info_data, uint16 type, * ********************************************************************/ static void construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int pnum, - int snum, int i, uint32 id, connection_struct *conn) + int snum, int i, uint32 id) { int k,j; @@ -1252,7 +1252,7 @@ static void construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int pnum, construct_info_data(info_data, type, field, id); DEBUGADD(4,("notify_info_data_table: in\n")); - notify_info_data_table[j].fn(conn,snum, info_data, queue, &printer); + notify_info_data_table[j].fn(snum, info_data, queue, &printer); DEBUGADD(4,("notify_info_data_table: out\n")); info->count++; info_data=&(info->data[info->count]); @@ -1269,7 +1269,7 @@ static void construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int pnum, * ********************************************************************/ static void construct_notify_jobs_info(print_queue_struct *queue, SPOOL_NOTIFY_INFO *info, - int pnum, int snum, int i, uint32 id, connection_struct *conn) + int pnum, int snum, int i, uint32 id) { int k,j; @@ -1298,7 +1298,7 @@ static void construct_notify_jobs_info(print_queue_struct *queue, SPOOL_NOTIFY_I DEBUGADD(4,("j=[%d]:%s\n", j, notify_info_data_table[j].name)); construct_info_data(info_data, type, field, id); DEBUGADD(4,("notify_info_data_table: in\n")); - notify_info_data_table[j].fn(conn, snum, info_data, queue, &printer); + notify_info_data_table[j].fn(snum, info_data, queue, &printer); DEBUGADD(4,("notify_info_data_table: out\n")); info->count++; info_data=&(info->data[info->count]); @@ -1315,7 +1315,7 @@ static void construct_notify_jobs_info(print_queue_struct *queue, SPOOL_NOTIFY_I * fill a notify_info struct with info asked * ********************************************************************/ -static void printserver_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, connection_struct *conn) +static void printserver_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info) { int snum; int pnum=find_printer_index_by_hnd(hnd); @@ -1334,7 +1334,7 @@ static void printserver_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, co { if ( lp_browseable(snum) && lp_snum_ok(snum) && lp_print_ok(snum) ) { - construct_notify_printer_info(info, pnum, snum, i, id, conn); + construct_notify_printer_info(info, pnum, snum, i, id); id++; } } @@ -1348,7 +1348,7 @@ static void printserver_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, co * fill a notify_info struct with info asked * ********************************************************************/ -static void printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, connection_struct *conn) +static void printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info) { int snum; int pnum=find_printer_index_by_hnd(hnd); @@ -1365,7 +1365,7 @@ static void printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, connec { case PRINTER_NOTIFY_TYPE: { - construct_notify_printer_info(info, pnum, snum, i, id, conn); + construct_notify_printer_info(info, pnum, snum, i, id); id--; break; } @@ -1375,10 +1375,10 @@ static void printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, connec print_queue_struct *queue=NULL; print_status_struct status; bzero(&status, sizeof(status)); - count=get_printqueue(snum, conn, &queue, &status); + count=get_printqueue(snum, NULL, &queue, &status); for (j=0; j<count; j++) { - construct_notify_jobs_info(&(queue[j]), info, pnum, snum, i, queue[j].job, conn); + construct_notify_jobs_info(&(queue[j]), info, pnum, snum, i, queue[j].job); } if (queue) free(queue); break; @@ -1393,7 +1393,7 @@ static void printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info, connec * * called from api_spoolss_rfnpcnex (see this to understand) ********************************************************************/ -static void spoolss_reply_rfnpcnex(SPOOL_Q_RFNPCNEX *q_u, prs_struct *rdata, connection_struct *conn) +static void spoolss_reply_rfnpcnex(SPOOL_Q_RFNPCNEX *q_u, prs_struct *rdata) { SPOOL_R_RFNPCNEX r_u; int pnum=find_printer_index_by_hnd(&(q_u->handle)); @@ -1404,10 +1404,10 @@ static void spoolss_reply_rfnpcnex(SPOOL_Q_RFNPCNEX *q_u, prs_struct *rdata, con switch (Printer[pnum].printer_type) { case PRINTER_HANDLE_IS_PRINTSERVER: - printserver_notify_info(&(q_u->handle), &(r_u.info), conn); + printserver_notify_info(&(q_u->handle), &(r_u.info)); break; case PRINTER_HANDLE_IS_PRINTER: - printer_notify_info(&(q_u->handle), &(r_u.info), conn); + printer_notify_info(&(q_u->handle), &(r_u.info)); break; } @@ -1421,21 +1421,21 @@ static void spoolss_reply_rfnpcnex(SPOOL_Q_RFNPCNEX *q_u, prs_struct *rdata, con * called from the spoolss dispatcher * ********************************************************************/ -static void api_spoolss_rfnpcnex(pipes_struct *p, prs_struct *data, +static void api_spoolss_rfnpcnex(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_RFNPCNEX q_u; spoolss_io_q_rfnpcnex("", &q_u, data, 0); - spoolss_reply_rfnpcnex(&q_u, rdata, p->conn); + spoolss_reply_rfnpcnex(&q_u, rdata); } /******************************************************************** * construct_printer_info_0 * fill a printer_info_1 struct ********************************************************************/ -static BOOL construct_printer_info_0(PRINTER_INFO_0 *printer,int snum, pstring servername, connection_struct *conn) +static BOOL construct_printer_info_0(PRINTER_INFO_0 *printer,int snum, pstring servername) { pstring chaine; int count; @@ -1450,7 +1450,7 @@ static BOOL construct_printer_info_0(PRINTER_INFO_0 *printer,int snum, pstring s return (False); } - count=get_printqueue(snum, conn ,&queue,&status); + count=get_printqueue(snum, NULL, &queue, &status); /* the description and the name are of the form \\server\share */ slprintf(chaine,sizeof(chaine)-1,"\\\\%s\\%s",servername, ntprinter.info_2->printername); @@ -1501,7 +1501,7 @@ static BOOL construct_printer_info_0(PRINTER_INFO_0 *printer,int snum, pstring s * construct_printer_info_1 * fill a printer_info_1 struct ********************************************************************/ -static BOOL construct_printer_info_1(PRINTER_INFO_1 *printer,int snum, pstring servername, connection_struct *conn) +static BOOL construct_printer_info_1(PRINTER_INFO_1 *printer,int snum, pstring servername) { pstring chaine; NT_PRINTER_INFO_LEVEL ntprinter; @@ -1593,7 +1593,7 @@ static void construct_dev_mode(DEVICEMODE *devmode, int snum, char *servername) * construct_printer_info_2 * fill a printer_info_2 struct ********************************************************************/ -static BOOL construct_printer_info_2(PRINTER_INFO_2 *printer, int snum, pstring servername, connection_struct *conn) +static BOOL construct_printer_info_2(PRINTER_INFO_2 *printer, int snum, pstring servername) { pstring chaine; int count; @@ -1603,7 +1603,7 @@ static BOOL construct_printer_info_2(PRINTER_INFO_2 *printer, int snum, pstring print_queue_struct *queue=NULL; print_status_struct status; bzero(&status, sizeof(status)); - count=get_printqueue(snum, conn, &queue, &status); + count=get_printqueue(snum, NULL, &queue, &status); if (get_a_printer(&ntprinter, 2, lp_servicename(snum)) !=0 ) { @@ -1654,14 +1654,14 @@ static BOOL construct_printer_info_2(PRINTER_INFO_2 *printer, int snum, pstring * enum_printer_info_1 * glue between spoolss_reply_enumprinters and construct_printer_info_1 ********************************************************************/ -static BOOL enum_printer_info_1(PRINTER_INFO_1 **printer, int snum, int number, connection_struct *conn) +static BOOL enum_printer_info_1(PRINTER_INFO_1 **printer, int snum, int number) { pstring servername; *printer=(PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1)); DEBUG(4,("Allocated memory for ONE PRINTER_INFO_1 at [%p]\n", *printer)); pstrcpy(servername, global_myname); - if (!construct_printer_info_1(*printer, snum, servername, conn)) + if (!construct_printer_info_1(*printer, snum, servername)) { free(*printer); return (False); @@ -1676,14 +1676,14 @@ static BOOL enum_printer_info_1(PRINTER_INFO_1 **printer, int snum, int number, * enum_printer_info_2 * glue between spoolss_reply_enumprinters and construct_printer_info_2 ********************************************************************/ -static BOOL enum_printer_info_2(PRINTER_INFO_2 **printer, int snum, int number, connection_struct *conn) +static BOOL enum_printer_info_2(PRINTER_INFO_2 **printer, int snum, int number) { pstring servername; *printer=(PRINTER_INFO_2 *)malloc(sizeof(PRINTER_INFO_2)); DEBUG(4,("Allocated memory for ONE PRINTER_INFO_2 at [%p]\n", *printer)); pstrcpy(servername, global_myname); - if (!construct_printer_info_2(*printer, snum, servername, conn)) + if (!construct_printer_info_2(*printer, snum, servername)) { free(*printer); return (False); @@ -1699,7 +1699,7 @@ static BOOL enum_printer_info_2(PRINTER_INFO_2 **printer, int snum, int number, * * called from api_spoolss_enumprinters (see this to understand) ********************************************************************/ -static void enum_all_printers_info_1(PRINTER_INFO_1 ***printers, uint32 *number, connection_struct *conn) +static void enum_all_printers_info_1(PRINTER_INFO_1 ***printers, uint32 *number) { int snum; int n_services=lp_numservices(); @@ -1713,7 +1713,7 @@ static void enum_all_printers_info_1(PRINTER_INFO_1 ***printers, uint32 *number, DEBUG(4,("Found a printer: %s[%x]\n",lp_servicename(snum),snum)); *printers=Realloc(*printers, (*number+1)*sizeof(PRINTER_INFO_1 *)); DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_1 pointers at [%p]\n", *number+1, *printers)); - if (enum_printer_info_1( &((*printers)[*number]), snum, *number, conn) ) + if (enum_printer_info_1( &((*printers)[*number]), snum, *number) ) { (*number)++; } @@ -1726,7 +1726,7 @@ static void enum_all_printers_info_1(PRINTER_INFO_1 ***printers, uint32 *number, * * called from api_spoolss_enumprinters (see this to understand) ********************************************************************/ -static void enum_all_printers_info_2(PRINTER_INFO_2 ***printers, uint32 *number, connection_struct *conn) +static void enum_all_printers_info_2(PRINTER_INFO_2 ***printers, uint32 *number) { int snum; int n_services=lp_numservices(); @@ -1740,7 +1740,7 @@ static void enum_all_printers_info_2(PRINTER_INFO_2 ***printers, uint32 *number, DEBUG(4,("Found a printer: %s[%x]\n",lp_servicename(snum),snum)); *printers=Realloc(*printers, (*number+1)*sizeof(PRINTER_INFO_2 *)); DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_2 pointers at [%p]\n", *number+1, *printers)); - if (enum_printer_info_2( &((*printers)[*number]), snum, *number, conn) ) + if (enum_printer_info_2( &((*printers)[*number]), snum, *number) ) { (*number)++; } @@ -1753,7 +1753,7 @@ static void enum_all_printers_info_2(PRINTER_INFO_2 ***printers, uint32 *number, * * called from api_spoolss_enumprinters (see this to understand) ********************************************************************/ -static void spoolss_reply_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *rdata, connection_struct *conn) +static void spoolss_reply_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *rdata) { SPOOL_R_ENUMPRINTERS r_u; @@ -1768,14 +1768,14 @@ static void spoolss_reply_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *rd case 1: if ( (q_u->flags==PRINTER_ENUM_NAME) || (q_u->flags==PRINTER_ENUM_NETWORK) ) /*if (is_a_printerserver(q_u->servername))*/ - enum_all_printers_info_1(&(r_u.printer.printers_1), &(r_u.returned), conn ); + enum_all_printers_info_1(&(r_u.printer.printers_1), &(r_u.returned) ); /*else enum_one_printer_info_1(&r_u);*/ break; case 2: if ( (q_u->flags==PRINTER_ENUM_NAME) || (q_u->flags==PRINTER_ENUM_NETWORK) ) /*if (is_a_printerserver(q_u->servername))*/ - enum_all_printers_info_2(&(r_u.printer.printers_2), &(r_u.returned), conn ); + enum_all_printers_info_2(&(r_u.printer.printers_2), &(r_u.returned) ); /*else enum_one_printer_info_2(&r_u);*/ break; @@ -1800,14 +1800,14 @@ static void spoolss_reply_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *rd * called from the spoolss dispatcher * ********************************************************************/ -static void api_spoolss_enumprinters(pipes_struct *p, prs_struct *data, +static void api_spoolss_enumprinters(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ENUMPRINTERS q_u; spoolss_io_q_enumprinters("", &q_u, data, 0); - spoolss_reply_enumprinters(&q_u, rdata, p->conn); + spoolss_reply_enumprinters(&q_u, rdata); spoolss_io_free_buffer(&(q_u.buffer)); } @@ -1815,7 +1815,7 @@ static void api_spoolss_enumprinters(pipes_struct *p, prs_struct *data, /**************************************************************************** ****************************************************************************/ -static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata, connection_struct *conn) +static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata) { SPOOL_R_GETPRINTER r_u; int snum; @@ -1833,7 +1833,7 @@ static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata, printer=(PRINTER_INFO_0 *)malloc(sizeof(PRINTER_INFO_0)); - construct_printer_info_0(printer, snum, servername, conn); + construct_printer_info_0(printer, snum, servername); r_u.printer.info0=printer; r_u.status=0x0000; r_u.offered=q_u->offered; @@ -1851,7 +1851,7 @@ static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata, printer=(PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1)); - construct_printer_info_1(printer, snum, servername, conn); + construct_printer_info_1(printer, snum, servername); r_u.printer.info1=printer; r_u.status=0x0000; @@ -1868,7 +1868,7 @@ static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata, PRINTER_INFO_2 *printer; printer=(PRINTER_INFO_2 *)malloc(sizeof(PRINTER_INFO_2)); - construct_printer_info_2(printer, snum, servername, conn); + construct_printer_info_2(printer, snum, servername); r_u.printer.info2=printer; r_u.status=0x0000; @@ -1888,14 +1888,14 @@ static void spoolss_reply_getprinter(SPOOL_Q_GETPRINTER *q_u, prs_struct *rdata, * called from the spoolss dispatcher * ********************************************************************/ -static void api_spoolss_getprinter(pipes_struct *p, prs_struct *data, +static void api_spoolss_getprinter(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_GETPRINTER q_u; spoolss_io_q_getprinter("", &q_u, data, 0); - spoolss_reply_getprinter(&q_u, rdata, p->conn); + spoolss_reply_getprinter(&q_u, rdata); } /******************************************************************** @@ -2149,7 +2149,7 @@ static void spoolss_reply_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_ * called from the spoolss dispatcher * ********************************************************************/ -static void api_spoolss_getprinterdriver2(pipes_struct *p, prs_struct *data, +static void api_spoolss_getprinterdriver2(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_GETPRINTERDRIVER2 q_u; @@ -2186,7 +2186,7 @@ static void spoolss_reply_startpageprinter(SPOOL_Q_STARTPAGEPRINTER *q_u, prs_st * called from the spoolss dispatcher * ********************************************************************/ -static void api_spoolss_startpageprinter(pipes_struct *p, prs_struct *data, +static void api_spoolss_startpageprinter(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_STARTPAGEPRINTER q_u; @@ -2221,7 +2221,7 @@ static void spoolss_reply_endpageprinter(SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct * called from the spoolss dispatcher * ********************************************************************/ -static void api_spoolss_endpageprinter(pipes_struct *p, prs_struct *data, +static void api_spoolss_endpageprinter(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ENDPAGEPRINTER q_u; @@ -2236,7 +2236,7 @@ static void api_spoolss_endpageprinter(pipes_struct *p, prs_struct *data, * called from the spoolss dispatcher * ********************************************************************/ -static void api_spoolss_startdocprinter(pipes_struct *p, prs_struct *data, +static void api_spoolss_startdocprinter(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_STARTDOCPRINTER q_u; @@ -2331,7 +2331,7 @@ static void spoolss_reply_enddocprinter(SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct * * called from the spoolss dispatcher * ********************************************************************/ -static void api_spoolss_enddocprinter(pipes_struct *p, prs_struct *data, +static void api_spoolss_enddocprinter(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ENDDOCPRINTER q_u; @@ -2431,7 +2431,7 @@ static void spoolss_reply_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, prs_struct *rd * called from the spoolss dispatcher * ********************************************************************/ -static void api_spoolss_writeprinter(pipes_struct *p, prs_struct *data, +static void api_spoolss_writeprinter(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_WRITEPRINTER q_u; @@ -2458,7 +2458,7 @@ static void api_spoolss_writeprinter(pipes_struct *p, prs_struct *data, * called from the spoolss dispatcher * ********************************************************************/ -static void control_printer(POLICY_HND handle, uint32 command, connection_struct *conn) +static void control_printer(POLICY_HND handle, uint32 command) { int pnum; int snum; @@ -2470,13 +2470,13 @@ static void control_printer(POLICY_HND handle, uint32 command, connection_struct { case PRINTER_CONTROL_PAUSE: /* pause the printer here */ - status_printqueue(conn, snum, LPSTAT_STOPPED); + status_printqueue(NULL, snum, LPSTAT_STOPPED); break; case PRINTER_CONTROL_RESUME: case PRINTER_CONTROL_UNPAUSE: /* UN-pause the printer here */ - status_printqueue(conn, snum, LPSTAT_OK); + status_printqueue(NULL, snum, LPSTAT_OK); break; case PRINTER_CONTROL_PURGE: /* Envoi des dragées FUCA dans l'imprimante */ @@ -2573,7 +2573,7 @@ static void spoolss_reply_setprinter(SPOOL_Q_SETPRINTER *q_u, prs_struct *rdata) /**************************************************************************** ****************************************************************************/ -static void api_spoolss_setprinter(pipes_struct *p, prs_struct *data, +static void api_spoolss_setprinter(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_SETPRINTER q_u; @@ -2588,7 +2588,7 @@ static void api_spoolss_setprinter(pipes_struct *p, prs_struct *data, switch (q_u.level) { case 0: - control_printer(q_u.handle, q_u.command, p->conn); + control_printer(q_u.handle, q_u.command); break; case 2: update_printer(q_u.handle, q_u.level, q_u.info, q_u.devmode); @@ -2611,7 +2611,7 @@ static void spoolss_reply_fcpn(SPOOL_Q_FCPN *q_u, prs_struct *rdata) /**************************************************************************** ****************************************************************************/ -static void api_spoolss_fcpn(pipes_struct *p, prs_struct *data, +static void api_spoolss_fcpn(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_FCPN q_u; @@ -2634,7 +2634,7 @@ static void spoolss_reply_addjob(SPOOL_Q_ADDJOB *q_u, prs_struct *rdata) /**************************************************************************** ****************************************************************************/ -static void api_spoolss_addjob(pipes_struct *p, prs_struct *data, +static void api_spoolss_addjob(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ADDJOB q_u; @@ -2734,7 +2734,7 @@ static BOOL fill_job_info_2(JOB_INFO_2 *job_info, print_queue_struct *queue, /**************************************************************************** ****************************************************************************/ -static void spoolss_reply_enumjobs(SPOOL_Q_ENUMJOBS *q_u, prs_struct *rdata, connection_struct *conn) +static void spoolss_reply_enumjobs(SPOOL_Q_ENUMJOBS *q_u, prs_struct *rdata) { SPOOL_R_ENUMJOBS r_u; int snum; @@ -2754,7 +2754,7 @@ static void spoolss_reply_enumjobs(SPOOL_Q_ENUMJOBS *q_u, prs_struct *rdata, con if (get_printer_snum(&(q_u->handle), &snum)) { - count=get_printqueue(snum, conn, &queue, &status); + count=get_printqueue(snum, NULL, &queue, &status); r_u.numofjobs=0; r_u.level=q_u->level; @@ -2801,14 +2801,14 @@ static void spoolss_reply_enumjobs(SPOOL_Q_ENUMJOBS *q_u, prs_struct *rdata, con /**************************************************************************** ****************************************************************************/ -static void api_spoolss_enumjobs(pipes_struct *p, prs_struct *data, +static void api_spoolss_enumjobs(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ENUMJOBS q_u; spoolss_io_q_enumjobs("", &q_u, data, 0); - spoolss_reply_enumjobs(&q_u, rdata, p->conn); + spoolss_reply_enumjobs(&q_u, rdata); spoolss_io_free_buffer(&(q_u.buffer)); } @@ -2826,7 +2826,7 @@ static void spoolss_reply_schedulejob(SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *rdat /**************************************************************************** ****************************************************************************/ -static void api_spoolss_schedulejob(pipes_struct *p, prs_struct *data, +static void api_spoolss_schedulejob(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_SCHEDULEJOB q_u; @@ -2838,7 +2838,7 @@ static void api_spoolss_schedulejob(pipes_struct *p, prs_struct *data, /**************************************************************************** ****************************************************************************/ -static void spoolss_reply_setjob(SPOOL_Q_SETJOB *q_u, prs_struct *rdata, connection_struct *conn) +static void spoolss_reply_setjob(SPOOL_Q_SETJOB *q_u, prs_struct *rdata) { SPOOL_R_SETJOB r_u; int snum; @@ -2852,7 +2852,7 @@ static void spoolss_reply_setjob(SPOOL_Q_SETJOB *q_u, prs_struct *rdata, connect if (get_printer_snum(&(q_u->handle), &snum)) { - count=get_printqueue(snum, conn, &queue, &status); + count=get_printqueue(snum, NULL, &queue, &status); while ( (i<count) && found==False ) { if ( q_u->jobid == queue[i].job ) @@ -2869,17 +2869,17 @@ static void spoolss_reply_setjob(SPOOL_Q_SETJOB *q_u, prs_struct *rdata, connect case JOB_CONTROL_CANCEL: case JOB_CONTROL_DELETE: { - del_printqueue(conn, snum, q_u->jobid); + del_printqueue(NULL, snum, q_u->jobid); break; } case JOB_CONTROL_PAUSE: { - status_printjob(conn, snum, q_u->jobid, LPQ_PAUSED); + status_printjob(NULL, snum, q_u->jobid, LPQ_PAUSED); break; } case JOB_CONTROL_RESUME: { - status_printjob(conn, snum, q_u->jobid, LPQ_QUEUED); + status_printjob(NULL, snum, q_u->jobid, LPQ_QUEUED); break; } } @@ -2893,19 +2893,19 @@ static void spoolss_reply_setjob(SPOOL_Q_SETJOB *q_u, prs_struct *rdata, connect /**************************************************************************** ****************************************************************************/ -static void api_spoolss_setjob(pipes_struct *p, prs_struct *data, +static void api_spoolss_setjob(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_SETJOB q_u; spoolss_io_q_setjob("", &q_u, data, 0); - spoolss_reply_setjob(&q_u, rdata, p->conn); + spoolss_reply_setjob(&q_u, rdata); } /**************************************************************************** ****************************************************************************/ -static void spoolss_reply_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *rdata, connection_struct *conn) +static void spoolss_reply_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *rdata) { SPOOL_R_ENUMPRINTERDRIVERS r_u; NT_PRINTER_DRIVER_INFO_LEVEL driver; @@ -2922,7 +2922,7 @@ static void spoolss_reply_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, pr fstrcpy(servername, global_myname); unistr2_to_ascii(architecture, &(q_u->environment), sizeof(architecture)); - count=get_ntdrivers(conn, &list, architecture); + count=get_ntdrivers(&list, architecture); DEBUGADD(4,("we have: [%d] drivers on archi [%s]\n",count, architecture)); for (i=0; i<count; i++) @@ -3018,14 +3018,14 @@ static void spoolss_reply_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, pr /**************************************************************************** ****************************************************************************/ -static void api_spoolss_enumprinterdrivers(pipes_struct *p, prs_struct *data, +static void api_spoolss_enumprinterdrivers(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ENUMPRINTERDRIVERS q_u; spoolss_io_q_enumprinterdrivers("", &q_u, data, 0); - spoolss_reply_enumprinterdrivers(&q_u, rdata, p->conn); + spoolss_reply_enumprinterdrivers(&q_u, rdata); spoolss_io_free_buffer(&(q_u.buffer)); } @@ -3095,7 +3095,7 @@ static void spoolss_reply_enumforms(SPOOL_Q_ENUMFORMS *q_u, prs_struct *rdata) /**************************************************************************** ****************************************************************************/ -static void api_spoolss_enumforms(pipes_struct *p, prs_struct *data, +static void api_spoolss_enumforms(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ENUMFORMS q_u; @@ -3167,7 +3167,7 @@ static void spoolss_reply_enumports(SPOOL_Q_ENUMPORTS *q_u, prs_struct *rdata) /**************************************************************************** ****************************************************************************/ -static void api_spoolss_enumports(pipes_struct *p, prs_struct *data, +static void api_spoolss_enumports(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ENUMPORTS q_u; @@ -3213,7 +3213,7 @@ static void spoolss_reply_addprinterex(SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *rd /**************************************************************************** ****************************************************************************/ -static void api_spoolss_addprinterex(pipes_struct *p, prs_struct *data, prs_struct *rdata) +static void api_spoolss_addprinterex(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ADDPRINTEREX q_u; NT_PRINTER_INFO_LEVEL printer; @@ -3250,7 +3250,7 @@ static void spoolss_reply_addprinterdriver(SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_st /**************************************************************************** ****************************************************************************/ -static void api_spoolss_addprinterdriver(pipes_struct *p, prs_struct *data, +static void api_spoolss_addprinterdriver(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ADDPRINTERDRIVER q_u; @@ -3293,7 +3293,7 @@ static void spoolss_reply_getprinterdriverdirectory(SPOOL_Q_GETPRINTERDRIVERDIR /**************************************************************************** ****************************************************************************/ -static void api_spoolss_getprinterdriverdirectory(pipes_struct *p, prs_struct *data, +static void api_spoolss_getprinterdriverdirectory(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_GETPRINTERDRIVERDIR q_u; @@ -3405,7 +3405,7 @@ static void spoolss_reply_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, prs_stru /**************************************************************************** ****************************************************************************/ -static void api_spoolss_enumprinterdata(pipes_struct *p, prs_struct *data, +static void api_spoolss_enumprinterdata(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ENUMPRINTERDATA q_u; @@ -3451,7 +3451,7 @@ static void spoolss_reply_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, prs_struct /**************************************************************************** ****************************************************************************/ -static void api_spoolss_setprinterdata(pipes_struct *p, prs_struct *data, +static void api_spoolss_setprinterdata(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_SETPRINTERDATA q_u; @@ -3493,7 +3493,7 @@ static void spoolss_reply_addform(SPOOL_Q_ADDFORM *q_u, prs_struct *rdata) /**************************************************************************** ****************************************************************************/ -static void api_spoolss_addform(pipes_struct *p, prs_struct *data, +static void api_spoolss_addform(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ADDFORM q_u; @@ -3532,7 +3532,7 @@ static void spoolss_reply_setform(SPOOL_Q_SETFORM *q_u, prs_struct *rdata) /**************************************************************************** ****************************************************************************/ -static void api_spoolss_setform(pipes_struct *p, prs_struct *data, +static void api_spoolss_setform(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_SETFORM q_u; @@ -3577,7 +3577,7 @@ static void spoolss_reply_enumprintprocessors(SPOOL_Q_ENUMPRINTPROCESSORS *q_u, /**************************************************************************** ****************************************************************************/ -static void api_spoolss_enumprintprocessors(pipes_struct *p, prs_struct *data, +static void api_spoolss_enumprintprocessors(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ENUMPRINTPROCESSORS q_u; @@ -3624,7 +3624,7 @@ static void spoolss_reply_enumprintmonitors(SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_ /**************************************************************************** ****************************************************************************/ -static void api_spoolss_enumprintmonitors(pipes_struct *p, prs_struct *data, +static void api_spoolss_enumprintmonitors(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_ENUMPRINTMONITORS q_u; @@ -3638,7 +3638,7 @@ static void api_spoolss_enumprintmonitors(pipes_struct *p, prs_struct *data, /**************************************************************************** ****************************************************************************/ -static void spoolss_reply_getjob(SPOOL_Q_GETJOB *q_u, prs_struct *rdata, connection_struct *conn) +static void spoolss_reply_getjob(SPOOL_Q_GETJOB *q_u, prs_struct *rdata) { SPOOL_R_GETJOB r_u; int snum; @@ -3657,7 +3657,7 @@ static void spoolss_reply_getjob(SPOOL_Q_GETJOB *q_u, prs_struct *rdata, connect if (get_printer_snum(&(q_u->handle), &snum)) { - count=get_printqueue(snum, conn, &queue, &status); + count=get_printqueue(snum, NULL, &queue, &status); r_u.level=q_u->level; @@ -3719,14 +3719,14 @@ static void spoolss_reply_getjob(SPOOL_Q_GETJOB *q_u, prs_struct *rdata, connect /**************************************************************************** ****************************************************************************/ -static void api_spoolss_getjob(pipes_struct *p, prs_struct *data, +static void api_spoolss_getjob(rpcsrv_struct *p, prs_struct *data, prs_struct *rdata) { SPOOL_Q_GETJOB q_u; spoolss_io_q_getjob("", &q_u, data, 0); - spoolss_reply_getjob(&q_u, rdata, p->conn); + spoolss_reply_getjob(&q_u, rdata); spoolss_io_free_buffer(&(q_u.buffer)); } @@ -3774,7 +3774,7 @@ struct api_struct api_spoolss_cmds[] = /******************************************************************* receives a spoolss pipe and responds. ********************************************************************/ -BOOL api_spoolss_rpc(pipes_struct *p, prs_struct *data) +BOOL api_spoolss_rpc(rpcsrv_struct *p, prs_struct *data) { return api_rpcTNP(p, "api_spoolss_rpc", api_spoolss_cmds, data); } diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c index 35f1676232..8dd99cccc6 100644 --- a/source3/rpc_server/srv_srvsvc.c +++ b/source3/rpc_server/srv_srvsvc.c @@ -972,7 +972,7 @@ static void srv_reply_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *q_n, /******************************************************************* ********************************************************************/ -static void api_srv_net_srv_get_info( pipes_struct *p, prs_struct *data, +static void api_srv_net_srv_get_info( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SRV_Q_NET_SRV_GET_INFO q_n; @@ -987,7 +987,7 @@ static void api_srv_net_srv_get_info( pipes_struct *p, prs_struct *data, /******************************************************************* ********************************************************************/ -static void api_srv_net_file_enum( pipes_struct *p, prs_struct *data, +static void api_srv_net_file_enum( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SRV_Q_NET_FILE_ENUM q_n; @@ -1005,7 +1005,7 @@ static void api_srv_net_file_enum( pipes_struct *p, prs_struct *data, /******************************************************************* ********************************************************************/ -static void api_srv_net_conn_enum( pipes_struct *p, prs_struct *data, +static void api_srv_net_conn_enum( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SRV_Q_NET_CONN_ENUM q_n; @@ -1023,7 +1023,7 @@ static void api_srv_net_conn_enum( pipes_struct *p, prs_struct *data, /******************************************************************* ********************************************************************/ -static void api_srv_net_sess_enum( pipes_struct *p, prs_struct *data, +static void api_srv_net_sess_enum( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SRV_Q_NET_SESS_ENUM q_n; @@ -1041,7 +1041,7 @@ static void api_srv_net_sess_enum( pipes_struct *p, prs_struct *data, /******************************************************************* ********************************************************************/ -static void api_srv_net_share_enum( pipes_struct *p, prs_struct *data, +static void api_srv_net_share_enum( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SRV_Q_NET_SHARE_ENUM q_n; @@ -1097,7 +1097,7 @@ static void srv_reply_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_n, } /******************************************************************* ********************************************************************/ -static void api_srv_net_remote_tod( pipes_struct *p, prs_struct *data, +static void api_srv_net_remote_tod( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SRV_Q_NET_REMOTE_TOD q_n; @@ -1127,7 +1127,7 @@ struct api_struct api_srv_cmds[] = /******************************************************************* receives a srvsvc pipe and responds. ********************************************************************/ -BOOL api_srvsvc_rpc(pipes_struct *p, prs_struct *data) +BOOL api_srvsvc_rpc(rpcsrv_struct *p, prs_struct *data) { return api_rpcTNP(p, "api_srvsvc_rpc", api_srv_cmds, data); } diff --git a/source3/rpc_server/srv_svcctl.c b/source3/rpc_server/srv_svcctl.c index e67cafb9df..12f0bdf3b3 100644 --- a/source3/rpc_server/srv_svcctl.c +++ b/source3/rpc_server/srv_svcctl.c @@ -61,7 +61,7 @@ static void svc_reply_close(SVC_Q_CLOSE *q_r, /******************************************************************* api_svc_close ********************************************************************/ -static void api_svc_close( pipes_struct *p, prs_struct *data, +static void api_svc_close( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SVC_Q_CLOSE q_r; @@ -117,7 +117,7 @@ static void svc_reply_open_service(SVC_Q_OPEN_SERVICE *q_u, /******************************************************************* api_svc_open_service ********************************************************************/ -static void api_svc_open_service( pipes_struct *p, prs_struct *data, +static void api_svc_open_service( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SVC_Q_OPEN_SERVICE q_u; @@ -153,7 +153,7 @@ static void svc_reply_start_service(SVC_Q_START_SERVICE *q_s, /******************************************************************* api_svc_start_service ********************************************************************/ -static void api_svc_start_service( pipes_struct *p, prs_struct *data, +static void api_svc_start_service( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SVC_Q_START_SERVICE q_u; @@ -203,7 +203,7 @@ static void svc_reply_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u, /******************************************************************* api_svc_open_sc_man ********************************************************************/ -static void api_svc_open_sc_man( pipes_struct *p, prs_struct *data, +static void api_svc_open_sc_man( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SVC_Q_OPEN_SC_MAN q_u; @@ -318,7 +318,7 @@ static void svc_reply_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_u, /******************************************************************* api_svc_enum_svcs_status ********************************************************************/ -static void api_svc_enum_svcs_status( pipes_struct *p, prs_struct *data, +static void api_svc_enum_svcs_status( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SVC_Q_ENUM_SVCS_STATUS q_u; @@ -356,7 +356,7 @@ static void svc_reply_query_disp_name(SVC_Q_QUERY_DISP_NAME *q_u, /******************************************************************* api_svc_query_disp_name ********************************************************************/ -static void api_svc_query_disp_name( pipes_struct *p, prs_struct *data, +static void api_svc_query_disp_name( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { SVC_Q_QUERY_DISP_NAME q_u; @@ -381,7 +381,7 @@ static struct api_struct api_svc_cmds[] = /******************************************************************* receives a svcctl pipe and responds. ********************************************************************/ -BOOL api_svcctl_rpc(pipes_struct *p, prs_struct *data) +BOOL api_svcctl_rpc(rpcsrv_struct *p, prs_struct *data) { return api_rpcTNP(p, "api_svc_rpc", api_svc_cmds, data); } diff --git a/source3/rpc_server/srv_wkssvc.c b/source3/rpc_server/srv_wkssvc.c index 9b0b0a3ca8..e97ae1ee6e 100644 --- a/source3/rpc_server/srv_wkssvc.c +++ b/source3/rpc_server/srv_wkssvc.c @@ -80,7 +80,7 @@ static void wks_reply_query_info(WKS_Q_QUERY_INFO *q_u, /******************************************************************* api_wks_query_info ********************************************************************/ -static void api_wks_query_info( pipes_struct *p, prs_struct *data, +static void api_wks_query_info( rpcsrv_struct *p, prs_struct *data, prs_struct *rdata ) { WKS_Q_QUERY_INFO q_u; @@ -105,7 +105,7 @@ struct api_struct api_wks_cmds[] = /******************************************************************* receives a wkssvc pipe and responds. ********************************************************************/ -BOOL api_wkssvc_rpc(pipes_struct *p, prs_struct *data) +BOOL api_wkssvc_rpc(rpcsrv_struct *p, prs_struct *data) { return api_rpcTNP(p, "api_wkssvc_rpc", api_wks_cmds, data); } |