From d341945ac03e902b4ccc9dd40a814634d9d8f56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Fri, 3 Oct 2003 11:51:42 +0000 Subject: [PATCH] add krb5_get_init_creds_opt_set_paq_request break out common part of extended opt functions to require_ext_opt git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12955 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/init_creds.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/lib/krb5/init_creds.c b/lib/krb5/init_creds.c index d4db40356..21c04889b 100644 --- a/lib/krb5/init_creds.c +++ b/lib/krb5/init_creds.c @@ -276,18 +276,44 @@ krb5_get_init_creds_opt_set_anonymous(krb5_get_init_creds_opt *opt, opt->anonymous = anonymous; } +static krb5_error_code +require_ext_opt(krb5_context context, + krb5_get_init_creds_opt *opt, + const char *type) +{ + if (opt->private == NULL) { + krb5_set_error_string(context, "%s on non extendable opt", type); + return EINVAL; + } + return 0; +} + krb5_error_code krb5_get_init_creds_opt_set_pa_password(krb5_context context, krb5_get_init_creds_opt *opt, const char *password, krb5_s2k_proc key_proc) { - if (opt->private == NULL) { - krb5_set_error_string(context, - "set_pa_password on non extendable opt"); - return EINVAL; - } + krb5_error_code ret; + ret = require_ext_opt(context, opt, "init_creds_opt_set_pa_password"); + if (ret) + return ret; opt->private->password = password; opt->private->key_proc = key_proc; return 0; } + +krb5_error_code +krb5_get_init_creds_opt_set_paq_request(krb5_context context, + krb5_get_init_creds_opt *opt, + krb5_boolean req_pac) +{ + krb5_error_code ret; + ret = require_ext_opt(context, opt, "init_creds_opt_set_pac_req"); + if (ret) + return ret; + opt->private->req_pac = req_pac ? + KRB5_PA_PAC_REQ_TRUE : + KRB5_PA_PAC_REQ_FALSE; + return 0; +}