diff options
author | Günther Deschner <gd@samba.org> | 2008-02-28 14:29:44 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-02-28 14:29:44 +0100 |
commit | 642f46dcf9717c274bb93abc20cf19a8a757ecae (patch) | |
tree | 3eb00d9f58295f7ff4798ba6f7205315e9b86092 /source3 | |
parent | e5775b4faed78e18353de8fb528615e29b44422d (diff) | |
download | samba-642f46dcf9717c274bb93abc20cf19a8a757ecae.tar.gz |
Some fixes for net ads join (uninitialized vars).
Guenther
(This used to be commit 735235e32bf41a7564ce2d585c1dae187b00bf6b)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net_ads.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index b87920a20f7..345665d62ee 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -1434,9 +1434,9 @@ int net_ads_join(int argc, const char **argv) { NTSTATUS nt_status; TALLOC_CTX *ctx = NULL; - struct libnet_JoinCtx *r; + struct libnet_JoinCtx *r = NULL; const char *domain = lp_realm(); - WERROR werr; + WERROR werr = WERR_SETUP_NOT_JOINED; bool createupn = False; const char *machineupn = NULL; const char *create_in_ou = NULL; @@ -1447,6 +1447,7 @@ int net_ads_join(int argc, const char **argv) nt_status = check_ads_config(); if (!NT_STATUS_IS_OK(nt_status)) { d_fprintf(stderr, "Invalid configuration. Exiting....\n"); + werr = ntstatus_to_werror(nt_status); goto fail; } @@ -1454,13 +1455,12 @@ int net_ads_join(int argc, const char **argv) werr = libnet_init_JoinCtx(ctx, &r); if (!W_ERROR_IS_OK(werr)) { - nt_status = werror_to_ntstatus(werr); goto fail; } if (!(ctx = talloc_init("net_ads_join"))) { d_fprintf(stderr, "Could not initialise talloc context.\n"); - nt_status = NT_STATUS_NO_MEMORY; + werr = WERR_NOMEM; goto fail; } @@ -1474,21 +1474,21 @@ int net_ads_join(int argc, const char **argv) else if ( !StrnCaseCmp(argv[i], "createcomputer", strlen("createcomputer")) ) { if ( (create_in_ou = get_string_param(argv[i])) == NULL ) { d_fprintf(stderr, "Please supply a valid OU path.\n"); - nt_status = NT_STATUS_INVALID_PARAMETER; + werr = WERR_INVALID_PARAM; goto fail; } } else if ( !StrnCaseCmp(argv[i], "osName", strlen("osName")) ) { if ( (os_name = get_string_param(argv[i])) == NULL ) { d_fprintf(stderr, "Please supply a operating system name.\n"); - nt_status = NT_STATUS_INVALID_PARAMETER; + werr = WERR_INVALID_PARAM; goto fail; } } else if ( !StrnCaseCmp(argv[i], "osVer", strlen("osVer")) ) { if ( (os_version = get_string_param(argv[i])) == NULL ) { d_fprintf(stderr, "Please supply a valid operating system version.\n"); - nt_status = NT_STATUS_INVALID_PARAMETER; + werr = WERR_INVALID_PARAM; goto fail; } } @@ -1565,12 +1565,11 @@ int net_ads_join(int argc, const char **argv) fail: /* issue an overall failure message at the end. */ d_printf("Failed to join domain: %s\n", - r->out.error_string ? r->out.error_string : + r && r->out.error_string ? r->out.error_string : get_friendly_werror_msg(werr)); TALLOC_FREE( ctx ); return -1; - } /******************************************************************* |