s3:libsmb: allow -U"\\administrator" to work
authorStefan Metzmacher <metze@samba.org>
Tue, 9 Jan 2018 07:55:48 +0000 (08:55 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 22 Feb 2018 22:15:16 +0000 (23:15 +0100)
cli_credentials_get_principal() returns NULL in that case.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13206

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/libsmb/cliconnect.c

index 26bf56962adb153342a11f86b25e2db335d9b06f..f5bf68f0938da7a7e19e8734e0d36d1d59e5c609 100644 (file)
@@ -283,8 +283,9 @@ NTSTATUS cli_session_creds_prepare_krb5(struct cli_state *cli,
 
        auth_requested = cli_credentials_authentication_requested(creds);
        if (auth_requested) {
+               errno = 0;
                user_principal = cli_credentials_get_principal(creds, frame);
-               if (user_principal == NULL) {
+               if (errno != 0) {
                        TALLOC_FREE(frame);
                        return NT_STATUS_NO_MEMORY;
                }
@@ -299,6 +300,10 @@ NTSTATUS cli_session_creds_prepare_krb5(struct cli_state *cli,
                try_kerberos = true;
        }
 
+       if (user_principal == NULL) {
+               try_kerberos = false;
+       }
+
        if (target_hostname == NULL) {
                try_kerberos = false;
        } else if (is_ipaddress(target_hostname)) {