summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-10-13 15:56:00 +0200
committerBjörn Jacke <bj@sernet.de>2009-10-13 23:09:05 +0200
commit8a27fdea89bc54aa35e363a376836662103c7cb7 (patch)
tree1fb16ac38dee536146690cb3f59ed395e2e4153f
parent3f5c077f2d175d21bb2699d2e21e59f3c3cac939 (diff)
downloadsamba-8a27fdea89bc54aa35e363a376836662103c7cb7.tar.gz
samba-8a27fdea89bc54aa35e363a376836662103c7cb7.tar.bz2
samba-8a27fdea89bc54aa35e363a376836662103c7cb7.zip
s3:net: Fix a segfault in "net rpc trustdom list" for overlong domain names
That was a complicated way to say "%-20.s"... But that code was from 2002 ...
-rw-r--r--source3/utils/net_rpc.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index afda1a724b..0e325b5269 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -6012,14 +6012,13 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
NTSTATUS nt_status;
const char *domain_name = NULL;
DOM_SID *queried_dom_sid;
- fstring padding;
int ascii_dom_name_len;
struct policy_handle connect_hnd;
union lsa_PolicyInformation *info = NULL;
/* trusted domains listing variables */
unsigned int num_domains, enum_ctx = 0;
- int i, pad_len, col_len = 20;
+ int i;
struct lsa_DomainList dom_list;
fstring pdc_name;
@@ -6228,17 +6227,12 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
if (ascii_dom_name_len && ascii_dom_name_len < FSTRING_LEN)
str[ascii_dom_name_len - 1] = '\0';
- /* calculate padding space for d_printf to look nicer */
- 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(str);
c->opt_workgroup = talloc_strdup(mem_ctx, str);
c->opt_target_workgroup = c->opt_workgroup;
- d_printf("%s%s", str, padding);
+ d_printf("%-20s", str);
/* connect to remote domain controller */
nt_status = net_make_ipc_connection(c,