Full_Name: Heiko Nardmann
Version: 2.4.39
OS: MinGW32
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (2001:a60:f08d:1:159e:f75f:8f0:44f1)


In clients/tools/ldapsearch.c the address of 'strcasecmp' is taken (inside
'dosearch()') around line 1455. That means that 'strcasecmp' is exported as an
undefined symbol into ldapsearch.o even if 'strcasecmp' is declared as
'always_inline'.

MinGW is such a platform which offers 'strcasecmp' by providing an inline
version of 'strcasecmp' (redirecting it to 'stricmp'). So this taking of an
address breaks linking.

Workaround:

before 'dosearch()' I place a local wrapper:

static int local_strcasecmp(const char *s1, const char *s2)
{
        return strcasecmp(s1, s2);
}

and inside 'dosearch' instead of

                if( sortattr ) {
                        (void) ldap_sort_entries( ld, &res,
                                ( *sortattr == '\0' ) ? NULL : sortattr, 
strcasecmp );
                }

I now have

                if( sortattr ) {
                        (void) ldap_sort_entries( ld, &res,
                                ( *sortattr == '\0' ) ? NULL : sortattr, 
local_strcasecmp );
                }

Some options to really solve that issue:

1) use my approach for all platforms.
2) change autoconf stuff to detect whether 'strcasecmp' is just inlined (MinGW)
or a "real" function (other platforms).

Thx in advance!

  Heiko

Reply via email to