diff options
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_lsa.c | 28 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe_hnd.c | 12 |
2 files changed, 25 insertions, 15 deletions
diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index f5dd09d05e..1c682044cf 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -90,6 +90,8 @@ static void init_dom_query(DOM_QUERY *d_q, char *dom_name, DOM_SID *dom_sid) fstring sid_str; int domlen = strlen(dom_name); + *sid_str = '\0'; + d_q->uni_dom_max_len = domlen * 2; d_q->uni_dom_str_len = domlen * 2; @@ -99,8 +101,10 @@ static void init_dom_query(DOM_QUERY *d_q, char *dom_name, DOM_SID *dom_sid) /* this string is supposed to be character short */ init_unistr2(&d_q->uni_domain_name, dom_name, domlen); - sid_to_string(sid_str, dom_sid); - init_dom_sid2(&d_q->dom_sid, dom_sid); + if(dom_sid) { + sid_to_string(sid_str, dom_sid); + init_dom_sid2(&d_q->dom_sid, dom_sid); + } } /*************************************************************************** @@ -128,7 +132,7 @@ lsa_reply_query_info ***************************************************************************/ static BOOL lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, prs_struct *rdata, - char *dom_name, DOM_SID *dom_sid) + char *dom_name, DOM_SID *dom_sid, uint32 status_code) { LSA_R_QUERY_INFO r_q; @@ -136,12 +140,14 @@ static BOOL lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, prs_struct *rdata, /* set up the LSA QUERY INFO response */ - r_q.undoc_buffer = 0x22000000; /* bizarre */ - r_q.info_class = q_q->info_class; + if(status_code == 0) { + r_q.undoc_buffer = 0x22000000; /* bizarre */ + r_q.info_class = q_q->info_class; - init_dom_query(&r_q.dom.id5, dom_name, dom_sid); + init_dom_query(&r_q.dom.id5, dom_name, dom_sid); + } - r_q.status = 0x0; + r_q.status = status_code; /* store the response in the SMB stream */ if(!lsa_io_r_query("", &r_q, rdata, 0)) { @@ -484,7 +490,8 @@ static BOOL api_lsa_enum_trust_dom(prs_struct *data, prs_struct *rdata) ZERO_STRUCT(q_e); /* grab the enum trust domain context etc. */ - lsa_io_q_enum_trust_dom("", &q_e, data, 0); + if(!lsa_io_q_enum_trust_dom("", &q_e, data, 0)) + return False; /* construct reply. return status is always 0x0 */ lsa_reply_enum_trust_dom(&q_e, rdata, 0, NULL, NULL); @@ -500,6 +507,8 @@ static BOOL api_lsa_query_info(prs_struct *data, prs_struct *rdata) LSA_Q_QUERY_INFO q_i; fstring name; DOM_SID *sid = NULL; + uint32 status_code = 0; + memset(name, 0, sizeof(name)); ZERO_STRUCT(q_i); @@ -525,11 +534,12 @@ static BOOL api_lsa_query_info(prs_struct *data, prs_struct *rdata) break; default: DEBUG(0,("api_lsa_query_info: unknown info level in Lsa Query: %d\n", q_i.info_class)); + status_code = (NT_STATUS_INVALID_INFO_CLASS | 0xC0000000); break; } /* construct reply. return status is always 0x0 */ - if(!lsa_reply_query_info(&q_i, rdata, name, sid)) + if(!lsa_reply_query_info(&q_i, rdata, name, sid, status_code)) return False; return True; diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 56b76d92be..17ed35addd 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -77,7 +77,7 @@ void init_rpc_pipe_hnd(void) Initialise an outgoing packet. ****************************************************************************/ -static BOOL pipe_init_outgoing_data(output_data *o_data, uint32 len) +static BOOL pipe_init_outgoing_data(output_data *o_data) { /* Reset the offset counters. */ o_data->data_sent_length = 0; @@ -93,7 +93,7 @@ static BOOL pipe_init_outgoing_data(output_data *o_data, uint32 len) * Initialize the outgoing RPC data buffer. * we will use this as the raw data area for replying to rpc requests. */ - if(!prs_init(&o_data->rdata, len, 4, MARSHALL)) { + if(!prs_init(&o_data->rdata, MAX_PDU_FRAG_LEN, 4, MARSHALL)) { DEBUG(0,("pipe_init_outgoing_data: malloc fail.\n")); return False; } @@ -486,7 +486,7 @@ authentication failed. Denying the request.\n", p->name)); * Process the complete data stream here. */ - if(pipe_init_outgoing_data(&p->out_data, MAX_PDU_FRAG_LEN)) + if(pipe_init_outgoing_data(&p->out_data)) ret = api_pipe_request(p); /* @@ -537,14 +537,14 @@ static ssize_t process_complete_pdu(pipes_struct *p) /* * We assume that a pipe bind is only in one pdu. */ - if(pipe_init_outgoing_data(&p->out_data, MAX_PDU_FRAG_LEN)) + if(pipe_init_outgoing_data(&p->out_data)) reply = api_pipe_bind_req(p, &rpc_in); break; case RPC_BINDRESP: /* * We assume that a pipe bind_resp is only in one pdu. */ - if(pipe_init_outgoing_data(&p->out_data, MAX_PDU_FRAG_LEN)) + if(pipe_init_outgoing_data(&p->out_data)) reply = api_pipe_bind_auth_resp(p, &rpc_in); break; case RPC_REQUEST: @@ -716,7 +716,7 @@ static BOOL read_from_remote(pipes_struct *p) * Create the response data buffer. */ - if(!pipe_init_outgoing_data(&p->out_data, 65536)) { + if(!pipe_init_outgoing_data(&p->out_data)) { DEBUG(0,("read_from_remote: failed to create outgoing buffer.\n")); return False; } |