From 7dc0a32c3d6d09abeecdf25285ef2c205357511d Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Mon, 30 May 2011 20:07:01 +0100 Subject: [PATCH] ubik: Use supplied config directory in ugen ugen_ClientInit permits the configuration directory to use to be passed on the command line. However, it was then promptly overwritting the supplied directory with the standard client (or server) directories, depending on whether localauth was in use or not. As a start to fixing this anti-social behaviour, modify ugen so that if we're not doing localauth, and if the caller has passed us a config directory, use that instead of the system default one. This allows us to start creating test harnesses for our command line tools. Change-Id: I6916389ce56df4cee62845a03282c5c10d3095eb Reviewed-on: http://gerrit.openafs.org/4809 Reviewed-by: Jeffrey Altman Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/ubik/uinit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ubik/uinit.c b/src/ubik/uinit.c index fee0aadff..e43ffc4d6 100644 --- a/src/ubik/uinit.c +++ b/src/ubik/uinit.c @@ -47,7 +47,6 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s struct rx_securityClass *sc; /* This must change if VLDB_MAXSERVERS becomes larger than MAXSERVERS */ static struct rx_connection *serverconns[MAXSERVERS]; - const char *confdir; code = rx_Init(0); if (code) { @@ -59,20 +58,21 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s secFlags = AFSCONF_SECOPTS_FALLBACK_NULL; if (sauth) { secFlags |= AFSCONF_SECOPTS_LOCALAUTH; - confdir = AFSDIR_SERVER_ETC_DIRPATH; + confDir = AFSDIR_SERVER_ETC_DIRPATH; } else { - confdir = AFSDIR_CLIENT_ETC_DIRPATH; + if (confDir == NULL) + confDir = AFSDIR_CLIENT_ETC_DIRPATH; } if (noAuthFlag) { secFlags |= AFSCONF_SECOPTS_NOAUTH; } - tdir = afsconf_Open(confdir); + tdir = afsconf_Open(confDir); if (!tdir) { fprintf(stderr, "%s: Could not process files in configuration directory (%s).\n", - funcName, confdir); + funcName, confDir); return -1; } @@ -83,7 +83,7 @@ ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 s if (code) { afsconf_Close(tdir); fprintf(stderr, "%s: can't find cell %s's hosts in %s/%s\n", - funcName, cellName, confdir, AFSDIR_CELLSERVDB_FILE); + funcName, cellName, confDir, AFSDIR_CELLSERVDB_FILE); return -1; } code = afsconf_PickClientSecObj(tdir, secFlags, &info, cellName, &sc, -- 2.39.5