util_ctxsetup.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (C) 1998 by the FundsXpress, INC.
*
* 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 FundsXpress. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. FundsXpress makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <gssapiP_krb5.h>
allocated and returns the length and list of ctypes in the token.
about. Those which are present in the token are filled in; the
order and length are not changed. If an error is returned, the
option list is in an indeterminate state. */
unsigned char *ptr;
int token_length;
int *nctypes; /* OUT */
int noptions;
{
int field_length, i;
int opt_id;
*ctypes = 0;
/* read the flags */
if (token_length < 4)
goto defective;
ptr += 4;
token_length -= 4;
/* read out the token list */
if (token_length < 2)
goto defective;
ptr += 2;
token_length -= 2;
*nctypes = field_length;
if (*nctypes == 0) {
*minor_status = 0;
return(GSS_S_DEFECTIVE_TOKEN);
}
if ((*ctypes = (krb5_cksumtype *)
*minor_status = ENOMEM;
return(GSS_S_FAILURE);
}
for (i=0; i<field_length; i++) {
if (token_length < 4)
goto defective;
ptr += 4;
token_length -= 4;
}
do {
if (token_length < 4)
goto defective;
ptr += 4;
token_length -= 4;
if (token_length < field_length)
goto defective;
for (i=0; i<noptions; i++) {
break;
}
}
ptr += field_length;
} while (opt_id);
if (token_length < 2)
goto defective;
ptr += 2;
token_length -= 2;
if (token_length < field_length)
goto defective;
ptr += field_length;
/* if there's anything left, assume it's a mic. the mic isn't
necessarily present */
if (mic && token_length) {
if (token_length < 2)
goto defective;
ptr += 2;
token_length -= 2;
if (token_length < field_length)
goto defective;
ptr += field_length;
} else if (mic) {
}
if (token_length)
goto defective;
return(GSS_S_COMPLETE);
if (*ctypes)
*minor_status = 0;
return(GSS_S_DEFECTIVE_TOKEN);
}
two lists. */
void
int *nc1;
int nc2;
const krb5_cksumtype *c2;
{
int i, j, count;
count = 0;
for (i=0; i<*nc1; i++) {
/* first, check to make sure that c1[i] isn't a duplicate in c1 */
for (j=0; j<i; j++)
break;
if (j<i)
continue;
/* check if c1[i] is in c2. If it is, keep it by swapping
it into c1[count] and incrementing count. If count < i, then
that field has already been looked at and skipped as
not intersecting, which is ok. */
for (j=0; j<nc2; j++)
break;
}
count++;
}
}