krb5_wrap: add smb_force_krb5_cc_default[_name]() wrappers
authorStefan Metzmacher <metze@samba.org>
Sat, 11 May 2024 00:38:21 +0000 (02:38 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 14 May 2024 10:18:31 +0000 (10:18 +0000)
If we touch the global krb5_ccache we want to make that explicit,
so calling krb5_cc_default[_name] will result in an error during
the next patches.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/krb5_wrap/krb5_samba.c
lib/krb5_wrap/krb5_samba.h

index 975717b226fcbce75d0da1d55ae2c03c9916f0c4..f8ea17ce2d0c5ff08787882f5d258b8bbcdf6f13 100644 (file)
@@ -4114,6 +4114,24 @@ krb5_error_code smb_krb5_init_context_common(krb5_context *_krb5_context)
        return 0;
 }
 
+/*
+ * This should only be used in code that
+ * really wants to touch the global default ccache!
+ */
+krb5_error_code smb_force_krb5_cc_default(krb5_context ctx, krb5_ccache *id)
+{
+       return krb5_cc_default(ctx, id);
+}
+
+/*
+ * This should only be used in code that
+ * really wants to touch the global default ccache!
+ */
+const char *smb_force_krb5_cc_default_name(krb5_context ctx)
+{
+       return krb5_cc_default_name(ctx);
+}
+
 #else /* HAVE_KRB5 */
 /* This saves a few linking headaches */
 int ads_krb5_cli_get_ticket(TALLOC_CTX *mem_ctx,
index a3470c1ea283324df6ae6f00f0834f6710a2ed67..6c04cb00f621fde4e494709ea5490b5d910feda7 100644 (file)
@@ -191,6 +191,17 @@ krb5_error_code smb_krb5_unparse_name(TALLOC_CTX *mem_ctx,
 
 krb5_error_code smb_krb5_init_context_common(krb5_context *_krb5_context);
 
+/*
+ * This should only be used in code that
+ * really wants to touch the global default ccache!
+ */
+krb5_error_code smb_force_krb5_cc_default(krb5_context ctx, krb5_ccache *id);
+/*
+ * This should only be used in code that
+ * really wants to touch the global default ccache!
+ */
+const char *smb_force_krb5_cc_default_name(krb5_context ctx);
+
 krb5_error_code krb5_set_default_tgs_ktypes(krb5_context ctx, const krb5_enctype *enc);
 
 #if defined(HAVE_KRB5_AUTH_CON_SETKEY) && !defined(HAVE_KRB5_AUTH_CON_SETUSERUSERKEY)