summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_lsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_server/srv_lsa.c')
-rw-r--r--source3/rpc_server/srv_lsa.c28
1 files changed, 19 insertions, 9 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;