summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-02-17 22:46:25 +0000
committerJeremy Allison <jra@samba.org>2004-02-17 22:46:25 +0000
commit8801465d30f6117e87fef4592bf9aaf103962c2c (patch)
tree928c0d1c3535aecc787b4d90473f4e7e7a2eba8d /source3/rpc_server
parentd5ad8c5099f0106660302df66fd8c8e9dd26c054 (diff)
downloadsamba-8801465d30f6117e87fef4592bf9aaf103962c2c.tar.gz
samba-8801465d30f6117e87fef4592bf9aaf103962c2c.tar.bz2
samba-8801465d30f6117e87fef4592bf9aaf103962c2c.zip
Fix based on Volker's code to correctly return code from lsa_lookup_sids
on unmapped sids. Jeremy. (This used to be commit 37a52c31682fcf115eefc31381c02a3ec29c1f8d)
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 3300c25254..66adc8398a 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;