krb5 profile config support
authorDerrick Brashear <shadow@dementix.org>
Mon, 30 Jul 2012 13:52:24 +0000 (09:52 -0400)
committerDerrick Brashear <shadow@dementix.org>
Tue, 31 Jul 2012 19:27:24 +0000 (12:27 -0700)
create openafs-client.conf and openafs-server.conf in respective ETC
dirs. enable afsd, ptserver, vlserver and fileserver option parsing from it

[afsd]
            dynroot = true
            dcache = 800
            cachedir = /var/db/openafs/cache

Change-Id: I4bae437d7c8f54daa5dadfaeb875cdd185809d61
Reviewed-on: http://gerrit.openafs.org/7903
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/afsd/afsd.c
src/ptserver/ptserver.c
src/util/dirpath.c
src/util/dirpath.hin
src/util/dirpath_nt.h
src/viced/viced.c
src/vlserver/vlserver.c

index cfccb9e..adc63b0 100644 (file)
@@ -1677,6 +1677,9 @@ mainproc(struct cmd_syndesc *as, void *arock)
     }
 #endif
 
+    cmd_OpenConfigFile(AFSDIR_CLIENT_CONFIG_FILE_FILEPATH);
+    cmd_SetCommandName("afsd");
+
     /* call atoi on the appropriate parsed results */
     if (cmd_OptionAsInt(as, OPT_blocks, &cacheBlocks) == 0)
        sawCacheBlocks = 1;
index 86f240b..2fc7462 100644 (file)
@@ -354,6 +354,11 @@ main(int argc, char **argv)
     if (code)
        PT_EXIT(1);
 
+    cmd_OptionAsString(opts, OPT_config, &configDir);
+
+    cmd_OpenConfigFile(AFSDIR_SERVER_CONFIG_FILE_FILEPATH);
+    cmd_SetCommandName("ptserver");
+
     if (cmd_OptionAsList(opts, OPT_access, &list) == 0) {
        prp_user_default = prp_access_mask(list->data);
        if (list->next == NULL || list->next->data == NULL) {
@@ -380,7 +385,6 @@ main(int argc, char **argv)
        free(interface);
     }
 
-    cmd_OptionAsString(opts, OPT_config, &configDir);
     cmd_OptionAsInt(opts, OPT_debug, &LogLevel);
     cmd_OptionAsString(opts, OPT_database, &pr_dbaseName);
     cmd_OptionAsString(opts, OPT_logfile, &logFile);
index 55bf251..6162021 100644 (file)
@@ -364,6 +364,10 @@ initDirPathArray(void)
     pathp = dirPathArray[AFSDIR_SERVER_AUDIT_FILEPATH_ID];
     AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_AUDIT_FILE);
 
+    pathp = dirPathArray[AFSDIR_SERVER_CONFIG_FILE_FILEPATH_ID];
+    AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR,
+                          AFSDIR_SERVER_CONFIG_FILE);
+
     pathp = dirPathArray[AFSDIR_SERVER_NETINFO_FILEPATH_ID];
     AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_NETINFO_FILE);
 
@@ -406,6 +410,9 @@ initDirPathArray(void)
     AFSDIR_CLIENT_FILEPATH(pathp, clntEtcDir, AFSDIR_CELLALIAS_FILE);
 #endif /* AFS_NT40_ENV */
 
+    pathp = dirPathArray[AFSDIR_CLIENT_CONFIG_FILE_FILEPATH_ID];
+    AFSDIR_CLIENT_FILEPATH(pathp, clntEtcDir, AFSDIR_CLIENT_CONFIG_FILE);
+
     pathp = dirPathArray[AFSDIR_CLIENT_NETINFO_FILEPATH_ID];
     AFSDIR_CLIENT_FILEPATH(pathp, clntEtcDir, AFSDIR_NETINFO_FILE);
 
index 0a8416b..9ffd341 100644 (file)
@@ -163,6 +163,8 @@ ConstructLocalLogPath(const char *cpath,
 #define AFSDIR_FSSTATE_FILE     "fsstate.dat"
 
 #define AFSDIR_CELLSERVDB_FILE_NTCLIENT  "afsdcell.ini"
+#define AFSDIR_CLIENT_CONFIG_FILE  "openafs-client.conf"
+#define AFSDIR_SERVER_CONFIG_FILE  "openafs-server.conf"
 
 #define AFSDIR_NETINFO_FILE     "NetInfo"
 #define AFSDIR_NETRESTRICT_FILE "NetRestrict"
@@ -283,6 +285,8 @@ typedef enum afsdir_id {
       AFSDIR_SERVER_SALSRV_FILEPATH_ID,
       AFSDIR_SERVER_SALSRVLOG_FILEPATH_ID,
       AFSDIR_SERVER_FSSTATE_FILEPATH_ID,
+      AFSDIR_CLIENT_CONFIG_FILE_FILEPATH_ID,
+      AFSDIR_SERVER_CONFIG_FILE_FILEPATH_ID,
       AFSDIR_PATHSTRING_MAX } afsdir_id_t;
 
 /* getDirPath() returns a pointer to a string from an internal array of path strings 
@@ -356,8 +360,10 @@ const char *getDirPath(afsdir_id_t string_id);
 #define AFSDIR_SERVER_MIGRATELOG_FILEPATH getDirPath(AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID)
 #define AFSDIR_SERVER_KRB_EXCL_FILEPATH getDirPath(AFSDIR_SERVER_KRB_EXCL_FILEPATH_ID)
 #define AFSDIR_SERVER_FSSTATE_FILEPATH getDirPath(AFSDIR_SERVER_FSSTATE_FILEPATH_ID)
+#define AFSDIR_SERVER_CONFIG_FILE_FILEPATH getDirPath(AFSDIR_SERVER_CONFIG_FILE_FILEPATH_ID)
 
 /* client file paths */
+#define AFSDIR_CLIENT_CONFIG_FILE_FILEPATH getDirPath(AFSDIR_CLIENT_CONFIG_FILE_FILEPATH_ID)
 #define AFSDIR_CLIENT_THISCELL_FILEPATH getDirPath(AFSDIR_CLIENT_THISCELL_FILEPATH_ID)
 #define AFSDIR_CLIENT_CELLSERVDB_FILEPATH getDirPath(AFSDIR_CLIENT_CELLSERVDB_FILEPATH_ID)  
 #define AFSDIR_CLIENT_CELLALIAS_FILEPATH getDirPath(AFSDIR_CLIENT_CELLALIAS_FILEPATH_ID)  
index 0e7121f..47e551c 100644 (file)
@@ -157,6 +157,8 @@ extern int
 #else
 #define AFSDIR_CELLSERVDB_FILE_NTCLIENT  AFSDIR_CELLSERVDB_FILE
 #endif
+#define AFSDIR_CLIENT_CONFIG_FILE  "openafs-client.conf"
+#define AFSDIR_SERVER_CONFIG_FILE  "openafs-server.conf"
 
 #define AFSDIR_NETINFO_FILE     "NetInfo"
 #define AFSDIR_NETRESTRICT_FILE "NetRestrict"
@@ -275,6 +277,8 @@ typedef enum afsdir_id {
     AFSDIR_SERVER_SALSRV_FILEPATH_ID,
     AFSDIR_SERVER_SALSRVLOG_FILEPATH_ID,
     AFSDIR_SERVER_FSSTATE_FILEPATH_ID,
+    AFSDIR_CLIENT_CONFIG_FILE_FILEPATH_ID,
+    AFSDIR_SERVER_CONFIG_FILE_FILEPATH_ID,
     AFSDIR_PATHSTRING_MAX
 } afsdir_id_t;
 
@@ -348,8 +352,10 @@ const char *getDirPath(afsdir_id_t string_id);
 #define AFSDIR_SERVER_MIGRATELOG_FILEPATH getDirPath(AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID)
 #define AFSDIR_SERVER_KRB_EXCL_FILEPATH getDirPath(AFSDIR_SERVER_KRB_EXCL_FILEPATH_ID)
 #define AFSDIR_SERVER_FSSTATE_FILEPATH getDirPath(AFSDIR_SERVER_FSSTATE_FILEPATH_ID)
+#define AFSDIR_SERVER_CONFIG_FILE_FILEPATH getDirPath(AFSDIR_SERVER_CONFIG_FILE_FILEPATH_ID)
 
 /* client file paths */
+#define AFSDIR_CLIENT_CONFIG_FILE_FILEPATH getDirPath(AFSDIR_CLIENT_CONFIG_FILE_FILEPATH_ID)
 #define AFSDIR_CLIENT_THISCELL_FILEPATH getDirPath(AFSDIR_CLIENT_THISCELL_FILEPATH_ID)
 #define AFSDIR_CLIENT_CELLSERVDB_FILEPATH getDirPath(AFSDIR_CLIENT_CELLSERVDB_FILEPATH_ID)
 #define AFSDIR_CLIENT_NETINFO_FILEPATH getDirPath(AFSDIR_CLIENT_NETINFO_FILEPATH_ID)
index c448d80..5f03ee6 100644 (file)
@@ -1160,6 +1160,11 @@ ParseArgs(int argc, char *argv[])
     if (code)
        return -1;
 
+    /* XXX - cmd_OptionAsString(opts, OPT_config, &configDir); */
+
+    cmd_OpenConfigFile(AFSDIR_SERVER_CONFIG_FILE_FILEPATH);
+    cmd_SetCommandName("fileserver");
+
     if (cmd_OptionPresent(opts, OPT_large)
        && cmd_OptionPresent(opts, OPT_small)) {
        printf("Only one of -L or -S must be specified\n");
@@ -1336,7 +1341,6 @@ ParseArgs(int argc, char *argv[])
        optstring = NULL;
     }
 
-    /* XXX - cmd_OptionAsString(opts, OPT_config, &configDir); */
     cmd_OptionAsInt(opts, OPT_debug, &LogLevel);
     /* XXX - cmd_OptionAsString(opts, OPT_logfile, &logFile); */
     cmd_OptionAsFlag(opts, OPT_mrafslogs, &mrafsStyleLogs);
index 3ced2cb..cbe4d5f 100644 (file)
@@ -267,6 +267,11 @@ main(int argc, char **argv)
     if (code)
        return -1;
 
+    cmd_OptionAsString(opts, OPT_config, &configDir);
+
+    cmd_OpenConfigFile(AFSDIR_SERVER_CONFIG_FILE_FILEPATH);
+    cmd_SetCommandName("vlserver");
+
     /* vlserver options */
     cmd_OptionAsFlag(opts, OPT_noauth, &noAuth);
     cmd_OptionAsFlag(opts, OPT_smallmem, &smallMem);
@@ -289,7 +294,6 @@ main(int argc, char **argv)
        free(interface);
     }
 
-    cmd_OptionAsString(opts, OPT_config, &configDir);
     cmd_OptionAsInt(opts, OPT_debug, &LogLevel);
     cmd_OptionAsString(opts, OPT_database, &vl_dbaseName);
     cmd_OptionAsString(opts, OPT_logfile, &logFile);