2 * Copyright (c) 1994 CyberSAFE Corporation.
5 * Export of this software from the United States of America may
6 * require a specific license from the United States Government.
7 * It is the responsibility of any person or organization contemplating
8 * export to obtain such a license before exporting.
10 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
11 * distribute this software and its documentation for any purpose and
12 * without fee is hereby granted, provided that the above copyright
13 * notice appear in all copies and that both that copyright notice and
14 * this permission notice appear in supporting documentation, and that
15 * the name of M.I.T. not be used in advertising or publicity pertaining
16 * to distribution of the software without specific, written prior
17 * permission. Neither M.I.T., the Open Computing Security Group, nor
18 * CyberSAFE Corporation make any representations about the suitability of
19 * this software for any purpose. It is provided "as is" without express
20 * or implied warranty.
26 #define MAX_REALM_LN 500
28 krb5_error_code INTERFACE
29 krb5_check_transited_list(context, trans, realm1, realm2)
35 char prev[MAX_REALM_LN+1];
36 char next[MAX_REALM_LN+1];
40 krb5_error_code retval = 0;
41 krb5_principal *tgs_list;
43 if (!trans || !trans->data) return(0);
44 trans_length = trans->data[trans->length-1] ?
45 trans->length : trans->length - 1;
47 if (retval = krb5_walk_realm_tree(context, realm1, realm2, &tgs_list,
48 KRB5_REALM_BRANCH_CHAR)) {
52 memset(prev, 0, MAX_REALM_LN + 1);
53 memset(next, 0, MAX_REALM_LN + 1), nextp = next;
54 for (i = 0; i <= trans_length; i++) {
55 if (i < trans_length-1 && trans->data[i] == '\\') {
57 *nextp++ = trans->data[i];
60 if (i < trans_length && trans->data[i] != ',') {
61 *nextp++ = trans->data[i];
64 if (strlen(next) > 0) {
66 if (*(nextp-1) == '.') strcat(next, prev);
67 retval = KRB5KRB_AP_ERR_ILL_CR_TKT;
68 for (j = 0; tgs_list[j]; j++) {
69 if (strlen(next) == (size_t) krb5_princ_realm(context, tgs_list[j])->length &&
70 !memcmp(next, krb5_princ_realm(context, tgs_list[j])->data,
76 if (retval) goto finish;
78 if (i+1 < trans_length && trans->data[i+1] == ' ') {
80 memset(next, 0, MAX_REALM_LN + 1), nextp = next;
83 if (i+1 < trans_length && trans->data[i+1] != '/') {
85 memset(next, 0, MAX_REALM_LN + 1), nextp = next;
92 krb5_free_realm_tree(context, tgs_list);