chk_trans.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* Copyright 2001 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. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* 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.
*
*
* krb5_check_transited_list()
*/
#include <k5-int.h>
#include <stdarg.h>
#define MAXLEN 512
static krb5_error_code
/* Simplify... */
const krb5_data *p;
p = n1;
n2 = p;
}
/* Okay, now len1 is always shorter or equal. */
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
return 0;
}
/* Now len1 is always shorter. */
if (len1 == 0)
/* Shouldn't be possible. Internal error? */
return KRB5KRB_AP_ERR_ILL_CR_TKT;
if (p1[0] == '/') {
/* X.500 style names, with common prefix. */
if (p2[0] != '/') {
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
if (p2[i] == '/') {
krb5_data d;
d.length = i;
if (r)
return r;
}
} else {
/* Domain style names, with common suffix. */
if (p2[0] == '/') {
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
krb5_data d;
if (r)
return r;
}
}
}
return 0;
}
static krb5_error_code
{
return 0;
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
/* We can ignore the case where the previous component was
empty; the strcat will be a no-op. It should probably
be an error case, but let's be flexible. */
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
}
/* Otherwise, do nothing. */
return 0;
}
/* The input strings cannot contain any \0 bytes, according to the
spec, but our API is such that they may not be \0 terminated
either. Thus we keep on treating them as krb5_data objects instead
of C strings. */
static krb5_error_code
{
char *p, *bufp;
int next_lit, intermediates, l;
/* Invariants:
- last_component points to last[]
- this_component points to buf[]
- last_component has length of last
- this_component has length of buf when calling out
Keep these consistent, and we should be okay. */
next_lit = 0;
intermediates = 0;
last_component.length = 0;
return 0;
}
if (next_lit) {
*bufp++ = *p;
return KRB5KRB_AP_ERR_ILL_CR_TKT;
next_lit = 0;
} else if (*p == '\\') {
next_lit = 1;
} else if (*p == ',') {
if (r)
return r;
if (r)
return r;
if (intermediates) {
&this_component, crealm);
else {
}
if (r)
return r;
}
intermediates = 0;
} else {
intermediates = 1;
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
}
/* This next component stands alone, even if it has a
trailing dot or leading slash. */
last_component.length = 0;
} else {
/* Not a special character; literal. */
*bufp++ = *p;
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
}
/* At end. Must be normal state. */
/* Process trailing element or comma. */
/* Trailing comma. */
} else {
/* Trailing component. */
if (r)
return r;
if (r)
return r;
if (intermediates)
}
if (r != 0)
return r;
return 0;
}
struct check_data {
};
static int
{
}
static krb5_error_code
{
int i;
return 0;
}
return KRB5KRB_AP_ERR_ILL_CR_TKT;
}
{
struct check_data cdata;
/*
* Work around buggy implementations that include NULL terminator in length.
*/
return 0;
if (r) {
return r;
}
#ifdef DEBUG /* avoid compiler warning about 'd' unused */
{
int i;
char *name;
}
}
#endif
return r;
}