Re: [RFC/PATCH 1/4] lib/defaults: use WITH_LDAP conditional aroundLDAP types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Tue, 16 Oct 2012, Ian Kent wrote:

On Tue, 2012-10-16 at 12:43 +0800, Ian Kent wrote:
On Tue, 2012-10-16 at 16:24 +1300, Chris Packham wrote:
Wrap the inclusion of lookup_ldap.h and functions that use ldap_uri or
ldap_schema with the WITH_LDAP conditional. WITH_LDAP is set by the
configure step when LDAP support is not desired. This also allows
compilation on a system that doesn't have any LDAP libraries.

This is broken, config.h isn't included which causes a bunch of errors.
Once that's fixed I get a libxml include error.

I'm still having a quick look, not sure how far I'll get in the time I
have.

I had to move the libxml/tree.h include out of include/lookup_ldap.h and
into modules/lookup_ldap.h to get this to compile.


Noted. I can make that change or perhaps move the WITH_LDAP into lookup_ldap.h around the #include <ldap.h>? I did that originally but then I thought it was funny to include lookup_ldap.h only to exclude most of the stuff that uses it.

I'm just trying to get my host to compile properly now so I can test these in a native and cross environment.


---
Looks a bit ugly. An alternative approach might be to move all the code
I've wrapped to a new defaults_ldap.c file which can be conditionally
included via the Makefile.

 lib/defaults.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/defaults.c b/lib/defaults.c
index 5ce71b7..c0e336f 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -19,7 +19,9 @@

 #include "list.h"
 #include "defaults.h"
+#ifdef WITH_LDAP
 #include "lookup_ldap.h"
+#endif
 #include "log.h"
 #include "automount.h"

@@ -197,6 +199,7 @@ static int parse_line(char *line, char **res, char **value)
 	return 1;
 }

+#ifdef WITH_LDAP
 void defaults_free_uris(struct list_head *list)
 {
 	struct list_head *next;
@@ -219,7 +222,9 @@ void defaults_free_uris(struct list_head *list)

 	return;
 }
+#endif

+#ifdef WITH_LDAP
 static unsigned int add_uris(char *value, struct list_head *list)
 {
 	char *str, *tok, *ptr = NULL;
@@ -252,7 +257,9 @@ static unsigned int add_uris(char *value, struct list_head *list)

 	return 1;
 }
+#endif

+#ifdef WITH_LDAP
 struct list_head *defaults_get_uris(void)
 {
 	FILE *f;
@@ -289,6 +296,7 @@ struct list_head *defaults_get_uris(void)
 	fclose(f);
 	return list;
 }
+#endif

 /*
  * Read config env variables and check they have been set.
@@ -450,6 +458,7 @@ unsigned int defaults_get_ldap_network_timeout(void)
 	return res;
 }

+#ifdef WITH_LDAP
 struct ldap_schema *defaults_get_default_schema(void)
 {
 	struct ldap_schema *schema;
@@ -507,7 +516,9 @@ struct ldap_schema *defaults_get_default_schema(void)

 	return schema;
 }
+#endif

+#ifdef WITH_LDAP
 static struct ldap_searchdn *alloc_searchdn(const char *value)
 {
 	struct ldap_searchdn *sdn;
@@ -528,7 +539,9 @@ static struct ldap_searchdn *alloc_searchdn(const char *value)

 	return sdn;
 }
+#endif

+#ifdef WITH_LDAP
 void defaults_free_searchdns(struct ldap_searchdn *sdn)
 {
 	struct ldap_searchdn *this = sdn;
@@ -543,7 +556,9 @@ void defaults_free_searchdns(struct ldap_searchdn *sdn)

 	return;
 }
+#endif

+#ifdef WITH_LDAP
 struct ldap_searchdn *defaults_get_searchdns(void)
 {
 	FILE *f;
@@ -587,7 +602,9 @@ struct ldap_searchdn *defaults_get_searchdns(void)
 	fclose(f);
 	return sdn;
 }
+#endif

+#ifdef WITH_LDAP
 struct ldap_schema *defaults_get_schema(void)
 {
 	struct ldap_schema *schema;
@@ -645,6 +662,7 @@ struct ldap_schema *defaults_get_schema(void)

 	return schema;
 }
+#endif

 unsigned int defaults_get_mount_nfs_default_proto(void)
 {


--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux