Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4528

Modified Files:
      Tag: Feb2010
        merovingian_controlrunner.c utils.c utils.h 
Log Message:
It's better to allocate some memory to write to.  Change signature of 
generateSalt, since it doesn't allocate memory as I mistakenly thought it did.

Index: merovingian_controlrunner.c
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/backends/monet5/merovingian/merovingian_controlrunner.c,v
retrieving revision 1.31
retrieving revision 1.31.2.1
diff -u -d -r1.31 -r1.31.2.1
--- merovingian_controlrunner.c 7 Jan 2010 15:24:31 -0000       1.31
+++ merovingian_controlrunner.c 5 Mar 2010 17:36:29 -0000       1.31.2.1
@@ -193,7 +193,7 @@
 
                        /* send challenge */
                        p = buf;
-                       generateSalt(&p, 32);
+                       generateSalt(p, 32);
                        len = snprintf(buf2, sizeof(buf2),
                                        "merovingian:1:%s:\n", p);
                        send(msgsock, buf2, len, 0);

Index: utils.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/utils.c,v
retrieving revision 1.23.2.1
retrieving revision 1.23.2.2
diff -u -d -r1.23.2.1 -r1.23.2.2
--- utils.c     5 Mar 2010 14:42:39 -0000       1.23.2.1
+++ utils.c     5 Mar 2010 17:36:31 -0000       1.23.2.2
@@ -286,7 +286,7 @@
  * Padds the remaining bytes in buf with null-bytes.
  */
 void
-generateSalt(char **buf, unsigned int len)
+generateSalt(char *buf, unsigned int len)
 {
        unsigned int c;
        unsigned int size = (unsigned int)rand();
@@ -294,9 +294,9 @@
        unsigned int min = len * 0.42;
        size = (size % (fill - min)) + min;
        for (c = 0; c < size; c++)
-               (*buf)[c] = seedChars[rand() % 62];
+               buf[c] = seedChars[rand() % 62];
        for ( ; c < len; c++)
-               (*buf)[c] = '\0';
+               buf[c] = '\0';
 }
 
 char *
@@ -304,7 +304,7 @@
 {
        FILE *f;
        unsigned int len = 48;
-       char *buf[len];
+       char buf[len];
 
        generateSalt(buf, len);
        if ((f = fopen(path, "w")) == NULL) {

Index: utils.h
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/utils.h,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -d -r1.13 -r1.13.2.1
--- utils.h     7 Jan 2010 15:24:31 -0000       1.13
+++ utils.h     5 Mar 2010 17:36:31 -0000       1.13.2.1
@@ -45,7 +45,7 @@
 char *setConfVal(confkeyval *ckv, char *val);
 void secondsToString(char *buf, time_t t, int longness);
 void abbreviateString(char *ret, const char *in, size_t width);
-void generateSalt(char *buf[], unsigned int len);
+void generateSalt(char *buf, unsigned int len);
 char *generatePassphraseFile(char *path);
 char *generateUUID(void);
 


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to