Commit d0edb478 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Patrick Monnerat modified the LDAP code and approach in curl. Starting now,

the configure script checks for openldap and friends and we link with those
libs just like we link all other third party libraries, and we no longer
dlopen() those libraries. Our private header file lib/ldap.h was renamed to
lib/curl_ldap.h due to this. I set a tag in CVS (curl-7_17_0-preldapfix)
just before this commit, just in case.
parent b238e0b1
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,14 @@


                                  Changelog
                                  Changelog


Daniel S (11 August 2007)
- Patrick Monnerat modified the LDAP code and approach in curl. Starting now,
  the configure script checks for openldap and friends and we link with those
  libs just like we link all other third party libraries, and we no longer
  dlopen() those libraries. Our private header file lib/ldap.h was renamed to
  lib/curl_ldap.h due to this. I set a tag in CVS (curl-7_17_0-preldapfix)
  just before this commit, just in case.

Dan F (8 August 2007)
Dan F (8 August 2007)
- Song Ma noted a zlib memory leak in the illegal compressed header
- Song Ma noted a zlib memory leak in the illegal compressed header
  countermeasures code path.
  countermeasures code path.
+1 −0
Original line number Original line Diff line number Diff line
@@ -14,6 +14,7 @@ This release includes the following changes:
 o support for OS/400 Secure Sockets Layer library
 o support for OS/400 Secure Sockets Layer library
 o curl_easy_setopt() now allocates strings passed to it
 o curl_easy_setopt() now allocates strings passed to it
 o SCP and SFTP support now requires libssh2 0.16 or later
 o SCP and SFTP support now requires libssh2 0.16 or later
 o LDAP libraries are now linked "regularly" and not with dlopen


This release includes the following bugfixes:
This release includes the following bugfixes:


+0 −75
Original line number Original line Diff line number Diff line
@@ -1830,81 +1830,6 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],


]) dnl end of AC_DEFUN()
]) dnl end of AC_DEFUN()



dnl Determine the name of the library to pass to dlopen() based on the name
dnl that would normally be given to AC_CHECK_LIB.  The preprocessor symbol
dnl given is set to the quoted library file name. 
dnl The standard dynamic library file name is first generated, based on the
dnl current system type, then a search is performed for that file on the
dnl standard dynamic library path.  If it is a symbolic link, the destination
dnl of the link is used as the file name, after stripping off any minor
dnl version numbers. If a library file can't be found, a guess is made.
dnl This macro assumes AC_PROG_LIBTOOL has been called and requires perl
dnl to be available in the PATH, or $PERL to be set to its location.
dnl
dnl CURL_DLLIB_NAME(VARIABLE, library_name)
dnl e.g. CURL_DLLIB_NAME(LDAP_NAME, ldap) on a Linux system might result
dnl in LDAP_NAME holding the string "libldap.so.2".

AC_DEFUN([CURL_DLLIB_NAME],
[
AC_MSG_CHECKING([name of dynamic library $2])
dnl The shared library extension variable name changes from version to
dnl version of libtool.  Try a few names then just set one statically.
test -z "$shared_ext" && eval shared_ext=\"$shrext_cmds\"
test -z "$shared_ext" && shared_ext="$std_shrext"
test -z "$shared_ext" && shared_ext="$shrext"
test -z "$shared_ext" && shared_ext=".so"

dnl Create the library link name of the correct form for this platform
LIBNAME_LINK_SPEC=`echo "$library_names_spec" | $SED 's/^.* //'`
DLGUESSLIB=`name=$2 eval echo "$libname_spec"`
DLGUESSFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$LIBNAME_LINK_SPEC"`
dnl Last resort in case libtool knows nothing about shared libs on this platform
test -z "$DLGUESSFILE" && DLGUESSFILE="$DLGUESSLIB$shared_ext"

dnl Synthesize a likely dynamic library name in case we can't find an actual one
SO_NAME_SPEC="$soname_spec"
dnl soname_spec undefined when identical to the 1st entry in library_names_spec
test -z "$SO_NAME_SPEC" && SO_NAME_SPEC=`echo "$library_names_spec" | $SED 's/ .*$//'`
DLGUESSSOFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$SO_NAME_SPEC"`
dnl Last resort in case libtool knows nothing about shared libs on this platform
test -z "$DLGUESSSOFILE" && DLGUESSSOFILE="$DLGUESSFILE"

if test "$cross_compiling" = yes; then
  dnl Can't look at filesystem when cross-compiling
  AC_DEFINE_UNQUOTED($1, "$DLGUESSSOFILE", [$2 dynamic library file])
  AC_MSG_RESULT([$DLGUESSSOFILE (guess while cross-compiling)])
else

  DLFOUNDFILE=""
  if test "$sys_lib_dlsearch_path_spec" ; then
    dnl Search for the link library name and see what it points to.
    for direc in $sys_lib_dlsearch_path_spec ; do
      DLTRYFILE="$direc/$DLGUESSFILE"
      dnl Find where the symbolic link for this name points
      changequote(<<, >>)dnl
      <<
      DLFOUNDFILE=`${PERL:-perl} -e 'use File::Basename; (basename(readlink($ARGV[0])) =~ /^(.*[^\d]\.\d+)[\d\.]*$/ && print ${1}) || exit 1;' "$DLTRYFILE" 2>&5`
      >>
      changequote([, ])dnl
      if test "$?" -eq "0"; then
        dnl Found the file link
        break
      fi
    done
  fi

  if test -z "$DLFOUNDFILE" ; then
    dnl Couldn't find a link library, so guess at a name.
    DLFOUNDFILE="$DLGUESSSOFILE"
  fi

  AC_DEFINE_UNQUOTED($1, "$DLFOUNDFILE", [$2 dynamic library file])
  AC_MSG_RESULT($DLFOUNDFILE)
fi
])

# This is only a temporary fix. This macro is here to replace the broken one
# This is only a temporary fix. This macro is here to replace the broken one
# delivered by the automake project (including the 1.9.6 release). As soon as
# delivered by the automake project (including the 1.9.6 release). As soon as
# they ship a working version we SHOULD remove this work-around.
# they ship a working version we SHOULD remove this work-around.
+43 −19
Original line number Original line Diff line number Diff line
@@ -89,6 +89,7 @@ dnl initialize all the info variables
 curl_manual_msg="no      (--enable-manual)"
 curl_manual_msg="no      (--enable-manual)"
curl_verbose_msg="enabled (--disable-verbose)"
curl_verbose_msg="enabled (--disable-verbose)"
   curl_sspi_msg="no      (--enable-sspi)"
   curl_sspi_msg="no      (--enable-sspi)"
   curl_ldap_msg="no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)"


dnl
dnl
dnl Save anything in $LIBS for later
dnl Save anything in $LIBS for later
@@ -500,55 +501,79 @@ AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
       AC_MSG_RESULT(no)
       AC_MSG_RESULT(no)
)
)


dnl dl lib?
AC_CHECK_FUNC(dlclose, , [ AC_CHECK_LIB(dl, dlopen) ])

dnl **********************************************************************
dnl **********************************************************************
dnl Check for the name of dynamic OpenLDAP libraries
dnl Check for LDAP
dnl **********************************************************************
dnl **********************************************************************


LDAPLIBNAME=""
LDAPLIBNAME=""
AC_ARG_WITH(ldap-lib,
AC_ARG_WITH(ldap-lib,
AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of dynamic ldap lib file]),
AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
 [LDAPLIBNAME="$withval"])
 [LDAPLIBNAME="$withval"])


LBERLIBNAME=""
LBERLIBNAME=""
AC_ARG_WITH(lber-lib,
AC_ARG_WITH(lber-lib,
AC_HELP_STRING([--with-lber-lib=libname],[Specify name of dynamic lber lib file]),
AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
 [LBERLIBNAME="$withval"])
 [LBERLIBNAME="$withval"])


if test x$CURL_DISABLE_LDAP != x1 ; then
if test x$CURL_DISABLE_LDAP != x1 ; then


  if test -z "$LDAPLIBNAME" ; then
  if test -z "$LDAPLIBNAME" ; then
    case $host in
    case $host in
      *-*-cygwin | *-*-mingw* | *-*-pw32*)
      *-*-cygwin* | *-*-mingw* | *-*-pw32*)
        dnl Windows uses a single and unique OpenLDAP DLL name
        dnl Windows uses a single and unique OpenLDAP DLL name
        LDAPLIBNAME="wldap32.dll"
        LDAPLIBNAME="wldap32"
        LBERLIBNAME="no"
        LBERLIBNAME="no"
        ;;
        ;;
    esac
    esac
  fi
  fi


  if test "$LDAPLIBNAME" ; then
  if test "$LDAPLIBNAME" ; then
    AC_DEFINE_UNQUOTED(DL_LDAP_FILE, "$LDAPLIBNAME")
    AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
    AC_MSG_CHECKING([name of dynamic library ldap])
      AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
    AC_MSG_RESULT($LDAPLIBNAME)
      AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
      AC_SUBST(CURL_DISABLE_LDAP, [1])])
  else
  else
    dnl Try to find the right ldap library name for this system
    dnl Try to find the right ldap library name for this system
    CURL_DLLIB_NAME(DL_LDAP_FILE, ldap)
    AC_SEARCH_LIBS(ldap_init, [ldap],, [
      AC_MSG_WARN([Cannot find LDAP library: LDAP disabled])
      AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
      AC_SUBST(CURL_DISABLE_LDAP, [1])])
  fi
fi
fi


if test x$CURL_DISABLE_LDAP != x1 ; then

  if test "$LBERLIBNAME" ; then
  if test "$LBERLIBNAME" ; then
    dnl If name is "no" then don't define this variable at all
    dnl If name is "no" then don't define this library at all
    dnl (it's only needed if libldap.so's dependencies are broken).
    dnl (it's only needed if libldap.so's dependencies are broken).
    if test "$LBERLIBNAME" != "no" ; then 
    if test "$LBERLIBNAME" != "no" ; then 
      AC_DEFINE_UNQUOTED(DL_LBER_FILE, "$LBERLIBNAME")
      AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
        AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
        AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
        AC_SUBST(CURL_DISABLE_LDAP, [1])])
    fi
    fi
    AC_MSG_CHECKING([name of dynamic library lber])
    AC_MSG_RESULT($LBERLIBNAME)
  else
  else
    dnl Try to find the right lber library name for this system
    dnl Try to find the right lber library name for this system
    CURL_DLLIB_NAME(DL_LBER_FILE, lber)
    AC_SEARCH_LIBS(ber_free, [lber],, [
      AC_MSG_WARN([Cannot find a library defining ber_free(): LDAP disabled])
      AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
      AC_SUBST(CURL_DISABLE_LDAP, [1])])
  fi
fi

if test x$CURL_DISABLE_LDAP != x1 ; then
  AC_CHECK_FUNCS([ldap_url_parse])

  if test "$LDAPLIBNAME" = "wldap32"; then
    curl_ldap_msg="yes (winldap)"
    AC_DEFINE(CURL_LDAP_WIN, 1, [Use W$ LDAP implementation])
    case $host in
      *-*-cygwin* | *-*-mingw* | *-*-pw32*)
        AC_DEFINE(CURL_LDAP_HYBRID, 1, [W$ LDAP with non-W$ compiler])
        ;;
    esac
  else
    curl_ldap_msg="yes (OpenLDAP)"
  fi
  fi
fi
fi


@@ -1716,7 +1741,6 @@ AC_CHECK_HEADERS(
        termio.h \
        termio.h \
        sgtty.h \
        sgtty.h \
        fcntl.h \
        fcntl.h \
        dlfcn.h \
        alloca.h \
        alloca.h \
        time.h \
        time.h \
        io.h \
        io.h \
@@ -1858,7 +1882,6 @@ AC_CHECK_FUNCS( strtoll \
                strlcat \
                strlcat \
                getpwuid \
                getpwuid \
                geteuid \
                geteuid \
                dlopen \
                utime \
                utime \
                sigsetjmp \
                sigsetjmp \
                basename \
                basename \
@@ -2363,4 +2386,5 @@ AC_MSG_NOTICE([Configured to build curl/libcurl:
  Verbose errors:  ${curl_verbose_msg}
  Verbose errors:  ${curl_verbose_msg}
  SSPI support:    ${curl_sspi_msg}
  SSPI support:    ${curl_sspi_msg}
  ca cert path:    ${ca}
  ca cert path:    ${ca}
  LDAP support:    ${curl_ldap_msg}
])
])
+1 −2
Original line number Original line Diff line number Diff line
@@ -29,9 +29,8 @@ LDFLAGS = -L/home/dast/lib -L/usr/local/ssl/lib
# We need -lcurl for the curl stuff
# We need -lcurl for the curl stuff
# We need -lsocket and -lnsl when on Solaris
# We need -lsocket and -lnsl when on Solaris
# We need -lssl and -lcrypto when using libcurl with SSL support
# We need -lssl and -lcrypto when using libcurl with SSL support
# We need -ldl for dlopen() if that is in libdl
# We need -lpthread for the pthread example
# We need -lpthread for the pthread example
LIBS = -lcurl -lsocket -lnsl -lssl -lcrypto -dl
LIBS = -lcurl -lsocket -lnsl -lssl -lcrypto


# Link the target with all objects and libraries
# Link the target with all objects and libraries
$(TARGET) : $(OBJS)
$(TARGET) : $(OBJS)
Loading