All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils
@ 2017-09-13 13:58 Justin Mitchell
  2017-09-13 14:00 ` [PATCH 1/7] nfs-utils: const-ify the config handling functions Justin Mitchell
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Justin Mitchell @ 2017-09-13 13:58 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Bruce Fields

It was suggested that merging the trees is more desirable than splitting
the common code out into a shared library, so this patch set attempts to
merge the libnfsidmap code into nfs-utils.

The main body of the code, copyright notices, and readme are copied
across, omitting the shared conffile code, and trimming unused files
like strlcpy.c and queue.h. The build files of both are adjusted to the
new structure, and the dependent nfs-utils now link to the included
shared library instead of an external one.

The source libnfsidmap tree did include some packaging files for
debian/dkpg which have been omitted, there are no packaging materials in
nfs-utils to merge them with, and i welcome advice on what should be
done here.



Justin Mitchell (7):
  nfs-utils: const-ify the config handling functions
  nfs-utils: Merge conf_get_str and conf_get_section
  nfs-utils: Add get_str with default value
  nfs-utils: split conffile to a separate convenience lib
  nfs-utils: Import libnfsidmap codebase
  nfs-utils: integrate libnfsidmap code with rest of nfs-utils
  nfs-utils: cleanup warnings from merged libnfsidmap code

 configure.ac                          |   50 +-
 support/include/conffile.h            |   23 +-
 support/nfs/Makefile.am               |   13 +-
 support/nfs/conffile.c                |   85 +--
 support/nfs/xlog.c                    |    2 +
 utils/Makefile.am                     |    3 +-
 utils/blkmapd/Makefile.am             |    2 +-
 utils/exportfs/Makefile.am            |    2 +-
 utils/gssd/Makefile.am                |    7 +-
 utils/idmapd/Makefile.am              |    4 +-
 utils/libnfsidmap/AUTHORS             |    1 +
 utils/libnfsidmap/COPYING             |   30 +
 utils/libnfsidmap/Makefile.am         |   61 ++
 utils/libnfsidmap/README              |  126 ++++
 utils/libnfsidmap/gums.c              |  788 ++++++++++++++++++++
 utils/libnfsidmap/idmapd.conf         |  137 ++++
 utils/libnfsidmap/idmapd.conf.5       |  308 ++++++++
 utils/libnfsidmap/libnfsidmap.c       |  712 ++++++++++++++++++
 utils/libnfsidmap/libnfsidmap.pc.in   |   11 +
 utils/libnfsidmap/libtest.c           |  160 ++++
 utils/libnfsidmap/nfs4_uid_to_name.3  |  174 +++++
 utils/libnfsidmap/nfsidmap.h          |   67 ++
 utils/libnfsidmap/nfsidmap_internal.h |   79 ++
 utils/libnfsidmap/nss.c               |  468 ++++++++++++
 utils/libnfsidmap/static.c            |  413 +++++++++++
 utils/libnfsidmap/umich_ldap.c        | 1303 +++++++++++++++++++++++++++++++++
 utils/mount/Makefile.am               |    2 +-
 utils/mountd/Makefile.am              |    2 +-
 utils/nfsd/Makefile.am                |    2 +-
 utils/nfsdcltrack/Makefile.am         |    2 +-
 utils/nfsidmap/Makefile.am            |    4 +-
 utils/statd/Makefile.am               |    4 +-
 32 files changed, 4967 insertions(+), 78 deletions(-)
 create mode 100644 utils/libnfsidmap/AUTHORS
 create mode 100644 utils/libnfsidmap/COPYING
 create mode 100644 utils/libnfsidmap/Makefile.am
 create mode 100644 utils/libnfsidmap/README
 create mode 100644 utils/libnfsidmap/gums.c
 create mode 100644 utils/libnfsidmap/idmapd.conf
 create mode 100644 utils/libnfsidmap/idmapd.conf.5
 create mode 100644 utils/libnfsidmap/libnfsidmap.c
 create mode 100644 utils/libnfsidmap/libnfsidmap.pc.in
 create mode 100644 utils/libnfsidmap/libtest.c
 create mode 100644 utils/libnfsidmap/nfs4_uid_to_name.3
 create mode 100644 utils/libnfsidmap/nfsidmap.h
 create mode 100644 utils/libnfsidmap/nfsidmap_internal.h
 create mode 100644 utils/libnfsidmap/nss.c
 create mode 100644 utils/libnfsidmap/static.c
 create mode 100644 utils/libnfsidmap/umich_ldap.c

-- 
1.8.3.1



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

* [PATCH 1/7] nfs-utils: const-ify the config handling functions
  2017-09-13 13:58 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils Justin Mitchell
@ 2017-09-13 14:00 ` Justin Mitchell
  2017-09-13 14:01 ` [PATCH 2/7] nfs-utils: Merge conf_get_str and conf_get_section Justin Mitchell
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Justin Mitchell @ 2017-09-13 14:00 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Bruce Fields

Tighten up the conffile interface by switching to const
arguments where appropriate.

Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
 support/include/conffile.h | 22 +++++++++++-----------
 support/nfs/conffile.c     | 38 +++++++++++++++++++-------------------
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/support/include/conffile.h b/support/include/conffile.h
index 2d11a52..0e7fa8b 100644
--- a/support/include/conffile.h
+++ b/support/include/conffile.h
@@ -49,21 +49,21 @@ struct conf_list {
 };
 
 extern int      conf_begin(void);
-extern int      conf_decode_base64(uint8_t *, uint32_t *, unsigned char *);
+extern int      conf_decode_base64(uint8_t *, uint32_t *, const unsigned char *);
 extern int      conf_end(int, int);
 extern void     conf_free_list(struct conf_list *);
-extern struct sockaddr *conf_get_address(char *, char *);
-extern struct conf_list *conf_get_list(char *, char *);
-extern struct conf_list *conf_get_tag_list(char *, char *);
-extern int      conf_get_num(char *, char *, int);
-extern _Bool    conf_get_bool(char *, char *, _Bool);
-extern char    *conf_get_str(char *, char *);
-extern char    *conf_get_section(char *, char *, char *);
+extern struct sockaddr *conf_get_address(const char *, const char *);
+extern struct conf_list *conf_get_list(const char *, const char *);
+extern struct conf_list *conf_get_tag_list(const char *, const char *);
+extern int      conf_get_num(const char *, const char *, int);
+extern _Bool    conf_get_bool(const char *, const char *, _Bool);
+extern char    *conf_get_str(const char *, const char *);
+extern char    *conf_get_section(const char *, const char *, const char *);
 extern void     conf_init(const char *);
 extern void     conf_cleanup(void);
-extern int      conf_match_num(char *, char *, int);
-extern int      conf_remove(int, char *, char *);
-extern int      conf_remove_section(int, char *);
+extern int      conf_match_num(const char *, const char *, int);
+extern int      conf_remove(int, const char *, const char *);
+extern int      conf_remove_section(int, const char *);
 extern void     conf_report(void);
 
 /*
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index 8690218..4323fbb 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -57,8 +57,8 @@
 
 static void conf_load_defaults(void);
 static char * conf_load(const char *path);
-static int conf_set(int , char *, char *, char *, 
-	char *, int , int );
+static int conf_set(int , const char *, const char *, const char *, 
+	const char *, int , int );
 static void conf_parse(int trans, char *buf, 
 	char **section, char **subsection);
 
@@ -116,7 +116,7 @@ struct conf_binding {
 LIST_HEAD (conf_bindings, conf_binding) conf_bindings[256];
 
 static __inline__ uint8_t
-conf_hash(char *s)
+conf_hash(const char *s)
 {
 	uint8_t hash = 0;
 
@@ -131,7 +131,7 @@ conf_hash(char *s)
  * Insert a tag-value combination from LINE (the equal sign is at POS)
  */
 static int
-conf_remove_now(char *section, char *tag)
+conf_remove_now(const char *section, const char *tag)
 {
 	struct conf_binding *cb, *next;
 
@@ -154,7 +154,7 @@ conf_remove_now(char *section, char *tag)
 }
 
 static int
-conf_remove_section_now(char *section)
+conf_remove_section_now(const char *section)
 {
   struct conf_binding *cb, *next;
   int unseen = 1;
@@ -181,8 +181,8 @@ conf_remove_section_now(char *section)
  * into SECTION of our configuration database.
  */
 static int
-conf_set_now(char *section, char *arg, char *tag, 
-	char *value, int override, int is_default)
+conf_set_now(const char *section, const char *arg, const char *tag, 
+	const char *value, int override, int is_default)
 {
 	struct conf_binding *node = 0;
 
@@ -565,7 +565,7 @@ conf_cleanup(void)
  * if that tag does not exist.
  */
 int
-conf_get_num(char *section, char *tag, int def)
+conf_get_num(const char *section, const char *tag, int def)
 {
 	char *value = conf_get_str(section, tag);
 
@@ -583,7 +583,7 @@ conf_get_num(char *section, char *tag, int def)
  * A failure to match one of these results in DEF
  */
 _Bool
-conf_get_bool(char *section, char *tag, _Bool def)
+conf_get_bool(const char *section, const char *tag, _Bool def)
 {
 	char *value = conf_get_str(section, tag);
 
@@ -609,7 +609,7 @@ conf_get_bool(char *section, char *tag, _Bool def)
 
 /* Validate X according to the range denoted by TAG in section SECTION.  */
 int
-conf_match_num(char *section, char *tag, int x)
+conf_match_num(const char *section, const char *tag, int x)
 {
 	char *value = conf_get_str (section, tag);
 	int val, min, max, n;
@@ -634,7 +634,7 @@ conf_match_num(char *section, char *tag, int x)
 
 /* Return the string value denoted by TAG in section SECTION.  */
 char *
-conf_get_str(char *section, char *tag)
+conf_get_str(const char *section, const char *tag)
 {
 	struct conf_binding *cb;
 retry:
@@ -662,7 +662,7 @@ retry:
  * Find a section that may or may not have an argument
  */
 char *
-conf_get_section(char *section, char *arg, char *tag)
+conf_get_section(const char *section, const char *arg, const char *tag)
 {
 	struct conf_binding *cb;
 
@@ -684,7 +684,7 @@ conf_get_section(char *section, char *arg, char *tag)
  * TAG in SECTION.
  */
 struct conf_list *
-conf_get_list(char *section, char *tag)
+conf_get_list(const char *section, const char *tag)
 {
 	char *liststr = 0, *p, *field, *t;
 	struct conf_list *list = 0;
@@ -738,7 +738,7 @@ cleanup:
 }
 
 struct conf_list *
-conf_get_tag_list(char *section, char *arg)
+conf_get_tag_list(const char *section, const char *arg)
 {
 	struct conf_list *list = 0;
 	struct conf_list_node *node;
@@ -776,7 +776,7 @@ cleanup:
 
 /* Decode a PEM encoded buffer.  */
 int
-conf_decode_base64 (uint8_t *out, uint32_t *len, unsigned char *buf)
+conf_decode_base64 (uint8_t *out, uint32_t *len, const unsigned char *buf)
 {
 	uint32_t c = 0;
 	uint8_t c1, c2, c3, c4;
@@ -873,8 +873,8 @@ conf_trans_node(int transaction, enum conf_op op)
 
 /* Queue a set operation.  */
 static int
-conf_set(int transaction, char *section, char *arg,
-	char *tag, char *value, int override, int is_default)
+conf_set(int transaction, const char *section, const char *arg,
+	const char *tag, const char *value, int override, int is_default)
 {
 	struct conf_trans *node;
 
@@ -926,7 +926,7 @@ fail:
 
 /* Queue a remove operation.  */
 int
-conf_remove(int transaction, char *section, char *tag)
+conf_remove(int transaction, const char *section, const char *tag)
 {
 	struct conf_trans *node;
 
@@ -955,7 +955,7 @@ fail:
 
 /* Queue a remove section operation.  */
 int
-conf_remove_section(int transaction, char *section)
+conf_remove_section(int transaction, const char *section)
 {
 	struct conf_trans *node;
 
-- 
1.8.3.1




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

* [PATCH 2/7] nfs-utils: Merge conf_get_str and conf_get_section
  2017-09-13 13:58 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils Justin Mitchell
  2017-09-13 14:00 ` [PATCH 1/7] nfs-utils: const-ify the config handling functions Justin Mitchell
@ 2017-09-13 14:01 ` Justin Mitchell
  2017-09-13 14:02 ` [PATCH 3/7] nfs-utils: Add get_str with default value Justin Mitchell
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Justin Mitchell @ 2017-09-13 14:01 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Bruce Fields

conf_get_section() started as conf_get_str() with one extra search
parameter, subsequent patches have not maintained feature parity,
combine the code to make a single more generic function and just call
that differently where required.

Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
 support/nfs/conffile.c | 36 ++++++++++++++----------------------
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index 4323fbb..8239d66 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -636,28 +636,9 @@ conf_match_num(const char *section, const char *tag, int x)
 char *
 conf_get_str(const char *section, const char *tag)
 {
-	struct conf_binding *cb;
-retry:
-	cb = LIST_FIRST (&conf_bindings[conf_hash (section)]);
-	for (; cb; cb = LIST_NEXT (cb, link)) {
-		if (strcasecmp (section, cb->section) == 0
-		    && strcasecmp (tag, cb->tag) == 0) {
-			if (cb->value[0] == '$') {
-				/* expand $name from [environment] section,
-				 * or from environment
-				 */
-				char *env = getenv(cb->value+1);
-				if (env && *env)
-					return env;
-				section = "environment";
-				tag = cb->value + 1;
-				goto retry;
-			}
-			return cb->value;
-		}
-	}
-	return 0;
+	return conf_get_section(section, NULL, tag);
 }
+
 /*
  * Find a section that may or may not have an argument
  */
@@ -665,7 +646,7 @@ char *
 conf_get_section(const char *section, const char *arg, const char *tag)
 {
 	struct conf_binding *cb;
-
+retry:
 	cb = LIST_FIRST (&conf_bindings[conf_hash (section)]);
 	for (; cb; cb = LIST_NEXT (cb, link)) {
 		if (strcasecmp(section, cb->section) != 0)
@@ -674,6 +655,17 @@ conf_get_section(const char *section, const char *arg, const char *tag)
 			continue;
 		if (strcasecmp(tag, cb->tag) != 0)
 			continue;
+		if (cb->value[0] == '$') {
+			/* expand $name from [environment] section,
+			 * or from environment
+			 */
+			char *env = getenv(cb->value+1);
+			if (env && *env)
+				return env;
+			section = "environment";
+			tag = cb->value + 1;
+			goto retry;
+		}
 		return cb->value;
 	}
 	return 0;
-- 
1.8.3.1




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

* [PATCH 3/7] nfs-utils: Add get_str with default value
  2017-09-13 13:58 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils Justin Mitchell
  2017-09-13 14:00 ` [PATCH 1/7] nfs-utils: const-ify the config handling functions Justin Mitchell
  2017-09-13 14:01 ` [PATCH 2/7] nfs-utils: Merge conf_get_str and conf_get_section Justin Mitchell
@ 2017-09-13 14:02 ` Justin Mitchell
  2017-09-13 14:03 ` [PATCH 4/7] nfs-utils: split conffile to a separate convenience lib Justin Mitchell
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Justin Mitchell @ 2017-09-13 14:02 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Bruce Fields

The similar config code in libnfsidmap had one additional feature of
a get_str function with a default value option, include an equivalent
function here to maintain compatibility.

Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
 support/include/conffile.h |  1 +
 support/nfs/conffile.c     | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/support/include/conffile.h b/support/include/conffile.h
index 0e7fa8b..d4cb6b4 100644
--- a/support/include/conffile.h
+++ b/support/include/conffile.h
@@ -58,6 +58,7 @@ extern struct conf_list *conf_get_tag_list(const char *, const char *);
 extern int      conf_get_num(const char *, const char *, int);
 extern _Bool    conf_get_bool(const char *, const char *, _Bool);
 extern char    *conf_get_str(const char *, const char *);
+extern char    *conf_get_str_with_def(const char *, const char *, char *);
 extern char    *conf_get_section(const char *, const char *, const char *);
 extern void     conf_init(const char *);
 extern void     conf_cleanup(void);
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index 8239d66..d2f9441 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -639,6 +639,17 @@ conf_get_str(const char *section, const char *tag)
 	return conf_get_section(section, NULL, tag);
 }
 
+/* Return the string value denoted by TAG in section SECTION,
+ * unless it is not set, in which case return def
+ */
+char *
+conf_get_str_with_def(const char *section, const char *tag, char *def)
+{
+	char * result = conf_get_section(section, NULL, tag);
+	if (!result) return def;
+	return result;
+}
+
 /*
  * Find a section that may or may not have an argument
  */
-- 
1.8.3.1





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

* [PATCH 4/7] nfs-utils: split conffile to a separate convenience lib
  2017-09-13 13:58 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils Justin Mitchell
                   ` (2 preceding siblings ...)
  2017-09-13 14:02 ` [PATCH 3/7] nfs-utils: Add get_str with default value Justin Mitchell
@ 2017-09-13 14:03 ` Justin Mitchell
  2017-09-13 14:06 ` [PATCH 6/7] nfs-utils: integrate libnfsidmap code with rest of nfs-utils Justin Mitchell
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Justin Mitchell @ 2017-09-13 14:03 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Bruce Fields

To allow better reuse of the code we split conffile and xlog
into their own separate convenience library, then merge it
back so as to not create extra dependancies for everything

Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
 support/nfs/Makefile.am       | 13 +++++++++----
 support/nfs/xlog.c            |  2 ++
 utils/blkmapd/Makefile.am     |  2 +-
 utils/exportfs/Makefile.am    |  2 +-
 utils/gssd/Makefile.am        |  4 ++--
 utils/idmapd/Makefile.am      |  2 +-
 utils/mount/Makefile.am       |  2 +-
 utils/mountd/Makefile.am      |  2 +-
 utils/nfsd/Makefile.am        |  2 +-
 utils/nfsdcltrack/Makefile.am |  2 +-
 utils/nfsidmap/Makefile.am    |  2 +-
 utils/statd/Makefile.am       |  4 ++--
 12 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/support/nfs/Makefile.am b/support/nfs/Makefile.am
index b74c870..c037c46 100644
--- a/support/nfs/Makefile.am
+++ b/support/nfs/Makefile.am
@@ -1,11 +1,16 @@
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libnfs.a
-libnfs_a_SOURCES = exports.c rmtab.c xio.c rpcmisc.c rpcdispatch.c \
-		   xlog.c xcommon.c wildmat.c mydaemon.c \
+noinst_LIBRARIES = 
+noinst_LTLIBRARIES = libnfs.la libnfsconf.la
+
+libnfs_la_SOURCES = exports.c rmtab.c xio.c rpcmisc.c rpcdispatch.c \
+		   xcommon.c wildmat.c mydaemon.c \
 		   rpc_socket.c getport.c \
-		   svc_socket.c cacheio.c closeall.c nfs_mntent.c conffile.c \
+		   svc_socket.c cacheio.c closeall.c nfs_mntent.c \
 		   svc_create.c atomicio.c strlcpy.c strlcat.c
+libnfs_la_LIBADD = libnfsconf.la
+
+libnfsconf_la_SOURCES = conffile.c xlog.c
 
 MAINTAINERCLEANFILES = Makefile.in
 
diff --git a/support/nfs/xlog.c b/support/nfs/xlog.c
index c8e4263..f75a9ab 100644
--- a/support/nfs/xlog.c
+++ b/support/nfs/xlog.c
@@ -33,6 +33,8 @@
 
 #undef	VERBOSE_PRINTF
 
+#pragma GCC visibility push(hidden)
+
 static int  log_stderr = 1;
 static int  log_syslog = 1;
 static int  logging = 0;		/* enable/disable DEBUG logs	*/
diff --git a/utils/blkmapd/Makefile.am b/utils/blkmapd/Makefile.am
index 203f9f2..56c8a4b 100644
--- a/utils/blkmapd/Makefile.am
+++ b/utils/blkmapd/Makefile.am
@@ -13,7 +13,7 @@ blkmapd_SOURCES = \
 	dm-device.c \
 	device-discovery.h
 
-blkmapd_LDADD = -ldevmapper ../../support/nfs/libnfs.a
+blkmapd_LDADD = -ldevmapper ../../support/nfs/libnfs.la
 
 MAINTAINERCLEANFILES = Makefile.in
 
diff --git a/utils/exportfs/Makefile.am b/utils/exportfs/Makefile.am
index d0226fc..4b29161 100644
--- a/utils/exportfs/Makefile.am
+++ b/utils/exportfs/Makefile.am
@@ -8,7 +8,7 @@ EXTRA_DIST	= $(man5_MANS) $(man7_MANS) $(man8_MANS)
 sbin_PROGRAMS	= exportfs
 exportfs_SOURCES = exportfs.c
 exportfs_LDADD = ../../support/export/libexport.a \
-	       	 ../../support/nfs/libnfs.a \
+	       	 ../../support/nfs/libnfs.la \
 		 ../../support/misc/libmisc.a \
 		 $(LIBWRAP) $(LIBNSL)
 
diff --git a/utils/gssd/Makefile.am b/utils/gssd/Makefile.am
index 3f5f59a..09a455e 100644
--- a/utils/gssd/Makefile.am
+++ b/utils/gssd/Makefile.am
@@ -44,7 +44,7 @@ gssd_SOURCES = \
 	write_bytes.h
 
 gssd_LDADD = \
-	../../support/nfs/libnfs.a \
+	../../support/nfs/libnfs.la \
 	$(LIBEVENT) \
 	$(RPCSECGSS_LIBS) \
 	$(KRBLIBS) \
@@ -74,7 +74,7 @@ svcgssd_SOURCES = \
 	svcgssd.h
 
 svcgssd_LDADD = \
-	../../support/nfs/libnfs.a \
+	../../support/nfs/libnfs.la \
 	$(RPCSECGSS_LIBS) $(LIBNFSIDMAP) \
 	$(KRBLIBS) $(GSSAPI_LIBS) $(LIBTIRPC)
 
diff --git a/utils/idmapd/Makefile.am b/utils/idmapd/Makefile.am
index 1e8e9e6..b4cac93 100644
--- a/utils/idmapd/Makefile.am
+++ b/utils/idmapd/Makefile.am
@@ -15,7 +15,7 @@ idmapd_SOURCES = \
 	nfs_idmap.h \
 	queue.h
 
-idmapd_LDADD = ../../support/nfs/libnfs.a $(LIBEVENT) $(LIBNFSIDMAP)
+idmapd_LDADD = ../../support/nfs/libnfs.la $(LIBEVENT) $(LIBNFSIDMAP)
 
 MAINTAINERCLEANFILES = Makefile.in
 
diff --git a/utils/mount/Makefile.am b/utils/mount/Makefile.am
index e24f3bd..7b97c31 100644
--- a/utils/mount/Makefile.am
+++ b/utils/mount/Makefile.am
@@ -25,7 +25,7 @@ else
 EXTRA_DIST += nfsmount.conf.man
 endif
 
-mount_nfs_LDADD = ../../support/nfs/libnfs.a \
+mount_nfs_LDADD = ../../support/nfs/libnfs.la \
 		  ../../support/export/libexport.a \
 		  $(LIBTIRPC)
 
diff --git a/utils/mountd/Makefile.am b/utils/mountd/Makefile.am
index 9e1ab5c..153a90a 100644
--- a/utils/mountd/Makefile.am
+++ b/utils/mountd/Makefile.am
@@ -11,7 +11,7 @@ noinst_HEADERS = fsloc.h
 mountd_SOURCES = mountd.c mount_dispatch.c auth.c rmtab.c cache.c \
 		 svc_run.c fsloc.c v4root.c mountd.h
 mountd_LDADD = ../../support/export/libexport.a \
-	       ../../support/nfs/libnfs.a \
+	       ../../support/nfs/libnfs.la \
 	       ../../support/misc/libmisc.a \
 	       $(LIBBSD) $(LIBWRAP) $(LIBNSL) $(LIBBLKID) $(LIBDL) $(LIBTIRPC)
 mountd_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) \
diff --git a/utils/nfsd/Makefile.am b/utils/nfsd/Makefile.am
index 39a6e6f..8acc9a0 100644
--- a/utils/nfsd/Makefile.am
+++ b/utils/nfsd/Makefile.am
@@ -9,7 +9,7 @@ sbin_PROGRAMS	= nfsd
 
 noinst_HEADERS = nfssvc.h
 nfsd_SOURCES = nfsd.c nfssvc.c
-nfsd_LDADD = ../../support/nfs/libnfs.a $(LIBTIRPC)
+nfsd_LDADD = ../../support/nfs/libnfs.la $(LIBTIRPC)
 
 MAINTAINERCLEANFILES = Makefile.in
 
diff --git a/utils/nfsdcltrack/Makefile.am
b/utils/nfsdcltrack/Makefile.am
index 0a2858f..2f7fe3d 100644
--- a/utils/nfsdcltrack/Makefile.am
+++ b/utils/nfsdcltrack/Makefile.am
@@ -13,7 +13,7 @@ sbin_PROGRAMS	= nfsdcltrack
 noinst_HEADERS	= sqlite.h
 
 nfsdcltrack_SOURCES = nfsdcltrack.c sqlite.c
-nfsdcltrack_LDADD = ../../support/nfs/libnfs.a $(LIBSQLITE) $(LIBCAP)
+nfsdcltrack_LDADD = ../../support/nfs/libnfs.la $(LIBSQLITE) $(LIBCAP)
 
 MAINTAINERCLEANFILES = Makefile.in
 
diff --git a/utils/nfsidmap/Makefile.am b/utils/nfsidmap/Makefile.am
index 91cedfd..8af22d0 100644
--- a/utils/nfsidmap/Makefile.am
+++ b/utils/nfsidmap/Makefile.am
@@ -4,7 +4,7 @@ man8_MANS = nfsidmap.man
 sbin_PROGRAMS	= nfsidmap
 
 nfsidmap_SOURCES = nfsidmap.c
-nfsidmap_LDADD = $(LIBNFSIDMAP) -lkeyutils ../../support/nfs/libnfs.a
+nfsidmap_LDADD = $(LIBNFSIDMAP) -lkeyutils ../../support/nfs/libnfs.la
 
 MAINTAINERCLEANFILES = Makefile.in
 EXTRA_DIST = id_resolver.conf $(man8_MANS)
diff --git a/utils/statd/Makefile.am b/utils/statd/Makefile.am
index ea32075..6facc15 100644
--- a/utils/statd/Makefile.am
+++ b/utils/statd/Makefile.am
@@ -13,11 +13,11 @@ sm_notify_SOURCES = sm-notify.c
 
 BUILT_SOURCES = $(GENFILES)
 statd_LDADD = ../../support/nsm/libnsm.a \
-	      ../../support/nfs/libnfs.a \
+	      ../../support/nfs/libnfs.la \
 	      ../../support/misc/libmisc.a \
 	      $(LIBWRAP) $(LIBNSL) $(LIBCAP) $(LIBTIRPC)
 sm_notify_LDADD = ../../support/nsm/libnsm.a \
-		  ../../support/nfs/libnfs.a \
+		  ../../support/nfs/libnfs.la \
 	          ../../support/misc/libmisc.a \
 		  $(LIBNSL) $(LIBCAP) $(LIBTIRPC)
 
-- 
1.8.3.1




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

* [PATCH 6/7] nfs-utils: integrate libnfsidmap code with rest of nfs-utils
  2017-09-13 13:58 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils Justin Mitchell
                   ` (3 preceding siblings ...)
  2017-09-13 14:03 ` [PATCH 4/7] nfs-utils: split conffile to a separate convenience lib Justin Mitchell
@ 2017-09-13 14:06 ` Justin Mitchell
  2017-09-13 14:06 ` [PATCH 7/7] nfs-utils: cleanup warnings from merged libnfsidmap code Justin Mitchell
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Justin Mitchell @ 2017-09-13 14:06 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Bruce Fields

Modify libnfsidmap to use the now shared conffile code,
adjust the build structure to generate everything correctly,
and modify the other utils to use the merged version of libnfsidmap
instead of testing for an external dependancy.

Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
 configure.ac                    | 50 +++++++++++++++++++++++++++++++++++------
 utils/Makefile.am               |  3 +--
 utils/gssd/Makefile.am          |  3 ++-
 utils/idmapd/Makefile.am        |  4 +++-
 utils/libnfsidmap/Makefile.am   |  5 ++---
 utils/libnfsidmap/libnfsidmap.c |  5 +++--
 utils/libnfsidmap/nss.c         |  2 +-
 utils/libnfsidmap/static.c      |  5 ++---
 utils/libnfsidmap/umich_ldap.c  |  2 +-
 utils/nfsidmap/Makefile.am      |  4 +++-
 10 files changed, 61 insertions(+), 22 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1ca1603..a2f72af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -304,9 +304,6 @@ if test "$enable_nfsv4" = yes; then
   dnl check for libevent libraries and headers
   AC_LIBEVENT
 
-  dnl check for nfsidmap libraries and headers
-  AC_LIBNFSIDMAP
-
   dnl check for the keyutils libraries and headers
   AC_KEYUTILS
 
@@ -339,7 +336,6 @@ fi
 
 dnl enable nfsidmap when its support by libnfsidmap
 AM_CONDITIONAL(CONFIG_NFSDCLTRACK, [test "$enable_nfsdcltrack" = "yes" ])
-AM_CONDITIONAL(CONFIG_NFSIDMAP, [test "$ac_cv_header_keyutils_h$ac_cv_lib_nfsidmap_nfs4_owner_to_uid" = "yesyes"])
 
 
 if test "$knfsd_cv_glibc2" = no; then
@@ -382,9 +378,6 @@ if test "$enable_gss" = yes; then
   dnl check for libevent libraries and headers
   AC_LIBEVENT
 
-  dnl 'gss' also depends on nfsidmap.h - at least for svcgssd_proc.c
-  AC_LIBNFSIDMAP
-
   dnl Check for Kerberos V5
   AC_KERBEROS_V5
 
@@ -407,6 +400,47 @@ if test "$enable_gss" = yes; then
   fi
 fi
 
+dnl libdnsidmap specific checks
+AC_CHECK_LIB([resolv], [__res_querydomain], , AC_MSG_ERROR(res_querydomain needed))
+
+AC_ARG_ENABLE([ldap],
+	[AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:default=detect@:>@])])
+
+dnl will libdnsidmap support LDAP ?
+if test "x$enable_ldap" != "xno" ; then
+        AC_CHECK_HEADER([ldap.h],
+                [AC_CHECK_LIB([ldap], [ldap_initialize],
+                              [have_ldap="yes"],[have_ldap="no"])],
+                [have_ldap="no"])
+        if test "x$have_ldap" = "xyes" ; then
+                AC_DEFINE([ENABLE_LDAP], 1, [Enable LDAP Support])
+        elif test "x$enable_ldap$have_ldap" = "xyesno" ; then
+                AC_MSG_ERROR(LDAP support not found!)
+        fi
+fi
+AM_CONDITIONAL(ENABLE_LDAP, test "x$have_ldap" = "xyes")
+
+dnl Should we build gums mapping library?
+AC_ARG_ENABLE([gums],
+        [AS_HELP_STRING([--enable-gums],[Enable support for the GUMS mapping library @<:@default=false@:>@])])
+if test "x$enable_gums" = "xyes" ; then
+        AC_DEFINE([ENABLE_GUMS], 1, [Enable GUMS mapping library support])
+fi
+AM_CONDITIONAL(ENABLE_GUMS, test "x$enable_gums" = "xyes")
+
+dnl Where do the Plugins live
+AC_ARG_WITH(pluginpath,
+    [AS_HELP_STRING([--with-pluginpath=/foo],[Causes the library to look in /foo instead of /usr/lib/libnfsidmap for plugins
+    ])],
+    path_plugins=$withval,
+    path_plugins=""
+    )
+if test -n "$path_plugins" ; then
+        AC_DEFINE_UNQUOTED(PATH_PLUGINS, "$path_plugins",
+                [Define this to change the plugins path])
+fi
+AM_CONDITIONAL(PATH_PLUGINS, test -n "$path_plugins")
+
 dnl Check for IPv6 support
 AC_IPV6
 
@@ -550,6 +584,8 @@ AC_CONFIG_FILES([
 	utils/exportfs/Makefile
 	utils/gssd/Makefile
 	utils/idmapd/Makefile
+	utils/libnfsidmap/Makefile
+	utils/libnfsidmap/libnfsidmap.pc
 	utils/mount/Makefile
 	utils/mountd/Makefile
 	utils/nfsd/Makefile
diff --git a/utils/Makefile.am b/utils/Makefile.am
index b892dc8..7dfc13a 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -3,11 +3,10 @@
 OPTDIRS =
 
 if CONFIG_NFSV4
+OPTDIRS += libnfsidmap
 OPTDIRS += idmapd
-if CONFIG_NFSIDMAP
 OPTDIRS += nfsidmap
 endif
-endif
 
 if CONFIG_NFSV41
 OPTDIRS += blkmapd
diff --git a/utils/gssd/Makefile.am b/utils/gssd/Makefile.am
index 09a455e..dcfc8a7 100644
--- a/utils/gssd/Makefile.am
+++ b/utils/gssd/Makefile.am
@@ -75,7 +75,8 @@ svcgssd_SOURCES = \
 
 svcgssd_LDADD = \
 	../../support/nfs/libnfs.la \
-	$(RPCSECGSS_LIBS) $(LIBNFSIDMAP) \
+	../../utils/libnfsidmap/libnfsidmap.la \
+	$(RPCSECGSS_LIBS) \
 	$(KRBLIBS) $(GSSAPI_LIBS) $(LIBTIRPC)
 
 svcgssd_LDFLAGS = $(KRBLDFLAGS)
diff --git a/utils/idmapd/Makefile.am b/utils/idmapd/Makefile.am
index b4cac93..7bc11a8 100644
--- a/utils/idmapd/Makefile.am
+++ b/utils/idmapd/Makefile.am
@@ -15,7 +15,9 @@ idmapd_SOURCES = \
 	nfs_idmap.h \
 	queue.h
 
-idmapd_LDADD = ../../support/nfs/libnfs.la $(LIBEVENT) $(LIBNFSIDMAP)
+idmapd_LDADD = ../../support/nfs/libnfs.la \
+	       ../../utils/libnfsidmap/libnfsidmap.la \
+	       $(LIBEVENT)
 
 MAINTAINERCLEANFILES = Makefile.in
 
diff --git a/utils/libnfsidmap/Makefile.am b/utils/libnfsidmap/Makefile.am
index 85f19c8..458944f 100644
--- a/utils/libnfsidmap/Makefile.am
+++ b/utils/libnfsidmap/Makefile.am
@@ -1,4 +1,3 @@
-ACLOCAL_AMFLAGS = -I m4
 
 if ENABLE_LDAP
 UMICH_LDAP_LIB = umich_ldap.la
@@ -25,9 +24,9 @@ pkglib_LTLIBRARIES = nsswitch.la static.la $(UMICH_LDAP_LIB) $(GUMS_MAPPING_LIB)
 #  <age> 	The number of previous additional interfaces supported
 #  		by this library.
 
-libnfsidmap_la_SOURCES = libnfsidmap.c cfg.c strlcpy.c cfg.h nfsidmap_internal.h queue.h
+libnfsidmap_la_SOURCES = libnfsidmap.c nfsidmap_internal.h
 libnfsidmap_la_LDFLAGS = -version-info 3:0:3
-libnfsidmap_la_LIBADD = -ldl
+libnfsidmap_la_LIBADD = -ldl ../../support/nfs/libnfsconf.la
 
 nsswitch_la_SOURCES = nss.c
 nsswitch_la_LDFLAGS = -module -avoid-version
diff --git a/utils/libnfsidmap/libnfsidmap.c b/utils/libnfsidmap/libnfsidmap.c
index d484101..aa368b7 100644
--- a/utils/libnfsidmap/libnfsidmap.c
+++ b/utils/libnfsidmap/libnfsidmap.c
@@ -59,7 +59,7 @@
 
 #include "nfsidmap.h"
 #include "nfsidmap_internal.h"
-#include "cfg.h"
+#include "conffile.h"
 
 static char *default_domain;
 static struct conf_list *local_realms;
@@ -340,6 +340,7 @@ int nfs4_init_name_mapping(char *conffile)
 	char *nobody_user, *nobody_group;
 	char *nostrip;
 	char *reformatgroup;
+	char *conf_path;
 
 	/* XXX: need to be able to reload configurations... */
 	if (nfs4_plugins) /* already succesfully initialized */
@@ -348,7 +349,7 @@ int nfs4_init_name_mapping(char *conffile)
 		conf_path = conffile;
 	else
 		conf_path = PATH_IDMAPDCONF;
-	conf_init();
+	conf_init(conf_path);
 	default_domain = conf_get_str("General", "Domain");
 	if (default_domain == NULL) {
 		dflt = 1;
diff --git a/utils/libnfsidmap/nss.c b/utils/libnfsidmap/nss.c
index 82799ce..48215ff 100644
--- a/utils/libnfsidmap/nss.c
+++ b/utils/libnfsidmap/nss.c
@@ -48,7 +48,7 @@
 #include <ctype.h>
 #include "nfsidmap.h"
 #include "nfsidmap_internal.h"
-#include "cfg.h"
+#include "conffile.h"
 #include <syslog.h>
 
 /*
diff --git a/utils/libnfsidmap/static.c b/utils/libnfsidmap/static.c
index 9f587af..37b293b 100644
--- a/utils/libnfsidmap/static.c
+++ b/utils/libnfsidmap/static.c
@@ -41,8 +41,7 @@
 #include <errno.h>
 #include <err.h>
 
-#include "queue.h"
-#include "cfg.h"
+#include "conffile.h"
 #include "nfsidmap.h"
 #include "nfsidmap_internal.h"
 
@@ -317,7 +316,7 @@ static int static_init() {
 		LIST_INIT (&uid_mappings[i]);
 
 	//get all principals for which we have mappings
-	princ_list = conf_get_tag_list("Static");
+	princ_list = conf_get_tag_list("Static", NULL);
 
 	if (!princ_list) {
 		return -ENOENT;
diff --git a/utils/libnfsidmap/umich_ldap.c b/utils/libnfsidmap/umich_ldap.c
index 886fa0c..664f282 100644
--- a/utils/libnfsidmap/umich_ldap.c
+++ b/utils/libnfsidmap/umich_ldap.c
@@ -48,7 +48,7 @@
 #include <ldap.h>
 #include "nfsidmap.h"
 #include "nfsidmap_internal.h"
-#include "cfg.h"
+#include "conffile.h"
 
 /* attribute/objectclass default mappings */
 #define DEFAULT_UMICH_OBJCLASS_REMOTE_PERSON	"NFSv4RemotePerson"
diff --git a/utils/nfsidmap/Makefile.am b/utils/nfsidmap/Makefile.am
index 8af22d0..96e6c09 100644
--- a/utils/nfsidmap/Makefile.am
+++ b/utils/nfsidmap/Makefile.am
@@ -4,7 +4,9 @@ man8_MANS = nfsidmap.man
 sbin_PROGRAMS	= nfsidmap
 
 nfsidmap_SOURCES = nfsidmap.c
-nfsidmap_LDADD = $(LIBNFSIDMAP) -lkeyutils ../../support/nfs/libnfs.la
+nfsidmap_LDADD = -lkeyutils \
+		 ../../support/nfs/libnfs.la \
+		 ../../utils/libnfsidmap/libnfsidmap.la
 
 MAINTAINERCLEANFILES = Makefile.in
 EXTRA_DIST = id_resolver.conf $(man8_MANS)
-- 
1.8.3.1




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

* [PATCH 7/7] nfs-utils: cleanup warnings from merged libnfsidmap code
  2017-09-13 13:58 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils Justin Mitchell
                   ` (4 preceding siblings ...)
  2017-09-13 14:06 ` [PATCH 6/7] nfs-utils: integrate libnfsidmap code with rest of nfs-utils Justin Mitchell
@ 2017-09-13 14:06 ` Justin Mitchell
  2017-09-13 15:29 ` [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils J. Bruce Fields
       [not found] ` <1505311491.15819.27.camel@redhat.com>
  7 siblings, 0 replies; 10+ messages in thread
From: Justin Mitchell @ 2017-09-13 14:06 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Bruce Fields

Clean up a bunch of warnings about unused parameters,
signedness differences, etc that we inherited from
the merged libnfsidmap code.

Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
 utils/libnfsidmap/libnfsidmap.c       | 10 ++++++----
 utils/libnfsidmap/nfsidmap_internal.h |  7 +++++++
 utils/libnfsidmap/nss.c               |  6 +++---
 utils/libnfsidmap/static.c            | 20 +++++++++++---------
 utils/libnfsidmap/umich_ldap.c        | 11 ++++++-----
 5 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/utils/libnfsidmap/libnfsidmap.c b/utils/libnfsidmap/libnfsidmap.c
index aa368b7..c8b53ff 100644
--- a/utils/libnfsidmap/libnfsidmap.c
+++ b/utils/libnfsidmap/libnfsidmap.c
@@ -103,7 +103,7 @@ nfs4_idmap_log_function_t idmap_log_func = default_logger;
 
 static char * toupper_str(char *s)
 {
-	int i;
+	size_t i;
 	for (i=0; i < strlen(s); i++)
 		s[i] = toupper(s[i]);
 	return s;
@@ -128,7 +128,8 @@ static int id_as_chars(char *name, uid_t *id)
 static int dns_txt_query(char *domain, char **nfs4domain)
 {
 	char *txtname = NFS4DNSTXTREC;
-	char *msg, *answ, *eom, *mptr; 
+	unsigned char *msg, *eom, *mptr; 
+	char *answ;
 	int len, status = -1;
 	HEADER *hdr;
 	
@@ -323,7 +324,8 @@ out:
 		unload_plugins(plgns);
 	return ret;
 }
-void nfs4_cleanup_name_mapping()
+
+void nfs4_cleanup_name_mapping(void)
 {
 	if (nfs4_plugins)
 		unload_plugins(nfs4_plugins);
@@ -534,7 +536,7 @@ struct conf_list *get_local_realms(void)
 }
 
 int
-nfs4_get_default_domain(char *server, char *domain, size_t len)
+nfs4_get_default_domain(char *UNUSED(server), char *domain, size_t len)
 {
 	char *d = get_default_domain();
 
diff --git a/utils/libnfsidmap/nfsidmap_internal.h b/utils/libnfsidmap/nfsidmap_internal.h
index 6696f50..a327862 100644
--- a/utils/libnfsidmap/nfsidmap_internal.h
+++ b/utils/libnfsidmap/nfsidmap_internal.h
@@ -70,3 +70,10 @@ extern nfs4_idmap_log_function_t idmap_log_func;
 /* Level zero always prints, others print depending on verbosity level */
 #define IDMAP_LOG(LVL, MSG) \
 	do { if (LVL <= idmap_verbosity) (*idmap_log_func)MSG; } while (0)
+
+#ifdef __GNUC__
+#define UNUSED(foo) UNUSED_ ## foo __attribute__((__unused__))
+#else
+#define UNUSED(foo) UNUSED_ ## foo
+#endif
+
diff --git a/utils/libnfsidmap/nss.c b/utils/libnfsidmap/nss.c
index 48215ff..a86d768 100644
--- a/utils/libnfsidmap/nss.c
+++ b/utils/libnfsidmap/nss.c
@@ -379,7 +379,7 @@ out:
 
 static int nss_gss_princ_to_ids(char *secname, char *princ,
 				uid_t *uid, uid_t *gid,
-				extra_mapping_params **ex)
+				extra_mapping_params **UNUSED(ex))
 {
 	struct passwd *pw;
 	int err = 0;
@@ -429,7 +429,7 @@ out:
 
 int nss_gss_princ_to_grouplist(char *secname, char *princ,
 			       gid_t *groups, int *ngroups,
-			       extra_mapping_params **ex)
+			       extra_mapping_params **UNUSED(ex))
 {
 	struct passwd *pw;
 	int ret = -EINVAL;
@@ -462,7 +462,7 @@ struct trans_func nss_trans = {
 	.gss_princ_to_grouplist = nss_gss_princ_to_grouplist,
 };
 
-struct trans_func *libnfsidmap_plugin_init()
+struct trans_func *libnfsidmap_plugin_init(void)
 {
 	return (&nss_trans);
 }
diff --git a/utils/libnfsidmap/static.c b/utils/libnfsidmap/static.c
index 37b293b..488010d 100644
--- a/utils/libnfsidmap/static.c
+++ b/utils/libnfsidmap/static.c
@@ -92,7 +92,8 @@ static __inline__ u_int8_t gid_hash (gid_t gid)
 LIST_HEAD (uid_mappings, uid_mapping) uid_mappings[256];
 LIST_HEAD (gid_mappings, gid_mapping) gid_mappings[256];
 
-static struct passwd *static_getpwnam(const char *name, const char *domain,
+static struct passwd *static_getpwnam(const char *name, 
+				      const char *UNUSED(domain),
 				      int *err_p)
 {
 	struct passwd *pw;
@@ -142,8 +143,9 @@ err:
 	return NULL;
 }
 
-static struct group *static_getgrnam(const char *name, const char *domain,
-				      int *err_p)
+static struct group *static_getgrnam(const char *name, 
+				     const char *UNUSED(domain),
+				     int *err_p)
 {
 	struct group *gr;
 	struct grbuf *buf;
@@ -194,7 +196,7 @@ err:
 
 static int static_gss_princ_to_ids(char *secname, char *princ,
 				   uid_t *uid, uid_t *gid,
-				   extra_mapping_params **ex)
+				   extra_mapping_params **UNUSED(ex))
 {
 	struct passwd *pw;
 	int err;
@@ -216,7 +218,7 @@ static int static_gss_princ_to_ids(char *secname, char *princ,
 
 static int static_gss_princ_to_grouplist(char *secname, char *princ,
 					 gid_t *groups, int *ngroups,
-					 extra_mapping_params **ex)
+					 extra_mapping_params **UNUSED(ex))
 {
 	struct passwd *pw;
 	int err;
@@ -266,7 +268,7 @@ static int static_name_to_gid(char *name, gid_t *gid)
 	return -err;
 }
 
-static int static_uid_to_name(uid_t uid, char *domain, char *name, size_t len)
+static int static_uid_to_name(uid_t uid, char *UNUSED(domain), char *name, size_t UNUSED(len))
 {
 	struct uid_mapping * um;
 
@@ -281,7 +283,7 @@ static int static_uid_to_name(uid_t uid, char *domain, char *name, size_t len)
 	return -ENOENT;
 }
 
-static int static_gid_to_name(gid_t gid, char *domain, char *name, size_t len)
+static int static_gid_to_name(gid_t gid, char *UNUSED(domain), char *name, size_t UNUSED(len))
 {
 	struct gid_mapping * gm;
 
@@ -301,7 +303,7 @@ static int static_gid_to_name(gid_t gid, char *domain, char *name, size_t len)
  * uid_to_name functions will be fast enough.
  */
 
-static int static_init() {	
+static int static_init(void) {	
 	int err;
 	struct conf_list * princ_list = NULL;
 	struct conf_list_node * cln, *next;
@@ -404,7 +406,7 @@ struct trans_func static_trans = {
 	.gss_princ_to_grouplist	= static_gss_princ_to_grouplist,
 };
 
-struct trans_func *libnfsidmap_plugin_init()
+struct trans_func *libnfsidmap_plugin_init(void)
 {
 	return (&static_trans);
 }
diff --git a/utils/libnfsidmap/umich_ldap.c b/utils/libnfsidmap/umich_ldap.c
index 664f282..736f40f 100644
--- a/utils/libnfsidmap/umich_ldap.c
+++ b/utils/libnfsidmap/umich_ldap.c
@@ -970,7 +970,8 @@ out:
  */
 static int
 umichldap_gss_princ_to_ids(char *secname, char *principal,
-			   uid_t *uid, gid_t *gid, extra_mapping_params **ex)
+			   uid_t *uid, gid_t *gid, 
+			   extra_mapping_params **UNUSED(ex))
 {
 	uid_t rtnd_uid = -1;
 	gid_t rtnd_gid = -1;
@@ -1012,20 +1013,20 @@ umichldap_name_to_gid(char *name, gid_t *gid)
 }
 
 static int
-umichldap_uid_to_name(uid_t uid, char *domain, char *name, size_t len)
+umichldap_uid_to_name(uid_t uid, char *UNUSED(domain), char *name, size_t len)
 {
 	return umich_id_to_name(uid, IDTYPE_USER, &name, len, &ldap_info);
 }
 
 static int
-umichldap_gid_to_name(gid_t gid, char *domain, char *name, size_t len)
+umichldap_gid_to_name(gid_t gid, char *UNUSED(domain), char *name, size_t len)
 {
 	return umich_id_to_name(gid, IDTYPE_GROUP, &name, len, &ldap_info);
 }
 
 static int
 umichldap_gss_princ_to_grouplist(char *secname, char *principal,
-		gid_t *groups, int *ngroups, extra_mapping_params **ex)
+		gid_t *groups, int *ngroups, extra_mapping_params **UNUSED(ex))
 {
 	int err = -EINVAL;
 
@@ -1296,7 +1297,7 @@ struct trans_func umichldap_trans = {
 	.gss_princ_to_grouplist = umichldap_gss_princ_to_grouplist,
 };
 
-struct trans_func *libnfsidmap_plugin_init()
+struct trans_func *libnfsidmap_plugin_init(void)
 {
 	return (&umichldap_trans);
 }
-- 
1.8.3.1




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

* Re: [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils
  2017-09-13 13:58 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils Justin Mitchell
                   ` (5 preceding siblings ...)
  2017-09-13 14:06 ` [PATCH 7/7] nfs-utils: cleanup warnings from merged libnfsidmap code Justin Mitchell
@ 2017-09-13 15:29 ` J. Bruce Fields
       [not found] ` <1505311491.15819.27.camel@redhat.com>
  7 siblings, 0 replies; 10+ messages in thread
From: J. Bruce Fields @ 2017-09-13 15:29 UTC (permalink / raw)
  To: Justin Mitchell; +Cc: Steve Dickson, linux-nfs, Anibal Monsalve Salazar

On Wed, Sep 13, 2017 at 02:58:46PM +0100, Justin Mitchell wrote:
> It was suggested that merging the trees is more desirable than splitting
> the common code out into a shared library, so this patch set attempts to
> merge the libnfsidmap code into nfs-utils.
> 
> The main body of the code, copyright notices, and readme are copied
> across, omitting the shared conffile code, and trimming unused files
> like strlcpy.c and queue.h. The build files of both are adjusted to the
> new structure, and the dependent nfs-utils now link to the included
> shared library instead of an external one.
> 
> The source libnfsidmap tree did include some packaging files for
> debian/dkpg which have been omitted, there are no packaging materials in
> nfs-utils to merge them with, and i welcome advice on what should be
> done here.

If I'm reading things right, Anibal Monsalve Salazar is the relevant
Debian maintainer (cc'd).

Traditionally I think Debian maintainers have prefered that upstream not
attempt Debian packaging at all, so I imagine they'll be OK with
ditching it.

--b.

> 
> 
> 
> Justin Mitchell (7):
>   nfs-utils: const-ify the config handling functions
>   nfs-utils: Merge conf_get_str and conf_get_section
>   nfs-utils: Add get_str with default value
>   nfs-utils: split conffile to a separate convenience lib
>   nfs-utils: Import libnfsidmap codebase
>   nfs-utils: integrate libnfsidmap code with rest of nfs-utils
>   nfs-utils: cleanup warnings from merged libnfsidmap code
> 
>  configure.ac                          |   50 +-
>  support/include/conffile.h            |   23 +-
>  support/nfs/Makefile.am               |   13 +-
>  support/nfs/conffile.c                |   85 +--
>  support/nfs/xlog.c                    |    2 +
>  utils/Makefile.am                     |    3 +-
>  utils/blkmapd/Makefile.am             |    2 +-
>  utils/exportfs/Makefile.am            |    2 +-
>  utils/gssd/Makefile.am                |    7 +-
>  utils/idmapd/Makefile.am              |    4 +-
>  utils/libnfsidmap/AUTHORS             |    1 +
>  utils/libnfsidmap/COPYING             |   30 +
>  utils/libnfsidmap/Makefile.am         |   61 ++
>  utils/libnfsidmap/README              |  126 ++++
>  utils/libnfsidmap/gums.c              |  788 ++++++++++++++++++++
>  utils/libnfsidmap/idmapd.conf         |  137 ++++
>  utils/libnfsidmap/idmapd.conf.5       |  308 ++++++++
>  utils/libnfsidmap/libnfsidmap.c       |  712 ++++++++++++++++++
>  utils/libnfsidmap/libnfsidmap.pc.in   |   11 +
>  utils/libnfsidmap/libtest.c           |  160 ++++
>  utils/libnfsidmap/nfs4_uid_to_name.3  |  174 +++++
>  utils/libnfsidmap/nfsidmap.h          |   67 ++
>  utils/libnfsidmap/nfsidmap_internal.h |   79 ++
>  utils/libnfsidmap/nss.c               |  468 ++++++++++++
>  utils/libnfsidmap/static.c            |  413 +++++++++++
>  utils/libnfsidmap/umich_ldap.c        | 1303 +++++++++++++++++++++++++++++++++
>  utils/mount/Makefile.am               |    2 +-
>  utils/mountd/Makefile.am              |    2 +-
>  utils/nfsd/Makefile.am                |    2 +-
>  utils/nfsdcltrack/Makefile.am         |    2 +-
>  utils/nfsidmap/Makefile.am            |    4 +-
>  utils/statd/Makefile.am               |    4 +-
>  32 files changed, 4967 insertions(+), 78 deletions(-)
>  create mode 100644 utils/libnfsidmap/AUTHORS
>  create mode 100644 utils/libnfsidmap/COPYING
>  create mode 100644 utils/libnfsidmap/Makefile.am
>  create mode 100644 utils/libnfsidmap/README
>  create mode 100644 utils/libnfsidmap/gums.c
>  create mode 100644 utils/libnfsidmap/idmapd.conf
>  create mode 100644 utils/libnfsidmap/idmapd.conf.5
>  create mode 100644 utils/libnfsidmap/libnfsidmap.c
>  create mode 100644 utils/libnfsidmap/libnfsidmap.pc.in
>  create mode 100644 utils/libnfsidmap/libtest.c
>  create mode 100644 utils/libnfsidmap/nfs4_uid_to_name.3
>  create mode 100644 utils/libnfsidmap/nfsidmap.h
>  create mode 100644 utils/libnfsidmap/nfsidmap_internal.h
>  create mode 100644 utils/libnfsidmap/nss.c
>  create mode 100644 utils/libnfsidmap/static.c
>  create mode 100644 utils/libnfsidmap/umich_ldap.c
> 
> -- 
> 1.8.3.1
> 
> 

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

* Re: [PATCH 5/7] nfs-utils: Import libnfsidmap codebase
       [not found]   ` <0c78c3e5-0ec8-1dcf-e608-77693596097d@RedHat.com>
@ 2017-09-13 15:58     ` Justin Mitchell
  0 siblings, 0 replies; 10+ messages in thread
From: Justin Mitchell @ 2017-09-13 15:58 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Bruce Fields

On Wed, 2017-09-13 at 10:35 -0400, Steve Dickson wrote:
> 
> On 09/13/2017 10:04 AM, Justin Mitchell wrote:
> > Merge the libnfsidmap code tree into nfs-utils.
> > These are the original unmodified files, cherry picked only the
> > necessary files that dont duplicate code, so will not build
> > correctly at this stage.
> > 
> > Signed-off-by: Justin Mitchell <jumitche@redhat.com>
> > ---
> >  utils/libnfsidmap/AUTHORS             |    1 +
> >  utils/libnfsidmap/COPYING             |   30 +
> >  utils/libnfsidmap/Makefile.am         |   62 ++
> >  utils/libnfsidmap/README              |  126 ++++
> >  utils/libnfsidmap/gums.c              |  788 ++++++++++++++++++++
> >  utils/libnfsidmap/idmapd.conf         |  137 ++++
> >  utils/libnfsidmap/idmapd.conf.5       |  308 ++++++++
> >  utils/libnfsidmap/libnfsidmap.c       |  709 ++++++++++++++++++
> >  utils/libnfsidmap/libnfsidmap.pc.in   |   11 +
> >  utils/libnfsidmap/libtest.c           |  160 ++++
> >  utils/libnfsidmap/nfs4_uid_to_name.3  |  174 +++++
> >  utils/libnfsidmap/nfsidmap.h          |   67 ++
> >  utils/libnfsidmap/nfsidmap_internal.h |   72 ++
> >  utils/libnfsidmap/nss.c               |  468 ++++++++++++
> >  utils/libnfsidmap/static.c            |  412 +++++++++++
> >  utils/libnfsidmap/umich_ldap.c        | 1302 +++++++++++++++++++++++++++++++++
> Quickly looking at this... I think the code should
> go under support/nfsidmap since that's where the
> other libraries live... Not sure how difficult it
> will be to change that... 
> 
> steved.

Okay, thats no problem, will wait and see what other comments there are
before i post the corrected version.

Justin




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

* [PATCH 3/7] nfs-utils: Add get_str with default value
  2017-09-14 14:02 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils UPDATED Justin Mitchell
@ 2017-09-14 14:04 ` Justin Mitchell
  0 siblings, 0 replies; 10+ messages in thread
From: Justin Mitchell @ 2017-09-14 14:04 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, J. Bruce Fields

The similar config code in libnfsidmap had one additional feature of
a get_str function with a default value option, include an equivalent
function here to maintain compatibility.

Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
 support/include/conffile.h |  1 +
 support/nfs/conffile.c     | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/support/include/conffile.h b/support/include/conffile.h
index 0e7fa8b..d4cb6b4 100644
--- a/support/include/conffile.h
+++ b/support/include/conffile.h
@@ -58,6 +58,7 @@ extern struct conf_list *conf_get_tag_list(const char *, const char *);
 extern int      conf_get_num(const char *, const char *, int);
 extern _Bool    conf_get_bool(const char *, const char *, _Bool);
 extern char    *conf_get_str(const char *, const char *);
+extern char    *conf_get_str_with_def(const char *, const char *, char *);
 extern char    *conf_get_section(const char *, const char *, const char *);
 extern void     conf_init(const char *);
 extern void     conf_cleanup(void);
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index 8239d66..d2f9441 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -639,6 +639,17 @@ conf_get_str(const char *section, const char *tag)
 	return conf_get_section(section, NULL, tag);
 }
 
+/* Return the string value denoted by TAG in section SECTION,
+ * unless it is not set, in which case return def
+ */
+char *
+conf_get_str_with_def(const char *section, const char *tag, char *def)
+{
+	char * result = conf_get_section(section, NULL, tag);
+	if (!result) return def;
+	return result;
+}
+
 /*
  * Find a section that may or may not have an argument
  */
-- 
1.8.3.1




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

end of thread, other threads:[~2017-09-14 14:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-13 13:58 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils Justin Mitchell
2017-09-13 14:00 ` [PATCH 1/7] nfs-utils: const-ify the config handling functions Justin Mitchell
2017-09-13 14:01 ` [PATCH 2/7] nfs-utils: Merge conf_get_str and conf_get_section Justin Mitchell
2017-09-13 14:02 ` [PATCH 3/7] nfs-utils: Add get_str with default value Justin Mitchell
2017-09-13 14:03 ` [PATCH 4/7] nfs-utils: split conffile to a separate convenience lib Justin Mitchell
2017-09-13 14:06 ` [PATCH 6/7] nfs-utils: integrate libnfsidmap code with rest of nfs-utils Justin Mitchell
2017-09-13 14:06 ` [PATCH 7/7] nfs-utils: cleanup warnings from merged libnfsidmap code Justin Mitchell
2017-09-13 15:29 ` [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils J. Bruce Fields
     [not found] ` <1505311491.15819.27.camel@redhat.com>
     [not found]   ` <0c78c3e5-0ec8-1dcf-e608-77693596097d@RedHat.com>
2017-09-13 15:58     ` [PATCH 5/7] nfs-utils: Import libnfsidmap codebase Justin Mitchell
2017-09-14 14:02 [PATCH 0/7] nfs-utils: Merge libnfsidmap tree with nfs-utils UPDATED Justin Mitchell
2017-09-14 14:04 ` [PATCH 3/7] nfs-utils: Add get_str with default value Justin Mitchell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.