Changeset: c74f22dee6da for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c74f22dee6da
Added Files:
        README.rst
Removed Files:
        README
Modified Files:
        HowToStart.rst
        Makefile.ag
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/exports.stable.out
        monetdb5/ChangeLog
        monetdb5/extras/rapi/Tests/rapi08.malC
        monetdb5/mal/mal_authorize.c
        monetdb5/mal/mal_authorize.h
        monetdb5/mal/mal_module.c
        monetdb5/mal/mal_session.c
        monetdb5/modules/atoms/batxml.c
        monetdb5/modules/kernel/batcolor.c
        monetdb5/modules/kernel/batstr.c
        monetdb5/modules/mal/clients.c
        sql/backends/monet5/sql_user.c
        sql/backends/monet5/vaults/bam/bam_wrapper.c
        sql/server/sql_parser.y
        tools/merovingian/daemon/controlrunner.c
        tools/mserver/mserver5.c
        tools/mserver/shutdowntest.c
Branch: wlcr
Log Message:

mereg with default


diffs (truncated from 1084 to 300 lines):

diff --git a/HowToStart.rst b/HowToStart.rst
--- a/HowToStart.rst
+++ b/HowToStart.rst
@@ -24,7 +24,7 @@ This document assumes that you are plann
 installing MonetDB on a Unix-like system (e.g., Linux, IRIX, Solaris,
 AIX, Mac OS X/Darwin, or CYGWIN).  For compilation and installation on
 a native Windows system (NT, 2000, XP) see the instructions in the
-file `../buildtools/doc/windowsbuild.rst`__.
+file `buildtools/doc/windowsbuild.rst`__.
 
 __ http://dev.monetdb.org/downloads/
 __ Windows-Installation.html
diff --git a/Makefile.ag b/Makefile.ag
--- a/Makefile.ag
+++ b/Makefile.ag
@@ -13,7 +13,7 @@ SUBDIRS = buildtools common clients \
        HAVE_TESTING?testing \
 
 EXTRA_DIST = bootstrap configure configure.ac configure.ag libversions \
-                        MonetDB.spec rpm.mk.in COPYING README license.txt 
HowToStart.rst
+                        MonetDB.spec rpm.mk.in COPYING README.rst license.txt 
HowToStart.rst
 
 EXTRA_DIST_DIR = NT debian MacOSX
 
diff --git a/README b/README
deleted file mode 100644
--- a/README
+++ /dev/null
@@ -1,26 +0,0 @@
-The MonetDB Database System
-===========================
-
-The MonetDB database is developed by the CWI database research group
-(see http://www.monetdb.org/).
-
-Via the MonetDB project we have brought the MonetDB system in open source,
-where it is accessible at http://www.monetdb.org/Downloads/
-
-The MonetDB database system is a high-performance database kernel for
-query-intensive applications. The MonetDB kernel works together with an
-SQL frontend that is in a separate CVS module.
-
-If you got a source distribution, please compile and install MonetDB first,
-following the instructions in the file 'HowToStart.rst' (for Unix)
-or 'buildtools/doc/windowsbuild.rst' (for Windows).
-
-
-Copyright Notice
-================
-
-This Source Code Form is subject to the terms of the Mozilla Public
-License, v. 2.0.  If a copy of the MPL was not distributed with this
-file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V.
diff --git a/README.rst b/README.rst
new file mode 100644
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,34 @@
+The MonetDB Database System
+===========================
+
+The MonetDB database is developed by the CWI database research group
+(see http://www.monetdb.org/).
+
+Via the MonetDB project we have brought the MonetDB system in open source,
+where it is accessible at http://www.monetdb.org/Downloads/
+
+The MonetDB database system is a high-performance database kernel for
+query-intensive applications. The MonetDB source can be found at our `Mercurial
+server`__. There is also a `github mirror`__ that is updated once a day.
+
+.. _MonetDB: http://dev.monetdb.org/hg/MonetDB/
+__ MonetDB_
+
+.. _github: https://github.com/MonetDB/MonetDB
+__ github_
+
+If you got a source distribution, please compile and install MonetDB first,
+following the instructions in the file `HowToStart.rst`__ (for Unix)
+or `buildtools/doc/windowsbuild.rst`__ (for Windows).
+
+__ HowToStart.rst
+__ buildtools/doc/windowsbuild.rst
+
+Copyright Notice
+================
+
+This Source Code Form is subject to the terms of the Mozilla Public
+License, v. 2.0.  If a copy of the MPL was not distributed with this
+file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V.
diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -8654,8 +8654,6 @@ Ready.
 [ "url",       "url",  "command url.url(s:url):url ",  "URLnoop;",     "Create 
an URL from a string literal"   ]
 [ "user",      "main", "function user.main():void;",   "",     ""      ]
 [ "user",      "main", "function user.main():void;",   "",     ""      ]
-[ "user",      "main", "function user.main():void;",   "",     ""      ]
-[ "user",      "main", "function user.main():void;",   "",     ""      ]
 [ "user",      "s2_1", "function user.s2_1():void;",   "",     ""      ]
 [ "uuid",      "#cmp", "command uuid.#cmp():void ",    "UUIDcompare;", ""      
]
 [ "uuid",      "#fromstr",     "command uuid.#fromstr():void ",        
"UUIDfromString;",      ""      ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -11019,8 +11019,6 @@ Ready.
 [ "url",       "url",  "command url.url(s:url):url ",  "URLnoop;",     "Create 
an URL from a string literal"   ]
 [ "user",      "main", "function user.main():void;",   "",     ""      ]
 [ "user",      "main", "function user.main():void;",   "",     ""      ]
-[ "user",      "main", "function user.main():void;",   "",     ""      ]
-[ "user",      "main", "function user.main():void;",   "",     ""      ]
 [ "user",      "s2_1", "function user.s2_1():void;",   "",     ""      ]
 [ "uuid",      "#cmp", "command uuid.#cmp():void ",    "UUIDcompare;", ""      
]
 [ "uuid",      "#fromstr",     "command uuid.#fromstr():void ",        
"UUIDfromString;",      ""      ]
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -740,19 +740,19 @@ str ALGunique1(bat *result, const bat *b
 str ALGunique2(bat *result, const bat *bid, const bat *sid);
 str ALGvariance(dbl *res, const bat *bid);
 str ALGvariancep(dbl *res, const bat *bid);
-str AUTHaddUser(oid *ret, Client c, str *user, str *pass);
-str AUTHchangePassword(Client c, str *oldpass, str *passwd);
-str AUTHchangeUsername(Client c, str *olduser, str *newuser);
-str AUTHcheckCredentials(oid *ret, Client c, str *user, str *passwd, str 
*challenge, str *algo);
-str AUTHgetPasswordHash(str *ret, Client c, str *username);
+str AUTHaddUser(oid *ret, Client c, const char *user, const char *pass);
+str AUTHchangePassword(Client c, const char *oldpass, const char *passwd);
+str AUTHchangeUsername(Client c, const char *olduser, const char *newuser);
+str AUTHcheckCredentials(oid *ret, Client c, const char *user, const char 
*passwd, const char *challenge, const char *algo);
+str AUTHgetPasswordHash(str *ret, Client c, const char *username);
 str AUTHgetUsername(str *ret, Client c);
 str AUTHgetUsers(BAT **ret1, BAT **ret2, Client c);
-str AUTHinitTables(str *passwd);
-str AUTHremoveUser(Client c, str *username);
+str AUTHinitTables(const char *passwd);
+str AUTHremoveUser(Client c, const char *username);
 void AUTHreset(void) __attribute__((__visibility__("hidden")));
-str AUTHresolveUser(str *ret, oid *uid);
-str AUTHsetPassword(Client c, str *username, str *passwd);
-str AUTHunlockVault(str *password);
+str AUTHresolveUser(str *ret, oid uid);
+str AUTHsetPassword(Client c, const char *username, const char *passwd);
+str AUTHunlockVault(const char *password);
 str BATPCREilike(bat *ret, const bat *b, const str *pat, const str *esc);
 str BATPCREilike2(bat *ret, const bat *b, const str *pat);
 str BATPCRElike(bat *ret, const bat *b, const str *pat, const str *esc);
diff --git a/monetdb5/ChangeLog b/monetdb5/ChangeLog
--- a/monetdb5/ChangeLog
+++ b/monetdb5/ChangeLog
@@ -1,6 +1,10 @@
 # ChangeLog file for MonetDB5
 # This file is updated with Maddlog
 
+* Thu Jan  5 2017 Sjoerd Mullender <sjo...@acm.org>
+- Changed the interfaces of the AUTH* functions: pass values, not pointers
+  to values.
+
 * Tue Dec 13 2016 Sjoerd Mullender <sjo...@acm.org>
 - Removed calc.setoid().
 - group.subgroup is now called group.group if it is not refining a group.
diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c
--- a/monetdb5/mal/mal_authorize.c
+++ b/monetdb5/mal/mal_authorize.c
@@ -39,9 +39,9 @@
 #endif
 #endif
 
-static str AUTHdecypherValue(str *ret, str *value);
-static str AUTHcypherValue(str *ret, str *value);
-static str AUTHverifyPassword(str *passwd);
+static str AUTHdecypherValue(str *ret, const char *value);
+static str AUTHcypherValue(str *ret, const char *value);
+static str AUTHverifyPassword(const char *passwd);
 
 static BAT *user = NULL;
 static BAT *pass = NULL;
@@ -74,7 +74,7 @@ AUTHfindUser(const char *username)
                        if (BUNfnd(duser, &pos) == BUN_NONE)
                                return p;
                }
-       } 
+       }
        return BUN_NONE;
 }
 
@@ -91,12 +91,13 @@ AUTHrequireAdmin(Client cntxt) {
        id = cntxt->user;
 
        if (id != 0) {
-               char u[BUFSIZ] = "";
-               str user = u;
+               str user = NULL;
                str tmp;
 
-               rethrow("requireAdmin", tmp, AUTHresolveUser(&user, &id));
-               throw(INVCRED, "requireAdmin", INVCRED_ACCESS_DENIED " '%s'", 
user);
+               rethrow("requireAdmin", tmp, AUTHresolveUser(&user, id));
+               tmp = createException(INVCRED, "requireAdmin", 
INVCRED_ACCESS_DENIED " '%s'", user);
+               GDKfree(user);
+               return tmp;
        }
 
        return(MAL_SUCCEED);
@@ -108,20 +109,21 @@ AUTHrequireAdmin(Client cntxt) {
  * InvalidCredentialsException.
  */
 static str
-AUTHrequireAdminOrUser(Client cntxt, str *username) {
+AUTHrequireAdminOrUser(Client cntxt, const char *username) {
        oid id = cntxt->user;
-       char u[BUFSIZ] = "";
-       str user = u;
+       str user = NULL;
        str tmp = MAL_SUCCEED;
 
        /* root?  then all is well */
        if (id == 0)
                return(MAL_SUCCEED);
 
-       rethrow("requireAdminOrUser", tmp, AUTHresolveUser(&user, &id));
-       if (username == NULL || *username == NULL || strcmp(*username, user) != 
0) {
+       rethrow("requireAdminOrUser", tmp, AUTHresolveUser(&user, id));
+       if (username == NULL || strcmp(username, user) != 0) {
+               GDKfree(user);
                throw(INVCRED, "requireAdminOrUser", INVCRED_ACCESS_DENIED " 
'%s'", user);
        }
+       GDKfree(user);
 
        return(MAL_SUCCEED);
 }
@@ -152,7 +154,7 @@ AUTHcommit(void)
  * after the GDK kernel has been initialized.
  */
 str
-AUTHinitTables(str *passwd) {
+AUTHinitTables(const char *passwd) {
        bat bid;
        int isNew = 1;
        str msg = MAL_SUCCEED;
@@ -224,15 +226,14 @@ AUTHinitTables(str *passwd) {
        if (isNew == 1) {
                /* insert the monetdb/monetdb administrator account on a
                 * complete fresh and new auth tables system */
-               str user = "monetdb";
-               str pw = "monetdb";
+               char *pw;
                oid uid;
                Client c = &mal_clients[0];
 
-               if (passwd != NULL && *passwd != NULL)
-                       pw = *passwd;
-               pw = mcrypt_BackendSum(pw, strlen(pw));
-               msg = AUTHaddUser(&uid, c, &user, &pw);
+               if (passwd == NULL)
+                       passwd = "monetdb";     /* default password */
+               pw = mcrypt_BackendSum(passwd, strlen(passwd));
+               msg = AUTHaddUser(&uid, c, "monetdb", pw);
                free(pw);
                if (msg)
                        return msg;
@@ -252,10 +253,10 @@ str
 AUTHcheckCredentials(
                oid *uid,
                Client cntxt,
-               str *username,
-               str *passwd,
-               str *challenge,
-               str *algo)
+               const char *username,
+               const char *passwd,
+               const char *challenge,
+               const char *algo)
 {
        str tmp;
        str pwd = NULL;
@@ -267,21 +268,21 @@ AUTHcheckCredentials(
        assert(user);
        assert(pass);
 
-       if (*username == NULL || strNil(*username))
+       if (username == NULL || strNil(username))
                throw(INVCRED, "checkCredentials", "invalid credentials for 
unknown user");
 
-       p = AUTHfindUser(*username);
+       p = AUTHfindUser(username);
        if (p == BUN_NONE) {
                /* DO NOT reveal that the user doesn't exist here! */
-               throw(INVCRED, "checkCredentials", INVCRED_INVALID_USER " 
'%s'", *username);
+               throw(INVCRED, "checkCredentials", INVCRED_INVALID_USER " 
'%s'", username);
        }
 
        /* a NULL password is impossible (since we should be dealing with
         * hashes here) so we can bail out immediately
         */
-       if (*passwd == NULL || strNil(*passwd)) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to