Skip to contentSkip to conversation

nfsidmap: Allow verbosity level to be set in the config file.

PATCH In review Steve Dickson 1 participant 2 messages May 22, 2012 – May 29, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfsidmap: Allow verbosity level to be set in the config file.

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

---
 utils/nfsidmap/nfsidmap.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
utils/nfsidmap/nfsidmap.c +18 -1
index cf11551..86cddd1 100644
@@ -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,12 +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
+ */
+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
  */
 int id_lookup(char *name_at_domain, key_serial_t key, int type)
@@ -266,7 +281,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;		
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 5 lines · Steve Dickson

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

Committed...

steved.

Quoted 54 lines
---
 utils/nfsidmap/nfsidmap.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
utils/nfsidmap/nfsidmap.c +18 -1
index cf11551..86cddd1 100644
@@ -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,12 +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
+ */
+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
  */
 int id_lookup(char *name_at_domain, key_serial_t key, int type)
@@ -266,7 +281,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;