diff options
author | Jeremy Allison <jra@samba.org> | 2006-03-09 18:35:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:11:11 -0500 |
commit | 485714ac6ba2f3c6dcacd116e055d4beb648492d (patch) | |
tree | f2d32c6e2dafcab6fc2201e66c58d2a3de4bb354 /source3 | |
parent | cc7b53f67384d3ca2176323b9bff827f17997821 (diff) | |
download | samba-485714ac6ba2f3c6dcacd116e055d4beb648492d.tar.gz samba-485714ac6ba2f3c6dcacd116e055d4beb648492d.tar.bz2 samba-485714ac6ba2f3c6dcacd116e055d4beb648492d.zip |
r14087: Protect against domain being NULL. Finish Coverity #152.
Jeremy.
(This used to be commit 88dd4ab48127bb08fdeb0b5c236020e0b910f0d8)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net_rpc_join.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c index ddd1623d8b..d611940e65 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -196,6 +196,12 @@ int net_rpc_join_newstyle(int argc, const char **argv) rpccli_lsa_close(pipe_hnd, mem_ctx, &lsa_pol); cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */ + /* Bail out if domain didn't get set. */ + if (!domain) { + DEBUG(0, ("Could not get domain name.\n")); + goto done; + } + /* Create domain user */ pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &result); if (!pipe_hnd) { @@ -402,10 +408,12 @@ done: /* Display success or failure */ - if (retval != 0) { - fprintf(stderr,"Unable to join domain %s.\n",domain); - } else { - printf("Joined domain %s.\n",domain); + if (domain) { + if (retval != 0) { + fprintf(stderr,"Unable to join domain %s.\n",domain); + } else { + printf("Joined domain %s.\n",domain); + } } cli_shutdown(cli); |