diff options
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 21 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr.c | 24 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr_nt.c | 63 |
3 files changed, 48 insertions, 60 deletions
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index dad35ec0e1..23fe7d0fc0 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -2169,16 +2169,19 @@ bool samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u, } /******************************************************************* -inits a ALIAS_INFO1 structure. + inits a samr_AliasInfoAll structure. ********************************************************************/ -void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member, char *acct_desc) +void init_samr_alias_info1(struct samr_AliasInfoAll *r, + const char *name, + uint32_t num_members, + const char *description) { DEBUG(5, ("init_samr_alias_info1\n")); - init_unistr4(&al1->name, acct_name, UNI_FLAGS_NONE); - al1->num_member = num_member; - init_unistr4(&al1->description, acct_desc, UNI_FLAGS_NONE); + init_lsa_String(&r->name, name); + r->num_members = num_members; + init_lsa_String(&r->description, description); } /******************************************************************* @@ -2216,15 +2219,17 @@ bool samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1, return True; } + /******************************************************************* -inits a ALIAS_INFO3 structure. +inits a lsa_String structure. ********************************************************************/ -void init_samr_alias_info3(ALIAS_INFO3 * al3, const char *acct_desc) +void init_samr_alias_info3(struct lsa_String *r, + const char *description) { DEBUG(5, ("init_samr_alias_info3\n")); - init_unistr4(&al3->description, acct_desc, UNI_FLAGS_NONE); + init_lsa_String(r, description); } /******************************************************************* diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index 2fea3c17b0..70fe85d6c7 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -230,29 +230,7 @@ static bool api_samr_query_dispinfo(pipes_struct *p) static bool api_samr_query_aliasinfo(pipes_struct *p) { - SAMR_Q_QUERY_ALIASINFO q_u; - SAMR_R_QUERY_ALIASINFO r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - /* grab the samr open */ - if(!samr_io_q_query_aliasinfo("", &q_u, data, 0)) { - DEBUG(0,("api_samr_query_aliasinfo: unable to unmarshall SAMR_Q_QUERY_ALIASINFO.\n")); - return False; - } - - r_u.status = _samr_query_aliasinfo(p, &q_u, &r_u); - - /* store the response in the SMB stream */ - if(!samr_io_r_query_aliasinfo("", &r_u, rdata, 0)) { - DEBUG(0,("api_samr_query_aliasinfo: unable to marshall SAMR_R_QUERY_ALIASINFO.\n")); - return False; - } - - return True; + return proxy_samr_call(p, NDR_SAMR_QUERYALIASINFO); } /******************************************************************* diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 092624d29e..836ff3574f 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -1341,25 +1341,36 @@ NTSTATUS _samr_query_dispinfo(pipes_struct *p, SAMR_Q_QUERY_DISPINFO *q_u, } /******************************************************************* - samr_reply_query_aliasinfo + _samr_QueryAliasInfo ********************************************************************/ -NTSTATUS _samr_query_aliasinfo(pipes_struct *p, SAMR_Q_QUERY_ALIASINFO *q_u, SAMR_R_QUERY_ALIASINFO *r_u) +NTSTATUS _samr_QueryAliasInfo(pipes_struct *p, + struct samr_QueryAliasInfo *r) { DOM_SID sid; struct acct_info info; uint32 acc_granted; NTSTATUS status; + union samr_AliasInfo *alias_info = NULL; + const char *alias_name = NULL; + const char *alias_description = NULL; - r_u->status = NT_STATUS_OK; + DEBUG(5,("_samr_QueryAliasInfo: %d\n", __LINE__)); - DEBUG(5,("_samr_query_aliasinfo: %d\n", __LINE__)); + alias_info = TALLOC_ZERO_P(p->mem_ctx, union samr_AliasInfo); + if (!alias_info) { + return NT_STATUS_NO_MEMORY; + } /* find the policy handle. open a policy on it. */ - if (!get_lsa_policy_samr_sid(p, &q_u->pol, &sid, &acc_granted, NULL)) + if (!get_lsa_policy_samr_sid(p, r->in.alias_handle, &sid, &acc_granted, NULL)) return NT_STATUS_INVALID_HANDLE; - if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(acc_granted, SA_RIGHT_ALIAS_LOOKUP_INFO, "_samr_query_aliasinfo"))) { - return r_u->status; + + status = access_check_samr_function(acc_granted, + SA_RIGHT_ALIAS_LOOKUP_INFO, + "_samr_QueryAliasInfo"); + if (!NT_STATUS_IS_OK(status)) { + return status; } become_root(); @@ -1369,26 +1380,30 @@ NTSTATUS _samr_query_aliasinfo(pipes_struct *p, SAMR_Q_QUERY_ALIASINFO *q_u, SAM if ( !NT_STATUS_IS_OK(status)) return status; - if ( !(r_u->ctr = TALLOC_ZERO_P( p->mem_ctx, ALIAS_INFO_CTR )) ) - return NT_STATUS_NO_MEMORY; - + /* FIXME: info contains fstrings */ + alias_name = talloc_strdup(r, info.acct_name); + alias_description = talloc_strdup(r, info.acct_desc); - switch (q_u->level ) { - case 1: - r_u->ctr->level = 1; - init_samr_alias_info1(&r_u->ctr->alias.info1, info.acct_name, 1, info.acct_desc); + switch (r->in.level) { + case ALIASINFOALL: + init_samr_alias_info1(&alias_info->all, + alias_name, + 1, + alias_description); break; - case 3: - r_u->ctr->level = 3; - init_samr_alias_info3(&r_u->ctr->alias.info3, info.acct_desc); + case ALIASINFODESCRIPTION: + init_samr_alias_info3(&alias_info->description, + alias_description); break; default: return NT_STATUS_INVALID_INFO_CLASS; } - DEBUG(5,("_samr_query_aliasinfo: %d\n", __LINE__)); + *r->out.info = alias_info; - return r_u->status; + DEBUG(5,("_samr_QueryAliasInfo: %d\n", __LINE__)); + + return NT_STATUS_OK; } #if 0 @@ -5218,16 +5233,6 @@ NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p, /**************************************************************** ****************************************************************/ -NTSTATUS _samr_QueryAliasInfo(pipes_struct *p, - struct samr_QueryAliasInfo *r) -{ - p->rng_fault_state = true; - return NT_STATUS_NOT_IMPLEMENTED; -} - -/**************************************************************** -****************************************************************/ - NTSTATUS _samr_QueryUserInfo(pipes_struct *p, struct samr_QueryUserInfo *r) { |