Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22590/src/mal

Modified Files:
        mal_authorize.mx mal_builder.mx mal_client.mx mal_import.mx 
        mal_linker.mx mal_module.mx mal_session.mx 
Log Message:
propagated changes of Thursday Oct 25 2007 - Monday Oct 29 2007
from the MonetDB_5-2 branch to the development trunk


Index: mal_linker.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_linker.mx,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- mal_linker.mx       14 Jun 2007 18:58:44 -0000      1.99
+++ mal_linker.mx       29 Oct 2007 20:09:55 -0000      1.100
@@ -115,6 +115,7 @@
        int mode = RTLD_NOW | RTLD_GLOBAL;
        void *handle = NULL;
        char *fullname;
+       MALfcn fcn=0;
 
        fullname = MSP_locate_file(filename);
        if (fullname == NULL) {
@@ -130,8 +131,11 @@
 #ifdef DEBUG_MAL_LINKER
        stream_printf(GDKout, "localObjectLoaded ? 
%s\n",(handle!=0?"yes":"no"));
 #endif
-       if (handle)
-               return (MALfcn) dlsym(handle, filename);
+       if (handle){
+               fcn=(MALfcn) dlsym(handle, filename);
+               GDKfree(filename);
+               return fcn;
+       }
        stream_printf(GDKout, "could not access library %s\n", dlerror());
        return 0;
 }

Index: mal_authorize.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_authorize.mx,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- mal_authorize.mx    17 Oct 2007 12:04:39 -0000      1.52
+++ mal_authorize.mx    29 Oct 2007 20:09:54 -0000      1.53
@@ -333,12 +333,15 @@
        rethrow("checkCredentials", tmp, AUTHdecypherValue(&pwd, &tmp));
        /* generate the hash as the client should have done */
        rethrow("checkCredentials", tmp, AUTHhashPassword(&hash, algo, &pwd, 
challenge));
+       GDKfree(pwd);
        /* and now we have it, compare it to what was given to us */
        if (strcmp(*passwd, hash) != 0) {
                /* of course we DO NOT print the password here */
+               GDKfree(hash);
                throw(INVCRED, "checkCredentials", "Invalid credentials for 
user '%s'",
                                *username);
        }
+       GDKfree(hash);
 
        /* now see if the scenario is permitted (if restrictions for that
         * apply)
@@ -415,6 +418,7 @@
        /* needs force, as SQL makes a view over user */
        BUNappend(user, *username, TRUE);
        BUNappend(pass, hash, FALSE);   /* should always be private! */
+       GDKfree(hash);
        /* retrieve the oid of the just inserted user */
        p = BUNfnd(BATmirror(user), *username);
        assert (p != BUN_NONE);
@@ -569,7 +573,8 @@
        /* cypher the password */
        rethrow("setPassword", tmp, AUTHcypherValue(&hash, passwd));
        /* ok, just overwrite the password field for this user */
-       BUNinplace(pass, p, BUNhead(passi, p), &hash, FALSE);
+       BUNinplace(pass, p, BUNhead(passi, p), hash, FALSE);
+       GDKfree(hash);
        AUTHcommit();
 
        return(MAL_SUCCEED);
@@ -619,7 +624,8 @@
        p = BUNfnd(pass, &id);
        assert (p != BUN_NONE);
        passi = bat_iterator(pass);
-       BUNinplace(pass, p, BUNhead(passi, p), &hash, FALSE);
+       BUNinplace(pass, p, BUNhead(passi, p), hash, FALSE);
+       GDKfree(hash);
        AUTHcommit();
 
        return(MAL_SUCCEED);
@@ -977,7 +983,9 @@
 /**
  * Returns the hash for the given password, challenge and algorithm.
  * The hash calculated using the given algorithm over the password
- * concatenated with the challenge.
+ * concatenated with the challenge.  The returned string is allocated
+ * using GDKmalloc, and hence should be freed with GDKfree by the
+ * caller.
  */
 static str
 AUTHhashPassword(str *ret, str *algo, str *password, str *challenge) {

Index: mal_import.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_import.mx,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- mal_import.mx       19 Aug 2007 16:34:02 -0000      1.70
+++ mal_import.mx       29 Oct 2007 20:09:55 -0000      1.71
@@ -245,16 +245,33 @@
        @:restoreClient()@
        return msg;
 }
+
+str mal_cmdline( char *s, int *len)
+{
+       if (s[*len - 1] != '\n') {
+               char *n = GDKmalloc(*len + 1 + 1);
+
+               strncpy(n, s, *len);
+               n[*len] = '\n';
+               n[*len + 1] = 0;
+               (*len)++;
+               return n;
+       }
+       return s;
+}
+
 @h
 mal_export str compileString(Symbol *fcn, Client c, str s);
 @c
 str
-compileString(Symbol *fcn, Client c, str s){
+compileString(Symbol *fcn, Client c, str s)
+{
        @:restoreState@
        int len = strlen(s);
        buffer *b;
        str msg = MAL_SUCCEED;
        str qry;
+       str old = s;
 
        c->yycur = 0;
        c->prompt = GDKstrdup("");      /* do not produce visible prompts */
@@ -264,18 +281,11 @@
        c->fdin = NULL;
        c->srcFile= NULL;
 
-       b = (buffer *) GDKmalloc(sizeof(buffer));
-       if (s[len - 1] != '\n') {
-               char *n = GDKmalloc(len + 1 + 1);
-
-               strncpy(n, s, len);
-               n[len] = '\n';
-               n[len + 1] = 0;
-               s = n;
-               len++;
-       }
-       if( *s== '"') s++;
+       s = mal_cmdline(s, &len);
        mal_unquote(qry = GDKstrdup(s));
+       if (old != s)
+               GDKfree(s);
+       b = (buffer *) GDKmalloc(sizeof(buffer));
        buffer_init(b, qry, len);
        MCpushClientInput(c, bstream_create(buffer_rastream(b, 
"compileString"), b->len), 0, "");
        MSinitClientPrg(c,"user", "main");      /* create new context */
@@ -295,12 +305,9 @@
        }
        *fcn= c->curprg;
        /* restore IO channel */
-       @:restoreClient1()@
-       c->listing = oldlisting;
-       c->glb = oldglb;
-       c->nspace = oldnspace;
-       c->curprg = oldprg;
+       @:restoreClient()@
        GDKfree(qry);
+       GDKfree(b);
        return MAL_SUCCEED;
 }
 
@@ -314,6 +321,7 @@
        int len = strlen(s);
        buffer *b;
        str msg = MAL_SUCCEED,qry;
+       str old = s;
 
        c->yycur = 0;
        c->prompt = GDKstrdup("");      /* do not produce visible prompts */
@@ -323,18 +331,11 @@
        c->fdin = NULL;
        c->srcFile= NULL;
 
-       b = (buffer *) GDKmalloc(sizeof(buffer));
-       if (s[len - 1] != '\n') {
-               char *n = GDKmalloc(len + 1 + 1);
-
-               strncpy(n, s, len);
-               n[len] = '\n';
-               n[len + 1] = 0;
-               s = n;
-               len++;
-       }
-       if( *s=='"') s++;
+       s = mal_cmdline(s, &len);
        mal_unquote(qry = GDKstrdup(s));
+       if (old != s)
+               GDKfree(s);
+       b = (buffer *) GDKmalloc(sizeof(buffer));
        buffer_init(b, qry, len);
        MCpushClientInput(c, bstream_create(buffer_rastream(b, "callString"), 
b->len), listing, "");
        MSinitClientPrg(c,"user", "main");      /* create new context */
@@ -347,6 +348,7 @@
        @:runPhase(MAL_SCENARIO_ENGINE,restoreClient2)@
        @:restoreClient2()@
        GDKfree(qry);
+       GDKfree(b);
 }
 
 @h

Index: mal_session.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_session.mx,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- mal_session.mx      22 Oct 2007 10:36:02 -0000      1.144
+++ mal_session.mx      29 Oct 2007 20:09:55 -0000      1.145
@@ -398,6 +398,7 @@
                        getHeadType(tpe) == TYPE_any || 
                        getTailType(tpe) == TYPE_any ));
 }
+
 void
 MSresetVariables(MalBlkPtr mb, MalStkPtr glb, int start)
 {

Index: mal_client.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_client.mx,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- mal_client.mx       3 Oct 2007 14:00:46 -0000       1.159
+++ mal_client.mx       29 Oct 2007 20:09:55 -0000      1.160
@@ -259,7 +259,6 @@
 mal_export void     MCtraceAllClients(int flag);
 mal_export void     MCtraceClient(oid which, int flag);
 
-mal_export bstream *MCgetConsole(Client c);
 mal_export void     MCpushClientInput(Client c, bstream *new_input, int 
listing, char *prompt);
 mal_export void     MCpopClientInput(Client c);
 
@@ -315,14 +314,6 @@
        /* printf("awake Thread %d %d\n", h->tid, (int) h->pid);*/
 }
 
-bstream *MCgetConsole(Client c){
-       ClientInput *x;
-       if( c->bak == 0) return c->fdin;
-       x= c->bak;
-       while(x->next) x= x->next;
-       return x->fdin;
-       /* return c->console;*/
-}
 void MCpushClientInput(Client c, bstream *new_input, int listing, char *prompt)
 {
        ClientInput *x = (ClientInput*)GDKmalloc(sizeof(ClientInput));

Index: mal_module.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_module.mx,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- mal_module.mx       15 Sep 2007 08:11:34 -0000      1.62
+++ mal_module.mx       29 Oct 2007 20:09:55 -0000      1.63
@@ -323,7 +323,7 @@
                        }
                        nxt = nxt->peer;
                }
-               }
+       }
 }
 
 @+ Inheritance

Index: mal_builder.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_builder.mx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mal_builder.mx      28 Aug 2007 19:56:41 -0000      1.26
+++ mal_builder.mx      29 Oct 2007 20:09:55 -0000      1.27
@@ -254,16 +254,19 @@
 }
 
 InstrPtr
-pushStr(MalBlkPtr mb, InstrPtr q, const char *val)
+pushStr(MalBlkPtr mb, InstrPtr q, const char *Val)
 {
        int _t;
        ValRecord cst;
+       char *val = (char*)Val;
 
        cst.vtype= TYPE_str;
-       cst.val.sval= GDKstrdup(val);
+       cst.val.sval= val;
        cst.len= strlen(cst.val.sval);
        _t = defConstant(mb,TYPE_str,&cst);
 
+       if (getConstant(mb,_t).val.sval == val) 
+               getConstant(mb,_t).val.sval = GDKstrdup(val);
        return pushArgument(mb, q, _t);
 }
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to