1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 01UPSTREAM_autofs-5.0.3-ldap-page-control-configure-fix.patch
3
## DP: Supplied by upstream.
7
diff --git a/CHANGELOG b/CHANGELOG
8
index 624fe9e..98855f5 100644
12
+??/??/2008 autofs-5.0.4
13
+-----------------------
14
+- correct configure test for ldapr page control functions.
16
14/01/2008 autofs-5.0.3
17
-----------------------
18
- include krb5.h in lookup_ldap.h (some openssl doesn't implicitly include it).
19
diff --git a/aclocal.m4 b/aclocal.m4
20
index 118ef0d..f24e076 100644
23
@@ -222,3 +222,69 @@ AC_TRY_LINK(
24
LDFLAGS="$af_check_hesiod_save_ldflags"
27
+dnl --------------------------------------------------------------------------
28
+dnl AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL
30
+dnl Check for function ldap_create_page_control
31
+dnl --------------------------------------------------------------------------
32
+AC_DEFUN([AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL],
33
+[AC_MSG_CHECKING(for ldap_create_page_control in -lldap)
35
+# save current ldflags
36
+af_check_ldap_create_page_control_save_ldflags="$LDFLAGS"
37
+LDFLAGS="$LDFLAGS -lldap_r"
40
+ [ #include <ldap.h> ],
46
+ ret = ldap_create_page_control(ld,ps,c,ic,clp); ],
47
+ [ af_have_ldap_create_page_control=yes
48
+ AC_MSG_RESULT(yes) ],
49
+ [ AC_MSG_RESULT(no) ])
51
+if test "$af_have_ldap_create_page_control" = "yes"; then
52
+ AC_DEFINE(HAVE_LDAP_CREATE_PAGE_CONTROL, 1,
53
+ [Define to 1 if you have the `ldap_create_page_control' function.])
57
+LDFLAGS="$af_check_ldap_create_page_control_save_ldflags"
60
+dnl --------------------------------------------------------------------------
61
+dnl AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL
63
+dnl Check for function ldap_parse_page_control
64
+dnl --------------------------------------------------------------------------
65
+AC_DEFUN([AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL],
66
+[AC_MSG_CHECKING(for ldap_parse_page_control in -lldap)
68
+# save current ldflags
69
+af_check_ldap_parse_page_control_save_ldflags="$LDFLAGS"
70
+LDFLAGS="$LDFLAGS -lldap_r"
73
+ [ #include <ldap.h> ],
79
+ ret = ldap_parse_page_control(ld,clp,ct,c); ],
80
+ [ af_have_ldap_parse_page_control=yes
81
+ AC_MSG_RESULT(yes) ],
82
+ [ AC_MSG_RESULT(no) ])
84
+if test "$af_have_ldap_create_page_control" = "yes"; then
85
+ AC_DEFINE(HAVE_LDAP_PARSE_PAGE_CONTROL, 1,
86
+ [Define to 1 if you have the `ldap_parse_page_control' function.])
90
+LDFLAGS="$af_check_ldap_parse_page_control_save_ldflags"
93
diff --git a/configure b/configure
94
index d212b05..e872392 100755
97
@@ -3631,7 +3631,7 @@ if test "${with_hesiod+set}" = set; then
101
-if test -z "$HAVE_HESIOD"
102
+if test -z "$HAVE_HESIOD" -o "$HAVE_HESIOD" != "0"
105
{ echo "$as_me:$LINENO: checking for libhesiod" >&5
106
@@ -4498,7 +4498,7 @@ if test "${with_openldap+set}" = set; then
110
-if test -z "$HAVE_LDAP"; then
111
+if test -z "$HAVE_LDAP" -o "$HAVE_LDAP" != "0"; then
113
LDAP_FLAGS="$LDAP_FLAGS -DLDAP_DEPRECATED=1"
114
{ echo "$as_me:$LINENO: checking for ldap_initialize in -lldap" >&5
115
@@ -4566,71 +4566,106 @@ if test $ac_cv_lib_ldap_ldap_initialize = yes; then
116
HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap_r -llber -lresolv"
119
- if test "$HAVE_LDAP" == "1"; then
120
+ if test "$HAVE_LDAP" = "1"; then
122
cat >>confdefs.h <<\_ACEOF
127
+ { echo "$as_me:$LINENO: checking for ldap_create_page_control in -lldap" >&5
128
+echo $ECHO_N "checking for ldap_create_page_control in -lldap... $ECHO_C" >&6; }
130
+# save current ldflags
131
+af_check_ldap_create_page_control_save_ldflags="$LDFLAGS"
132
+LDFLAGS="$LDFLAGS -lldap_r"
134
+cat >conftest.$ac_ext <<_ACEOF
137
+cat confdefs.h >>conftest.$ac_ext
138
+cat >>conftest.$ac_ext <<_ACEOF
139
+/* end confdefs.h. */
149
+ ret = ldap_create_page_control(ld,ps,c,ic,clp);
154
+rm -f conftest.$ac_objext conftest$ac_exeext
155
+if { (ac_try="$ac_link"
157
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
158
+ *) ac_try_echo=$ac_try;;
160
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
161
+ (eval "$ac_link") 2>conftest.er1
163
+ grep -v '^ *+' conftest.er1 >conftest.err
165
+ cat conftest.err >&5
166
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
167
+ (exit $ac_status); } && {
168
+ test -z "$ac_c_werror_flag" ||
169
+ test ! -s conftest.err
170
+ } && test -s conftest$ac_exeext &&
171
+ $as_test_x conftest$ac_exeext; then
172
+ af_have_ldap_create_page_control=yes
173
+ { echo "$as_me:$LINENO: result: yes" >&5
174
+echo "${ECHO_T}yes" >&6; }
176
+ echo "$as_me: failed program was:" >&5
177
+sed 's/^/| /' conftest.$ac_ext >&5
179
+ { echo "$as_me:$LINENO: result: no" >&5
180
+echo "${ECHO_T}no" >&6; }
183
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
184
+ conftest$ac_exeext conftest.$ac_ext
186
+if test "$af_have_ldap_create_page_control" = "yes"; then
188
+cat >>confdefs.h <<\_ACEOF
189
+#define HAVE_LDAP_CREATE_PAGE_CONTROL 1
192
-LDFLAGS="${AF_tmp_ldflags}"
196
+LDFLAGS="$af_check_ldap_create_page_control_save_ldflags"
198
+ { echo "$as_me:$LINENO: checking for ldap_parse_page_control in -lldap" >&5
199
+echo $ECHO_N "checking for ldap_parse_page_control in -lldap... $ECHO_C" >&6; }
201
-for ac_func in ldap_create_page_control ldap_parse_page_control
203
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
204
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
205
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
206
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
207
- echo $ECHO_N "(cached) $ECHO_C" >&6
209
- cat >conftest.$ac_ext <<_ACEOF
210
+# save current ldflags
211
+af_check_ldap_parse_page_control_save_ldflags="$LDFLAGS"
212
+LDFLAGS="$LDFLAGS -lldap_r"
214
+cat >conftest.$ac_ext <<_ACEOF
217
cat confdefs.h >>conftest.$ac_ext
218
cat >>conftest.$ac_ext <<_ACEOF
219
/* end confdefs.h. */
220
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
221
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
222
-#define $ac_func innocuous_$ac_func
224
-/* System header to define __stub macros and hopefully few prototypes,
225
- which can conflict with char $ac_func (); below.
226
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
227
- <limits.h> exists even on freestanding compilers. */
230
-# include <limits.h>
232
-# include <assert.h>
237
-/* Override any GCC internal prototype to avoid an error.
238
- Use char because int might match the return type of a GCC
239
- builtin and then its argument prototype would still apply. */
244
-/* The GNU C library defines this for functions which it implements
245
- to always fail with ENOSYS. Some functions are actually named
246
- something starting with __ and the normal name is an alias. */
247
-#if defined __stub_$ac_func || defined __stub___$ac_func
261
+ ret = ldap_parse_page_control(ld,clp,ct,c);
265
@@ -4653,28 +4688,37 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
266
test ! -s conftest.err
267
} && test -s conftest$ac_exeext &&
268
$as_test_x conftest$ac_exeext; then
269
- eval "$as_ac_var=yes"
270
+ af_have_ldap_parse_page_control=yes
271
+ { echo "$as_me:$LINENO: result: yes" >&5
272
+echo "${ECHO_T}yes" >&6; }
274
echo "$as_me: failed program was:" >&5
275
sed 's/^/| /' conftest.$ac_ext >&5
277
- eval "$as_ac_var=no"
278
+ { echo "$as_me:$LINENO: result: no" >&5
279
+echo "${ECHO_T}no" >&6; }
282
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
283
conftest$ac_exeext conftest.$ac_ext
285
-ac_res=`eval echo '${'$as_ac_var'}'`
286
- { echo "$as_me:$LINENO: result: $ac_res" >&5
287
-echo "${ECHO_T}$ac_res" >&6; }
288
-if test `eval echo '${'$as_ac_var'}'` = yes; then
289
- cat >>confdefs.h <<_ACEOF
290
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
292
+if test "$af_have_ldap_create_page_control" = "yes"; then
294
+cat >>confdefs.h <<\_ACEOF
295
+#define HAVE_LDAP_PARSE_PAGE_CONTROL 1
302
+LDFLAGS="$af_check_ldap_parse_page_control_save_ldflags"
309
+LDFLAGS="${AF_tmp_ldflags}"
313
@@ -4703,7 +4747,7 @@ if test "${with_sasl+set}" = set; then
317
-if test -z "$HAVE_SASL" -a "$HAVE_LIBXML" == "1"
318
+if test -z "$HAVE_SASL" -o "$HAVE_SASL" != "0" -a "$HAVE_LIBXML" == "1"
321
{ echo "$as_me:$LINENO: checking for sasl_client_start in -lsasl2" >&5
322
diff --git a/configure.in b/configure.in
323
index 952d040..a9c86dd 100644
326
@@ -155,7 +155,7 @@ AC_ARG_WITH(hesiod,
330
-if test -z "$HAVE_HESIOD"
331
+if test -z "$HAVE_HESIOD" -o "$HAVE_HESIOD" != "0"
335
@@ -194,15 +194,17 @@ AC_ARG_WITH(openldap,
336
LDAP_FLAGS="-I${withval}/include"
339
-if test -z "$HAVE_LDAP"; then
340
+if test -z "$HAVE_LDAP" -o "$HAVE_LDAP" != "0"; then
342
LDAP_FLAGS="$LDAP_FLAGS -DLDAP_DEPRECATED=1"
343
AC_CHECK_LIB(ldap, ldap_initialize, HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap_r -llber -lresolv", ,
344
-llber -lresolv $LIBS)
345
- if test "$HAVE_LDAP" == "1"; then
346
+ if test "$HAVE_LDAP" = "1"; then
347
AC_DEFINE(WITH_LDAP,1,
348
[Define if using LDAP as a source of automount maps])
350
+ AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL()
351
+ AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL()
355
@@ -210,8 +212,6 @@ AC_SUBST(HAVE_LDAP)
357
LDFLAGS="${AF_tmp_ldflags}"
359
-AC_CHECK_FUNCS(ldap_create_page_control ldap_parse_page_control)
363
# configure magic taken from:
364
@@ -236,7 +236,7 @@ AC_ARG_WITH(sasl,
365
SASL_FLAGS="-I${withval}/include"
368
-if test -z "$HAVE_SASL" -a "$HAVE_LIBXML" == "1"
369
+if test -z "$HAVE_SASL" -o "$HAVE_SASL" != "0" -a "$HAVE_LIBXML" == "1"
372
AC_CHECK_LIB(sasl2, sasl_client_start, HAVE_SASL=1 LIBSASL="$LIBSASL -lsasl2", , -lsasl2 $LIBS)
373
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
374
index 0723fd8..e8530f6 100644
375
--- a/modules/lookup_ldap.c
376
+++ b/modules/lookup_ldap.c
377
@@ -55,7 +55,7 @@ struct ldap_search_params {
378
char *query, **attrs;
379
struct berval *cookie;
381
- unsigned int totalCount;
382
+ ber_int_t totalCount;
386
@@ -63,7 +63,7 @@ struct ldap_search_params {
387
static LDAP *auth_init(unsigned logopt, const char *, struct lookup_context *);
389
#ifndef HAVE_LDAP_CREATE_PAGE_CONTROL
390
-int ldap_create_page_control(LDAP *ldap, unsigned int pagesize,
391
+int ldap_create_page_control(LDAP *ldap, ber_int_t pagesize,
392
struct berval *cookie, char isCritical,
393
LDAPControl **output)
395
@@ -93,7 +93,7 @@ int ldap_create_page_control(LDAP *ldap, unsigned int pagesize,
397
#ifndef HAVE_LDAP_PARSE_PAGE_CONTROL
398
int ldap_parse_page_control(LDAP *ldap, LDAPControl **controls,
399
- unsigned int *totalcount, struct berval **cookie)
400
+ ber_int_t *totalcount, struct berval **cookie)
404
@@ -1644,7 +1644,7 @@ static int do_paged_query(struct ldap_search_params *sp, struct lookup_context *
405
struct autofs_point *ap = sp->ap;
406
LDAPControl *pageControl=NULL, *controls[2] = { NULL, NULL };
407
LDAPControl **returnedControls = NULL;
408
- static unsigned long pageSize = 1000;
409
+ static ber_int_t pageSize = 1000;
410
static char pagingCriticality = 'T';
411
int rv, scope = LDAP_SCOPE_SUBTREE;