]> git.wh0rd.org - patches.git/blob - libnfsidmap-optional-ldap.patch
initial import
[patches.git] / libnfsidmap-optional-ldap.patch
1 --- libnfsidmap-0.17/configure.in
2 +++ libnfsidmap-0.17/configure.in
3 @@ -13,6 +13,21 @@
4
5 # Checks for libraries.
6
7 +AC_ARG_ENABLE([ldap],
8 + [AC_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:@default=detect@:>@])])
9 +if test "x$enable_ldap" != "xno" ; then
10 + AC_CHECK_HEADER([ldap.h],
11 + [AC_CHECK_LIB([ldap], [ldap_initialize],
12 + [have_ldap="yes"],[have_ldap="no"])],
13 + [have_ldap="no"])
14 + if test "x$have_ldap" = "xyes" ; then
15 + AC_DEFINE([ENABLE_LDAP], 1, [Enable LDAP Support])
16 + LIBS="$LIBS -lldap"
17 + elif test "x$enable_ldap$have_ldap" = "xyesno" ; then
18 + AC_MSG_ERROR(LDAP support not found!)
19 + fi
20 +fi
21 +
22 # Checks for header files.
23 AC_HEADER_STDC
24 AC_CHECK_HEADERS([stdlib.h string.h unistd.h errno.h])
25 --- libnfsidmap-0.17/Makefile.am
26 +++ libnfsidmap-0.17/Makefile.am
27 @@ -4,7 +4,6 @@
28 libnfsidmap_la_LDFLAGS = -version-info 2:0:2
29 include_HEADERS = nfsidmap.h
30 EXTRA_DIST = $(man_MANS) libtest.c idmapd.conf
31 -LIBS = -lldap
32
33 # XXX: also exclude debian/files and debian/files.new ? do a clean??
34 dist-hook:
35 --- libnfsidmap-0.17/libnfsidmap.c
36 +++ libnfsidmap-0.17/libnfsidmap.c
37 @@ -166,11 +166,13 @@
38 extern struct trans_func nss_trans;
39 extern struct trans_func umichldap_trans;
40
41 -#define TR_SIZE 2
42 -static struct trans_func * t_array[TR_SIZE] = {
43 - [0] = &nss_trans,
44 - [1] = &umichldap_trans,
45 +static struct trans_func * t_array[] = {
46 + &nss_trans,
47 +#ifdef ENABLE_LDAP
48 + &umichldap_trans,
49 +#endif
50 };
51 +#define TR_SIZE (sizeof(t_array)/sizeof(*t_array))
52
53 int
54 set_trans_method(char *method)
55 --- libnfsidmap-0.17/umich_ldap.c
56 +++ libnfsidmap-0.17/umich_ldap.c
57 @@ -32,6 +32,8 @@
58 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 */
60
61 +#ifdef ENABLE_LDAP
62 +
63 #include <sys/types.h>
64 #include <sys/socket.h>
65 #include <netdb.h>
66 @@ -1019,3 +1021,5 @@
67 .gid_to_name = umichldap_gid_to_name,
68 .gss_princ_to_grouplist = umichldap_gss_princ_to_grouplist,
69 };
70 +
71 +#endif