summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/rpcclient/cmd_samr.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 35598fb50c..2050f2a779 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -351,7 +351,7 @@ static NTSTATUS cmd_samr_query_user(struct rpc_pipe_client *cli,
return NT_STATUS_OK;
}
- sscanf(argv[1], "%i", &user_rid);
+ user_rid = strtoul(argv[1], NULL, 10);
if (argc > 2)
sscanf(argv[2], "%i", &info_level);
@@ -380,6 +380,27 @@ static NTSTATUS cmd_samr_query_user(struct rpc_pipe_client *cli,
access_mask,
user_rid, &user_pol);
+ if (NT_STATUS_EQUAL(result, NT_STATUS_NO_SUCH_USER) &&
+ (user_rid == 0)) {
+
+ /* Probably this was a user name, try lookupnames */
+ uint32 num_rids;
+ uint32 *rids, *types;
+
+ result = rpccli_samr_lookup_names(cli, mem_ctx, &domain_pol,
+ 1000, 1, &argv[1],
+ &num_rids, &rids,
+ &types);
+
+ if (NT_STATUS_IS_OK(result)) {
+ result = rpccli_samr_open_user(cli, mem_ctx,
+ &domain_pol,
+ access_mask,
+ rids[0], &user_pol);
+ }
+ }
+
+
if (!NT_STATUS_IS_OK(result))
goto done;