summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-02-17 22:46:27 +0000
committerJeremy Allison <jra@samba.org>2004-02-17 22:46:27 +0000
commit9be8961cc98f59079bccaeaf98eec964741d6f1a (patch)
tree508cbd7ae3aebf194224c798df46e3193c596251 /source3/rpc_server
parent25d96fd0f0d3812fc05492cea56a936ff8a0452d (diff)
downloadsamba-9be8961cc98f59079bccaeaf98eec964741d6f1a.tar.gz
samba-9be8961cc98f59079bccaeaf98eec964741d6f1a.tar.bz2
samba-9be8961cc98f59079bccaeaf98eec964741d6f1a.zip
Fix based on Volker's code to correctly return code from lsa_lookup_sids
on unmapped sids. Jeremy. (This used to be commit 0ac64c8b4d944315cf49e6b183c07396abc7bab3)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_lsa_nt.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index 4a3f6ddbf1..ddf79ef564 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -252,9 +252,6 @@ static void init_lsa_trans_names(TALLOC_CTX *ctx, DOM_R_REF *ref, LSA_TRANS_NAME
/* Lookup sid from winbindd */
- memset(dom_name, '\0', sizeof(dom_name));
- memset(name, '\0', sizeof(name));
-
status = lookup_sid(&find_sid, dom_name, name, &sid_name_use);
DEBUG(5, ("init_lsa_trans_names: %s\n", status ? "found" :
@@ -262,21 +259,25 @@ static void init_lsa_trans_names(TALLOC_CTX *ctx, DOM_R_REF *ref, LSA_TRANS_NAME
if (!status) {
sid_name_use = SID_NAME_UNKNOWN;
+ memset(dom_name, '\0', sizeof(dom_name));
+ sid_to_string(name, &find_sid);
+ dom_idx = -1;
+
+ DEBUG(10,("init_lsa_trans_names: added unknown user '%s' to "
+ "referenced list.\n", name ));
} else {
(*mapped_count)++;
- }
+ /* Store domain sid in ref array */
+ if (find_sid.num_auths == 5) {
+ sid_split_rid(&find_sid, &rid);
+ }
+ dom_idx = init_dom_ref(ref, dom_name, &find_sid);
- /* Store domain sid in ref array */
+ DEBUG(10,("init_lsa_trans_names: added user '%s\\%s' to "
+ "referenced list.\n", dom_name, name ));
- if (find_sid.num_auths == 5) {
- sid_split_rid(&find_sid, &rid);
}
- dom_idx = init_dom_ref(ref, dom_name, &find_sid);
-
- DEBUG(10,("init_lsa_trans_names: added user '%s\\%s' to "
- "referenced list.\n", dom_name, name ));
-
init_lsa_trans_name(&trn->name[total], &trn->uni_name[total],
sid_name_use, name, dom_idx);
total++;
@@ -301,11 +302,6 @@ static void init_reply_lookup_sids(LSA_R_LOOKUP_SIDS *r_l,
r_l->dom_ref = ref;
r_l->names = names;
r_l->mapped_count = mapped_count;
-
- if (mapped_count == 0)
- r_l->status = NT_STATUS_NONE_MAPPED;
- else
- r_l->status = NT_STATUS_OK;
}
static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *sd_size)
@@ -665,6 +661,12 @@ done:
/* set up the LSA Lookup SIDs response */
init_lsa_trans_names(p->mem_ctx, ref, names, num_entries, sid, &mapped_count);
+ if (mapped_count == 0)
+ r_u->status = NT_STATUS_NONE_MAPPED;
+ else if (mapped_count != num_entries)
+ r_u->status = STATUS_SOME_UNMAPPED;
+ else
+ r_u->status = NT_STATUS_OK;
init_reply_lookup_sids(r_u, ref, names, mapped_count);
return r_u->status;