summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-22 22:38:45 +0100
committerKarolin Seeger <kseeger@samba.org>2010-01-13 14:00:58 +0100
commit0adc4feb774eb6df0608a8bbb1f57eef5d55a0b4 (patch)
tree0326e3cc86b4e91c092430e5b23ee061064d2dff /source
parentdeec7b8d777ebcfdda5ed84bbdd522fca02633c1 (diff)
downloadsamba-0adc4feb774eb6df0608a8bbb1f57eef5d55a0b4.tar.gz
samba-0adc4feb774eb6df0608a8bbb1f57eef5d55a0b4.tar.xz
samba-0adc4feb774eb6df0608a8bbb1f57eef5d55a0b4.zip
s3: Fix bug 6338 -- net rpc trustdom list always display "none"
(cherry picked from commit ff9d20909cdce671d92f1d5cee1249db465efa9b)
Diffstat (limited to 'source')
-rw-r--r--source/utils/net_rpc.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c
index d90aac1af29..826b6d9ac87 100644
--- a/source/utils/net_rpc.c
+++ b/source/utils/net_rpc.c
@@ -5984,6 +5984,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
int i, pad_len, col_len = 20;
struct lsa_DomainList dom_list;
fstring pdc_name;
+ bool found_domain;
/* trusting domains listing variables */
POLICY_HND domain_hnd;
@@ -6068,6 +6069,8 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
d_printf("Trusted domains list:\n\n");
+ found_domain = false;
+
do {
nt_status = rpccli_lsa_EnumTrustDom(pipe_hnd, mem_ctx,
&connect_hnd,
@@ -6085,16 +6088,19 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
for (i = 0; i < dom_list.count; i++) {
print_trusted_domain(dom_list.domains[i].sid,
dom_list.domains[i].name.string);
+ found_domain = true;
};
- /*
- * in case of no trusted domains say something rather
- * than just display blank line
- */
- if (!dom_list.count) d_printf("none\n");
-
} while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
+ /*
+ * in case of no trusted domains say something rather
+ * than just display blank line
+ */
+ if (!found_domain) {
+ d_printf("none\n");
+ }
+
/* close this connection before doing next one */
nt_status = rpccli_lsa_Close(pipe_hnd, mem_ctx, &connect_hnd);
if (NT_STATUS_IS_ERR(nt_status)) {
@@ -6157,6 +6163,8 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
* perform actual enumeration
*/
+ found_domain = false;
+
enum_ctx = 0; /* reset enumeration context from last enumeration */
do {
@@ -6179,6 +6187,8 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
char *str = CONST_DISCARD(char *, trusts->entries[i].name.string);
+ found_domain = true;
+
/*
* get each single domain's sid (do we _really_ need this ?):
* 1) connect to domain's pdc
@@ -6224,10 +6234,12 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
};
};
- if (!num_domains) d_printf("none\n");
-
} while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
+ if (!found_domain) {
+ d_printf("none\n");
+ }
+
/* close opened samr and domain policy handles */
nt_status = rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_hnd);
if (!NT_STATUS_IS_OK(nt_status)) {