summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-12 11:36:33 +0100
committerGünther Deschner <gd@samba.org>2008-02-12 11:36:33 +0100
commitb88982a5c857fc1ff0c4e349dd7f1ae8b0de317d (patch)
tree65e9b2eb8e40226f7b86697f6425c2db2384c97a /source3/utils
parent0ed6c373f1dcb7ad6813b43cf614ebb69b4cb518 (diff)
downloadsamba-b88982a5c857fc1ff0c4e349dd7f1ae8b0de317d.tar.gz
samba-b88982a5c857fc1ff0c4e349dd7f1ae8b0de317d.tar.bz2
samba-b88982a5c857fc1ff0c4e349dd7f1ae8b0de317d.zip
Use rpccli_samr_EnumDomainUsers in net and rpcclient.
Guenther (This used to be commit bcf2cd324c2898bda38515036a205c8d0982494f)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_rpc.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 959395c294..403cb19f84 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -6345,9 +6345,8 @@ static int rpc_trustdom_list(int argc, const char **argv)
/* trusting domains listing variables */
POLICY_HND domain_hnd;
- char **trusting_dom_names;
- uint32 *trusting_dom_rids;
-
+ struct samr_SamArray *trusts = NULL;
+
/*
* Listing trusted domains (stored in secrets.tdb, if local)
*/
@@ -6507,11 +6506,14 @@ static int rpc_trustdom_list(int argc, const char **argv)
enum_ctx = 0; /* reset enumeration context from last enumeration */
do {
-
- nt_status = rpccli_samr_enum_dom_users(pipe_hnd, mem_ctx, &domain_hnd,
- &enum_ctx, ACB_DOMTRUST, 0xffff,
- &trusting_dom_names, &trusting_dom_rids,
- &num_domains);
+
+ nt_status = rpccli_samr_EnumDomainUsers(pipe_hnd, mem_ctx,
+ &domain_hnd,
+ &enum_ctx,
+ ACB_DOMTRUST,
+ &trusts,
+ 0xffff,
+ &num_domains);
if (NT_STATUS_IS_ERR(nt_status)) {
DEBUG(0, ("Couldn't enumerate accounts. Error was: %s\n",
nt_errstr(nt_status)));
@@ -6519,9 +6521,11 @@ static int rpc_trustdom_list(int argc, const char **argv)
talloc_destroy(mem_ctx);
return -1;
};
-
+
for (i = 0; i < num_domains; i++) {
+ char *str = CONST_DISCARD(char *, trusts->entries[i].name.string);
+
/*
* get each single domain's sid (do we _really_ need this ?):
* 1) connect to domain's pdc
@@ -6529,22 +6533,22 @@ static int rpc_trustdom_list(int argc, const char **argv)
*/
/* get rid of '$' tail */
- ascii_dom_name_len = strlen(trusting_dom_names[i]);
+ ascii_dom_name_len = strlen(str);
if (ascii_dom_name_len && ascii_dom_name_len < FSTRING_LEN)
- trusting_dom_names[i][ascii_dom_name_len - 1] = '\0';
-
+ str[ascii_dom_name_len - 1] = '\0';
+
/* calculate padding space for d_printf to look nicer */
- pad_len = col_len - strlen(trusting_dom_names[i]);
+ pad_len = col_len - strlen(str);
padding[pad_len] = 0;
do padding[--pad_len] = ' '; while (pad_len);
/* set opt_* variables to remote domain */
- strupper_m(trusting_dom_names[i]);
- opt_workgroup = talloc_strdup(mem_ctx, trusting_dom_names[i]);
+ strupper_m(str);
+ opt_workgroup = talloc_strdup(mem_ctx, str);
opt_target_workgroup = opt_workgroup;
-
- d_printf("%s%s", trusting_dom_names[i], padding);
-
+
+ d_printf("%s%s", str, padding);
+
/* connect to remote domain controller */
nt_status = net_make_ipc_connection(
NET_FLAGS_PDC | NET_FLAGS_ANONYMOUS,