auth/credentials: use smb_krb5_cc_new_unique_memory() in krb5_cc_remove_cred_wrap()
authorStefan Metzmacher <metze@samba.org>
Tue, 27 Feb 2024 14:49:09 +0000 (15:49 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 7 May 2024 11:30:33 +0000 (11:30 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
auth/credentials/credentials_krb5.c

index 45fabc19447766943aa037f845d4f698abaefdb4..61c69ee74db8f417c975e52e8123b3e8d0018f15 100644 (file)
@@ -382,29 +382,18 @@ static krb5_error_code krb5_cc_remove_cred_wrap(struct ccache_container *ccc,
        krb5_creds cached_creds = {0};
        krb5_cc_cursor cursor = NULL;
        krb5_error_code code;
-       char *dummy_name;
-
-       dummy_name = talloc_asprintf(ccc,
-                                    "MEMORY:copy_ccache-%p",
-                                    &ccc->ccache);
-       if (dummy_name == NULL) {
-               return KRB5_CC_NOMEM;
-       }
 
-       code = krb5_cc_resolve(ccc->smb_krb5_context->krb5_context,
-                              dummy_name,
-                              &dummy_ccache);
+       code = smb_krb5_cc_new_unique_memory(ccc->smb_krb5_context->krb5_context,
+                                            NULL, NULL,
+                                            &dummy_ccache);
        if (code != 0) {
                DBG_ERR("krb5_cc_resolve failed: %s\n",
                        smb_get_krb5_error_message(
                                ccc->smb_krb5_context->krb5_context,
                                code, ccc));
-               TALLOC_FREE(dummy_name);
                return code;
        }
 
-       TALLOC_FREE(dummy_name);
-
        code = krb5_cc_start_seq_get(ccc->smb_krb5_context->krb5_context,
                                     ccc->ccache,
                                     &cursor);