(krb5_get_init_creds_opt_alloc): allocate a opt structure
(krb5_get_init_creds_opt_free): free a opt structure (krb5_get_init_creds_opt_set_pa_password): set preauth info for enc-timestamp git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12726 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,34 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997 - 2001, 2003 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* 3. Neither the name of the Institute nor the names of its contributors
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "krb5_locl.h"
|
#include "krb5_locl.h"
|
||||||
@@ -40,6 +40,37 @@ krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt)
|
|||||||
{
|
{
|
||||||
memset (opt, 0, sizeof(*opt));
|
memset (opt, 0, sizeof(*opt));
|
||||||
opt->flags = 0;
|
opt->flags = 0;
|
||||||
|
opt->private = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
krb5_error_code
|
||||||
|
krb5_get_init_creds_opt_alloc(krb5_get_init_creds_opt **opt)
|
||||||
|
{
|
||||||
|
krb5_get_init_creds_opt *o;
|
||||||
|
|
||||||
|
*opt = NULL;
|
||||||
|
o = calloc(1, sizeof(*o));
|
||||||
|
if (o == NULL)
|
||||||
|
return ENOMEM;
|
||||||
|
krb5_get_init_creds_opt_init(o);
|
||||||
|
o->private = calloc(1, sizeof(*o->private));
|
||||||
|
if (o->private == NULL) {
|
||||||
|
free(o);
|
||||||
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
*opt = o;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
krb5_get_init_creds_opt_free(krb5_get_init_creds_opt *opt)
|
||||||
|
{
|
||||||
|
if (opt->private == NULL)
|
||||||
|
return;
|
||||||
|
free(opt->private);
|
||||||
|
opt->private = NULL;
|
||||||
|
memset(opt, 0, sizeof(*opt));
|
||||||
|
free(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -95,7 +126,7 @@ static krb5_addresses no_addrs = {0, NULL};
|
|||||||
|
|
||||||
void
|
void
|
||||||
krb5_get_init_creds_opt_set_default_flags(krb5_context context,
|
krb5_get_init_creds_opt_set_default_flags(krb5_context context,
|
||||||
const char *appname,
|
const char *appname,
|
||||||
krb5_const_realm realm,
|
krb5_const_realm realm,
|
||||||
krb5_get_init_creds_opt *opt)
|
krb5_get_init_creds_opt *opt)
|
||||||
{
|
{
|
||||||
@@ -115,7 +146,7 @@ krb5_get_init_creds_opt_set_default_flags(krb5_context context,
|
|||||||
t = get_config_time (context, realm, "ticket_lifetime", 0);
|
t = get_config_time (context, realm, "ticket_lifetime", 0);
|
||||||
if(t != 0)
|
if(t != 0)
|
||||||
krb5_get_init_creds_opt_set_tkt_life(opt, t);
|
krb5_get_init_creds_opt_set_tkt_life(opt, t);
|
||||||
|
|
||||||
krb5_appdefault_time(context, appname, realm, "renew_lifetime", 0, &t);
|
krb5_appdefault_time(context, appname, realm, "renew_lifetime", 0, &t);
|
||||||
if (t == 0)
|
if (t == 0)
|
||||||
t = get_config_time (context, realm, "renew_lifetime", 0);
|
t = get_config_time (context, realm, "renew_lifetime", 0);
|
||||||
@@ -130,7 +161,7 @@ krb5_get_init_creds_opt_set_default_flags(krb5_context context,
|
|||||||
krb5_appdefault_boolean(context, appname, realm, "anonymous", FALSE, &b);
|
krb5_appdefault_boolean(context, appname, realm, "anonymous", FALSE, &b);
|
||||||
krb5_get_init_creds_opt_set_anonymous (opt, b);
|
krb5_get_init_creds_opt_set_anonymous (opt, b);
|
||||||
|
|
||||||
krb5_get_init_creds_opt_set_etype_list(opt, enctype,
|
krb5_get_init_creds_opt_set_etype_list(opt, enctype,
|
||||||
etype_str.num_strings);
|
etype_str.num_strings);
|
||||||
|
|
||||||
krb5_get_init_creds_opt_set_salt(krb5_get_init_creds_opt *opt,
|
krb5_get_init_creds_opt_set_salt(krb5_get_init_creds_opt *opt,
|
||||||
@@ -218,3 +249,19 @@ krb5_get_init_creds_opt_set_anonymous(krb5_get_init_creds_opt *opt,
|
|||||||
opt->flags |= KRB5_GET_INIT_CREDS_OPT_ANONYMOUS;
|
opt->flags |= KRB5_GET_INIT_CREDS_OPT_ANONYMOUS;
|
||||||
opt->anonymous = anonymous;
|
opt->anonymous = anonymous;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
opt->private->password = password;
|
||||||
|
opt->private->key_proc = key_proc;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user