summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-12-01 12:52:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:41 -0500
commite30b176ea3ee9cb6f51eaf38e5fc5e77d0027e3c (patch)
treeb8e6298418ed33e9dc352bb80de4a8020f3f56fe
parent5f733f12a690275a58510b752dfeffe7fd9a4ff5 (diff)
downloadsamba-e30b176ea3ee9cb6f51eaf38e5fc5e77d0027e3c.tar.gz
samba-e30b176ea3ee9cb6f51eaf38e5fc5e77d0027e3c.tar.bz2
samba-e30b176ea3ee9cb6f51eaf38e5fc5e77d0027e3c.zip
r11998: Add lookupname to rpcclient query_user as a fallback, we now accept both rid
and username. Volker (This used to be commit 8fefafcbb8dc774c7cee2062b13a2790bfc3e5c8)
-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;