troubles with glibc 2.10

Bernhard Graf <[email protected]> Thu, 29 Apr 2010 09:52:26 +0200
Newsgroups gmane.mail.vmailmgr
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------020008010809040806040105
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

Hi,

I've just installed vmailmgr on a current openSUSE 11.2.

Compiling fails with:

> make[2]: Entering directory `/home/graf/packages/BUILD/vmailmgr-0.97/authenticate'
> g++ -DHAVE_CONFIG_H -I. -I. -I..  -I../lib    -g -O2 -fno-rtti -fno-exceptions -Wall -c checkvpw.cc
> checkvpw.cc: In function 'char* strcasestr(const char*, const char*)':
> checkvpw.cc:108: error: new declaration 'char* strcasestr(const char*, const char*)'
> /usr/include/string.h:367: error: ambiguates old declaration 'const char* strcasestr(const char*, const char*)'
> make[2]: *** [checkvpw.o] Error 1
> make[2]: Leaving directory `/home/graf/packages/BUILD/vmailmgr-0.97/authenticate'

The reason is strcasestr() which is defined in checkvpw.cc, but also
exists in glibc. This didn't hurt until now, because both were declared
the same way, but now in glibc 2.10 the declaration changed slightly:
strcasestr() returns "const char *" instead of "char *", and this
results in the above error.

The easy fix is to delete strcasestr() from checkvpw.cc, this is what
the attached patch does. A check for strcasestr() in configure on the
current system would probably better.

-- 
Bernhard Graf

--------------020008010809040806040105
Content-Type: text/x-patch;
 name="vmailmgr-0.97-strcasestr.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="vmailmgr-0.97-strcasestr.patch"

--- authenticate/checkvpw.cc
+++ authenticate/checkvpw.cc
@@ -105,15 +105,6 @@
   return new auth_data(name, pass, stamp);
 }
 
-char* strcasestr(const char* haystack, const char* needle)
-{
-  for(size_t hlength = strlen(haystack), nlength = strlen(needle);
-      hlength >= nlength; hlength--, haystack++)
-    if(!strncasecmp(haystack, needle, nlength))
-      return (char*)haystack;
-  return 0;
-}
-
 unsigned find_maildir(int argc, const char* args[])
 {
   for(int arg = 0; arg < argc; arg++) {

--------------020008010809040806040105--