credentials: Fix set_ccache with empty creds cache
authorVolker Lendecke <vl@samba.org>
Wed, 21 Nov 2018 14:28:42 +0000 (15:28 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 28 Nov 2018 16:44:14 +0000 (17:44 +0100)
This is an extension of bb2f7e3aee7e9b8: Without this fix in the
"empty ccache" case we never set cred->ccache, so the whole call to
cli_credentials_set_ccache became pointless

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
auth/credentials/credentials_krb5.c

index a683caf98ef871ed30689bbed1af5f527e9019fb..6087da8d51f0fc4d9a7e871a9f8917741f051a45 100644 (file)
@@ -354,14 +354,15 @@ _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred,
                        TALLOC_FREE(ccc);
                        return ret;
                }
+       }
+
+       cred->ccache = ccc;
+       cred->ccache_obtained = obtained;
+       talloc_steal(cred, ccc);
 
-               cred->ccache = ccc;
-               cred->ccache_obtained = obtained;
-               talloc_steal(cred, ccc);
+       cli_credentials_invalidate_client_gss_creds(
+               cred, cred->ccache_obtained);
 
-               cli_credentials_invalidate_client_gss_creds(cred, cred->ccache_obtained);
-               return 0;
-       }
        return 0;
 }