Changeset: 4c337d905de2 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4c337d905de2 Modified Files: MonetDB.spec clients/mapilib/mapi.c configure.ag monetdb5/mal/mal_authorize.mx monetdb5/optimizer/opt_support.mx Branch: default Log Message:
Merge with Apr2011 branch. diffs (truncated from 480 to 300 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -37,7 +37,7 @@ BuildRequires: libcurl-devel BuildRequires: libuuid-devel BuildRequires: libxml2-devel -BuildRequires: openssl-devel >= 0.9.8f +BuildRequires: openssl-devel BuildRequires: pcre-devel >= 4.5 BuildRequires: perl BuildRequires: perl-devel @@ -145,7 +145,7 @@ Group: Applications/Databases Requires: %{name}-client = %{version}-%{release} Requires: %{name}-stream-devel = %{version}-%{release} -Requires: openssl-devel >= 0.9.8f +Requires: openssl-devel %description client-devel MonetDB is a database management system that is developed from a diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -2474,28 +2474,49 @@ strncpy(key, mid->password, n); +#ifdef HAVE_RIPEMD160 if (strcmp(serverhash, "RIPEMD160") == 0) { RIPEMD160((unsigned char *) key, n, md); len = 40; - } else if (strcmp(serverhash, "SHA512") == 0) { + } else +#endif +#ifdef HAVE_SHA512 + if (strcmp(serverhash, "SHA512") == 0) { SHA512((unsigned char *) key, n, md); len = 128; - } else if (strcmp(serverhash, "SHA384") == 0) { + } else +#endif +#ifdef HAVE_SHA384 + if (strcmp(serverhash, "SHA384") == 0) { SHA384((unsigned char *) key, n, md); len = 96; - } else if (strcmp(serverhash, "SHA256") == 0) { + } else +#endif +#ifdef HAVE_SHA256 + if (strcmp(serverhash, "SHA256") == 0) { SHA256((unsigned char *) key, n, md); len = 64; - } else if (strcmp(serverhash, "SHA224") == 0) { + } else +#endif +#ifdef HAVE_SHA224 + if (strcmp(serverhash, "SHA224") == 0) { SHA224((unsigned char *) key, n, md); len = 56; - } else if (strcmp(serverhash, "SHA1") == 0) { + } else +#endif +#ifdef HAVE_SHA1 + if (strcmp(serverhash, "SHA1") == 0) { SHA1((unsigned char *) key, n, md); len = 40; - } else if (strcmp(serverhash, "MD5") == 0) { + } else +#endif +#ifdef HAVE_MD5 + if (strcmp(serverhash, "MD5") == 0) { MD5((unsigned char *) key, n, md); len = 32; - } else { + } else +#endif + { snprintf(buf, BLOCK, "server requires unknown hash '%s'", serverhash); close_connection(mid); return mapi_setError(mid, buf, "mapi_start_talking", MERROR); @@ -2533,6 +2554,7 @@ /* TODO: make this actually obey the separation by commas, and * only allow full matches */ +#ifdef HAVE_RIPEMD160 if (strstr(hashes, "RIPEMD160") != NULL) { /* The RIPEMD160 hash algorithm is a 160 bit hash. In order to * use in a string, a hexadecimal representation of the bit @@ -2559,7 +2581,10 @@ md[8], md[9], md[10], md[11], md[12], md[13], md[14], md[15], md[16], md[17], md[18], md[19]); - } else if (strstr(hashes, "SHA1") != NULL) { + } else +#endif +#ifdef HAVE_SHA1 + if (strstr(hashes, "SHA1") != NULL) { /* The SHA-1 RSA hash algorithm is a 160 bit hash. In order to * use in a string, a hexadecimal representation of the bit * sequence is used. @@ -2585,7 +2610,10 @@ md[8], md[9], md[10], md[11], md[12], md[13], md[14], md[15], md[16], md[17], md[18], md[19]); - } else if (strstr(hashes, "MD5") != NULL) { + } else +#endif +#ifdef HAVE_MD5 + if (strstr(hashes, "MD5") != NULL) { /* The MD5 hash algorithm is a 128 bit hash. In order to * use in a string, a hexadecimal representation of the bit * sequence is used. @@ -2610,8 +2638,10 @@ md[4], md[5], md[6], md[7], md[8], md[9], md[10], md[11], md[12], md[13], md[14], md[15]); + } else +#endif #ifdef HAVE_CRYPT - } else if (pversion == 8 && strstr(hashes, "crypt") != NULL) { + if (pversion == 8 && strstr(hashes, "crypt") != NULL) { /* The crypt hash algorithm uses UNIX crypt, a modification of * DES which uses a 2-char wide salt. Because crypt only cares * about the first eight characters of the given password, the @@ -2644,8 +2674,9 @@ assert(cr != NULL); hash = malloc(sizeof(char) * ( /*{crypt} */ 7 + strlen(cr) + 1)); sprintf(hash, "{crypt}%s", cr); + } else #endif - } else if (pversion == 8 && strstr(hashes, "plain") != NULL) { + if (pversion == 8 && strstr(hashes, "plain") != NULL) { /* The plain text algorithm, doesn't really hash at all. It's * the easiest algorithm, as it just appends the challenge to * the password and returns it. diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -292,7 +292,8 @@ dnl logs usually end up in /var/log logdir='${localstatedir}/log/monetdb' AC_ARG_WITH(logdir, - [--with-logdir=DIR Where to put log files (LOCALSTATEDIR/log/monetdb/)], + AS_HELP_STRING([--with-logdir=DIR], + [Where to put log files (LOCALSTATEDIR/log/monetdb/)]), [case "$withval" in yes|no|auto) AC_MSG_WARN([--with-logdir called without argument - will use default]) @@ -306,7 +307,8 @@ dnl pidfiles usually end up in /var/run rundir='${localstatedir}/run/monetdb' AC_ARG_WITH(rundir, - [--with-rundir=DIR Where to put pid files (LOCALSTATEDIR/run/monetdb/)], + AS_HELP_STRING([--with-rundir=DIR], + [Where to put pid files (LOCALSTATEDIR/run/monetdb/)]), [case "$withval" in yes|no|auto) AC_MSG_WARN([--with-rundir called without argument - will use default]) @@ -2150,8 +2152,8 @@ dnl OpenSSL library dnl required for MonetDB5 (and SQL), optional otherwise -PKG_CHECK_MODULES([openssl], [openssl >= 0.9.8f], - [have_openssl=yes; AC_DEFINE(HAVE_OPENSSL, 1, [Define if you have the OpenSSL library])], +PKG_CHECK_MODULES([openssl], [openssl], + [have_openssl=yes], [have_openssl=no]) case "$enable_monetdb5-$have_openssl" in yes-no) @@ -2163,7 +2165,33 @@ disable_monetdb5="(OpenSSL library not found but required for MonetDB5)" fi ;; +*-yes) + save_LIBS="$LIBS" + LIBS="$LIBS $openssl_LIBS" + AC_CHECK_FUNCS([MD5 RIPEMD160 SHA1 SHA224 SHA256 SHA384 SHA512]) + LIBS="$save_LIBS" + if eval test \"x\$ac_cv_func_$MONETDB5_PASSWDHASH\" != x"yes"; then + case "$enable_monetdb5" in + yes) + AC_MSG_ERROR([OpenSSL library found but checksum algorithm required for MonetDB5 not found]) + ;; + auto) + enable_monetdb5=no + if test "x$disable_monetdb5" = x; then + disable_monetdb5="(OpenSSL library found but checksum algorithm required for MonetDB5 not found)" + fi + ;; + *) + AC_MSG_WARN([OpenSSL library found but required checksum algorithm not found, so disabling]) + ;; + esac + have_openssl=no + fi + ;; esac +if test x"$have_openssl" = x"yes"; then + AC_DEFINE(HAVE_OPENSSL, 1, [Define if you have the OpenSSL library]) +fi dnl PCRE library dnl required for MonetDB5 (and SQL), optional otherwise diff --git a/monetdb5/mal/mal_authorize.mx b/monetdb5/mal/mal_authorize.mx --- a/monetdb5/mal/mal_authorize.mx +++ b/monetdb5/mal/mal_authorize.mx @@ -839,6 +839,7 @@ return(MAL_SUCCEED); } +#ifdef HAVE_MD5 /** * Returns a GDKmalloced string representing the hex representation of * the MD5 hash of the given string. @@ -859,7 +860,9 @@ return(MAL_SUCCEED); } +#endif +#ifdef HAVE_SHA1 /** * Returns a GDKmalloced string representing the hex representation of * the SHA-1 hash of the given string. @@ -880,7 +883,9 @@ return(MAL_SUCCEED); } +#endif +#if defined(HAVE_SHA224) || defined(HAVE_SHA256) || defined(HAVE_SHA384) || defined(HAVE_SHA512) /** * Returns a GDKmalloced string representing the hex representation of * the SHA-2 hash with number of bits of the given string. @@ -890,10 +895,8 @@ unsigned char md[64]; /* should be SHA512_DIGEST_LENGTH */ switch (*number) { +#ifdef HAVE_SHA224 case 224: -#ifdef OPENSSL_NO_SHA256 - throw(MAL, "AUTHSHA2Sum", "SHA224 support not compiled in"); -#else SHA224((unsigned char*)*string, *len, md); *ret = GDKmalloc(sizeof(char) * (28 * 2 + 1)); sprintf(*ret, @@ -909,10 +912,8 @@ ); break; #endif +#ifdef HAVE_SHA256 case 256: -#ifdef OPENSSL_NO_SHA256 - throw(MAL, "AUTHSHA2Sum", "SHA256 support not compiled in"); -#else SHA256((unsigned char*)*string, *len, md); *ret = GDKmalloc(sizeof(char) * (32 * 2 + 1)); sprintf(*ret, @@ -930,10 +931,8 @@ ); break; #endif +#ifdef HAVE_SHA384 case 384: -#ifdef OPENSSL_NO_SHA512 - throw(MAL, "AUTHSHA2Sum" "SHA384 support not compiled in"); -#else SHA384((unsigned char*)*string, *len, md); *ret = GDKmalloc(sizeof(char) * (48 * 2 + 1)); sprintf(*ret, @@ -955,10 +954,8 @@ ); break; #endif +#ifdef HAVE_SHA512 case 512: -#ifdef OPENSSL_NO_SHA512 - throw(MAL, "AUTHSHA2Sum" "SHA512 support not compiled in"); -#else SHA512((unsigned char*)*string, *len, md); *ret = GDKmalloc(sizeof(char) * (64 * 2 + 1)); sprintf(*ret, @@ -993,7 +990,9 @@ return(MAL_SUCCEED); } +#endif +#ifdef HAVE_RIPEMD160 /** * Returns a GDKmalloced string representing the hex representation of * the RIPEMD-160 hash of the given string. @@ -1014,6 +1013,7 @@ return(MAL_SUCCEED); } +#endif /** _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list