(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,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@@ -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
|
||||||
@@ -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