summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-10-28 17:52:12 +0000
committerLuke Leighton <lkcl@samba.org>1999-10-28 17:52:12 +0000
commit2222a306a86135cf198751973376a97eda704ab9 (patch)
tree1e791f2a1a401d5687998e69c53fbf56c78edae5 /source3/rpcclient
parent050121b1a14cc00ca004c31fc3c9b5677d203fea (diff)
downloadsamba-2222a306a86135cf198751973376a97eda704ab9.tar.gz
samba-2222a306a86135cf198751973376a97eda704ab9.tar.bz2
samba-2222a306a86135cf198751973376a97eda704ab9.zip
rewrote samr enum groups code a bit.
(This used to be commit 3f99ab77203da2eb80b7cedbda88cb03640d427b)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_samr.c69
1 files changed, 41 insertions, 28 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 438760243d..13a17d46e5 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -2005,7 +2005,7 @@ BOOL sam_query_groupmem(struct client_info *info, uint16 fnum,
if (rid_copy != NULL)
{
- int i;
+ uint32 i;
for (i = 0; i < num_mem; i++)
{
rid_copy[i] = (*rid_mem)[i];
@@ -2076,7 +2076,9 @@ static void req_groupmem_info(struct client_info *info, uint16 fnum,
/****************************************************************************
SAM groups query.
****************************************************************************/
-void cmd_sam_enum_groups(struct client_info *info)
+BOOL msrpc_sam_enum_groups(struct client_info *info,
+ BOOL request_member_info,
+ BOOL request_group_info)
{
uint16 fnum;
fstring srv_name;
@@ -2084,19 +2086,15 @@ void cmd_sam_enum_groups(struct client_info *info)
fstring sid;
DOM_SID sid1;
BOOL res = True;
- BOOL request_member_info = False;
- BOOL request_group_info = False;
uint32 ace_perms = 0x02000000; /* access control permissions. */
- fstring tmp;
uint32 group_idx;
- int i;
sid_copy(&sid1, &info->dom.level5_sid);
if (sid1.num_auths == 0)
{
report(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n");
- return;
+ return 0;
}
sid_to_string(sid, &sid1);
@@ -2106,21 +2104,6 @@ void cmd_sam_enum_groups(struct client_info *info)
fstrcat(srv_name, info->dest_host);
strupper(srv_name);
- /* a bad way to do token parsing... */
- for (i = 0; i < 2; i++)
- {
- /* a bad way to do token parsing... */
- if (next_token(NULL, tmp, NULL, sizeof(tmp)))
- {
- request_member_info |= strequal(tmp, "-m");
- request_group_info |= strequal(tmp, "-g");
- }
- else
- {
- break;
- }
- }
-
report(out_hnd, "SAM Enumerate Groups\n");
report(out_hnd, "From: %s To: %s Domain: %s SID: %s\n",
info->myhostname, srv_name, domain, sid);
@@ -2181,17 +2164,47 @@ void cmd_sam_enum_groups(struct client_info *info)
/* close the session */
cli_nt_session_close(smb_cli, fnum);
- if (info->dom.sam != NULL)
+ if (res)
{
- free(info->dom.sam);
+ DEBUG(5,("msrpc_sam_enum_groups: succeeded\n"));
}
+ else
+ {
+ DEBUG(5,("msrpc_sam_enum_groups: failed\n"));
+ }
+ return info->dom.num_sam_entries;
+}
- if (res)
+/****************************************************************************
+experimental SAM groups enum.
+****************************************************************************/
+void cmd_sam_enum_groups(struct client_info *info)
+{
+ BOOL request_member_info = False;
+ BOOL request_group_info = False;
+ fstring tmp;
+ int i;
+
+ for (i = 0; i < 3; i++)
{
- DEBUG(5,("cmd_sam_enum_groups: succeeded\n"));
+ /* a bad way to do token parsing... */
+ if (next_token(NULL, tmp, NULL, sizeof(tmp)))
+ {
+ request_member_info |= strequal(tmp, "-m");
+ request_group_info |= strequal(tmp, "-g");
+ }
+ else
+ {
+ break;
+ }
}
- else
+
+ msrpc_sam_enum_groups(info,
+ request_member_info,
+ request_group_info);
+
+ if (info->dom.sam != NULL)
{
- DEBUG(5,("cmd_sam_enum_groups: failed\n"));
+ free(info->dom.sam);
}
}