Changeset: 7474cd43300d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7474cd43300d Branch: txtsim Log Message:
Merge with default. diffs (truncated from 7260 to 300 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -48789,11 +48789,6 @@ command remote.connect(X_0:str, X_1:str, RMTconnectScen; returns a newly created connection for uri, using user name, password and scenario remote -connect -pattern remote.connect(X_0:str, X_1:str):str -RMTconnectTable; -return a newly created connection for a table. username and password should be in the vault -remote disconnect command remote.disconnect(X_0:str):void RMTdisconnect; @@ -49234,6 +49229,11 @@ command sql.date_trunc(X_0:str, X_1:time date_trunc; Truncate a timestamp to (millennium, century,decade,year,quarter,month,week,day,hour,minute,second, milliseconds,microseconds) sql +decypher +pattern sql.decypher(X_0:str):str +SQLdecypher; +Return decyphered password +sql delete unsafe pattern sql.delete(X_0:int, X_1:str, X_2:str, X_3:any):int mvc_delete_wrap; @@ -49724,11 +49724,6 @@ pattern sql.row_number(X_0:any_1, X_1:bi SQLrow_number; return the row_numer-ed groups sql -rt_credentials -pattern sql.rt_credentials(X_0:str) (X_1:bat[:str], X_2:bat[:str], X_3:bat[:str]) -sql_rt_credentials_wrap; -Return the remote table credentials for the given table -sql sessions pattern sql.sessions() (X_0:bat[:int], X_1:bat[:str], X_2:bat[:timestamp], X_3:bat[:timestamp], X_4:bat[:str], X_5:bat[:int], X_6:bat[:int], X_7:bat[:int], X_8:bat[:int]) sql_sessions_wrap; @@ -50259,6 +50254,11 @@ pattern sqlcatalog.create_table(X_0:str, SQLcreate_table; Catalog operation create_table sqlcatalog +create_table +pattern sqlcatalog.create_table(X_0:str, X_1:str, X_2:ptr, X_3:int, X_4:str, X_5:str):void +SQLcreate_table; +Catalog operation create_table +sqlcatalog create_trigger pattern sqlcatalog.create_trigger(X_0:str, X_1:str, X_2:str, X_3:int, X_4:int, X_5:int, X_6:str, X_7:str, X_8:str, X_9:str, X_10:int):void SQLcreate_trigger; diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -37219,11 +37219,6 @@ command remote.connect(X_0:str, X_1:str, RMTconnectScen; returns a newly created connection for uri, using user name, password and scenario remote -connect -pattern remote.connect(X_0:str, X_1:str):str -RMTconnectTable; -return a newly created connection for a table. username and password should be in the vault -remote disconnect command remote.disconnect(X_0:str):void RMTdisconnect; @@ -37639,6 +37634,11 @@ command sql.date_trunc(X_0:str, X_1:time date_trunc; Truncate a timestamp to (millennium, century,decade,year,quarter,month,week,day,hour,minute,second, milliseconds,microseconds) sql +decypher +pattern sql.decypher(X_0:str):str +SQLdecypher; +Return decyphered password +sql delete unsafe pattern sql.delete(X_0:int, X_1:str, X_2:str, X_3:any):int mvc_delete_wrap; @@ -38104,11 +38104,6 @@ pattern sql.row_number(X_0:any_1, X_1:bi SQLrow_number; return the row_numer-ed groups sql -rt_credentials -pattern sql.rt_credentials(X_0:str) (X_1:bat[:str], X_2:bat[:str], X_3:bat[:str]) -sql_rt_credentials_wrap; -Return the remote table credentials for the given table -sql sessions pattern sql.sessions() (X_0:bat[:int], X_1:bat[:str], X_2:bat[:timestamp], X_3:bat[:timestamp], X_4:bat[:str], X_5:bat[:int], X_6:bat[:int], X_7:bat[:int], X_8:bat[:int]) sql_sessions_wrap; @@ -38584,6 +38579,11 @@ pattern sqlcatalog.create_table(X_0:str, SQLcreate_table; Catalog operation create_table sqlcatalog +create_table +pattern sqlcatalog.create_table(X_0:str, X_1:str, X_2:ptr, X_3:int, X_4:str, X_5:str):void +SQLcreate_table; +Catalog operation create_table +sqlcatalog create_trigger pattern sqlcatalog.create_trigger(X_0:str, X_1:str, X_2:str, X_3:int, X_4:int, X_5:int, X_6:str, X_7:str, X_8:str, X_9:str, X_10:int):void SQLcreate_trigger; 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 @@ -721,18 +721,8 @@ const char *wsaerror(int); # monetdb5 str AUTHGeneratePasswordHash(str *res, const char *value); -str AUTHRegisterGetPasswordHandler(get_user_password_handler callback); -str AUTHRegisterGetUserNameHandler(get_user_name_handler callback); -str AUTHRegisterGetUserOIDHandler(get_user_oid_handler callback); -str AUTHaddRemoteTableCredentials(const char *local_table, const char *localuser, const char *uri, const char *remoteuser, const char *pass, bool pw_encrypted); -str AUTHcheckCredentials(oid *ret, Client c, const char *user, const char *passwd, const char *challenge, const char *algo); str AUTHcypherValue(str *ret, const char *value); str AUTHdecypherValue(str *ret, const char *value); -str AUTHdeleteRemoteTableCredentials(const char *local_table); -str AUTHgetPasswordHash(str *ret, Client c, const char *username); -str AUTHgetRemoteTableCredentials(const char *local_table, str *uri, str *username, str *password); -str AUTHgetUsername(str *ret, Client c); -str AUTHinitTables(void); str AUTHrequireAdmin(Client c); str AUTHunlockVault(const char *password); str AUTHverifyPassword(const char *passwd); @@ -1366,8 +1356,8 @@ str SQLengineIntern(Client c, backend *b str SQLescapeString(str s); str SQLexit(Client c); str SQLexitClient(Client c); -str SQLinitClient(Client c); -str SQLinitClientFromMAL(Client c); +str SQLinitClient(Client c, const char *passwd, const char *challenge, const char *algo); +str SQLinitClientFromMAL(Client c, const char *passwd, const char *challenge, const char *algo); str SQLparser(Client c); str SQLreader(Client c); str SQLresetClient(Client c); diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -409,6 +409,47 @@ bailout: return false; } +static bool +has_remote_user_info_table(Mapi mid) +{ + MapiHdl hdl; + bool ret; + static int answer = -1; + + if (answer >= 0) + return answer; + + if ((hdl = mapi_query(mid, + "select id from sys._tables" + " where name = 'remote_user_info'" + " and schema_id = (" + "select id from sys.schemas" + " where name = 'sys')")) == NULL || + mapi_error(mid)) + goto bailout; + ret = mapi_get_row_count(hdl) == 1; + while ((mapi_fetch_row(hdl)) != 0) { + if (mapi_error(mid)) + goto bailout; + } + if (mapi_error(mid)) + goto bailout; + mapi_close_handle(hdl); + answer = ret; + return ret; + +bailout: + if (hdl) { + if (mapi_result_error(hdl)) + mapi_explain_result(hdl, stderr); + else + mapi_explain_query(hdl, stderr); + mapi_close_handle(hdl); + } else + mapi_explain(mid, stderr); + return false; +} + static int dump_foreign_keys(Mapi mid, const char *schema, const char *tname, const char *tid, stream *toConsole) { @@ -1320,10 +1361,17 @@ describe_table(Mapi mid, const char *sch } else if (type == 5) { /* remote table */ char *rt_user = NULL; char *rt_hash = NULL; - snprintf(query, maxquerylen, - "SELECT username, hash " - "FROM sys.remote_table_credentials('%s.%s')", - schema, tname); + if (has_remote_user_info_table(mid)) { + snprintf(query, maxquerylen, + "SELECT username, sys.decypher(password) " + "FROM sys.remote_user_info where table_id = (select t.id from sys._tables t, sys.schemas s where " + "t.schema_id = s.id and s.name = '%s' and t.name = '%s')", schema, tname); + } else { + snprintf(query, maxquerylen, + "SELECT username, hash " + "FROM sys.remote_table_credentials('%s.%s')", + schema, tname); + } if ((hdl = mapi_query(mid, query)) == NULL || mapi_error(mid)) goto bailout; cnt = 0; diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -30,6 +30,9 @@ endif() if(WITH_CMOCKA) find_package(CMocka) + if (TARGET cmocka::cmocka) + set(CMOCKA_LIBRARY cmocka::cmocka) + endif() endif() if(WITH_PCRE) diff --git a/gdk/ChangeLog.Sep2022 b/gdk/ChangeLog.Sep2022 --- a/gdk/ChangeLog.Sep2022 +++ b/gdk/ChangeLog.Sep2022 @@ -1,6 +1,17 @@ # ChangeLog file for GDK # This file is updated with Maddlog +* Mon Feb 20 2023 Sjoerd Mullender <sjo...@acm.org> +- A race condition was fixed where certain write-ahead log messages + could get intermingled, resulting in a corrupted WAL file. +- If opening of a file failed when it was supposed to get memory mapped, + an incorrect value was returned to indicate the failure, causing + crashes later on. This has been fixed. + +* Thu Feb 16 2023 Sjoerd Mullender <sjo...@acm.org> +- A race condition was fixed that could result in a missing tail file + for a string bat (i.e. a file with .tail1, .tail2, or .tail4 extension). + * Mon Feb 13 2023 Sjoerd Mullender <sjo...@acm.org> - When saving a bat failed for some reason during a low-level commit, this was logged in the log file, but the error was then subsequently diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -737,9 +737,9 @@ BATdestroy(BAT *b) GDKfree(b->theap); } if (b->oldtail) { + ATOMIC_AND(&b->oldtail->refs, ~DELAYEDREMOVE); /* the bat has not been committed, so we cannot remove * the old tail file */ - ATOMIC_AND(&b->oldtail->refs, ~DELAYEDREMOVE); HEAPdecref(b->oldtail, false); b->oldtail = NULL; } diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -648,7 +648,7 @@ BBPreadBBPline(FILE *fp, unsigned bbpver { char buf[4096]; uint64_t batid; - uint16_t status; + unsigned int status; unsigned int properties; int nread, n; char *s; @@ -676,14 +676,14 @@ BBPreadBBPline(FILE *fp, unsigned bbpver if (bbpversion <= GDKLIBRARY_HSIZE ? sscanf(buf, - "%" SCNu64 " %" SCNu16 " %128s %19s %u %" SCNu64 + "%" SCNu64 " %u %128s %19s %u %" SCNu64 " %" SCNu64 " %" SCNu64 "%n", &batid, &status, batname, filename, &properties, &count, &capacity, &base, &nread) < 8 : sscanf(buf, - "%" SCNu64 " %" SCNu16 " %128s %19s %u %" SCNu64 + "%" SCNu64 " %u %128s %19s %u %" SCNu64 " %" SCNu64 "%n", &batid, &status, batname, filename, @@ -3184,6 +3184,11 @@ BBPdestroy(BAT *b) if (vtp != 0) BBPrelease(vtp); } + if (b->oldtail) { + ATOMIC_AND(&b->oldtail->refs, ~DELAYEDREMOVE); + HEAPdecref(b->oldtail, true); + b->oldtail = NULL; + } BATdelete(b); BBPclear(b->batCacheid); /* if destroyed; de-register from BBP */ @@ -3795,7 +3800,21 @@ BBPsync(int cnt, bat *restrict subcommit if (size > bi.count) /* includes sizes==NULL */ size = bi.count; _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org