Skip to content

Commit

Permalink
krb5_wrap: add smb_force_krb5_cc_default[_name]() wrappers
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
  • Loading branch information
metze-samba committed May 14, 2024
1 parent d49de77 commit f850bcf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/krb5_wrap/krb5_samba.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions lib/krb5_wrap/krb5_samba.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f850bcf

Please sign in to comment.