Changeset: f19bf95c6460 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f19bf95c6460
Added Files:
        monetdb5/modules/mal/Tests/clients-hashes.stable.out.Darwin
Modified Files:
        monetdb5/modules/mal/Tests/clients-hashes.malC
        monetdb5/modules/mal/clients.c
Branch: default
Log Message:

Merge with Jun2016 branch.


diffs (178 lines):

diff --git a/monetdb5/modules/mal/Tests/clients-hashes.malC 
b/monetdb5/modules/mal/Tests/clients-hashes.malC
--- a/monetdb5/modules/mal/Tests/clients-hashes.malC
+++ b/monetdb5/modules/mal/Tests/clients-hashes.malC
@@ -1,14 +1,35 @@
 p := clients.md5sum("monetdb");
 io.print(p);
+catch MALException:str;
+io.print("clients.md5sum not available");
+exit MALException;
 p := clients.sha1sum("monetdb");
 io.print(p);
+catch MALException:str;
+io.print("clients.sha1sum not available");
+exit MALException;
 p := clients.ripemd160sum("monetdb");
 io.print(p);
+catch MALException:str;
+io.print("clients.ripemd160sum not available");
+exit MALException;
 p := clients.sha2sum("monetdb", 224);
 io.print(p);
+catch MALException:str;
+io.print("clients.sha2sum (224) not available");
+exit MALException;
 p := clients.sha2sum("monetdb", 256);
 io.print(p);
+catch MALException:str;
+io.print("clients.sha2sum (256) not available");
+exit MALException;
 p := clients.sha2sum("monetdb", 384);
 io.print(p);
+catch MALException:str;
+io.print("clients.sha2sum (384) not available");
+exit MALException;
 p := clients.sha2sum("monetdb", 512);
 io.print(p);
+catch MALException:str;
+io.print("clients.sha2sum (512) not available");
+exit MALException;
diff --git a/monetdb5/modules/mal/Tests/clients-hashes.stable.out.Darwin 
b/monetdb5/modules/mal/Tests/clients-hashes.stable.out.Darwin
new file mode 100644
--- /dev/null
+++ b/monetdb5/modules/mal/Tests/clients-hashes.stable.out.Darwin
@@ -0,0 +1,41 @@
+stdout of test 'clients-hashes` in directory 'monetdb5/modules/mal` itself:
+
+
+# 14:07:01 >  
+# 14:07:01 >   mserver5 
"--config=/export/scratch/stripe/fabian/monetdb/current/program-i86pc/etc/monetdb5.conf"
 --debug=10 --set gdk_nr_threads=0 --set 
"monet_mod_path=/export/scratch/stripe/fabian/monetdb/current/program-i86pc/lib/MonetDB5:/export/scratch/stripe/fabian/monetdb/current/program-i86pc/lib/MonetDB5/lib:/export/scratch/stripe/fabian/monetdb/current/program-i86pc/lib/MonetDB5/bin"
 --set 
"gdk_dbfarm=/export/scratch/stripe/fabian/monetdb/current/mtest-pegasus.ins.cwi.nl/five/dbfarm"
 --set 
"sql_logdir=/export/scratch/stripe/fabian/monetdb/current/mtest-pegasus.ins.cwi.nl/five/sqllog"
 --set 
"xquery_logdir=/export/scratch/stripe/fabian/monetdb/current/mtest-pegasus.ins.cwi.nl/five/xquerylog"
  --set mapi_open=true --set xrpc_open=true --set mapi_port=37637 --set 
xrpc_port=44162 --set monet_prompt= --trace  --dbname=mTests_src_modules_mal  
clients-hashes.mal
+# 14:07:01 >  
+
+# MonetDB server v5.11.0, based on kernel v1.29.0
+# Serving database 'mTests_src_modules_mal', using 1 thread
+# Compiled for x86_64-pc-solaris2.11/64bit with 64bit OIDs dynamically linked
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://vienna.da.cwi.nl:35410/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-26774/.s.monetdb.35410
+# MonetDB/GIS module loaded
+# Start processing logs sql/sql_logs version 52200
+# Start reading the write-ahead log 'sql_logs/sql/log.4'
+# Finished reading the write-ahead log 'sql_logs/sql/log.4'
+# Finished processing logs sql/sql_logs
+# MonetDB/SQL module loaded
+# MonetDB/R   module loaded
+
+Ready.
+
+# 09:46:40 >  
+# 09:46:40 >  "mclient" "-lmal" "-ftest" "-Eutf-8" 
"--host=/var/tmp/mtest-26774" "--port=35410"
+# 09:46:40 >  
+
+[ "4fe67471e97aae17f10bf200ccadc4e4" ]
+[ "4751fc28d9a64a043865922548ee7d623743bcad" ]
+[ "clients.ripemd160sum not available" ]
+[ "ba11e4ad9ac60f775cf1f133a81faf32241d9c136e4d3b193bdbbf1e" ]
+[ "38e38a32871128f6c9b84c72c4b6c473e53ab084bffb37c094310045716a8247" ]
+[ 
"d494cbc91a0d3315210af1c2d14e3758ba7d6716393a234cf9f29d8de077110c9009dd840f9c93a5d350b739253f6bd9"
 ]
+[ 
"a73f1d86383446438ac64f56e15ada38b41fbb18f029d2181723aeb2acac6a831f60e5fdbd64ac2c8c70e035dd44cbbe3b45565ef2d58feb2821a2078c7fad35"
 ]
+
+# 14:07:02 >  
+# 14:07:02 >  Done.
+# 14:07:02 >  
+
diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -350,41 +350,67 @@ CLTwakeup(void *ret, int *id)
 }
 
 str CLTmd5sum(str *ret, str *pw) {
+#ifdef HAVE_MD5_UPDATE
        char *mret = mcrypt_MD5Sum(*pw, strlen(*pw));
        *ret = GDKstrdup(mret);
        free(mret);
        return MAL_SUCCEED;
+#else
+       (void) ret;
+       (void) pw;
+       throw(MAL, "clients.md5sum", PROGRAM_NYI);
+#endif
 }
 
 str CLTsha1sum(str *ret, str *pw) {
+#ifdef HAVE_SHA1_UPDATE
        char *mret = mcrypt_SHA1Sum(*pw, strlen(*pw));
        *ret = GDKstrdup(mret);
        free(mret);
        return MAL_SUCCEED;
+#else
+       (void) ret;
+       (void) pw;
+       throw(MAL, "clients.sha1sum", PROGRAM_NYI);
+#endif
 }
 
 str CLTripemd160sum(str *ret, str *pw) {
+#ifdef HAVE_RIPEMD160_UPDATE
        char *mret = mcrypt_RIPEMD160Sum(*pw, strlen(*pw));
        *ret = GDKstrdup(mret);
        free(mret);
        return MAL_SUCCEED;
+#else
+       (void) ret;
+       (void) pw;
+       throw(MAL, "clients.ripemd160sum", PROGRAM_NYI);
+#endif
 }
 
 str CLTsha2sum(str *ret, str *pw, int *bits) {
        char *mret;
        switch (*bits) {
+#ifdef HAVE_SHA512_UPDATE
                case 512:
                        mret = mcrypt_SHA512Sum(*pw, strlen(*pw));
                        break;
+#endif
+#ifdef HAVE_SHA384_UPDATE
                case 384:
                        mret = mcrypt_SHA384Sum(*pw, strlen(*pw));
                        break;
+#endif
+#ifdef HAVE_SHA256_UPDATE
                case 256:
                        mret = mcrypt_SHA256Sum(*pw, strlen(*pw));
                        break;
+#endif
+#ifdef HAVE_SHA224_UPDATE
                case 224:
                        mret = mcrypt_SHA224Sum(*pw, strlen(*pw));
                        break;
+#endif
                default:
                        throw(ILLARG, "clients.sha2sum", "wrong number of bits "
                                        "for SHA2 sum: %d", *bits);
@@ -464,6 +490,7 @@ str CLTsetPassword(Client cntxt, MalBlkP
 }
 
 str CLTcheckPermission(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci) {
+#ifdef HAVE_SHA1_UPDATE
        str *usr = getArgReference_str(stk, pci, 1);
        str *pw = getArgReference_str(stk, pci, 2);
        str ch = "";
@@ -477,6 +504,13 @@ str CLTcheckPermission(Client cntxt, Mal
        msg = AUTHcheckCredentials(&id, cntxt, usr, &pwd, &ch, &algo);
        free(pwd);
        return msg;
+#else
+       (void) cntxt;
+       (void) mb;
+       (void) stk;
+       (void) pci;
+       throw(MAL, "mal.checkPermission", "Required digest algorithm SHA-1 
missing");
+#endif
 }
 
 str CLTgetUsers(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to