broken strndup on AIX 5.1

Doug VanLeuven roamdad at sonic.net
Sun Aug 22 00:31:48 GMT 2004


Hi,
AIX 5.1.0.50
samba 3_0 svn 1824
strndup in libc.a

I could pass all the smbtorture tests except MANGLE.
This patch on an AIX illustrates the problem if smb.conf uses hash2 
method and allows MANGLE to succeed.
Neither are the build_farm AIX systems passing this test.

Would someone point me towards the proper way to solve this in 
configure?  Try and test for broken strndup behavior or just use the 
builtin for AIX 5L?

--- mangle_hash2.c.orig 2004-08-21 14:31:07.000000000 -0700
+++ mangle_hash2.c      2004-08-21 16:42:38.000000000 -0700
@@ -175,6 +175,10 @@
        }
 
        prefix_cache[i] = strndup(prefix, length);
+       if (strlen(prefix_cache[i]) != length) {
+               M_DEBUG(0,("cache_insert: strlen of %d != requested 
length of %d\n",strlen(prefix_cache[i]),length));
+               prefix_cache[i][length] = '\0';
+       }
        prefix_cache_hashes[i] = hash;
 }



More information about the samba-technical mailing list