From f850bcfc0b42302e39b35faa64ad9743b736745e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 11 May 2024 02:38:21 +0200 Subject: [PATCH] krb5_wrap: add smb_force_krb5_cc_default[_name]() wrappers 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 Reviewed-by: Andreas Schneider --- lib/krb5_wrap/krb5_samba.c | 18 ++++++++++++++++++ lib/krb5_wrap/krb5_samba.h | 11 +++++++++++ 2 files changed, 29 insertions(+) diff --git a/lib/krb5_wrap/krb5_samba.c b/lib/krb5_wrap/krb5_samba.c index 975717b226f..f8ea17ce2d0 100644 --- a/lib/krb5_wrap/krb5_samba.c +++ b/lib/krb5_wrap/krb5_samba.c @@ -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, diff --git a/lib/krb5_wrap/krb5_samba.h b/lib/krb5_wrap/krb5_samba.h index a3470c1ea28..6c04cb00f62 100644 --- a/lib/krb5_wrap/krb5_samba.h +++ b/lib/krb5_wrap/krb5_samba.h @@ -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)