Changeset: 26118dfc5b76 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=26118dfc5b76
Modified Files:
        monetdb5/mal/mal_authorize.c
        tools/mserver/mserver5.c
Branch: default
Log Message:

Merge with Oct2020 branch.


diffs (67 lines):

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
@@ -23,6 +23,8 @@
 #include "mal_exception.h"
 #include "mal_private.h"
 #include "mcrypt.h"
+#include "msabaoth.h"
+
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -60,6 +62,7 @@ static BAT *rt_hashedpwd = NULL;
 static BAT *rt_deleted = NULL;
 /* yep, the vault key is just stored in memory */
 static str vaultKey = NULL;
+static str master_password = NULL;
 
 void AUTHreset(void)
 {
@@ -402,6 +405,12 @@ AUTHinitTables(const char *passwd) {
                /* normally, we'd commit here, but it's done already in 
AUTHaddUser */
        }
 
+       if (!GDKinmemory(0)) {
+               msg = msab_pickSecret(&master_password);
+               if (msg != NULL)
+                       return msg;
+       }
+
        return(MAL_SUCCEED);
 }
 
@@ -469,7 +478,6 @@ AUTHcheckCredentials(
        /* special case: users whose name starts with '.' can authenticate using
         * the temporary master password.
         */
-       const char *master_password = GDKgetenv("master_password");
        if (username[0] == '.' && master_password != NULL && master_password[0] 
!= '\0') {
                // first encrypt the master password as if we've just found it
                // in the password store
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -771,18 +771,10 @@ main(int argc, char **av)
 
        emergencyBreakpoint();
 
-       if (!GDKinmemory(0)) {
-               char *secret = NULL;
-               if ((err = msab_pickSecret(&secret)) != NULL || (err = 
msab_registerStarted()) != NULL) {
-                       /* throw the error at the user, but don't die */
-                       fprintf(stderr, "!%s\n", err);
-                       free(err);
-               }
-               if (secret) {
-                       if (GDKsetenv("master_password", secret) != GDK_SUCCEED)
-                               fprintf(stderr, "GSKsetenv failed\n");
-                       free(secret);
-               }
+       if (!GDKinmemory(0) && (err = msab_registerStarted()) != NULL) {
+               /* throw the error at the user, but don't die */
+               fprintf(stderr, "!%s\n", err);
+               free(err);
        }
 
 #ifdef SIGHUP
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to