From 485714ac6ba2f3c6dcacd116e055d4beb648492d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Mar 2006 18:35:57 +0000 Subject: r14087: Protect against domain being NULL. Finish Coverity #152. Jeremy. (This used to be commit 88dd4ab48127bb08fdeb0b5c236020e0b910f0d8) --- source3/utils/net_rpc_join.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source3/utils/net_rpc_join.c') 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); -- cgit