1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

r14087: Protect against domain being NULL. Finish Coverity #152.

Jeremy.
(This used to be commit 88dd4ab481)
This commit is contained in:
Jeremy Allison 2006-03-09 18:35:57 +00:00 committed by Gerald (Jerry) Carter
parent cc7b53f673
commit 485714ac6b

View File

@ -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);