summaryrefslogtreecommitdiff
path: root/source3/utils/net_rpc.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-22 22:38:45 +0100
committerVolker Lendecke <vl@samba.org>2009-11-22 22:42:02 +0100
commit579bb30188eac3393dfa0d72fd825b7acf8444c9 (patch)
tree22c3f9bb0e4109911143b02e9f4b6ee7345510c1 /source3/utils/net_rpc.c
parent03b6e6e525f574a64e6dfb9f05862ac827e6d645 (diff)
downloadsamba-579bb30188eac3393dfa0d72fd825b7acf8444c9.tar.gz
samba-579bb30188eac3393dfa0d72fd825b7acf8444c9.tar.bz2
samba-579bb30188eac3393dfa0d72fd825b7acf8444c9.zip
s3: Fix bug 6338 -- net rpc trustdom list always display "none"
Diffstat (limited to 'source3/utils/net_rpc.c')
-rw-r--r--source3/utils/net_rpc.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 4ef86d171b..910d782fba 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -6018,6 +6018,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
int i;
struct lsa_DomainList dom_list;
fstring pdc_name;
+ bool found_domain;
/* trusting domains listing variables */
struct policy_handle domain_hnd;
@@ -6099,9 +6100,11 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
* Keep calling LsaEnumTrustdom over opened pipe until
* the end of enumeration is reached
*/
-
+
d_printf(_("Trusted domains list:\n\n"));
+ found_domain = false;
+
do {
nt_status = rpccli_lsa_EnumTrustDom(pipe_hnd, mem_ctx,
&connect_hnd,
@@ -6119,16 +6122,20 @@ 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)) {
@@ -6191,6 +6198,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 {
@@ -6213,6 +6222,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
@@ -6251,13 +6262,15 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
"responding: %s\n"),
nt_errstr(nt_status));
d_printf(_("couldn't get domain's sid\n"));
- };
- };
-
- 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)) {