more code
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1323 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -7,6 +7,7 @@ krb5_auth_con_init(krb5_context context,
|
||||
krb5_auth_context *auth_context)
|
||||
{
|
||||
krb5_auth_context p;
|
||||
|
||||
p = ALLOC(1, krb5_auth_context_data);;
|
||||
if(!p)
|
||||
return ENOMEM;
|
||||
@@ -14,14 +15,15 @@ krb5_auth_con_init(krb5_context context,
|
||||
p->authenticator = ALLOC(1, krb5_authenticator_data);
|
||||
if (!p->authenticator)
|
||||
return ENOMEM;
|
||||
p->flags = KRB5_AUTH_CONTEXT_DO_TIME;
|
||||
p->cksumtype = CKSUMTYPE_RSA_MD4_DES;
|
||||
*auth_context = p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
krb5_error_code
|
||||
krb5_auth_con_free(krb5_context context,
|
||||
krb5_auth_context auth_context,
|
||||
krb5_flags flags)
|
||||
krb5_auth_context auth_context)
|
||||
{
|
||||
free (auth_context->authenticator);
|
||||
free (auth_context);
|
||||
@@ -54,6 +56,14 @@ krb5_auth_con_setaddrs(krb5_context context,
|
||||
krb5_address *local_addr,
|
||||
krb5_address *remote_addr)
|
||||
{
|
||||
auth_context->local_address.type = local_addr->type;
|
||||
krb5_data_copy (&auth_context->local_address.address,
|
||||
local_addr->address.data,
|
||||
local_addr->address.length);
|
||||
auth_context->remote_address.type = remote_addr->type;
|
||||
krb5_data_copy (&auth_context->remote_address.address,
|
||||
remote_addr->address.data,
|
||||
remote_addr->address.length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -64,15 +74,41 @@ krb5_auth_con_getaddrs(krb5_context context,
|
||||
krb5_address **local_addr,
|
||||
krb5_address **remote_addr)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
|
||||
if(*local_addr)
|
||||
krb5_free_address (context, *local_addr);
|
||||
*local_addr = malloc (sizeof(**local_addr));
|
||||
if (*local_addr == NULL)
|
||||
return ENOMEM;
|
||||
(*local_addr)->type = auth_context->local_address.type;
|
||||
ret = krb5_data_copy (&(*local_addr)->address,
|
||||
auth_context->local_address.address.data,
|
||||
auth_context->local_address.address.length);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if(*remote_addr)
|
||||
krb5_free_address (context, *remote_addr);
|
||||
*remote_addr = malloc (sizeof(**remote_addr));
|
||||
if (*remote_addr == NULL)
|
||||
return ENOMEM;
|
||||
(*remote_addr)->type = auth_context->remote_address.type;
|
||||
ret = krb5_data_copy (&(*remote_addr)->address,
|
||||
auth_context->remote_address.address.data,
|
||||
auth_context->remote_address.address.length);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
krb5_error_code
|
||||
krb5_auth_con_setuserkey(krb5_context context,
|
||||
krb5_auth_context auth_context,
|
||||
krb5_keyblock *keyblock)
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +127,35 @@ krb5_auth_con_getkey(krb5_context context,
|
||||
auth_context->key.contents.length);
|
||||
}
|
||||
|
||||
krb5_error_code
|
||||
krb5_auth_con_getlocalsubkey(krb5_context context,
|
||||
krb5_auth_context auth_context,
|
||||
krb5_keyblock **keyblock)
|
||||
{
|
||||
*keyblock = malloc(sizeof(**keyblock));
|
||||
if (*keyblock == NULL)
|
||||
return ENOMEM;
|
||||
(*keyblock)->keytype = auth_context->local_subkey.keytype;
|
||||
(*keyblock)->contents.length = 0;
|
||||
return krb5_data_copy (&(*keyblock)->contents,
|
||||
auth_context->local_subkey.contents.data,
|
||||
auth_context->local_subkey.contents.length);
|
||||
}
|
||||
|
||||
krb5_error_code
|
||||
krb5_auth_con_getremotesubkey(krb5_context context,
|
||||
krb5_auth_context auth_context,
|
||||
krb5_keyblock **keyblock)
|
||||
{
|
||||
*keyblock = malloc(sizeof(**keyblock));
|
||||
if (*keyblock == NULL)
|
||||
return ENOMEM;
|
||||
(*keyblock)->keytype = auth_context->remote_subkey.keytype;
|
||||
(*keyblock)->contents.length = 0;
|
||||
return krb5_data_copy (&(*keyblock)->contents,
|
||||
auth_context->remote_subkey.contents.data,
|
||||
auth_context->remote_subkey.contents.length);
|
||||
}
|
||||
|
||||
void
|
||||
krb5_free_keyblock(krb5_context context,
|
||||
@@ -105,8 +170,18 @@ krb5_auth_setcksumtype(krb5_context context,
|
||||
krb5_auth_context auth_context,
|
||||
krb5_cksumtype cksumtype)
|
||||
{
|
||||
auth_context->cksumtype = cksumtype;
|
||||
return 0;
|
||||
}
|
||||
|
||||
krb5_error_code
|
||||
krb5_auth_getcksumtype(krb5_context context,
|
||||
krb5_auth_context auth_context,
|
||||
krb5_cksumtype *cksumtype)
|
||||
{
|
||||
*cksumtype = auth_context->cksumtype;
|
||||
return 0;
|
||||
}
|
||||
|
||||
krb5_error_code
|
||||
krb5_auth_getlocalseqnumber(krb5_context context,
|
||||
@@ -127,16 +202,30 @@ krb5_auth_getremoteseqnumber(krb5_context context,
|
||||
krb5_error_code
|
||||
krb5_auth_getauthenticator(krb5_context context,
|
||||
krb5_auth_context auth_context,
|
||||
krb5_authenticator **authenticator)
|
||||
krb5_authenticator *authenticator)
|
||||
{
|
||||
*authenticator = malloc(sizeof(**authenticator));
|
||||
if (*authenticator == NULL)
|
||||
return ENOMEM;
|
||||
(*authenticator)->vno = auth_context->authenticator->vno;
|
||||
krb5_copy_principal (context,
|
||||
auth_context->authenticator->cname,
|
||||
&(*authenticator)->cname);
|
||||
(*authenticator)->cusec = auth_context->authenticator->cusec;
|
||||
(*authenticator)->ctime = auth_context->authenticator->ctime;
|
||||
(*authenticator)->seq_number = auth_context->authenticator->seq_number; /* XXX */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
krb5_free_authenticator(krb5_authenticator *authenticator)
|
||||
{
|
||||
krb5_free_principal ((*authenticator)->cname);
|
||||
free (*authenticator);
|
||||
*authenticator = NULL;
|
||||
}
|
||||
/* ??? */
|
||||
|
||||
|
||||
krb5_error_code
|
||||
krb5_auth_initvector(krb5_context context,
|
||||
|
Reference in New Issue
Block a user