2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
13 #include <afs/pthread_glock.h>
14 #include <sys/types.h>
18 #include <netinet/in.h>
21 #include <afs/cellconfig.h>
26 #include <afs/afsutil.h>
29 #include "afs_usrops.h"
32 /* This is a utility routine that many parts of kauth use but it invokes the
33 afsconf package so its best to have it in a separate .o file to make the
36 static struct afsconf_dir *conf = 0;
37 static char cell_name[MAXCELLCHARS];
40 ka_CellConfig(const char *dir)
44 strcpy(cell_name, afs_LclCellName);
52 conf = afsconf_Open(dir);
57 code = afsconf_GetLocalCell(conf, cell_name, sizeof(cell_name));
77 strcpy(cell_name, afs_LclCellName);
79 if ((conf = afsconf_Open(AFSDIR_CLIENT_ETC_DIRPATH))) {
80 code = afsconf_GetLocalCell(conf, cell_name, sizeof(cell_name));
81 /* leave conf open so we can lookup other cells */
82 /* afsconf_Close (conf); */
85 printf("** Can't determine local cell name!\n");
96 ka_ExpandCell(char *cell, char *fullCell, int *alocal)
100 char cellname[MAXKTCREALMLEN];
101 struct afsconf_cell cellinfo; /* storage for cell info */
104 ka_LocalCell(); /* initialize things */
110 if ((cell == 0) || (strlen(cell) == 0)) {
114 cell = lcstring(cellname, cell, sizeof(cellname));
115 code = afsconf_GetCellInfo(conf, cell, 0, &cellinfo);
120 cell = cellinfo.name;
122 if (strcmp(cell, cell_name) == 0)
126 strcpy(fullCell, cell);
134 ka_CellToRealm(char *cell, char *realm, int *local)
139 code = ka_ExpandCell(cell, realm, local);
140 ucstring(realm, realm, MAXKTCREALMLEN);