summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-27 20:29:16 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-27 20:29:16 +0000
commit015dc121ea507dfd6c1011985ad6ac3ba422fa14 (patch)
tree7037f749d9010e60accd077b38e9e09246071e1e /source3/rpcclient
parent4c92992b4e9797f34113251c00a99eafa97958bf (diff)
downloadsamba-015dc121ea507dfd6c1011985ad6ac3ba422fa14.tar.gz
samba-015dc121ea507dfd6c1011985ad6ac3ba422fa14.tar.bz2
samba-015dc121ea507dfd6c1011985ad6ac3ba422fa14.zip
enhanced samuser command to do same thing as enumusers command (-g -u -a)
except with only one user. done by sharing same code. (This used to be commit 4e029d50fcb9148f2d65c6be2703b1003e68cec7)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_samr.c49
-rw-r--r--source3/rpcclient/rpcclient.c2
2 files changed, 44 insertions, 7 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index fbfde7c9a4..f436e1b22f 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -1516,6 +1516,7 @@ void cmd_sam_query_user(struct client_info *info, int argc, char *argv[])
DOM_SID sid;
BOOL res = True;
BOOL res1 = True;
+ int opt;
char *user_name;
char *names[1];
@@ -1525,6 +1526,10 @@ void cmd_sam_query_user(struct client_info *info, int argc, char *argv[])
POLICY_HND sam_pol;
POLICY_HND pol_dom;
+ BOOL request_user_info = False;
+ BOOL request_group_info = False;
+ BOOL request_alias_info = False;
+
fstrcpy(domain, info->dom.level5_dom);
sid_copy(&sid, &info->dom.level5_sid);
@@ -1536,12 +1541,37 @@ void cmd_sam_query_user(struct client_info *info, int argc, char *argv[])
if (argc < 2)
{
- report(out_hnd, "samuser <name>\n");
+ report(out_hnd, "samuser <name> [-u] [-g] [-a]\n");
return;
}
user_name = argv[1];
+ argc--;
+ argv++;
+
+ while ((opt = getopt(argc, argv, "uga")) != EOF)
+ {
+ switch (opt)
+ {
+ case 'u':
+ {
+ request_user_info = True;
+ break;
+ }
+ case 'g':
+ {
+ request_group_info = True;
+ break;
+ }
+ case 'a':
+ {
+ request_alias_info = True;
+ break;
+ }
+ }
+ }
+
fstrcpy(srv_name, "\\\\");
fstrcat(srv_name, info->dest_host);
strupper(srv_name);
@@ -1569,14 +1599,21 @@ void cmd_sam_query_user(struct client_info *info, int argc, char *argv[])
/* send user info query */
if (res1 && num_rids == 1)
{
- res1 = req_user_info( &pol_dom,
+ msrpc_sam_user( &pol_dom, NULL,
domain,
- &sid,
- rid[0],
- sam_display_user_info);
+ &sid, NULL,
+ rid[0], names[0],
+ sam_display_user,
+ request_user_info ? sam_display_user_info : NULL,
+ request_group_info ? sam_display_group_members : NULL,
+ request_alias_info ? sam_display_group_members : NULL);
+ }
+ else
+ {
+ res1 = False;
}
- res = res ? samr_close( &sam_pol) : False;
+ res = res ? samr_close( &sam_pol) : False;
res = res ? samr_close( &pol_dom) : False;
if (res1)
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index f0f4a6de5c..189f8fa734 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -429,7 +429,7 @@ commands[] =
{
"samuser",
cmd_sam_query_user,
- "<username> SAM User Query (experimental!)",
+ "<username> [-g] [-u] [-a] SAM User Query (experimental!)",
{COMPL_SAMUSR, COMPL_NONE}
},
{