client_principal.c revision c54c769d4c1cde75dd28975fb0090a8f944651a6
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*
* Openvision retains the copyright to derivative works of
* this source code. Do *NOT* create a derivative of this
* source code before consulting with your legal department.
* Do *NOT* integrate *ANY* of this source code into another
* product before consulting with your legal department.
*
* For further information, read the top-level Openvision
* copyright which is contained in the top-level MIT Kerberos
* copyright.
*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*
*/
/*
* Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved
*
* $Header: /cvs/krbdev/krb5/src/lib/kadm5/clnt/client_principal.c,v 1.11 2004/06/16 03:11:53 tlyu Exp $
*/
#if !defined(lint) && !defined(__CODECENTER__)
static char *rcsid = "$Header: /cvs/krbdev/krb5/src/lib/kadm5/clnt/client_principal.c,v 1.11 2004/06/16 03:11:53 tlyu Exp $";
#endif
#include <kadm5/kadm_rpc.h>
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
#include "client_internal.h"
#ifdef DEBUG /* SUNWresync14 XXX */
#else
#define eret() return KADM5_RPC_ERROR
#endif
char *pw)
{
generic_ret *r;
return EINVAL;
} else {
}
/*
* hack hack cough cough.
* krb5_unparse name dumps core if we pass it in garbage
* or null. So, since the client is not allowed to set mod_name
* anyway, we just fill it in with a dummy principal. The server of
* course ignores this.
*/
} else
if(!(mask & KADM5_POLICY))
if (! (mask & KADM5_KEY_DATA)) {
}
if (! (mask & KADM5_TL_DATA)) {
}
if(r == NULL)
eret();
return r->code;
}
int n_ks_tuple,
char *pw)
{
generic_ret *r;
return EINVAL;
} else {
}
/*
* hack hack cough cough.
* krb5_unparse name dumps core if we pass it in garbage
* or null. So, since the client is not allowed to set mod_name
* anyway, we just fill it in with a dummy principal. The server of
* course ignores this.
*/
} else
if(!(mask & KADM5_POLICY))
if (! (mask & KADM5_KEY_DATA)) {
}
if (! (mask & KADM5_TL_DATA)) {
}
if(r == NULL)
eret();
return r->code;
}
{
generic_ret *r;
return EINVAL;
if(r == NULL)
eret();
return r->code;
}
{
generic_ret *r;
/*
* cough cough gag gag
* see comment in create_principal.
*/
return EINVAL;
} else {
}
if(!(mask & KADM5_POLICY))
if (! (mask & KADM5_KEY_DATA)) {
}
if (! (mask & KADM5_TL_DATA)) {
}
/*
* See comment in create_principal
*/
} else
if(r == NULL)
eret();
return r->code;
}
kadm5_get_principal(void *server_handle,
long mask)
{
gprinc_ret *r;
return EINVAL;
else
if(r == NULL)
eret();
if (r->code == 0) {
if (!(*entp = (kadm5_principal_ent_t_v1)
malloc(sizeof(kadm5_principal_ent_rec_v1))))
return ENOMEM;
/* this memcpy works because the v1 structure is an initial
subset of the v2 struct. C guarantees that this will
result in the same layout in memory */
} else {
}
} else {
if (r->code == 0)
}
return r->code;
}
{
gprincs_ret *r;
return EINVAL;
if(r == NULL)
eret();
if(r->code == 0) {
} else {
*count = 0;
}
return r->code;
}
{
generic_ret *r;
return EINVAL;
if(r == NULL)
eret();
return r->code;
}
{
generic_ret *r;
return EINVAL;
if(r == NULL)
eret();
return r->code;
}
char *password)
{
generic_ret *r;
return EINVAL;
if(r == NULL)
eret();
return r->code;
}
{
generic_ret *r;
return EINVAL;
if(r == NULL)
eret();
return r->code;
}
int n_keys)
{
generic_ret *r;
return EINVAL;
if(r == NULL)
eret();
return r->code;
}
int n_keys)
{
generic_ret *r;
return EINVAL;
if(r == NULL)
eret();
return r->code;
}
/*
* Solaris Kerberos:
* This routine implements just the "old" randkey_principal code.
* The code in the kadmin client sometimes needs to call this
* directly when the kadm5_randkey_principal_3 call fails.
*
* so the standard fallback in kadm5_randkey_principal (see below)
* will not work because it would result in kadm5_randkey_principal_3
* kadmin and once with the NULL set (used to indicate that the server
* should use the full set of supported enctypes). Making this
* routine separate makes the code simpler and avoids making the
* kadm5_randkey_principal_3 twice from kadmin.
*/
krb5_keyblock **key,
int *n_keys)
{
chrand_ret *r;
int i, ret;
/* For safety */
if (n_keys)
*n_keys = 0;
if (key)
return EINVAL;
if (r == NULL)
return KADM5_RPC_ERROR;
if (key)
r->n_keys*sizeof(krb5_keyblock));
return ENOMEM;
for (i = 0; i < r->n_keys; i++) {
&r->keys[i],
&(*key)[i]);
if (ret) {
return ENOMEM;
}
}
if (n_keys)
}
return (r->code);
}
{
chrand_ret *r;
int i, ret;
/* For safety */
if (n_keys)
*n_keys = 0;
if (key)
return EINVAL;
if(r == NULL)
eret();
if (key)
} else {
if (n_keys)
if (key) {
if(r->n_keys) {
*key = (krb5_keyblock *)
return ENOMEM;
for (i = 0; i < r->n_keys; i++) {
&r->keys[i],
&(*key)[i]);
if (ret) {
return ENOMEM;
}
}
}
}
return r->code;
}
{
/*
* Default to trying the newest API to insure that the full
* set of enctypes is created.
*/
/*
* We will get an RPC error if the RPC call failed which
* will normally indicate that the remote procedure did not
* exist on the server, so try the older API.
*/
if (kret == KADM5_RPC_ERROR) {
}
return (kret);
}
/* not supported on client side */
{
return EINVAL;
}