2N/A/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2N/A * Copyright 1992 by the Massachusetts Institute of Technology. 2N/A * All Rights Reserved. 2N/A * Export of this software from the United States of America may 2N/A * require a specific license from the United States Government. 2N/A * It is the responsibility of any person or organization contemplating 2N/A * export to obtain such a license before exporting. 2N/A * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 2N/A * distribute this software and its documentation for any purpose and 2N/A * without fee is hereby granted, provided that the above copyright 2N/A * notice appear in all copies and that both that copyright notice and 2N/A * this permission notice appear in supporting documentation, and that 2N/A * the name of M.I.T. not be used in advertising or publicity pertaining 2N/A * to distribution of the software without specific, written prior 2N/A * permission. Furthermore if you modify this software you must label 2N/A * your software as modified software and not distribute it in such a 2N/A * fashion that it might be confused with the original M.I.T. software. 2N/A * M.I.T. makes no representations about the suitability of 2N/A * this software for any purpose. It is provided "as is" without express 2N/A * or implied warranty. 2N/A * Build a principal from a V4 specification, or separate a V5 2N/A * principal into name, instance, and realm. 2N/A * NOTE: This is highly site specific, and is only really necessary 2N/A * for sites who need to convert from V4 to V5. It is used by both 2N/A * the KDC and the kdb5_convert program. Since its use is highly 2N/A * specialized, the necesary information is just going to be 2N/A * hard-coded in this file. 2N/A/* The maximum sizes for V4 aname, realm, sname, and instance +1 */ 2N/A * Kadmin doesn't do realm conversion because it's currently 2N/A * "Realm conversion" is a bit of a misnomer; really, the v5 name is 2N/A * using a FQDN or something that looks like it, where the v4 name is 2N/A * just using the first label. Sometimes that second principal name 2N/A * component is a hostname, sometimes the realm name, sometimes it's 2N/A * This list should probably be more configurable, and more than 2N/A * likely on a per-realm basis, so locally-defined services can be 2N/A /* Realm conversion, Change service name */ 2N/A /* Realm conversion */ 2N/A /* No Realm conversion */ 2N/A R(
"mandarin-agent"),
2N/A * char *strnchr(s, c, n) 2N/A * returns a pointer to the first occurrence of character c in the 2N/A * string s, or a NULL pointer if c does not occur in in the string; 2N/A * however, at most the first n characters will be considered. 2N/A * This falls in the "should have been in the ANSI C library" 2N/Astatic char *
strnchr(
register char *s,
register int c,
2N/A register unsigned int n)
2N/A/* XXX This calls for a new error code */ 2N/A /* Check if this principal is listed in the table */ 2N/A * It is, so set the new name now, and chop off 2N/A * instance's domain name if requested. 2N/A /* If inst isn't set, the service isn't listed in the table, */ 2N/A /* so just copy it. */ 2N/A /* name may have been set above; otherwise, just copy it */ 2N/A /* Ask for v4_realm corresponding to 2N/A char buf[
256];
/* V4 instances are limited to 40 characters */ 2N/A /* First, convert the realm, since the v4 realm is not necessarily the same as the v5 realm 2N/A To do that, iterate over all the realms in the config file, looking for a matching 2N/A /* If it's not found, just keep going */