diff --git a/src/kauth/authclient.c b/src/kauth/authclient.c index 86d7b1f7ee..c07034057d 100644 --- a/src/kauth/authclient.c +++ b/src/kauth/authclient.c @@ -145,6 +145,7 @@ ka_GetServers(char *cell, struct afsconf_cell * cellinfo) } } code = myCellLookup(conf, cell, AFSCONF_KAUTHSERVICE, cellinfo); + afsconf_Close(conf); UNLOCK_GLOBAL_MUTEX; return code; } diff --git a/src/ptserver/ptuser.c b/src/ptserver/ptuser.c index 26791f4ff3..ebf6c47b19 100644 --- a/src/ptserver/ptuser.c +++ b/src/ptserver/ptuser.c @@ -71,7 +71,7 @@ pr_Initialize(IN afs_int32 secLevel, IN const char *confDir, IN char *cell) afs_int32 code; struct rx_connection *serverconns[MAXSERVERS]; struct rx_securityClass *sc[3]; - static struct afsconf_dir *tdir = (struct afsconf_dir *)0; /* only do this once */ + static struct afsconf_dir *tdir = (struct afsconf_dir *)NULL; /* only do this once */ static char tconfDir[100] = ""; static char tcell[64] = ""; struct ktc_token ttoken; @@ -109,6 +109,7 @@ pr_Initialize(IN afs_int32 secLevel, IN const char *confDir, IN char *cell) code = afsconf_GetLocalCell(tdir, cellstr, sizeof(cellstr)); if (code) { + afsconf_Close(tdir); fprintf(stderr, "libprot: Could not get local cell. [%d]\n", code); return code; @@ -117,16 +118,16 @@ pr_Initialize(IN afs_int32 secLevel, IN const char *confDir, IN char *cell) } #endif /* defined(UKERNEL) */ - if (tdir == 0 || strcmp(confDir, tconfDir) || strcmp(cell, tcell)) { + if (tdir == NULL || strcmp(confDir, tconfDir) || strcmp(cell, tcell)) { /* * force re-evaluation. we either don't have an afsconf_dir, * the directory has changed or the cell has changed. */ if (tdir && !gottdir) { afsconf_Close(tdir); - tdir = (struct afsconf_dir *)0; + tdir = (struct afsconf_dir *)NULL; } - pruclient = (struct ubik_client *)0; + pruclient = (struct ubik_client *)NULL; refresh = 1; } @@ -153,6 +154,7 @@ pr_Initialize(IN afs_int32 secLevel, IN const char *confDir, IN char *cell) code = afsconf_GetCellInfo(tdir, cell, "afsprot", &info); if (code) { + afsconf_Close(tdir); fprintf(stderr, "libprot: Could not locate cell %s in %s/%s\n", cell, confDir, AFSDIR_CELLSERVDB_FILE); return code; @@ -163,11 +165,14 @@ pr_Initialize(IN afs_int32 secLevel, IN const char *confDir, IN char *cell) * want, don't get a new one. Unless the security level is 2 in * which case we will get one (and re-read the key file). */ - if (pruclient && (lastLevel == secLevel) && (secLevel != 2)) + if (pruclient && (lastLevel == secLevel) && (secLevel != 2)) { + afsconf_Close(tdir); return 0; + } code = rx_Init(0); if (code) { + afsconf_Close(tdir); fprintf(stderr, "libprot: Could not initialize rx.\n"); return code; } @@ -216,6 +221,9 @@ pr_Initialize(IN afs_int32 secLevel, IN const char *confDir, IN char *cell) ttoken.ticket); } } + afsconf_Close(tdir); + tdir = NULL; + if (scIndex == 1) return PRBADARG; if ((scIndex == 0) && (sc[0] == 0)) diff --git a/src/ubik/uinit.c b/src/ubik/uinit.c index 650fcd2ec5..76e66fa630 100644 --- a/src/ubik/uinit.c +++ b/src/ubik/uinit.c @@ -87,6 +87,7 @@ ugen_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth, } code = afsconf_ClientAuth(tdir, &sc, &scIndex); /* sets sc,scIndex */ if (code) { + afsconf_Close(tdir); fprintf(stderr, "%s: Could not get security object for -localAuth\n", funcName); @@ -96,6 +97,7 @@ ugen_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth, afsconf_GetCellInfo(tdir, tdir->cellName, serviceid, &info); if (code) { + afsconf_Close(tdir); fprintf(stderr, "%s: can't find cell %s's hosts in %s/%s\n", funcName, cellName, AFSDIR_SERVER_ETC_DIRPATH, diff --git a/src/viced/viced.c b/src/viced/viced.c index 85a12a1810..5bee4ae97c 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -1601,6 +1601,7 @@ vl_Initialize(const char *confDir) info.hostAddr[i].sin_port, USER_SERVICE_ID, sc, scIndex); code = ubik_ClientInit(serverconns, &cstruct); + afsconf_Close(tdir); if (code) { ViceLog(0, ("vl_Initialize: ubik client init failed.\n")); return code;