cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl-library Digest, Vol 81, Issue 37

From: slon v sobstvennom palto <slonvpalto_at_gmail.com>
Date: Mon, 28 May 2012 23:39:44 +0300

> Please stop top-posting and full-quoting. If you intend to respond to emails
> on this list, you really shouldn't use digest mode emails. I don't think the
> netiquette document leaves a lot of doubt in any of these matters.

I'm really sorry for that. This will not happen anymore.

>> I run 'configure' (curl 7.25) with the next parametrs:
>> configure --enable-ldap --enable-ldaps =ldap50
>
> What is that =ldap50 supposed to mean?

The command line of configure is:
configure --enable-ldap --enable-ldaps --with-ldap-lib=ldap50

libldap50.so is Mozilla LDAP SDK library. Just another LDAP SDK
implementation, it implements the standard Open LDAP interface. Before
running configure I setup the environment. MY_DIR is my directory that
contains sub-directories lib and include where Mozilla LDAP SDK and
OpenSSL are situated.

MY_DIR=<my lib dir>
export LDFLAGS="-L$MY_DIR/lib -lcrypto -lssl"
export LD_LIBRARY_PATH=$MY_DIR/lib
export CPPFLAGS="-I$MY_DIR/include -I$MY_DIR/include/ldap"

>> At line 19209 of 'configure' we see:
>
> Can't we instead talk about configure.ac details as that's the file we write.
>
>> if test "$LDAPLIBNAME" ; then
>> This is true if we specified something at '--with-ldap-lib' parameter of
>> 'configure' script.
>
> Yes, or if you run it on windows without specifying a lib.
>
>> Then at line 19267 we see:
>> CURL_DISABLE_LDAPS=1
>
> That's done at three different places in configure.ac.
>
>> This last code line seems to be unconditionally executed if the condition
>> from line above is true. It means that if I specify LDAP library with
>> '--with-ldap-lib' then LDAPS support will be disabled. Could you please
>> assist/comment?
>
> That's not how I read the code. See line 887 and onwards in configure.ac for
> something that is much more readable than the gibberish in the generated
> configure script.
>
> I'll admit I don't understand the flow the code runs in your case but then I
> also don't have the slightest idea about what "Mozilla LDAP SDK" is...

'configure.ac' contains the code regarding LDAP that seems very
proper. However after I ran 'configure' I received the result that
LDAP is enabled and LDAPS is disabled. Let's take a look on a code
portion from 'configure.ac', line 904:

if test "$LDAPLIBNAME" ; then
    AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
      AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
      AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
      AC_SUBST(CURL_DISABLE_LDAP, [1])])
      AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
      AC_SUBST(CURL_DISABLE_LDAPS, [1])

It seems that when it is translated into 'configure' then we have some
phantom small piece of code at the very bottom (I marked it with a
comment) that disables LDAPS unconditionally when the first 'if'
condition is true. Here's the code from 'configure' that corresponds
to the lines from 'configure.ac' above ((I just made a proper
indentation to make it easier for reading):

if test "$LDAPLIBNAME" ; then
            as_ac_Lib=`$as_echo "ac_cv_lib_"$LDAPLIBNAME"''_ldap_init" | $as_tr_sh`
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_init in
-l\"$LDAPLIBNAME\"" >&5
        $as_echo_n "checking for ldap_init in -l\"$LDAPLIBNAME\"... " >&6; }
        if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
                  $as_echo_n "(cached) " >&6
        else
                  ac_check_lib_save_LIBS=$LIBS
                LIBS="-l"$LDAPLIBNAME" $LIBS"
                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
                /* end confdefs.h. */

                #ifdef __cplusplus
                extern "C"
                #endif
                char ldap_init ();
                int main (void)
                {
                        return ldap_init ();
                         ;
                        return 0;
                }
                _ACEOF
                if ac_fn_c_try_link "$LINENO"; then :
                          eval "$as_ac_Lib=yes"
                else
                          eval "$as_ac_Lib=no"
                fi
                rm -f core conftest.err conftest.$ac_objext \
                    conftest$ac_exeext conftest.$ac_ext
                LIBS=$ac_check_lib_save_LIBS
        fi
        eval ac_res=\$$as_ac_Lib
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
        $as_echo "$ac_res" >&6; }
        eval as_val=\$$as_ac_Lib
           if test "x$as_val" = x""yes; then :
                  cat >>confdefs.h <<_ACEOF
                #define `$as_echo "HAVE_LIB"$LDAPLIBNAME"" | $as_tr_cpp` 1
                _ACEOF

                  LIBS="-l"$LDAPLIBNAME" $LIBS"

        else

                      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
\"$LDAPLIBNAME\" is not an LDAP library: LDAP disabled" >&5
                $as_echo "$as_me: WARNING: \"$LDAPLIBNAME\" is not an LDAP library:
LDAP disabled" >&2;}

                $as_echo "#define CURL_DISABLE_LDAP 1" >>confdefs.h

                      CURL_DISABLE_LDAP=1

        fi

              # ------------------------------------------------------------------------------------------------
              # This is a strange piece of code that disable LDAPS unconditionally
              # ------------------------------------------------------------------------------------------------
        $as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h

              CURL_DISABLE_LDAPS=1

I appreciate your help on this issue.
Thanks
Oleg
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-05-28