s3-libsmb/passchange.c: Fix cli_errstr() usage (part of bug #7864)
authorBjörn Baumbach <bb@sernet.de>
Fri, 4 Feb 2011 13:25:52 +0000 (14:25 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 18 May 2011 08:50:57 +0000 (10:50 +0200)
Convert cli_errstr() to nt_errstr()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/libsmb/passchange.c

index fc68e41bd91b303598454e817c55bbc919da33d6..37496bdb1331cedc9912091e073505e93cf6e537 100644 (file)
@@ -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 {