diff --git a/CHANGELOG b/CHANGELOG index 624fe9e..98855f5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +??/??/2008 autofs-5.0.4 +----------------------- +- correct configure test for ldapr page control functions. + 14/01/2008 autofs-5.0.3 ----------------------- - include krb5.h in lookup_ldap.h (some openssl doesn't implicitly include it). diff --git a/aclocal.m4 b/aclocal.m4 index 118ef0d..f24e076 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -222,3 +222,69 @@ AC_TRY_LINK( LDFLAGS="$af_check_hesiod_save_ldflags" ]) +dnl -------------------------------------------------------------------------- +dnl AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL +dnl +dnl Check for function ldap_create_page_control +dnl -------------------------------------------------------------------------- +AC_DEFUN([AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL], +[AC_MSG_CHECKING(for ldap_create_page_control in -lldap) + +# save current ldflags +af_check_ldap_create_page_control_save_ldflags="$LDFLAGS" +LDFLAGS="$LDFLAGS -lldap_r" + +AC_TRY_LINK( + [ #include ], + [ LDAP *ld; + ber_int_t ps; + struct berval *c; + int ic, ret; + LDAPControl **clp; + ret = ldap_create_page_control(ld,ps,c,ic,clp); ], + [ af_have_ldap_create_page_control=yes + AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no) ]) + +if test "$af_have_ldap_create_page_control" = "yes"; then + AC_DEFINE(HAVE_LDAP_CREATE_PAGE_CONTROL, 1, + [Define to 1 if you have the `ldap_create_page_control' function.]) +fi + +# restore ldflags +LDFLAGS="$af_check_ldap_create_page_control_save_ldflags" +]) + +dnl -------------------------------------------------------------------------- +dnl AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL +dnl +dnl Check for function ldap_parse_page_control +dnl -------------------------------------------------------------------------- +AC_DEFUN([AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL], +[AC_MSG_CHECKING(for ldap_parse_page_control in -lldap) + +# save current ldflags +af_check_ldap_parse_page_control_save_ldflags="$LDFLAGS" +LDFLAGS="$LDFLAGS -lldap_r" + +AC_TRY_LINK( + [ #include ], + [ LDAP *ld; + ber_int_t ct; + struct berval *c; + int ret; + LDAPControl **clp; + ret = ldap_parse_page_control(ld,clp,ct,c); ], + [ af_have_ldap_parse_page_control=yes + AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no) ]) + +if test "$af_have_ldap_create_page_control" = "yes"; then + AC_DEFINE(HAVE_LDAP_PARSE_PAGE_CONTROL, 1, + [Define to 1 if you have the `ldap_parse_page_control' function.]) +fi + +# restore ldflags +LDFLAGS="$af_check_ldap_parse_page_control_save_ldflags" +]) + diff --git a/configure.in b/configure.in index 952d040..a9c86dd 100644 --- a/configure.in +++ b/configure.in @@ -155,7 +155,7 @@ AC_ARG_WITH(hesiod, fi ) -if test -z "$HAVE_HESIOD" +if test -z "$HAVE_HESIOD" -o "$HAVE_HESIOD" != "0" then HAVE_HESIOD=0 AF_CHECK_LIBHESIOD() @@ -194,15 +194,17 @@ AC_ARG_WITH(openldap, LDAP_FLAGS="-I${withval}/include" fi ) -if test -z "$HAVE_LDAP"; then +if test -z "$HAVE_LDAP" -o "$HAVE_LDAP" != "0"; then HAVE_LDAP=0 LDAP_FLAGS="$LDAP_FLAGS -DLDAP_DEPRECATED=1" AC_CHECK_LIB(ldap, ldap_initialize, HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap_r -llber -lresolv", , -llber -lresolv $LIBS) - if test "$HAVE_LDAP" == "1"; then + if test "$HAVE_LDAP" = "1"; then AC_DEFINE(WITH_LDAP,1, [Define if using LDAP as a source of automount maps]) fi + AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL() + AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL() fi AC_SUBST(LDAP_FLAGS) @@ -210,8 +212,6 @@ AC_SUBST(HAVE_LDAP) AC_SUBST(LIBLDAP) LDFLAGS="${AF_tmp_ldflags}" -AC_CHECK_FUNCS(ldap_create_page_control ldap_parse_page_control) - # # SASL support # configure magic taken from: @@ -236,7 +236,7 @@ AC_ARG_WITH(sasl, SASL_FLAGS="-I${withval}/include" fi ) -if test -z "$HAVE_SASL" -a "$HAVE_LIBXML" == "1" +if test -z "$HAVE_SASL" -o "$HAVE_SASL" != "0" -a "$HAVE_LIBXML" == "1" then HAVE_SASL=0 AC_CHECK_LIB(sasl2, sasl_client_start, HAVE_SASL=1 LIBSASL="$LIBSASL -lsasl2", , -lsasl2 $LIBS) diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c index 0723fd8..e8530f6 100644 --- a/modules/lookup_ldap.c +++ b/modules/lookup_ldap.c @@ -55,7 +55,7 @@ struct ldap_search_params { char *query, **attrs; struct berval *cookie; int morePages; - unsigned int totalCount; + ber_int_t totalCount; LDAPMessage *result; time_t age; }; @@ -63,7 +63,7 @@ struct ldap_search_params { static LDAP *auth_init(unsigned logopt, const char *, struct lookup_context *); #ifndef HAVE_LDAP_CREATE_PAGE_CONTROL -int ldap_create_page_control(LDAP *ldap, unsigned int pagesize, +int ldap_create_page_control(LDAP *ldap, ber_int_t pagesize, struct berval *cookie, char isCritical, LDAPControl **output) { @@ -93,7 +93,7 @@ int ldap_create_page_control(LDAP *ldap, unsigned int pagesize, #ifndef HAVE_LDAP_PARSE_PAGE_CONTROL int ldap_parse_page_control(LDAP *ldap, LDAPControl **controls, - unsigned int *totalcount, struct berval **cookie) + ber_int_t *totalcount, struct berval **cookie) { int i, rc; BerElement *theBer; @@ -1644,7 +1644,7 @@ static int do_paged_query(struct ldap_search_params *sp, struct lookup_context * struct autofs_point *ap = sp->ap; LDAPControl *pageControl=NULL, *controls[2] = { NULL, NULL }; LDAPControl **returnedControls = NULL; - static unsigned long pageSize = 1000; + static ber_int_t pageSize = 1000; static char pagingCriticality = 'T'; int rv, scope = LDAP_SCOPE_SUBTREE;