[RFC/PATCH 1/4] lib/defaults: use WITH_LDAP conditional around LDAP types

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

 



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.
---
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)
 {
-- 
1.7.10.2.dirty

--
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