diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c index fc68e41bd91..37496bdb133 100644 --- a/source3/libsmb/passchange.c +++ b/source3/libsmb/passchange.c @@ -85,12 +85,12 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam make_nmb_name(&called , remote_machine, 0x20); if (!cli_session_request(cli, &calling, &called)) { + result = cli_nt_error(cli); if (asprintf(err_str, "machine %s rejected the session setup. " "Error was : %s.\n", - remote_machine, cli_errstr(cli)) == -1) { + remote_machine, nt_errstr(result)) == -1) { *err_str = NULL; } - result = cli_nt_error(cli); cli_shutdown(cli); return result; } @@ -126,7 +126,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam if (!NT_STATUS_EQUAL(result, NT_STATUS_PASSWORD_MUST_CHANGE) && !NT_STATUS_EQUAL(result, NT_STATUS_PASSWORD_EXPIRED)) { if (asprintf(err_str, "Could not connect to machine %s: " - "%s\n", remote_machine, cli_errstr(cli)) == -1) { + "%s\n", remote_machine, nt_errstr(result)) == -1) { *err_str = NULL; } cli_shutdown(cli); @@ -146,7 +146,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam if (!NT_STATUS_IS_OK(result)) { if (asprintf(err_str, "machine %s rejected the session " "setup. Error was : %s.\n", - remote_machine, cli_errstr(cli)) == -1) { + remote_machine, nt_errstr(result)) == -1) { *err_str = NULL; } cli_shutdown(cli); @@ -204,12 +204,12 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam if (lp_client_lanman_auth()) { /* Use the old RAP method. */ if (!cli_oem_change_password(cli, user_name, new_passwd, old_passwd)) { + result = cli_nt_error(cli); if (asprintf(err_str, "machine %s rejected the " "password change: Error was : %s.\n", - remote_machine, cli_errstr(cli)) == -1) { + remote_machine, nt_errstr(result)) == -1) { *err_str = NULL; } - result = cli_nt_error(cli); cli_shutdown(cli); return result; } @@ -295,12 +295,13 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam cli_shutdown(cli); return NT_STATUS_OK; } + + result = cli_nt_error(cli); if (asprintf(err_str, "machine %s rejected the password " "change: Error was : %s.\n", - remote_machine, cli_errstr(cli)) == -1) { + remote_machine, nt_errstr(result)) == -1) { *err_str = NULL; } - result = cli_nt_error(cli); cli_shutdown(cli); return result; } else {