From: Steve Dickson <steved@redhat.com>
To: Olga Kornievskaia <okorniev@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/2] nfs-utils: gssd: unconditionally use krb5_get_init_creds_opt_alloc
Date: Mon, 24 Mar 2025 16:24:42 -0400 [thread overview]
Message-ID: <a44cc4ae-a246-4dc6-85f4-0992d9083d87@redhat.com> (raw)
In-Reply-To: <20250225214607.20449-2-okorniev@redhat.com>
On 2/25/25 4:46 PM, Olga Kornievskaia wrote:
> Modern kerberos API uses krb5_get_init_creds_opt_alloc() for managing
> its options for credential data structure.
>
> Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Committed... (tag: nfs-utils-2-8-3-rc8)
steved.
> ---
> utils/gssd/krb5_util.c | 37 ++++++++++---------------------------
> 1 file changed, 10 insertions(+), 27 deletions(-)
>
> diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
> index d7116d93..201585ed 100644
> --- a/utils/gssd/krb5_util.c
> +++ b/utils/gssd/krb5_util.c
> @@ -397,12 +397,7 @@ gssd_get_single_krb5_cred(krb5_context context,
> struct gssd_k5_kt_princ *ple,
> int force_renew)
> {
> -#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
> - krb5_get_init_creds_opt *init_opts = NULL;
> -#else
> - krb5_get_init_creds_opt options;
> -#endif
> - krb5_get_init_creds_opt *opts;
> + krb5_get_init_creds_opt *opts = NULL;
> krb5_creds my_creds;
> krb5_ccache ccache = NULL;
> char kt_name[BUFSIZ];
> @@ -443,33 +438,23 @@ gssd_get_single_krb5_cred(krb5_context context,
> if ((krb5_unparse_name(context, ple->princ, &pname)))
> pname = NULL;
>
> -#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
> - code = krb5_get_init_creds_opt_alloc(context, &init_opts);
> + code = krb5_get_init_creds_opt_alloc(context, &opts);
> if (code) {
> k5err = gssd_k5_err_msg(context, code);
> printerr(0, "ERROR: %s allocating gic options\n", k5err);
> goto out;
> }
> - if (krb5_get_init_creds_opt_set_addressless(context, init_opts, 1))
> +#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
> + if (krb5_get_init_creds_opt_set_addressless(context, opts, 1))
> printerr(1, "WARNING: Unable to set option for addressless "
> "tickets. May have problems behind a NAT.\n");
> -#ifdef TEST_SHORT_LIFETIME
> - /* set a short lifetime (for debugging only!) */
> - printerr(1, "WARNING: Using (debug) short machine cred lifetime!\n");
> - krb5_get_init_creds_opt_set_tkt_life(init_opts, 5*60);
> +#else
> + krb5_get_init_creds_opt_set_address_list(opts, NULL);
> #endif
> - opts = init_opts;
> -
> -#else /* HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS */
> -
> - krb5_get_init_creds_opt_init(&options);
> - krb5_get_init_creds_opt_set_address_list(&options, NULL);
> #ifdef TEST_SHORT_LIFETIME
> /* set a short lifetime (for debugging only!) */
> - printerr(0, "WARNING: Using (debug) short machine cred lifetime!\n");
> - krb5_get_init_creds_opt_set_tkt_life(&options, 5*60);
> -#endif
> - opts = &options;
> + printerr(1, "WARNING: Using (debug) short machine cred lifetime!\n");
> + krb5_get_init_creds_opt_set_tkt_life(opts, 5*60);
> #endif
>
> if ((code = krb5_get_init_creds_keytab(context, &my_creds, ple->princ,
> @@ -530,10 +515,8 @@ gssd_get_single_krb5_cred(krb5_context context,
> printerr(2, "%s(0x%lx): principal '%s' ccache:'%s'\n",
> __func__, tid, pname, cc_name);
> out:
> -#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
> - if (init_opts)
> - krb5_get_init_creds_opt_free(context, init_opts);
> -#endif
> + if (opts)
> + krb5_get_init_creds_opt_free(context, opts);
> if (pname)
> k5_free_unparsed_name(context, pname);
> if (ccache)
next prev parent reply other threads:[~2025-03-24 20:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 21:46 [PATCH 0/2] nfs-utils: gssd: do not use krb5_initialize Olga Kornievskaia
2025-02-25 21:46 ` [PATCH 1/2] nfs-utils: gssd: unconditionally use krb5_get_init_creds_opt_alloc Olga Kornievskaia
2025-03-24 20:24 ` Steve Dickson
2025-03-24 20:24 ` Steve Dickson [this message]
2025-02-25 21:46 ` [PATCH 2/2] nfs-utils: gssd: do not use krb5_cc_initialize Olga Kornievskaia
2025-03-24 20:26 ` Steve Dickson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a44cc4ae-a246-4dc6-85f4-0992d9083d87@redhat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=okorniev@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox