Prevent clashes between system and Samba SHA functions
authorEmmanuel Dreyfus <manu@netbsd.org>
Sat, 30 May 2015 05:31:01 +0000 (07:31 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 2 Jun 2015 23:54:23 +0000 (01:54 +0200)
Samba provides its own set of SHA function, which would replace
libc-provided flavors. This is a problem because while the prototypes
are the same, the context structure are different. As a result,
when connecting to a LDAP/SSL directory, we go through
libldap/libssl/libcrypto and there libcrypto expects to call libc
SHA functions, not Samba's.

The fix is to check for SHA function presence and rename Samba's
version to avoid a clash.

Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo <simo@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun  3 01:54:24 CEST 2015 on sn-devel-104

lib/crypto/sha256.h
lib/crypto/sha512.h
lib/crypto/wscript_configure

index 7ee8fac73cb8d5db74e70a19416426832003f55e..010dbff8c6b90be8677117eca8d9edd4baac25e5 100644 (file)
  */
 #define HEIM_SHA_H 1
 
-#if 0
+#if SHA1_RENAME_NEEDED
 /* symbol renaming */
 #define SHA1_Init hc_SHA1_Init
 #define SHA1_Update hc_SHA1_Update
 #define SHA1_Final hc_SHA1_Final
+#endif
+#if SHA256_RENAME_NEEDED
+/* symbol renaming */
 #define SHA256_Init hc_SHA256_Init
 #define SHA256_Update hc_SHA256_Update
 #define SHA256_Final hc_SHA256_Final
index dc394fd5f5ff45bd6279a8ee0db66cd2fde51801..509fd955e0a47d5c595fbd22b10049dbecc1baf9 100644 (file)
@@ -36,7 +36,7 @@
 #ifndef HEIM_SHA_H
 #define HEIM_SHA_H 1
 
-#if 0
+#if SHA512_RENAME_NEEDED
 /* symbol renaming */
 #define SHA512_Init hc_SHA512_Init
 #define SHA512_Update hc_SHA512_Update
index 21ec566b6ba966544915b374c42fa2c6d40494fe..130acec4381f192b0863e4c5af31efe8cbaedb7e 100644 (file)
@@ -6,3 +6,10 @@ if not conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h',
                         checklibc=True)
 conf.CHECK_FUNCS_IN('CC_MD5_Init', '', headers='CommonCrypto/CommonDigest.h',
     checklibc=True)
+
+if conf.CHECK_FUNCS('SHA1_Update'):
+       conf.DEFINE('SHA1_RENAME_NEEDED', 1)
+if conf.CHECK_FUNCS('SHA256_Update'):
+       conf.DEFINE('SHA256_RENAME_NEEDED', 1)
+if conf.CHECK_FUNCS('SHA512_Update'):
+       conf.DEFINE('SHA512_RENAME_NEEDED', 1)