credentials: Simplify cli_credentials_get_server_gss_creds()
authorAndreas Schneider <asn@samba.org>
Tue, 13 Dec 2016 10:38:13 +0000 (11:38 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 3 Jan 2018 13:37:12 +0000 (14:37 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Jan  3 14:37:12 CET 2018 on sn-devel-144

auth/credentials/credentials_krb5.c

index b88497dcace5084fe1d47178ae017644e71a65ab..585203a640d321d6cdf4838c5f8a3479dcb96576 100644 (file)
@@ -1151,16 +1151,17 @@ _PUBLIC_ int cli_credentials_get_server_gss_creds(struct cli_credentials *cred,
        }
 
        if (ktc->password_based || obtained < CRED_SPECIFIED) {
-               /* This creates a GSSAPI cred_id_t for match-by-key with only the keytab set */
-               maj_stat = smb_gss_krb5_import_cred(&min_stat, smb_krb5_context->krb5_context,
-                                                   NULL, NULL, ktc->keytab,
-                                                   &gcc->creds);
-       } else {
-               /* This creates a GSSAPI cred_id_t with the principal and keytab set, matching by name */
-               maj_stat = smb_gss_krb5_import_cred(&min_stat, smb_krb5_context->krb5_context,
-                                                   NULL, princ, ktc->keytab,
-                                                   &gcc->creds);
+               /*
+                * This creates a GSSAPI cred_id_t for match-by-key with only
+                * the keytab set
+                */
+               princ = NULL;
        }
+       maj_stat = smb_gss_krb5_import_cred(&min_stat,
+                                           smb_krb5_context->krb5_context,
+                                           NULL, princ,
+                                           ktc->keytab,
+                                           &gcc->creds);
        if (maj_stat) {
                if (min_stat) {
                        ret = min_stat;