linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfsidmap: Allow verbosity level to be set in the config file.
@ 2012-05-22 19:38 Steve Dickson
  2012-05-29 19:17 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Dickson @ 2012-05-22 19:38 UTC (permalink / raw)
  To: Linux NFS Mailing list

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 |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c
index cf11551..86cddd1 100644
--- a/utils/nfsidmap/nfsidmap.c
+++ b/utils/nfsidmap/nfsidmap.c
@@ -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;		
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nfsidmap: Allow verbosity level to be set in the config file.
  2012-05-22 19:38 [PATCH] nfsidmap: Allow verbosity level to be set in the config file Steve Dickson
@ 2012-05-29 19:17 ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2012-05-29 19:17 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Linux NFS Mailing list



On 05/22/2012 03:38 PM, Steve Dickson wrote:
> 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>
Committed...

steved.
> ---
>  utils/nfsidmap/nfsidmap.c |   19 ++++++++++++++++++-
>  1 files changed, 18 insertions(+), 1 deletions(-)
> 
> diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c
> index cf11551..86cddd1 100644
> --- a/utils/nfsidmap/nfsidmap.c
> +++ b/utils/nfsidmap/nfsidmap.c
> @@ -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;		

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-29 19:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-22 19:38 [PATCH] nfsidmap: Allow verbosity level to be set in the config file Steve Dickson
2012-05-29 19:17 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).