2 * This file replaces some of the routines in the Kerberos utilities.
3 * It is based on the Kerberos library modules:
6 * Copyright 1987, 1988, 1992 by the Massachusetts Institute of Technology.
8 * For copying and distribution information, please see the file
12 #include <afsconfig.h>
17 #include <kerberosIV/mit-copyright.h>
27 #include <afs/cellconfig.h>
32 #define S_AD_SZ sizeof(struct sockaddr_in)
34 char *afs_realm_of_cell(krb5_context context, struct afsconf_cell *cellconfig, int fallback)
36 static char krbrlm[REALM_SZ+1];
38 krb5_error_code retval;
45 p = strchr(cellconfig->hostName[0], '.');
49 strcpy(krbrlm, cellconfig->name);
50 for (p=krbrlm; *p; p++) {
55 if ((retval = krb5_get_host_realm(context,
56 cellconfig->hostName[0], &hrealms)))
58 if(!hrealms[0]) return 0;
59 strcpy(krbrlm, hrealms[0]);
61 if (hrealms) krb5_free_host_realm(context, hrealms);