Changeset: 8ec2f8a7977b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8ec2f8a7977b
Modified Files:
        configure.ag
        monetdb5/mal/mal_client.c
        monetdb5/mal/mal_client.h
        monetdb5/mal/mal_session.c
        sql/backends/monet5/mal_backend.c
        sql/backends/monet5/mal_backend.h
        sql/backends/monet5/sql_scenario.c
        tools/mserver/mserver5.c
Branch: noconsole
Log Message:

console gone from implementation, mtest still needs a fix


diffs (248 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -292,20 +292,6 @@ AC_ARG_ENABLE([pyintegration],
        [enable_pyintegration=$enableval],
        [enable_pyintegration=$dft_pyintegration])
 
-# The console is a direct client hooked onto the kernel with full
-# administrative privileges, bypassing any security checks.  It is
-# handy only during development.
-# We simply can't disable it for now because Testing gets hopelessly
-# upset about it, but we can offer to the user to disable it for
-# increased security.
-dft_console=yes
-AC_ARG_ENABLE([console],
-       [AS_HELP_STRING([--enable-console],
-               [enables direct console on the server (involves security risks) 
(default=yes)])],
-       [enable_console="$enableval"],
-       [enable_console=$dft_console])
-AS_VAR_IF([enable_console], [no], [],
-       [AC_DEFINE([HAVE_CONSOLE], 1, [If the console should be used])])
 
 dft_int128=auto
 AC_ARG_ENABLE([int128],
@@ -3049,7 +3035,6 @@ for comp in \
        'monetdb5    ' \
        'sql         ' \
        'geom        ' \
-       'console     ' \
        'pyintegration' \
        'rintegration' \
        'odbc        ' \
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
@@ -127,11 +127,7 @@ MCnewClient(void)
 {
        Client c;
        MT_lock_set(&mal_contextLock);
-       if (mal_clients[CONSOLE].user && mal_clients[CONSOLE].mode == 
FINISHCLIENT) {
-               /*system shutdown in progress */
-               MT_lock_unset(&mal_contextLock);
-               return NULL;
-       }
+       // TODO: check some exiting flag here?
        for (c = mal_clients; c < mal_clients + MAL_MAXCLIENTS; c++) {
                if (c->mode == FREECLIENT) {
                        c->mode = RUNCLIENT;
@@ -429,7 +425,7 @@ MCstopClients(Client cntxt)
        Client c = mal_clients;
 
        MT_lock_set(&mal_contextLock);
-       for(c= mal_clients +1;  c < mal_clients+MAL_MAXCLIENTS; c++)
+       for(c= mal_clients ;  c < mal_clients+MAL_MAXCLIENTS; c++)
        if( cntxt != c){
                if ( c->mode == RUNCLIENT)
                        c->mode = FINISHCLIENT; 
@@ -446,7 +442,7 @@ MCactiveClients(void)
        int freeclient=0, finishing=0, running=0, blocked = 0;
        Client cntxt = mal_clients;
 
-       for(cntxt= mal_clients+1;  cntxt<mal_clients+MAL_MAXCLIENTS; cntxt++){
+       for(cntxt= mal_clients;  cntxt<mal_clients+MAL_MAXCLIENTS; cntxt++){
                freeclient += (cntxt->mode == FREECLIENT);
                finishing += (cntxt->mode == FINISHCLIENT);
                running += (cntxt->mode == RUNCLIENT);
@@ -462,14 +458,8 @@ MCcloseClient(Client c)
        printf("closeClient %d " OIDFMT "\n", (int) (c - mal_clients), c->user);
 #endif
        /* free resources of a single thread */
-       if (!isAdministrator(c)) {
-               freeClient(c);
-               return;
-       }
+       freeClient(c);
 
-       /* adm is set to disallow new clients entering */
-       mal_clients[CONSOLE].mode = FINISHCLIENT;
-       mal_exit();
 }
 
 str
diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -15,9 +15,6 @@
 #include "mal_resolve.h"
 #include "mal_profiler.h"
 
-#define CONSOLE     0
-#define isAdministrator(X) (X==mal_clients)
-
 enum clientmode {
        FREECLIENT,
        FINISHCLIENT,
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
@@ -425,7 +425,7 @@ MSserveClient(void *dummy)
        Client c = (Client) dummy;
        str msg = 0;
 
-       if (!isAdministrator(c) && MCinitClientThread(c) < 0) {
+       if (MCinitClientThread(c) < 0) {
                MCcloseClient(c);
                return;
        }
@@ -482,15 +482,8 @@ MSserveClient(void *dummy)
                assert(0);
        }
 
-       if (c->mode > FINISHCLIENT) {
-               if (isAdministrator(c) /* && moreClients(0)==0 */) {
-                       if (c->scenario) {
-                               exitScenario(c);
-                       }
-               }
-       }
-       if (!isAdministrator(c))
-               MCcloseClient(c);
+       MCcloseClient(c);
+
        if (c->nspace && strcmp(c->nspace->name, "user") == 0) {
                GDKfree(c->nspace->space);
                GDKfree(c->nspace);
diff --git a/sql/backends/monet5/mal_backend.c 
b/sql/backends/monet5/mal_backend.c
--- a/sql/backends/monet5/mal_backend.c
+++ b/sql/backends/monet5/mal_backend.c
@@ -29,7 +29,6 @@ backend_create(mvc *m, Client c)
 {
        backend *b = MNEW(backend);
 
-       b->console = isAdministrator(c);
        b->mvc = m;
        b->client = c;
        b->mvc_var = 0;
diff --git a/sql/backends/monet5/mal_backend.h 
b/sql/backends/monet5/mal_backend.h
--- a/sql/backends/monet5/mal_backend.h
+++ b/sql/backends/monet5/mal_backend.h
@@ -32,7 +32,6 @@ typedef enum output_format {
 } ofmt;
 
 typedef struct backend {
-       int     console;
        char    language;               /* 'S' or 's' or 'X' */
        mvc     *mvc;
        stream  *out;
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -450,7 +450,7 @@ SQLinitClient(Client c)
        if (c->sqlcontext == 0) {
                m = mvc_create(c->idx, 0, SQLdebug, c->fdin, c->fdout);
                global_variables(m, "monetdb", "sys");
-               if (isAdministrator(c) || strcmp(c->scenario, "msql") == 0)     
/* console should return everything */
+               if (strcmp(c->scenario, "msql") == 0)   /* console should 
return everything */
                        m->reply_size = -1;
                be = (void *) backend_create(m, c);
        } else {
@@ -799,7 +799,7 @@ SQLreader(Client c)
                                c->yycur = 0;
                        }
                        if (in->eof || !blocked) {
-                               language = (be->console) ? 'S' : 0;
+                               language = 0;
 
                                /* The rules of auto_commit require us to finish
                                   and start a transaction on the start of a 
new statement (s A;B; case) */
@@ -824,7 +824,7 @@ SQLreader(Client c)
                                if (be->language == 'D' && in->eof == 0)
                                        return 0;
 
-                               if (rd == 0 && language !=0 && in->eof && 
!be->console) {
+                               if (rd == 0 && language !=0 && in->eof) {
                                        /* we hadn't seen the EOF before, so 
just try again
                                           (this time with prompt) */
                                        more = TRUE;
@@ -832,7 +832,7 @@ SQLreader(Client c)
                                }
                                go = FALSE;
                                break;
-                       } else if (go && !be->console && language == 0) {
+                       } else if (go && language == 0) {
                                if (in->buf[in->pos] == 's' && !in->eof) {
                                        while ((rd = bstream_next(in)) > 0)
                                                ;
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -52,9 +52,6 @@
 #endif
 
 static int malloc_init = 1;
-#ifdef HAVE_CONSOLE
-static int monet_daemon;
-#endif
 
 /* NEEDED? */
 #if defined(_MSC_VER) && defined(__cplusplus)
@@ -99,7 +96,6 @@ usage(char *prog, int xit)
        fprintf(stderr, "    --dbextra=<directory>     Directory for transient 
BATs\n");
        fprintf(stderr, "    --dbinit=<stmt>           Execute statement at 
startup\n");
        fprintf(stderr, "    --config=<config_file>    Use config_file to read 
options from\n");
-       fprintf(stderr, "    --daemon=yes|no           Do not read commands 
from standard input [no]\n");
        fprintf(stderr, "    --single-user             Allow only one user at a 
time\n");
        fprintf(stderr, "    --readonly                Safeguard database\n");
        fprintf(stderr, "    --set <option>=<value>    Set configuration 
option\n");
@@ -207,15 +203,9 @@ monet_init(opt *set, int setlen)
        if (!GDKinit(set, setlen))
                return 0;
 
-#ifdef HAVE_CONSOLE
-       monet_daemon = 0;
-       if (GDKgetenv_isyes("monet_daemon")) {
-               monet_daemon = 1;
 #ifdef HAVE_SETSID
                setsid();
 #endif
-       }
-#endif
        monet_hello();
        return 1;
 }
@@ -359,12 +349,6 @@ main(int argc, char **av)
                                        dbinit = optarg;
                                break;
                        }
-#ifdef HAVE_CONSOLE
-                       if (strcmp(long_options[option_index].name, "daemon") 
== 0) {
-                               setlen = mo_add_option(&set, setlen, 
opt_cmdline, "monet_daemon", optarg);
-                               break;
-                       }
-#endif
                        if (strcmp(long_options[option_index].name, 
"single-user") == 0) {
                                setlen = mo_add_option(&set, setlen, 
opt_cmdline, "gdk_single_user", "yes");
                                break;
@@ -683,11 +667,6 @@ main(int argc, char **av)
 
        if (monet_script)
                free(monet_script);
-#ifdef HAVE_CONSOLE
-       if (!monet_daemon) {
-               MSserveClient(mal_clients);
-       } else
-#endif
        while (1)
                MT_sleep_ms(5000);
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to