From: Stefan Metzmacher Date: Tue, 27 Feb 2024 15:21:02 +0000 (+0100) Subject: auth/credentials: use smb_krb5_cc_new_unique_memory() in cli_credentials_shallow_ccache() X-Git-Tag: tdb-1.4.11~840 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=176c55efb202f1f218c6c4ddf69d2d357488e25f;p=thirdparty%2Fsamba.git auth/credentials: use smb_krb5_cc_new_unique_memory() in cli_credentials_shallow_ccache() Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- diff --git a/auth/credentials/credentials_krb5.c b/auth/credentials/credentials_krb5.c index 04a38aaeed5..2d9503e2f1b 100644 --- a/auth/credentials/credentials_krb5.c +++ b/auth/credentials/credentials_krb5.c @@ -1138,7 +1138,6 @@ static int cli_credentials_shallow_ccache(struct cli_credentials *cred) const struct ccache_container *old_ccc = NULL; enum credentials_obtained old_obtained; struct ccache_container *ccc = NULL; - char *ccache_name = NULL; krb5_principal princ; old_obtained = cred->ccache_obtained; @@ -1171,10 +1170,10 @@ static int cli_credentials_shallow_ccache(struct cli_credentials *cred) *ccc = *old_ccc; ccc->ccache = NULL; - ccache_name = talloc_asprintf(ccc, "MEMORY:%p", ccc); - - ret = krb5_cc_resolve(ccc->smb_krb5_context->krb5_context, - ccache_name, &ccc->ccache); + ret = smb_krb5_cc_new_unique_memory(ccc->smb_krb5_context->krb5_context, + NULL, + NULL, + &ccc->ccache); if (ret != 0) { TALLOC_FREE(ccc); return ret; @@ -1182,8 +1181,6 @@ static int cli_credentials_shallow_ccache(struct cli_credentials *cred) talloc_set_destructor(ccc, free_mccache); - TALLOC_FREE(ccache_name); - ret = smb_krb5_cc_copy_creds(ccc->smb_krb5_context->krb5_context, old_ccc->ccache, ccc->ccache); if (ret != 0) {