* $Source: /usr/src/kerberosIV/krb/RCS/get_krbrlm.c,v $
* Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
* For copying and distribution information, please see the file
static char *rcsid_get_krbrlm_c
=
"$Header: /usr/src/kerberosIV/krb/RCS/get_krbrlm.c,v 4.10 91/03/29 15:10:53 kfall Exp Locker: kfall $";
#include <mit-copyright.h>
* krb_get_lrealm takes a pointer to a string, and a number, n. It fills
* in the string, r, with the name of the nth realm specified on the
* first line of the kerberos config file (KRB_CONF, defined in "krb.h").
* It returns 0 (KSUCCESS) on success, and KFAILURE on failure. If the
* config file does not exist, and if n=1, a successful return will occur
* with r = KRB_REALM (also defined in "krb.h").
* NOTE: for archaic & compatibility reasons, this routine will only return
* valid results when n = 1.
* For the format of the KRB_CONF file, see comments describing the routine
if ((cnffile
= fopen(KRB_CONF
, "r")) == (FILE *) NULL
)
return(KFAILURE
); /* Temporary restriction */
if ((cnffile
= fopen(KRB_CONF
, "r")) == NULL
) {
(void) strcpy(r
, KRB_REALM
);
if (fscanf(cnffile
,"%s",r
) != 1) {