summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_client/cli_samr.c6
-rw-r--r--source3/rpc_server/srv_samr_nt.c37
-rw-r--r--source3/rpcclient/cmd_samr.c3
3 files changed, 32 insertions, 14 deletions
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c
index 03b3c2134b..e4c8d46a75 100644
--- a/source3/rpc_client/cli_samr.c
+++ b/source3/rpc_client/cli_samr.c
@@ -1649,9 +1649,11 @@ NTSTATUS cli_samr_lookup_rids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/* Return output parameters */
- if (!NT_STATUS_IS_OK(result = r.status)) {
+ result = r.status;
+
+ if (!NT_STATUS_IS_OK(result) &&
+ !NT_STATUS_EQUAL(result, STATUS_SOME_UNMAPPED))
goto done;
- }
if (r.num_names1 == 0) {
*num_names = 0;
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 7a436e23e9..1881bc6e48 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -1510,7 +1510,9 @@ NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOK
int num_rids = q_u->num_rids1;
int i;
uint32 acc_granted;
-
+ BOOL have_mapped = False;
+ BOOL have_unmapped = False;
+
r_u->status = NT_STATUS_OK;
DEBUG(5,("_samr_lookup_rids: %d\n", __LINE__));
@@ -1529,7 +1531,11 @@ NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOK
return NT_STATUS_NO_MEMORY;
}
- r_u->status = NT_STATUS_NONE_MAPPED;
+ if (!sid_equal(&pol_sid, get_global_sam_sid())) {
+ /* TODO: Sooner or later we need to look up BUILTIN rids as
+ * well. -- vl */
+ goto done;
+ }
become_root(); /* lookup_sid can require root privs */
@@ -1542,21 +1548,30 @@ NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOK
group_attrs[i] = SID_NAME_UNKNOWN;
*group_names[i] = '\0';
- if (sid_equal(&pol_sid, get_global_sam_sid())) {
- sid_copy(&sid, &pol_sid);
- sid_append_rid(&sid, q_u->rid[i]);
+ sid_copy(&sid, &pol_sid);
+ sid_append_rid(&sid, q_u->rid[i]);
- if (lookup_sid(&sid, domname, tmpname, &type)) {
- r_u->status = NT_STATUS_OK;
- group_attrs[i] = (uint32)type;
- fstrcpy(group_names[i],tmpname);
- DEBUG(5,("_samr_lookup_rids: %s:%d\n", group_names[i], group_attrs[i]));
- }
+ if (lookup_sid(&sid, domname, tmpname, &type)) {
+ group_attrs[i] = (uint32)type;
+ fstrcpy(group_names[i],tmpname);
+ DEBUG(5,("_samr_lookup_rids: %s:%d\n", group_names[i],
+ group_attrs[i]));
+ have_mapped = True;
+ } else {
+ have_unmapped = True;
}
}
unbecome_root();
+ done:
+
+ r_u->status = NT_STATUS_NONE_MAPPED;
+
+ if (have_mapped)
+ r_u->status =
+ have_unmapped ? STATUS_SOME_UNMAPPED : NT_STATUS_OK;
+
if(!make_samr_lookup_rids(p->mem_ctx, num_rids, group_names, &hdr_name, &uni_name))
return NT_STATUS_NO_MEMORY;
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 9daded42ec..e8ddfd32d7 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -1431,7 +1431,8 @@ static NTSTATUS cmd_samr_lookup_rids(struct cli_state *cli,
flags, num_rids, rids,
&num_names, &names, &name_types);
- if (!NT_STATUS_IS_OK(result))
+ if (!NT_STATUS_IS_OK(result) &&
+ !NT_STATUS_EQUAL(result, STATUS_SOME_UNMAPPED))
goto done;
/* Display results */