Fossil Forum

db_unprotect/db_protect_pop in wrong spot
Login

db_unprotect/db_protect_pop in wrong spot

db_unprotect/db_protect_pop in wrong spot

(1) By anonymous on 2021-10-11 07:55:44 [source]

The db_unprotect/db_protect_pop calls have been added in the wrong spot. Without this fossil tls-config remove-exception example.org fails due to the authorizer (as expected).

Index: src/http_ssl.c
==================================================================
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -586,18 +586,16 @@
     Blob sql;
     char *zSep = "(";
     db_begin_transaction();
     blob_init(&sql, 0, 0);
     if( g.argc==4 && find_option("all",0,0)!=0 ){
-      db_unprotect(PROTECT_CONFIG);
       blob_append_sql(&sql,
         "DELETE FROM global_config WHERE name GLOB 'cert:*';\n"
         "DELETE FROM global_config WHERE name GLOB 'trusted:*';\n"
         "DELETE FROM config WHERE name GLOB 'cert:*';\n"
         "DELETE FROM config WHERE name GLOB 'trusted:*';\n"
       );
-      db_protect_pop();
     }else{
       if( g.argc<4 ){
         usage("remove-exception DOMAIN-NAME ...");
       }
       blob_append_sql(&sql,"DELETE FROM global_config WHERE name IN ");
@@ -614,11 +612,13 @@
            zSep/*safe-for-%s*/, g.argv[i], g.argv[i]);
         zSep = ",";
       }
       blob_append_sql(&sql,");");
     }
+    db_unprotect(PROTECT_CONFIG);
     db_exec_sql(blob_str(&sql));
+    db_protect_pop();
     db_commit_transaction();
     blob_reset(&sql);
   }else
   /*default*/{
     fossil_fatal("unknown sub-command \"%s\".\nshould be one of:"

(2) By sean (jungleboogie) on 2021-10-12 17:53:13 in reply to 1 [link] [source]

Fixed in commit https://fossil-scm.org/home/info/156c890a2e71d980

Not sure if you're the same anonymous poster, but thank you for these fixes!