Changeset: 0f7dd398e3bb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0f7dd398e3bb
Modified Files:
        monetdb5/mal/mal.c
        monetdb5/mal/mal_authorize.c
        monetdb5/mal/mal_client.c
        monetdb5/mal/mal_session.c
Branch: default
Log Message:

removed last needs for client[0], cleanup client after malBootstrap


diffs (95 lines):

diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -115,10 +115,6 @@ void mserver_reset(void)
        }
        mal_factory_reset();
        mal_dataflow_reset();
-       /* are later destroyed by GDKreset */
-       mal_clients[0].fdout = 0;
-       mal_clients[0].fdin = 0;
-       MCcloseClient(mal_clients);
        mal_client_reset();
        mal_linker_reset();
        mal_resource_reset();
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
@@ -382,14 +382,13 @@ AUTHinitTables(const char *passwd) {
                 * complete fresh and new auth tables system */
                char *pw;
                oid uid;
-               Client c = &mal_clients[0];
 
                if (passwd == NULL)
                        passwd = "monetdb";     /* default password */
                pw = mcrypt_BackendSum(passwd, strlen(passwd));
                if(!pw)
                        throw(MAL, "initTables", SQLSTATE(42000) "Crypt backend 
hash not found");
-               msg = AUTHaddUser(&uid, c, "monetdb", pw);
+               msg = AUTHaddUser(&uid, NULL, "monetdb", pw);
                free(pw);
                if (msg)
                        return msg;
@@ -420,7 +419,8 @@ AUTHcheckCredentials(
        BUN p;
        BATiter passi;
 
-       rethrow("checkCredentials", tmp, AUTHrequireAdminOrUser(cntxt, 
username));
+       if (cntxt)
+               rethrow("checkCredentials", tmp, AUTHrequireAdminOrUser(cntxt, 
username));
        assert(user);
        assert(pass);
 
@@ -475,9 +475,10 @@ AUTHaddUser(oid *uid, Client cntxt, cons
        str tmp;
        str hash = NULL;
 
-       rethrow("addUser", tmp, AUTHrequireAdmin(cntxt));
        assert(user);
        assert(pass);
+       if (BATcount(user))
+               rethrow("addUser", tmp, AUTHrequireAdmin(cntxt));
 
        /* some pre-condition checks */
        if (username == NULL || strNil(username))
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -183,7 +183,9 @@ MCexitClient(Client c)
                }
                assert(c->bak == NULL);
                if (c->fdin) {
-                       /* missing protection against closing stdin stream */
+                       /* protection against closing stdin stream */
+                        if (c->fdin->s == GDKstdin)
+                                c->fdin->s = NULL;
                        bstream_destroy(c->fdin);
                }
                c->fdout = NULL;
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -66,7 +66,7 @@ malBootstrap(void)
                return msg;
        }
        msg = MALengine(c);
-       if (msg != MAL_SUCCEED)
+//     if (msg != MAL_SUCCEED)
                MCfreeClient(c);
        return msg;
 }
@@ -270,12 +270,11 @@ MSscheduleClient(str command, str challe
                str err;
                oid uid;
                sabdb *stats = NULL;
-               Client root = &mal_clients[0];
 
                /* access control: verify the credentials supplied by the user,
                 * no need to check for database stuff, because that is done per
                 * database itself (one gets a redirect) */
-               err = AUTHcheckCredentials(&uid, root, user, passwd, challenge, 
algo);
+               err = AUTHcheckCredentials(&uid, NULL, user, passwd, challenge, 
algo);
                if (err != MAL_SUCCEED) {
                        mnstr_printf(fout, "!%s\n", err);
                        exit_streams(fin, fout);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to