scc_read.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* Copyright 1990,1991 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*
* This file contains the source code for reading variables from a
* credentials cache. These are not library-exported functions.
*/
#include "scc.h"
/*
* Effects:
* Reads len bytes from the cache id, storing them in buf.
*
* Errors:
* KRB5_CC_END - there were not len bytes available
* system errors (read)
*/
int len;
{
int ret;
errno = 0;
return KRB5_CC_END;
else
return KRB5_OK;
}
/*
* FOR ALL OF THE FOLLOWING FUNCTIONS:
*
* Requires:
* id is open and set to read at the appropriate place in the file
*
* Effects:
* Fills in the second argument with data of the appropriate type from
* the file. In some cases, the functions have to allocate space for
* variable length fields; therefore, krb5_destroy_<type> must be
* called for each filled in structure.
*
* Errors:
* system errors (read errors)
* KRB5_CC_NOMEM
*/
{
register krb5_principal tmpprinc;
int i;
} else {
/* Read principal type */
return kret;
}
/* Read the number of components */
return kret;
/*
* DCE includes the principal's realm in the count; the new format
* does not.
*/
length--;
return KRB5_CC_NOMEM;
if (length) {
return KRB5_CC_NOMEM;
}
} else
i = 0;
for (i=0; i < length; i++) {
}
return KRB5_OK;
while(--i >= 0)
return kret;
}
krb5_address ***addrs;
{
int i;
*addrs = 0;
/* Read the number of components */
/* Make *addrs able to hold length pointers to krb5_address structs
* Add one extra for a null-terminated list
*/
return KRB5_CC_NOMEM;
for (i=0; i < length; i++) {
return KRB5_CC_NOMEM;
}
}
return KRB5_OK;
if (*addrs)
return kret;
}
{
/* This works because the old etype is the same as the new enctype. */
/* keyblock->enctype = ui2; */
}
#ifdef _MSDOS
#else
return KRB5_CC_NOMEM;
#endif
return KRB5_OK;
sizeof(krb5_octet));
return KRB5_CC_NOMEM;
if (kret)
goto errout;
return KRB5_OK;
return kret;
}
{
#ifdef _MSDOS
len &= VALID_INT_BITS;
#else
return KRB5_CC_NOMEM;
#endif
return KRB5_OK;
}
return KRB5_CC_NOMEM;
return KRB5_OK;
return kret;
}
{
#ifdef _MSDOS
#else
return KRB5_CC_NOMEM;
#endif
return KRB5_OK;
return KRB5_CC_NOMEM;
return KRB5_OK;
return kret;
}
krb5_int32 *i;
{
unsigned char buf[4];
else {
if (retval)
return retval;
return 0;
}
}
krb5_ui_2 *i;
{
unsigned char buf[2];
else {
if (retval)
return retval;
return 0;
}
}
krb5_octet *i;
{
}
{
krb5_int32 i;
else {
t->authtime = i;
t->starttime = i;
t->endtime = i;
t->renew_till = i;
}
return 0;
return retval;
}
krb5_authdata ***a;
{
int i;
*a = 0;
/* Read the number of components */
if (length == 0)
return KRB5_OK;
/* Make *a able to hold length pointers to krb5_authdata structs
* Add one extra for a null-terminated list
*/
if (*a == NULL)
return KRB5_CC_NOMEM;
for (i=0; i < length; i++) {
if ((*a)[i] == NULL) {
krb5_free_authdata(context, *a);
return KRB5_CC_NOMEM;
}
}
return KRB5_OK;
if (*a)
krb5_free_authdata(context, *a);
return kret;
}
krb5_authdata *a;
{
a->magic = KV5M_AUTHDATA;
#ifdef _MSDOS
int32 &= VALID_INT_BITS;
#else
return KRB5_CC_NOMEM;
#endif
if (a->length == 0 )
return KRB5_OK;
return KRB5_CC_NOMEM;
return KRB5_OK;
if (a->contents)
krb5_xfree(a->contents);
return kret;
}