10 static char expand[REALM_SZ];
12 krb5_error_code result;
14 result = krb5_get_host_realm(Z_krb5_ctx, realm, &list_realms);
16 /* Error, just return upper-cased realm */
20 *cp1++ = toupper(*cp2++);
25 strncpy(expand, list_realms[0], sizeof(expand));
26 expand[sizeof(expand)-1] = '\0';
27 result = krb5_free_host_realm(Z_krb5_ctx, list_realms);
33 he = gethostbyname(realm);
35 if (!he || !he->h_name)
36 /* just use the raw realm */
43 *cp1++ = toupper(*cp2++);
51 char krb_host[NS_MAXDNAME + 1];
52 static char krb_realm[REALM_SZ+1];
56 /* upcase what we got */
60 *cp1++ = toupper(*cp2++);
64 if ((rlm_file = fopen("/etc/krb.conf", "r")) == (FILE *) 0) {
68 if (fgets(linebuf, BUFSIZ, rlm_file) == NULL) {
70 (void) fclose(rlm_file);
74 if (sscanf(linebuf, "%s", krb_realm) < 1) {
76 (void) fclose(rlm_file);
80 if (!strncmp(krb_realm, expand, strlen(expand))) {
81 (void) fclose(rlm_file);
86 /* run through the file, looking for admin host */
87 if (fgets(linebuf, BUFSIZ, rlm_file) == NULL) {
88 (void) fclose(rlm_file);
92 if (sscanf(linebuf, "%s %s admin %s", krb_realm, krb_host, scratch)
95 if (!strncmp(krb_realm, expand, strlen(expand))) {
96 (void) fclose(rlm_file);
100 #endif /* HAVE_KRB4 */