From 5c9be9a2f8eb4e2e8e9bf80132976adc506d968b Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sat, 21 Apr 2012 20:55:23 +0100 Subject: [PATCH] util: Completely remove get_krbrlm Commit d85ece0977e043154b7d8f5aef5f4cd972771e8e added a new mechanism for determining whether a realm is local or not, and susequent commits removed all in-tree calls to the now-legacy functions in get_krbrlm.c To avoid confusion, just remove all of these legacy functions, as we don't want to end up supporting two ways of doing this operation. This change is not suitable for pullup to a stable release. Change-Id: Ie2f5c447f751d12a0d85a4a438efd7e210133e97 Reviewed-on: http://gerrit.openafs.org/7263 Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- src/libafsauthent/Makefile.in | 5 - src/libafsauthent/NTMakefile | 1 - src/shlibafsauthent/Makefile.in | 4 - src/shlibafsauthent/NTMakefile | 4 - src/shlibafsauthent/libafsauthent.map | 1 - src/tvlserver/Makefile.in | 5 +- src/util/Makefile.in | 8 +- src/util/NTMakefile | 2 - src/util/afsutil_prototypes.h | 4 - src/util/get_krbrlm.c | 171 -------------------------- 10 files changed, 3 insertions(+), 202 deletions(-) delete mode 100644 src/util/get_krbrlm.c diff --git a/src/libafsauthent/Makefile.in b/src/libafsauthent/Makefile.in index 79af7164b..160268251 100644 --- a/src/libafsauthent/Makefile.in +++ b/src/libafsauthent/Makefile.in @@ -59,7 +59,6 @@ UBIKOBJS = \ UTILOBJS = \ pthread_glock.o \ - get_krbrlm.o \ dirpath.o \ serverLog.o \ fileutil.o @@ -207,10 +206,6 @@ ubik_int.cs.o: ../ubik/ubik_int.cs.c ubik_int.xdr.o: ../ubik/ubik_int.xdr.c ${AFS_CCRULE} ../ubik/ubik_int.xdr.c - -get_krbrlm.o: ${UTIL}/get_krbrlm.c - ${AFS_CCRULE} ${UTIL}/get_krbrlm.c - dirpath.o: ${UTIL}/dirpath.c ${AFS_CCRULE} ${UTIL}/dirpath.c diff --git a/src/libafsauthent/NTMakefile b/src/libafsauthent/NTMakefile index 11bd6d97d..c06436ede 100644 --- a/src/libafsauthent/NTMakefile +++ b/src/libafsauthent/NTMakefile @@ -69,7 +69,6 @@ UBIKOBJS = \ UTILOBJS = \ $(OUT)\pthread_glock.obj \ - $(OUT)\get_krbrlm.obj \ $(OUT)\fileutil.obj \ $(OUT)\dirpath.obj \ $(OUT)\readdir_nt.obj diff --git a/src/shlibafsauthent/Makefile.in b/src/shlibafsauthent/Makefile.in index 2212a7966..57ba5c8f8 100644 --- a/src/shlibafsauthent/Makefile.in +++ b/src/shlibafsauthent/Makefile.in @@ -66,7 +66,6 @@ UBIKOBJS = \ UTILOBJS = \ pthread_glock.o \ - get_krbrlm.o \ dirpath.o \ serverLog.o \ fileutil.o \ @@ -264,9 +263,6 @@ ubik_int.cs.o: ../ubik/ubik_int.cs.c ubik_int.xdr.o: ../ubik/ubik_int.xdr.c ${AFS_CCRULE} ../ubik/ubik_int.xdr.c -get_krbrlm.o: ${UTIL}/get_krbrlm.c - ${AFS_CCRULE} ${UTIL}/get_krbrlm.c - dirpath.o: ${UTIL}/dirpath.c ${AFS_CCRULE} ${UTIL}/dirpath.c diff --git a/src/shlibafsauthent/NTMakefile b/src/shlibafsauthent/NTMakefile index e05377dc3..238eabf2f 100644 --- a/src/shlibafsauthent/NTMakefile +++ b/src/shlibafsauthent/NTMakefile @@ -56,7 +56,6 @@ UBIKOBJS = \ UTILOBJS = \ $(OUT)\pthread_glock.obj \ - $(OUT)\get_krbrlm.obj \ $(OUT)\fileutil.obj \ $(OUT)\dirpath.obj \ $(OUT)\readdir_nt.obj @@ -158,9 +157,6 @@ ubik_int.cs.obj: $(UBIK)\ubik_int.cs.c ubik_int.xdr.obj: $(UBIK)\ubik_int.xdr.c $(C2OBJ) $(UBIK)\ubik_int.xdr.c -get_krbrlm.obj: $(UTIL)\get_krbrlm.c - $(C2OBJ) $(UTIL)\get_krbrlm.c - dirpath.obj: $(UTIL)\dirpath.c $(C2OBJ) $(UTIL)\dirpath.c diff --git a/src/shlibafsauthent/libafsauthent.map b/src/shlibafsauthent/libafsauthent.map index 346eac86e..fb2e6519e 100644 --- a/src/shlibafsauthent/libafsauthent.map +++ b/src/shlibafsauthent/libafsauthent.map @@ -75,7 +75,6 @@ pr_GetCPS; pr_Initialize; pr_GetHostCPS; - afs_krb_get_lrealm; pr_NameToId; pr_IdToName; pr_ListMembers; diff --git a/src/tvlserver/Makefile.in b/src/tvlserver/Makefile.in index 0174404ef..6648b3f57 100644 --- a/src/tvlserver/Makefile.in +++ b/src/tvlserver/Makefile.in @@ -20,7 +20,7 @@ RXOBJS= rx_pthread.o rxkad_errs.o UTILOBJS=uuid.o serverLog.o fileutil.o netutils.o dirpath.o \ volparse.o flipbase64.o softsig.o hostparse.o pthread_glock.o \ - pthread_threadname.o get_krbrlm.o + pthread_threadname.o INCLS=${TOP_INCDIR}/ubik.h \ ${TOP_INCDIR}/lwp.h \ @@ -93,9 +93,6 @@ pthread_glock.o: ${UTIL}/pthread_glock.c pthread_threadname.o: ${UTIL}/pthread_threadname.c $(AFS_CCRULE) $(UTIL)/pthread_threadname.c -get_krbrlm.o: ${UTIL}/get_krbrlm.c - $(AFS_CCRULE) $(UTIL)/get_krbrlm.c - # # Other stuff # diff --git a/src/util/Makefile.in b/src/util/Makefile.in index 6de1ba183..69866a944 100644 --- a/src/util/Makefile.in +++ b/src/util/Makefile.in @@ -13,7 +13,7 @@ HELPER_SPLINT=@HELPER_SPLINT@ objects =base64.o ktime.o volparse.o hostparse.o exec.o \ - hputil.o kreltime.o get_krbrlm.o uuid.o serverLog.o \ + hputil.o kreltime.o uuid.o serverLog.o \ dirpath.o fileutil.o netutils.o flipbase64.o fstab.o \ afs_atomlist.o afs_lhash.o pthread_glock.o tabular_output.o \ pthread_threadname.o ${REGEX_OBJ} @@ -26,7 +26,6 @@ objects_pic = \ exec_pic.o \ hputil_pic.o \ kreltime_pic.o \ - get_krbrlm_pic.o \ uuid_pic.o \ serverLog_pic.o \ dirpath_pic.o \ @@ -203,9 +202,6 @@ hputil_pic.o: ${srcdir}/hputil.c ${includes} kreltime_pic.o: ${srcdir}/kreltime.c ${includes} $(SHD_CCRULE) ${srcdir}/kreltime.c -get_krbrlm_pic.o: ${srcdir}/get_krbrlm.c ${includes} - $(SHD_CCRULE) ${srcdir}/get_krbrlm.c - uuid_pic.o: ${srcdir}/uuid.c ${includes} $(SHD_CCRULE) ${srcdir}/uuid.c @@ -321,6 +317,6 @@ include ../config/Makefile.version check-splint: sh $(HELPER_SPLINT) $(CFLAGS) \ base64.c ktime.c volparse.c hostparse.c \ - hputil.c kreltime.c get_krbrlm.c uuid.c serverLog.c \ + hputil.c kreltime.c uuid.c serverLog.c \ dirpath.c fileutil.c netutils.c flipbase64.c \ afs_atomlist.c afs_lhash.c fstab.c diff --git a/src/util/NTMakefile b/src/util/NTMakefile index edbb01357..6a31d47ee 100644 --- a/src/util/NTMakefile +++ b/src/util/NTMakefile @@ -40,7 +40,6 @@ MT_LIBFILE = $(DESTDIR)\lib\afs\mtafsutil.lib LIBOBJS = \ $(OUT)\base32.obj \ - $(OUT)\get_krbrlm.obj \ $(OUT)\hostparse.obj \ $(OUT)\krb5_nt.obj \ $(OUT)\kreltime.obj \ @@ -59,7 +58,6 @@ LIBOBJS = \ MT_LIBOBJS = \ $(OUT)\base32.obj \ - $(OUT)\get_krbrlm.obj \ $(OUT)\hostparse.obj \ $(OUT)\krb5_nt.obj \ $(OUT)\kreltime.obj \ diff --git a/src/util/afsutil_prototypes.h b/src/util/afsutil_prototypes.h index 592ac65fa..dd3d7fbbf 100644 --- a/src/util/afsutil_prototypes.h +++ b/src/util/afsutil_prototypes.h @@ -59,10 +59,6 @@ extern char *int64_to_flipbase64(lb64_string_t s, afs_uint64 a); extern afs_int64 flipbase64_to_int64(char *s); #endif -/* get_krbrlm.c */ -extern int afs_krb_get_lrealm(char *r, int n); -extern int afs_krb_exclusion(char *name); -extern int afs_is_foreign_ticket_name(char *tname, char *tinst, char * tcell, char *localrealm); /* hostparse.c */ extern struct hostent *hostutil_GetHostByName(char *ahost); extern char *hostutil_GetNameByINet(afs_uint32 addr); diff --git a/src/util/get_krbrlm.c b/src/util/get_krbrlm.c deleted file mode 100644 index 770d76459..000000000 --- a/src/util/get_krbrlm.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, please see the file . - */ - -#include -#include - -#include - -#include - -#include "afsutil.h" - -/* - * Specialized version of the kerberos krb_get_lrealm function. - * 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. - * - * On the kerberos version 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"). - * - */ -#define KSUCCESS 0 -#define KFAILURE (-1) - -static char * -parse_str(char *buffer, char *result, int size) -{ - int n=0; - - if (!buffer) - goto cleanup; - - while (*buffer && isspace(*buffer)) - buffer++; - while (*buffer && !isspace(*buffer)) { - if (n < size - 1) { - *result++=*buffer++; - n++; - } else { - buffer++; - } - } - - cleanup: - *result='\0'; - return buffer; -} - - -int -afs_krb_get_lrealm(char *r, int n) -{ - char linebuf[2048]; - char tr[AFS_REALM_SZ] = ""; - char *p; - FILE *cnffile/*, *fopen()*/; - int i; - int rv = KFAILURE; - - *r = '\0'; - - if ((cnffile = fopen(AFSDIR_SERVER_KCONF_FILEPATH, "r")) == NULL) { - return (KFAILURE); - } - if (fgets(linebuf, sizeof(linebuf)-1, cnffile) == NULL) { - goto cleanup; - } - linebuf[sizeof(linebuf)-1] = '\0'; - for (i=0, p=linebuf; i<=n && *p; i++) { - p = parse_str(p, tr, AFS_REALM_SZ); - } - - if (*tr) { - strcpy(r,tr); - rv = KSUCCESS; - } - - cleanup: - (void)fclose(cnffile); - return rv; -} - -int -afs_krb_exclusion(char * name) -{ - char linebuf[2048]; - char excl_name[256] = ""; - FILE *cnffile/*, *fopen()*/; - int exclude = 0; - - if ((cnffile = fopen(AFSDIR_SERVER_KRB_EXCL_FILEPATH, "r")) == NULL) - return exclude; - - for (;;) { - if (fgets(linebuf, sizeof(linebuf)-1, cnffile) == NULL) { - goto cleanup; - } - linebuf[sizeof(linebuf)-1] = '\0'; - parse_str(linebuf, excl_name, sizeof(excl_name)); - - if (!strcmp(name,excl_name)) { - exclude = 1; - break; - } - } - - cleanup: - (void)fclose(cnffile); - return exclude; -} - -int -afs_is_foreign_ticket_name(char *tname, char *tinst, char * tcell, char *localrealm) -{ - int foreign = 0; - - if (localrealm && strcasecmp(localrealm, tcell)) - foreign = 1; - - if (foreign) { - static char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ]; - static int num_lrealms = -1; - int lrealm_match, i; - char uname[256]; - - if (num_lrealms == -1) { - for (i=0; i