]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libsmb: allow -U"\\administrator" to work
authorStefan Metzmacher <metze@samba.org>
Tue, 9 Jan 2018 07:55:48 +0000 (08:55 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 20 Mar 2018 16:12:12 +0000 (17:12 +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>
(cherry picked from commit 0786a65cabb92a812cf1c692d0d26914f74a6f87)

source3/libsmb/cliconnect.c

index 75bcae42f128a501c3907b1cbf9a9391b3bc2d12..b18e91278c6f0b3ef7c1787840de55706d6df112 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)) {