/* -*- mode: c; c-file-style: "bsd"; indent-tabs-mode: t -*- */
/*
*/
/*
* Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved
*/
/*
* 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
*
*/
#include <krb5.h>
#include <errno.h>
#include <kadm5/kadm_rpc.h>
#include <kadm5/admin_xdr.h>
#include <stdlib.h>
#include <string.h>
static bool_t
int v);
static bool_t
/*
* Function: xdr_ui_4
*
* Purpose: XDR function which serves as a wrapper for xdr_u_int,
* to prevent compiler warnings about type clashes between u_int32
* and krb5_ui_4.
*/
{
/* Assumes that krb5_ui_4 and u_int32 are both four bytes long.
This should not be a harmful assumption. */
}
/*
* Function: xdr_nullstring
*
* Purpose: XDR function for "strings" that are either NULL-terminated
* or NULL.
*/
{
size = 0;
else
}
return FALSE;
}
case XDR_DECODE:
if (size == 0) {
return TRUE;
return FALSE;
}
}
case XDR_ENCODE:
if (size != 0)
return TRUE;
case XDR_FREE:
return TRUE;
}
return FALSE;
}
/*
* Function: xdr_nulltype
*
* Purpose: XDR function for arbitrary pointer types that are either
* NULL or contain data.
*/
{
case XDR_DECODE:
return FALSE;
if (null) {
return TRUE;
}
case XDR_ENCODE:
else
return FALSE;
return TRUE;
case XDR_FREE:
if (*objp)
return TRUE;
}
return FALSE;
}
{
/* This assumes that int32 and krb5_timestamp are the same size.
This shouldn't be a problem, since we've got a unit test which
checks for this. */
return (FALSE);
}
return (TRUE);
}
{
unsigned char tmp;
return (FALSE);
return (TRUE);
}
{
/* This assumes that int32 and krb5_deltat are the same size.
This shouldn't be a problem, since we've got a unit test which
checks for this. */
return (FALSE);
}
return (TRUE);
}
{
/* This assumes that int32 and krb5_flags are the same size.
This shouldn't be a problem, since we've got a unit test which
checks for this. */
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (TRUE);
}
{
int tmp;
return(FALSE);
return(TRUE);
}
/*
* Function: xdr_krb5_ui_2
*
* Purpose: XDR function which serves as a wrapper for xdr_u_int,
* to prevent compiler warnings about type clashes between u_int
* and krb5_ui_2.
*/
{
unsigned int tmp;
return(FALSE);
return(TRUE);
}
{
case XDR_DECODE:
return FALSE;
return TRUE;
case XDR_ENCODE:
case XDR_FREE:
return TRUE;
}
return FALSE;
}
{
/*
* Note that this function intentionally DOES NOT tranfer key
* length or contents! xdr_krb5_key_data in adb_xdr.c does, but
* that is only for use within the server-side library.
*/
unsigned int tmp;
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
}
/*
* kadm5_get_principal on the server side allocates and returns
* key contents when asked. Even though this function refuses to
* transmit that data, it still has to *free* the data at the
* appropriate time to avoid a memory leak.
*/
&tmp, ~0))
return FALSE;
&tmp, ~0))
return FALSE;
}
return (TRUE);
}
{
return FALSE;
return FALSE;
return TRUE;
}
{
unsigned int len;
case XDR_FREE:
while (tl) {
}
break;
case XDR_ENCODE:
tl = *tl_data_head;
while (1) {
return FALSE;
break;
return FALSE;
return FALSE;
}
break;
case XDR_DECODE:
while (1) {
return FALSE;
break;
return FALSE;
return FALSE;
return FALSE;
}
*tl_data_head = tl;
break;
}
return TRUE;
}
{
return (FALSE);
return (TRUE);
}
{
}
static bool_t
int v)
{
unsigned int n;
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
xdr_krb5_tl_data)) {
return FALSE;
}
n = objp->n_key_data;
&n, ~0, sizeof(krb5_key_data),
return (FALSE);
}
return (TRUE);
}
static bool_t
{
return (FALSE);
}
/* these all used to be u_int32, but it's stupid for sized types
to be exposed at the api, and they're the same as longs on the
wire. */
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
if (vers == KADM5_API_VERSION_3) {
return (FALSE);
return (FALSE);
return (FALSE);
objp->pw_max_fail = 0;
objp->pw_failcnt_interval = 0;
objp->pw_lockout_duration = 0;
}
return (TRUE);
}
{
}
{
return (FALSE);
}
objp->api_version)) {
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
objp->api_version)) {
return (FALSE);
}
return (FALSE);
}
(unsigned int *)&objp->n_ks_tuple, ~0,
sizeof(krb5_key_salt_tuple),
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return(TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
objp->api_version)) {
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
sizeof(char *), xdr_nullstring)) {
return (FALSE);
}
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
(unsigned int*)&objp->n_ks_tuple, ~0,
sizeof(krb5_key_salt_tuple),
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
&n_keys, ~0,
sizeof(krb5_keyblock), xdr_krb5_keyblock)) {
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
sizeof(krb5_keyblock), xdr_krb5_keyblock)) {
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
(unsigned int *) &objp->n_ks_tuple, ~0,
sizeof(krb5_key_salt_tuple), xdr_krb5_key_salt_tuple)) {
return (FALSE);
}
sizeof(krb5_keyblock), xdr_krb5_keyblock)) {
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
(unsigned int*)&objp->n_ks_tuple, ~0,
sizeof(krb5_key_salt_tuple),
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
/* Solaris Kerberos */
sizeof(krb5_keyblock), xdr_krb5_keyblock))
return FALSE;
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return FALSE;
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
objp->api_version)) {
return (FALSE);
}
}
return (TRUE);
}
{
return (FALSE);
}
objp->api_version)) {
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
objp->api_version)) {
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
objp->api_version))
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (TRUE);
}
{
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
sizeof(char *), xdr_nullstring)) {
return (FALSE);
}
}
return (TRUE);
}
{
return (FALSE);
}
return FALSE;
return TRUE;
}
{
int ret;
char *p = NULL;
/* using a static context here is ugly, but should work
ok, and the other solutions are even uglier */
if (!context &&
return(FALSE);
case XDR_ENCODE:
if (*objp) {
return FALSE;
}
if(!xdr_nullstring(xdrs, &p))
return FALSE;
if (p) free(p);
break;
case XDR_DECODE:
if(!xdr_nullstring(xdrs, &p))
return FALSE;
if (p) {
if(ret != 0)
return FALSE;
free(p);
} else
break;
case XDR_FREE:
break;
}
return TRUE;
}
{
return (FALSE);
return (TRUE);
}
{
/*
* This used to be xdr_krb5_keytype, but keytypes and enctypes have
* been merged into only enctypes. However, randkey_principal
* already ensures that only a key of ENCTYPE_DES_CBC_CRC will be
* returned to v1 clients, and ENCTYPE_DES_CBC_CRC has the same
* value as KEYTYPE_DES used too, which is what all v1 clients
* expect. Therefore, IMHO, just encoding whatever enctype we get
* is safe.
*/
return (FALSE);
return (TRUE);
}
{
return FALSE;
return TRUE;
}
{
/* XXX This only works because free_keyblock assumes ->contents
is allocated by malloc() */
return FALSE;
return FALSE;
return TRUE;
}