Fossil SCM

Added missing db_unprotect()/db_protect_pop() to the login-group command.

stephan 2020-09-09 13:05 trunk
Commit ca5a5c7948cc68317ea16372db65ec11bff2399981196adc085ce9ad028a70b0
2 files changed +1 -1 +2
+1 -1
--- src/db.c
+++ src/db.c
@@ -359,11 +359,11 @@
359359
**
360360
** Each of these routines pushes the previous protection mask onto
361361
** a finite-size stack. Each should be followed by a call to
362362
** db_protect_pop() to pop the stack and restore the protections that
363363
** existed prior to the call. The protection mask stack has a limited
364
-** depth, so take care not to next calls too deeply.
364
+** depth, so take care not to nest calls too deeply.
365365
**
366366
** About Database Write Protection
367367
** -------------------------------
368368
**
369369
** This is *not* a primary means of defending the application from
370370
--- src/db.c
+++ src/db.c
@@ -359,11 +359,11 @@
359 **
360 ** Each of these routines pushes the previous protection mask onto
361 ** a finite-size stack. Each should be followed by a call to
362 ** db_protect_pop() to pop the stack and restore the protections that
363 ** existed prior to the call. The protection mask stack has a limited
364 ** depth, so take care not to next calls too deeply.
365 **
366 ** About Database Write Protection
367 ** -------------------------------
368 **
369 ** This is *not* a primary means of defending the application from
370
--- src/db.c
+++ src/db.c
@@ -359,11 +359,11 @@
359 **
360 ** Each of these routines pushes the previous protection mask onto
361 ** a finite-size stack. Each should be followed by a call to
362 ** db_protect_pop() to pop the stack and restore the protections that
363 ** existed prior to the call. The protection mask stack has a limited
364 ** depth, so take care not to nest calls too deeply.
365 **
366 ** About Database Write Protection
367 ** -------------------------------
368 **
369 ** This is *not* a primary means of defending the application from
370
--- src/login.c
+++ src/login.c
@@ -1985,10 +1985,11 @@
19851985
** other repository and on our own repository.
19861986
*/
19871987
zSelfProjCode = abbreviated_project_code(zSelfProjCode);
19881988
zOtherProjCode = abbreviated_project_code(zOtherProjCode);
19891989
db_begin_transaction();
1990
+ db_unprotect(PROTECT_CONFIG);
19901991
db_multi_exec(
19911992
"DELETE FROM \"%w\".config WHERE name GLOB 'peer-*';"
19921993
"INSERT INTO \"%w\".config(name,value) VALUES('peer-repo-%q',%Q);"
19931994
"INSERT INTO \"%w\".config(name,value) "
19941995
" SELECT 'peer-name-%q', value FROM other.config"
@@ -2008,10 +2009,11 @@
20082009
"REPLACE INTO \"%w\".config(name,value)"
20092010
" SELECT name, value FROM other.config"
20102011
" WHERE name GLOB 'peer-*' OR name GLOB 'login-group-*'",
20112012
zSelf
20122013
);
2014
+ db_protect_pop();
20132015
db_end_transaction(0);
20142016
db_multi_exec("DETACH other");
20152017
20162018
/* Propagate the changes to all other members of the login-group */
20172019
zSql = mprintf(
20182020
--- src/login.c
+++ src/login.c
@@ -1985,10 +1985,11 @@
1985 ** other repository and on our own repository.
1986 */
1987 zSelfProjCode = abbreviated_project_code(zSelfProjCode);
1988 zOtherProjCode = abbreviated_project_code(zOtherProjCode);
1989 db_begin_transaction();
 
1990 db_multi_exec(
1991 "DELETE FROM \"%w\".config WHERE name GLOB 'peer-*';"
1992 "INSERT INTO \"%w\".config(name,value) VALUES('peer-repo-%q',%Q);"
1993 "INSERT INTO \"%w\".config(name,value) "
1994 " SELECT 'peer-name-%q', value FROM other.config"
@@ -2008,10 +2009,11 @@
2008 "REPLACE INTO \"%w\".config(name,value)"
2009 " SELECT name, value FROM other.config"
2010 " WHERE name GLOB 'peer-*' OR name GLOB 'login-group-*'",
2011 zSelf
2012 );
 
2013 db_end_transaction(0);
2014 db_multi_exec("DETACH other");
2015
2016 /* Propagate the changes to all other members of the login-group */
2017 zSql = mprintf(
2018
--- src/login.c
+++ src/login.c
@@ -1985,10 +1985,11 @@
1985 ** other repository and on our own repository.
1986 */
1987 zSelfProjCode = abbreviated_project_code(zSelfProjCode);
1988 zOtherProjCode = abbreviated_project_code(zOtherProjCode);
1989 db_begin_transaction();
1990 db_unprotect(PROTECT_CONFIG);
1991 db_multi_exec(
1992 "DELETE FROM \"%w\".config WHERE name GLOB 'peer-*';"
1993 "INSERT INTO \"%w\".config(name,value) VALUES('peer-repo-%q',%Q);"
1994 "INSERT INTO \"%w\".config(name,value) "
1995 " SELECT 'peer-name-%q', value FROM other.config"
@@ -2008,10 +2009,11 @@
2009 "REPLACE INTO \"%w\".config(name,value)"
2010 " SELECT name, value FROM other.config"
2011 " WHERE name GLOB 'peer-*' OR name GLOB 'login-group-*'",
2012 zSelf
2013 );
2014 db_protect_pop();
2015 db_end_transaction(0);
2016 db_multi_exec("DETACH other");
2017
2018 /* Propagate the changes to all other members of the login-group */
2019 zSql = mprintf(
2020

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button