auth/credentials: a temporary MEMORY ccache needs krb5_cc_destroy()
authorStefan Metzmacher <metze@samba.org>
Tue, 27 Feb 2024 15:07:22 +0000 (16:07 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 23 Apr 2024 14:17:32 +0000 (14:17 +0000)
A simple krb5_cc_close() doesn't remove it from the global memory list.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
auth/credentials/credentials_krb5.c

index c388f6c82dfa35ab51a90aebf86212ecd905a892..6841f72c926fa2baa60f444510c08d98ebab6f3c 100644 (file)
@@ -109,13 +109,13 @@ static uint32_t smb_gss_krb5_copy_ccache(uint32_t *min_stat,
         */
        maj_stat = gss_krb5_copy_ccache(min_stat, cred, dummy_ccache);
        if (maj_stat != 0) {
-               krb5_cc_close(context, dummy_ccache);
+               krb5_cc_destroy(context, dummy_ccache);
                return maj_stat;
        }
 
        code = krb5_cc_start_seq_get(context, dummy_ccache, &cursor);
        if (code != 0) {
-               krb5_cc_close(context, dummy_ccache);
+               krb5_cc_destroy(context, dummy_ccache);
                *min_stat = EINVAL;
                return GSS_S_FAILURE;
        }
@@ -125,7 +125,7 @@ static uint32_t smb_gss_krb5_copy_ccache(uint32_t *min_stat,
                                 &cursor,
                                 &creds);
        if (code != 0) {
-               krb5_cc_close(context, dummy_ccache);
+               krb5_cc_destroy(context, dummy_ccache);
                *min_stat = EINVAL;
                return GSS_S_FAILURE;
        }
@@ -163,7 +163,7 @@ static uint32_t smb_gss_krb5_copy_ccache(uint32_t *min_stat,
                krb5_cc_end_seq_get(context, dummy_ccache, &cursor);
                code = 0;
        }
-       krb5_cc_close(context, dummy_ccache);
+       krb5_cc_destroy(context, dummy_ccache);
 
        if (code != 0 || princ == NULL) {
                krb5_free_cred_contents(context, &creds);