]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
nfsidmap: Allow verbosity level to be set in the config file
authorSteve Dickson <steved@redhat.com>
Tue, 29 May 2012 18:27:24 +0000 (14:27 -0400)
committerSteve Dickson <steved@redhat.com>
Tue, 29 May 2012 18:44:18 +0000 (14:44 -0400)
To make it easier to enable ID mapping debugging, nfsidmap
should read /etc/idmap.conf to see if the verbosity level
is set, similar to what rpc.idmapd does

Signed-off-by: Steve Dickson <steved@redhat.com>
utils/nfsidmap/nfsidmap.c

index cf1155188851836fcd0ef38934afd9d9f8244cb9..b767395fba10effb198b2217583459de51b3b611 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <unistd.h>
 #include "xlog.h"
+#include "conffile.h"
 
 int verbose = 0;
 char *usage="Usage: %s [-v] [-c || [-u|-g|-r key] || [-t timeout] key desc]";
@@ -26,11 +27,26 @@ char *usage="Usage: %s [-v] [-c || [-u|-g|-r key] || [-t timeout] key desc]";
 #define DEFAULT_KEYRING "id_resolver"
 #endif
 
+#ifndef PATH_IDMAPDCONF
+#define PATH_IDMAPDCONF "/etc/idmapd.conf"
+#endif
+
 static int keyring_clear(char *keyring);
 
 #define UIDKEYS 0x1
 #define GIDKEYS 0x2
 
+/*
+ * Check to the config file for the verbosity level
+ */
+int
+get_config_verbose(char *path)
+{
+       conf_path = path;
+       conf_init();
+       return conf_get_num("General", "Verbosity", 0);
+}
+
 /*
  * Find either a user or group id based on the name@domain string
  */
@@ -266,7 +282,9 @@ int main(int argc, char **argv)
                        break;
                }
        }
-
+       if (!verbose) {
+               verbose = get_config_verbose(PATH_IDMAPDCONF);
+       }
        if (keystr) {
                rc = key_revoke(keystr, keymask);
                return rc;