summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-04-22 22:53:26 +0400
committerAlexander Nozdrin <alik@sun.com>2010-04-22 22:53:26 +0400
commit53af29c086aada825d50e3518dbe112bd625ce51 (patch)
tree0b6e0ac6567058a2ee50f09f6bb21bf72885556c /sql/item_strfunc.cc
parentdbe6981b30caac4856368a61a861dac9f0a73d87 (diff)
downloadmariadb-git-53af29c086aada825d50e3518dbe112bd625ce51.tar.gz
Patch for Bug#53022: Compilation of "embedded" is broken.
The bug was a side effect of WL#5030 (fix header files) and WL#5161 (CMake). The problem was that CMake-generated config.h (and my_config.h as a copy of it) had a header guard. GNU autotools-generated [my_]config.h did not. During WL#5030 the order of header files was changed, so the following started to happen (using GNU autotools, in embedded server): - my_config.h included, defining HAVE_OPENSSL - my_global.h included, un-defining HAVE_OPENSSL - zlib.h included, including config.h, defining HAVE_OPENSSL again. The fix is to check HAVE_OPENSSL in conjuction with EMBEDDED_LIBRARY. More common fix would be to define a macros as HAVE_OPENSSL && !EMBEDDED_LIBRARY and use it instead of HAVE_OPENSSL.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc24
1 files changed, 9 insertions, 15 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 7025cf1af56..f2b34fe59ed 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -29,13 +29,6 @@
#pragma implementation // gcc: Class implementation
#endif
-/*
- NOTE: zlib.h must be included *before* my_global.h because my_global.h
- may undef some HAVE_ macros. Including zlib.h after my_global.h may lead
- to re-defining undefined macros, thus to compile errors.
-*/
-#include <zlib.h> // Must be before my_global.h
-
/* May include caustic 3rd-party defs. Use early, so it can override nothing. */
#include "sha2.h"
#include "my_global.h" // HAVE_*
@@ -58,6 +51,7 @@
#include "my_md5.h"
#include "sha1.h"
#include "my_aes.h"
+#include <zlib.h>
C_MODE_START
#include "../mysys/my_static.h" // For soundex_map
C_MODE_END
@@ -251,7 +245,7 @@ void Item_func_sha::fix_length_and_dec()
String *Item_func_sha2::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
-#ifdef HAVE_OPENSSL
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
unsigned char digest_buf[SHA512_DIGEST_LENGTH];
String *input_string;
unsigned char *input_ptr;
@@ -329,7 +323,7 @@ String *Item_func_sha2::val_str(String *str)
"sha2", "--with-ssl");
null_value= TRUE;
return (String *) NULL;
-#endif
+#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
}
@@ -338,7 +332,7 @@ void Item_func_sha2::fix_length_and_dec()
maybe_null = 1;
max_length = 0;
-#if defined(HAVE_OPENSSL)
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
int sha_variant= args[1]->const_item() ? args[1]->val_int() : 512;
switch (sha_variant) {
@@ -384,7 +378,7 @@ void Item_func_sha2::fix_length_and_dec()
ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
"sha2", "--with-ssl");
-#endif
+#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
}
/* Implementation of AES encryption routines */
@@ -643,7 +637,7 @@ void Item_func_concat::fix_length_and_dec()
String *Item_func_des_encrypt::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
-#ifdef HAVE_OPENSSL
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
uint code= ER_WRONG_PARAMETERS_TO_PROCEDURE;
DES_cblock ivec;
struct st_des_keyblock keyblock;
@@ -729,7 +723,7 @@ error:
push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_WARN,
ER_FEATURE_DISABLED, ER(ER_FEATURE_DISABLED),
"des_encrypt", "--with-ssl");
-#endif /* HAVE_OPENSSL */
+#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
null_value=1;
return 0;
}
@@ -738,7 +732,7 @@ error:
String *Item_func_des_decrypt::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
-#ifdef HAVE_OPENSSL
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
uint code= ER_WRONG_PARAMETERS_TO_PROCEDURE;
DES_cblock ivec;
struct st_des_keyblock keyblock;
@@ -807,7 +801,7 @@ wrong_key:
push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_WARN,
ER_FEATURE_DISABLED, ER(ER_FEATURE_DISABLED),
"des_decrypt", "--with-ssl");
-#endif /* HAVE_OPENSSL */
+#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
null_value=1;
return 0;
}