Changeset: 59310f1347ae for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=59310f1347ae
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/mal/mal_authorize.c
        monetdb5/mal/mal_authorize.h
        sql/backends/monet5/embeddedclient.c.in
        tools/merovingian/ChangeLog.Jan2014
        tools/merovingian/client/monetdb.1
        tools/merovingian/client/monetdb.c
        tools/merovingian/daemon/Makefile.ag
        tools/merovingian/daemon/controlrunner.c
        tools/mserver/mserver5.c
Branch: Jan2014
Log Message:

Backing out changesets 8f6aa798f4c5, 82119e107e56, and 6177dd32ac5d.
ABI change only allowed in default branch.  The change will have to
wait to the next feature release.


diffs (276 lines):

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
@@ -881,7 +881,7 @@ str AUTHcheckCredentials(oid *ret, Clien
 str AUTHgetPasswordHash(str *ret, Client *c, str *username);
 str AUTHgetUsername(str *ret, Client *c);
 str AUTHgetUsers(BAT **ret, Client *c);
-str AUTHinitTables(str *passwd);
+str AUTHinitTables(void);
 str AUTHremoveUser(Client *c, str *username);
 str AUTHrequireAdmin(Client *c);
 str AUTHresolveUser(str *ret, oid *uid);
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
@@ -112,13 +112,12 @@ AUTHcommit(void)
  * Localize the authorization tables in the database.  The authorization
  * tables are a set of aligned BATs that store username, password (hashed)
  * and scenario permissions.
- * If the BATs do not exist, they are created, and the monetdb
- * administrator account is added with the given password (or 'monetdb'
- * if NULL).  Initialising the authorization tables can only be done
- * after the GDK kernel has been initialized.
+ * If the BATs do not exist, they are created, and the monetdb/monetdb
+ * administrator account is added.  Initialising the authorization tables
+ * can only be done after the GDK kernel has been initialized.
  */
 str
-AUTHinitTables(str *passwd) {
+AUTHinitTables(void) {
        bat bid;
        BAT *b;
        int isNew = 1;
@@ -169,13 +168,12 @@ AUTHinitTables(str *passwd) {
                /* insert the monetdb/monetdb administrator account on a
                 * complete fresh and new auth tables system */
                str user = "monetdb";
-               str pw = "monetdb";
+               str pw; /* will become the right hash for "monetdb" */
+               int len = (int) strlen(user);
                oid uid;
                Client c = &mal_clients[0];
 
-               if (passwd != NULL && *passwd != NULL)
-                       pw = *passwd;
-               pw = mcrypt_BackendSum(pw, strlen(pw));
+               pw = mcrypt_BackendSum(user /* because user == pass */, len);
                msg = AUTHaddUser(&uid, &c, &user, &pw);
                free(pw);
                if (msg)
diff --git a/monetdb5/mal/mal_authorize.h b/monetdb5/mal/mal_authorize.h
--- a/monetdb5/mal/mal_authorize.h
+++ b/monetdb5/mal/mal_authorize.h
@@ -38,7 +38,7 @@ mal_export str AUTHgetUsers(BAT **ret, C
 mal_export str AUTHgetPasswordHash(str *ret, Client *c, str *username);
 
 mal_export str AUTHrequireAdmin(Client *c);
-mal_export str AUTHinitTables(str *passwd);
+mal_export str AUTHinitTables(void);
 
 
 /*
diff --git a/sql/backends/monet5/embeddedclient.c.in 
b/sql/backends/monet5/embeddedclient.c.in
--- a/sql/backends/monet5/embeddedclient.c.in
+++ b/sql/backends/monet5/embeddedclient.c.in
@@ -114,7 +114,7 @@ start_sql_server(void *arg)
                                return 0;
                }
                /* make sure the authorisation BATs are loaded */
-               if (AUTHinitTables(NULL) != MAL_SUCCEED)
+               if (AUTHinitTables() != MAL_SUCCEED)
                        return 0;
                MSinitClientPrg(mal_clients, "user","main");
                initialized = 1;
diff --git a/tools/merovingian/ChangeLog.Jan2014 
b/tools/merovingian/ChangeLog.Jan2014
--- a/tools/merovingian/ChangeLog.Jan2014
+++ b/tools/merovingian/ChangeLog.Jan2014
@@ -2,7 +2,5 @@
 # This file is updated with mchangelog
 
 * Sun Feb 16 2014 Fabian Groffen <fab...@monetdb.org>
-- monetdb create: add -p flag to set monetdb user password on creation,
-  and therefore allow creating the database in unlocked state
 - monetdb destroy -f now also works on running databases
 
diff --git a/tools/merovingian/client/monetdb.1 
b/tools/merovingian/client/monetdb.1
--- a/tools/merovingian/client/monetdb.1
+++ b/tools/merovingian/client/monetdb.1
@@ -52,14 +52,12 @@ stopping a database inside the MonetDB D
 For all commands, database arguments can be glob-like expressions.
 This allows to do wildcard matches.  For details on the syntax, see
 .IR EXPRESSIONS .
-.IP "create [\-m pattern] [\-p password] database [database ...]"
+.IP "create [\-m pattern] database [database ...]"
 Initialises a new database in the MonetDB Database Server.  A database
 created with this command makes it available under its database name,
 but not yet for use by clients, as the database is put into maintenance
 mode.  This allows the database administrator to perform initialisation
-steps before releasing it to users, unless the
-.I \-p
-argument is supplied.  See also
+steps before releasing it to users.  See also
 .BR "monetdb lock" .
 The name of the database must match the expression [A\-Za\-z0\-9\-_]+.
 .IP "  \-m pattern"
@@ -76,14 +74,6 @@ or discovery.  Each parallel target for 
 sequence, separated by commas.  Here the pattern is an ordinary pattern
 as would be used for connecting to a database, and can hence also be
 just the name of a database.
-.IP "  \-p password"
-The
-.I \-p
-flag allows to create a database with the given password for the monetdb
-user.  Since this protects the database from being accessed via
-well-known credentials, the created database is not locked after
-creation.  This way, a new database can be created and used right away
-using the password supplied.
 .IP "destroy [\-f] database [database ...]"
 Removes the given database, including all its data and logfiles.  Once
 destroy has completed, all data is lost.  Be careful when using this
diff --git a/tools/merovingian/client/monetdb.c 
b/tools/merovingian/client/monetdb.c
--- a/tools/merovingian/client/monetdb.c
+++ b/tools/merovingian/client/monetdb.c
@@ -1435,7 +1435,6 @@ command_create(int argc, char *argv[])
 {
        int i;
        char *mfunnel = NULL;
-       char *password = NULL;
        sabdb *orig = NULL;
        sabdb *stats = NULL;
 
@@ -1465,19 +1464,6 @@ command_create(int argc, char *argv[])
                                        command_help(2, &argv[-1]);
                                        exit(1);
                                }
-                       } else if (argv[i][1] == 'p') {
-                               if (argv[i][2] != '\0') {
-                                       password = &argv[i][2];
-                                       argv[i] = NULL;
-                               } else if (i + 1 < argc && argv[i + 1][0] != 
'-') {
-                                       argv[i] = NULL;
-                                       password = argv[++i];
-                                       argv[i] = NULL;
-                               } else {
-                                       fprintf(stderr, "create: -p needs an 
argument\n");
-                                       command_help(2, &argv[-1]);
-                                       exit(1);
-                               }
                        } else {
                                fprintf(stderr, "create: unknown option: %s\n", 
argv[i]);
                                command_help(argc + 1, &argv[-1]);
@@ -1506,13 +1492,6 @@ command_create(int argc, char *argv[])
                simple_argv_cmd(argv[0], orig, cmd, 
                                "created multiplex-funnel in maintenance mode", 
NULL);
                free(cmd);
-       } else if (password != NULL) {
-               size_t len = strlen("create password=") + strlen(password) + 1;
-               char *cmd = malloc(len);
-               snprintf(cmd, len, "create password=%s", password);
-               simple_argv_cmd(argv[0], orig, cmd, 
-                               "created database with password for monetdb 
user", NULL);
-               free(cmd);
        } else {
                simple_argv_cmd(argv[0], orig, "create", 
                                "created database in maintenance mode", NULL);
diff --git a/tools/merovingian/daemon/Makefile.ag 
b/tools/merovingian/daemon/Makefile.ag
--- a/tools/merovingian/daemon/Makefile.ag
+++ b/tools/merovingian/daemon/Makefile.ag
@@ -27,10 +27,7 @@ monetdb_var_dbfarm_DATA = .merovingian_p
 INCLUDES = .. \
                   ../../../common/stream \
                   ../../../common/utils \
-                  ../../../common/options \
                   ../../../clients/mapilib \
-                  ../../../gdk \
-                  ../../../monetdb5/mal \
                   $(MSGCONTROL_FLAGS)
 
 EXTRA_DIST = $(man_MANS) .merovingian_properties
@@ -57,8 +54,6 @@ bin_monetdbd = {
                   ../../../common/utils/libmsabaoth \
                   ../../../common/utils/libmuuid \
                   ../../../common/utils/libmutils \
-                  ../../../monetdb5/tools/libmonetdb5 \
-                  ../../../gdk/libbat \
                   $(UUID_LIBS) \
                   $(curl_LIBS) \
                   $(SOCKET_LIBS) \
diff --git a/tools/merovingian/daemon/controlrunner.c 
b/tools/merovingian/daemon/controlrunner.c
--- a/tools/merovingian/daemon/controlrunner.c
+++ b/tools/merovingian/daemon/controlrunner.c
@@ -41,10 +41,6 @@
 #include <utils/database.h>
 #include <utils/control.h>
 
-#include "gdk.h"  /* these three for creation of dbs with password */
-#include "gdk_private.h"
-#include "mal_authorize.h"
-
 #include "merovingian.h"
 #include "discoveryrunner.h" /* broadcast, remotedb */
 #include "forkmserver.h"
@@ -358,15 +354,8 @@ static void ctl_handle_client(
                                                        "database is not 
running: %s\n", q);
                                        send_client("!");
                                }
-                       } else if (strcmp(p, "create") == 0 ||
-                                       strncmp(p, "create password=", 
strlen("create password=")) == 0) {
-                               err e;
-
-                               p += strlen("create");
-                               if (*p == ' ')
-                                       p += strlen(" password=");
-
-                               e = db_create(q);
+                       } else if (strcmp(p, "create") == 0) {
+                               err e = db_create(q);
                                if (e != NO_ERR) {
                                        Mfprintf(_mero_ctlerr, "%s: failed to 
create "
                                                        "database '%s': %s\n", 
origin, q, getErrMsg(e));
@@ -375,43 +364,6 @@ static void ctl_handle_client(
                                        send_client("!");
                                        free(e);
                                } else {
-                                       if (*p != '\0') {
-                                               pid_t child;
-                                               if ((child = fork()) == 0) {
-                                                       FILE *secretf;
-                                                       size_t len;
-                                                       char *err;
-                                                       char *vaultkey;
-
-                                                       /* the child, pollute 
scope by loading BBP */
-                                                       chdir(q);
-
-                                                       buf2[0] = '\0';
-                                                       if ((secretf = 
fopen(".vaultkey", "r")) != NULL) {
-                                                               len = 
fread(buf2, 1, sizeof(buf2), secretf);
-                                                               buf2[len] = 
'\0';
-                                                               len = 
strlen(buf2); /* secret can contain null-bytes */
-                                                               fclose(secretf);
-                                                       }
-                                                       BBPinit();
-                                                       vaultkey = buf2;
-                                                       
AUTHunlockVault(&vaultkey);
-                                                       err = 
AUTHinitTables(&p);
-                                                       if (err != NULL) {
-                                                               
Mfprintf(_mero_ctlerr, "%s: could not setup "
-                                                                               
"database '%s': %s\n", origin, q, err);
-                                                       } else {
-                                                               /* don't start 
locked */
-                                                               
unlink(".maintenance");
-                                                       }
-
-                                                       exit(0); /* return to 
the parent */
-                                               } else {
-                                                       /* wait for the child 
to finish */
-                                                       waitpid(child, NULL, 0);
-                                               }
-                                       }
-
                                        Mfprintf(_mero_ctlout, "%s: created 
database '%s'\n",
                                                        origin, q);
                                        len = snprintf(buf2, sizeof(buf2), 
"OK\n");
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -576,7 +576,7 @@ main(int argc, char **av)
                }
        }
        /* make sure the authorisation BATs are loaded */
-       if ((err = AUTHinitTables(NULL)) != MAL_SUCCEED) {
+       if ((err = AUTHinitTables()) != MAL_SUCCEED) {
                /* don't show this as a crash */
                msab_registerStop();
                GDKfatal("%s", err);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to