Fossil SCM

Fixes and enhancements to SEE integration on Windows.

mistachkin 2020-06-07 23:03 testPid
Commit 584ac9ffc40d9954e1eeea57d33a87ff83ca50194e18a60d8925b8675bc54983
+25
--- src/db.c
+++ src/db.c
@@ -1182,10 +1182,33 @@
11821182
}
11831183
}else{
11841184
fossil_panic("failed to open pid %lu: %lu", processId, GetLastError());
11851185
}
11861186
}
1187
+
1188
+/*
1189
+** This function evaluates the specified TH1 script and attempts to parse
1190
+** its result as a colon-delimited triplet containing a process identifier,
1191
+** address, and size (in bytes) of the database encryption key. This is
1192
+** only necessary (or functional) on Windows.
1193
+*/
1194
+void db_read_saved_encryption_key_from_process_via_th1(
1195
+ const char *zConfig /* The TH1 script to evaluate. */
1196
+){
1197
+ int rc;
1198
+ char *zResult;
1199
+ Th_FossilInit(TH_INIT_DEFAULT | TH_INIT_NEED_CONFIG | TH_INIT_NO_REPO);
1200
+ rc = Th_Eval(g.interp, 0, zConfig, -1);
1201
+ zResult = (char*)Th_GetResult(g.interp, 0);
1202
+ if( zResult ){
1203
+ DWORD processId = 0;
1204
+ LPVOID pAddress = NULL;
1205
+ SIZE_T nSize = 0;
1206
+ parse_pid_key_value(zResult, &processId, &pAddress, &nSize);
1207
+ db_read_saved_encryption_key_from_process(processId, pAddress, nSize);
1208
+ }
1209
+}
11871210
#endif /* defined(_WIN32) */
11881211
#endif /* USE_SEE */
11891212
11901213
/*
11911214
** If the database file zDbFile has a name that suggests that it is
@@ -1386,10 +1409,11 @@
13861409
int rc;
13871410
sqlite3_wal_checkpoint(g.db, 0);
13881411
rc = sqlite3_close(g.db);
13891412
if( g.fSqlTrace ) fossil_trace("-- db_close_config(%d)\n", rc);
13901413
g.db = 0;
1414
+ g.repositoryOpen = 0;
13911415
}else{
13921416
return;
13931417
}
13941418
fossil_free(g.zConfigDbName);
13951419
g.zConfigDbName = 0;
@@ -3932,10 +3956,11 @@
39323956
sqlite3_open(":memory:", &g.db);
39333957
rDiff = db_double(0.0, "SELECT julianday('now') - julianday(%Q)", g.argv[2]);
39343958
fossil_print("Time differences: %s\n", db_timespan_name(rDiff));
39353959
sqlite3_close(g.db);
39363960
g.db = 0;
3961
+ g.repositoryOpen = 0;
39373962
}
39383963
39393964
/*
39403965
** COMMAND: test-without-rowid
39413966
**
39423967
--- src/db.c
+++ src/db.c
@@ -1182,10 +1182,33 @@
1182 }
1183 }else{
1184 fossil_panic("failed to open pid %lu: %lu", processId, GetLastError());
1185 }
1186 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1187 #endif /* defined(_WIN32) */
1188 #endif /* USE_SEE */
1189
1190 /*
1191 ** If the database file zDbFile has a name that suggests that it is
@@ -1386,10 +1409,11 @@
1386 int rc;
1387 sqlite3_wal_checkpoint(g.db, 0);
1388 rc = sqlite3_close(g.db);
1389 if( g.fSqlTrace ) fossil_trace("-- db_close_config(%d)\n", rc);
1390 g.db = 0;
 
1391 }else{
1392 return;
1393 }
1394 fossil_free(g.zConfigDbName);
1395 g.zConfigDbName = 0;
@@ -3932,10 +3956,11 @@
3932 sqlite3_open(":memory:", &g.db);
3933 rDiff = db_double(0.0, "SELECT julianday('now') - julianday(%Q)", g.argv[2]);
3934 fossil_print("Time differences: %s\n", db_timespan_name(rDiff));
3935 sqlite3_close(g.db);
3936 g.db = 0;
 
3937 }
3938
3939 /*
3940 ** COMMAND: test-without-rowid
3941 **
3942
--- src/db.c
+++ src/db.c
@@ -1182,10 +1182,33 @@
1182 }
1183 }else{
1184 fossil_panic("failed to open pid %lu: %lu", processId, GetLastError());
1185 }
1186 }
1187
1188 /*
1189 ** This function evaluates the specified TH1 script and attempts to parse
1190 ** its result as a colon-delimited triplet containing a process identifier,
1191 ** address, and size (in bytes) of the database encryption key. This is
1192 ** only necessary (or functional) on Windows.
1193 */
1194 void db_read_saved_encryption_key_from_process_via_th1(
1195 const char *zConfig /* The TH1 script to evaluate. */
1196 ){
1197 int rc;
1198 char *zResult;
1199 Th_FossilInit(TH_INIT_DEFAULT | TH_INIT_NEED_CONFIG | TH_INIT_NO_REPO);
1200 rc = Th_Eval(g.interp, 0, zConfig, -1);
1201 zResult = (char*)Th_GetResult(g.interp, 0);
1202 if( zResult ){
1203 DWORD processId = 0;
1204 LPVOID pAddress = NULL;
1205 SIZE_T nSize = 0;
1206 parse_pid_key_value(zResult, &processId, &pAddress, &nSize);
1207 db_read_saved_encryption_key_from_process(processId, pAddress, nSize);
1208 }
1209 }
1210 #endif /* defined(_WIN32) */
1211 #endif /* USE_SEE */
1212
1213 /*
1214 ** If the database file zDbFile has a name that suggests that it is
@@ -1386,10 +1409,11 @@
1409 int rc;
1410 sqlite3_wal_checkpoint(g.db, 0);
1411 rc = sqlite3_close(g.db);
1412 if( g.fSqlTrace ) fossil_trace("-- db_close_config(%d)\n", rc);
1413 g.db = 0;
1414 g.repositoryOpen = 0;
1415 }else{
1416 return;
1417 }
1418 fossil_free(g.zConfigDbName);
1419 g.zConfigDbName = 0;
@@ -3932,10 +3956,11 @@
3956 sqlite3_open(":memory:", &g.db);
3957 rDiff = db_double(0.0, "SELECT julianday('now') - julianday(%Q)", g.argv[2]);
3958 fossil_print("Time differences: %s\n", db_timespan_name(rDiff));
3959 sqlite3_close(g.db);
3960 g.db = 0;
3961 g.repositoryOpen = 0;
3962 }
3963
3964 /*
3965 ** COMMAND: test-without-rowid
3966 **
3967
+33 -32
--- src/main.c
+++ src/main.c
@@ -210,10 +210,14 @@
210210
Blob httpHeader; /* Complete text of the HTTP request header */
211211
UrlData url; /* Information about current URL */
212212
const char *zLogin; /* Login name. NULL or "" if not logged in. */
213213
const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
214214
** SSL client identity */
215
+#if defined(_WIN32) && USE_SEE
216
+ const char *zPidKey; /* Saved value of the --usepidkey option. Only
217
+ * applicable when using SEE on Windows. */
218
+#endif
215219
int useLocalauth; /* No login required if from 127.0.0.1 */
216220
int noPswd; /* Logged in without password (on 127.0.0.1) */
217221
int userUid; /* Integer user id */
218222
int isHuman; /* True if access by a human, not a spider or bot */
219223
int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
@@ -758,10 +762,30 @@
758762
if( find_option("utc",0,0) ) g.fTimeFormat = 1;
759763
if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
760764
if( zChdir && file_chdir(zChdir, 0) ){
761765
fossil_fatal("unable to change directories to %s", zChdir);
762766
}
767
+#if defined(_WIN32) && USE_SEE
768
+ {
769
+ g.zPidKey = find_option("usepidkey",0,1);
770
+ if( g.zPidKey ){
771
+ DWORD processId = 0;
772
+ LPVOID pAddress = NULL;
773
+ SIZE_T nSize = 0;
774
+ parse_pid_key_value(g.zPidKey, &processId, &pAddress, &nSize);
775
+ db_read_saved_encryption_key_from_process(processId, pAddress, nSize);
776
+ }else{
777
+ const char *zSeeDbConfig = find_option("seedbcfg",0,1);
778
+ if( !zSeeDbConfig ){
779
+ zSeeDbConfig = fossil_getenv("FOSSIL_SEE_DB_CONFIG");
780
+ }
781
+ if( zSeeDbConfig ){
782
+ db_read_saved_encryption_key_from_process_via_th1(zSeeDbConfig);
783
+ }
784
+ }
785
+ }
786
+#endif
763787
if( find_option("help",0,0)!=0 ){
764788
/* If --help is found anywhere on the command line, translate the command
765789
* to "fossil help cmdname" where "cmdname" is the first argument that
766790
* does not begin with a "-" character. If all arguments start with "-",
767791
* translate to "fossil help argv[1] argv[2]...". */
@@ -2363,15 +2387,20 @@
23632387
void test_pid_page(void){
23642388
login_check_credentials();
23652389
if( !g.perm.Setup ){ login_needed(0); return; }
23662390
#if defined(_WIN32) && USE_SEE
23672391
if( P("usepidkey")!=0 ){
2368
- const char *zSavedKey = db_get_saved_encryption_key();
2369
- size_t savedKeySize = db_get_saved_encryption_key_size();
2370
- if( zSavedKey!=0 && savedKeySize>0 ){
2371
- @ %lu(GetCurrentProcessId()):%p(zSavedKey):%u(savedKeySize)
2392
+ if( g.zPidKey ){
2393
+ @ %s(g.zPidKey)
23722394
return;
2395
+ }else{
2396
+ const char *zSavedKey = db_get_saved_encryption_key();
2397
+ size_t savedKeySize = db_get_saved_encryption_key_size();
2398
+ if( zSavedKey!=0 && savedKeySize>0 ){
2399
+ @ %lu(GetCurrentProcessId()):%p(zSavedKey):%u(savedKeySize)
2400
+ return;
2401
+ }
23732402
}
23742403
}
23752404
#endif
23762405
@ %d(GETPID())
23772406
}
@@ -2441,13 +2470,10 @@
24412470
const char *zInFile;
24422471
const char *zOutFile;
24432472
int useSCGI;
24442473
int noJail;
24452474
int allowRepoList;
2446
-#if defined(_WIN32) && USE_SEE
2447
- const char *zPidKey;
2448
-#endif
24492475
24502476
Th_InitTraceLog();
24512477
24522478
/* The winhttp module passes the --files option as --files-urlenc with
24532479
** the argument being URL encoded, to avoid wildcard expansion in the
@@ -2494,21 +2520,10 @@
24942520
cgi_replace_parameter("HTTPS","on");
24952521
}
24962522
zHost = find_option("host", 0, 1);
24972523
if( zHost ) cgi_replace_parameter("HTTP_HOST",zHost);
24982524
2499
-#if defined(_WIN32) && USE_SEE
2500
- zPidKey = find_option("usepidkey", 0, 1);
2501
- if( zPidKey ){
2502
- DWORD processId = 0;
2503
- LPVOID pAddress = NULL;
2504
- SIZE_T nSize = 0;
2505
- parse_pid_key_value(zPidKey, &processId, &pAddress, &nSize);
2506
- db_read_saved_encryption_key_from_process(processId, pAddress, nSize);
2507
- }
2508
-#endif
2509
-
25102525
/* We should be done with options.. */
25112526
verify_all_options();
25122527
25132528
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
25142529
g.cgiOutput = 1;
@@ -2723,13 +2738,10 @@
27232738
const char *zAltBase; /* Argument to the --baseurl option */
27242739
const char *zFileGlob; /* Static content must match this */
27252740
char *zIpAddr = 0; /* Bind to this IP address */
27262741
int fCreate = 0; /* The --create flag */
27272742
const char *zInitPage = 0; /* Start on this page. --page option */
2728
-#if defined(_WIN32) && USE_SEE
2729
- const char *zPidKey;
2730
-#endif
27312743
27322744
#if defined(_WIN32)
27332745
const char *zStopperFile; /* Name of file used to terminate server */
27342746
zStopperFile = find_option("stopper", 0, 1);
27352747
#endif
@@ -2773,21 +2785,10 @@
27732785
}
27742786
if( find_option("localhost", 0, 0)!=0 ){
27752787
flags |= HTTP_SERVER_LOCALHOST;
27762788
}
27772789
2778
-#if defined(_WIN32) && USE_SEE
2779
- zPidKey = find_option("usepidkey", 0, 1);
2780
- if( zPidKey ){
2781
- DWORD processId = 0;
2782
- LPVOID pAddress = NULL;
2783
- SIZE_T nSize = 0;
2784
- parse_pid_key_value(zPidKey, &processId, &pAddress, &nSize);
2785
- db_read_saved_encryption_key_from_process(processId, pAddress, nSize);
2786
- }
2787
-#endif
2788
-
27892790
/* We should be done with options.. */
27902791
verify_all_options();
27912792
27922793
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
27932794
if( isUiCmd ){
27942795
--- src/main.c
+++ src/main.c
@@ -210,10 +210,14 @@
210 Blob httpHeader; /* Complete text of the HTTP request header */
211 UrlData url; /* Information about current URL */
212 const char *zLogin; /* Login name. NULL or "" if not logged in. */
213 const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
214 ** SSL client identity */
 
 
 
 
215 int useLocalauth; /* No login required if from 127.0.0.1 */
216 int noPswd; /* Logged in without password (on 127.0.0.1) */
217 int userUid; /* Integer user id */
218 int isHuman; /* True if access by a human, not a spider or bot */
219 int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
@@ -758,10 +762,30 @@
758 if( find_option("utc",0,0) ) g.fTimeFormat = 1;
759 if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
760 if( zChdir && file_chdir(zChdir, 0) ){
761 fossil_fatal("unable to change directories to %s", zChdir);
762 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763 if( find_option("help",0,0)!=0 ){
764 /* If --help is found anywhere on the command line, translate the command
765 * to "fossil help cmdname" where "cmdname" is the first argument that
766 * does not begin with a "-" character. If all arguments start with "-",
767 * translate to "fossil help argv[1] argv[2]...". */
@@ -2363,15 +2387,20 @@
2363 void test_pid_page(void){
2364 login_check_credentials();
2365 if( !g.perm.Setup ){ login_needed(0); return; }
2366 #if defined(_WIN32) && USE_SEE
2367 if( P("usepidkey")!=0 ){
2368 const char *zSavedKey = db_get_saved_encryption_key();
2369 size_t savedKeySize = db_get_saved_encryption_key_size();
2370 if( zSavedKey!=0 && savedKeySize>0 ){
2371 @ %lu(GetCurrentProcessId()):%p(zSavedKey):%u(savedKeySize)
2372 return;
 
 
 
 
 
 
 
2373 }
2374 }
2375 #endif
2376 @ %d(GETPID())
2377 }
@@ -2441,13 +2470,10 @@
2441 const char *zInFile;
2442 const char *zOutFile;
2443 int useSCGI;
2444 int noJail;
2445 int allowRepoList;
2446 #if defined(_WIN32) && USE_SEE
2447 const char *zPidKey;
2448 #endif
2449
2450 Th_InitTraceLog();
2451
2452 /* The winhttp module passes the --files option as --files-urlenc with
2453 ** the argument being URL encoded, to avoid wildcard expansion in the
@@ -2494,21 +2520,10 @@
2494 cgi_replace_parameter("HTTPS","on");
2495 }
2496 zHost = find_option("host", 0, 1);
2497 if( zHost ) cgi_replace_parameter("HTTP_HOST",zHost);
2498
2499 #if defined(_WIN32) && USE_SEE
2500 zPidKey = find_option("usepidkey", 0, 1);
2501 if( zPidKey ){
2502 DWORD processId = 0;
2503 LPVOID pAddress = NULL;
2504 SIZE_T nSize = 0;
2505 parse_pid_key_value(zPidKey, &processId, &pAddress, &nSize);
2506 db_read_saved_encryption_key_from_process(processId, pAddress, nSize);
2507 }
2508 #endif
2509
2510 /* We should be done with options.. */
2511 verify_all_options();
2512
2513 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
2514 g.cgiOutput = 1;
@@ -2723,13 +2738,10 @@
2723 const char *zAltBase; /* Argument to the --baseurl option */
2724 const char *zFileGlob; /* Static content must match this */
2725 char *zIpAddr = 0; /* Bind to this IP address */
2726 int fCreate = 0; /* The --create flag */
2727 const char *zInitPage = 0; /* Start on this page. --page option */
2728 #if defined(_WIN32) && USE_SEE
2729 const char *zPidKey;
2730 #endif
2731
2732 #if defined(_WIN32)
2733 const char *zStopperFile; /* Name of file used to terminate server */
2734 zStopperFile = find_option("stopper", 0, 1);
2735 #endif
@@ -2773,21 +2785,10 @@
2773 }
2774 if( find_option("localhost", 0, 0)!=0 ){
2775 flags |= HTTP_SERVER_LOCALHOST;
2776 }
2777
2778 #if defined(_WIN32) && USE_SEE
2779 zPidKey = find_option("usepidkey", 0, 1);
2780 if( zPidKey ){
2781 DWORD processId = 0;
2782 LPVOID pAddress = NULL;
2783 SIZE_T nSize = 0;
2784 parse_pid_key_value(zPidKey, &processId, &pAddress, &nSize);
2785 db_read_saved_encryption_key_from_process(processId, pAddress, nSize);
2786 }
2787 #endif
2788
2789 /* We should be done with options.. */
2790 verify_all_options();
2791
2792 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
2793 if( isUiCmd ){
2794
--- src/main.c
+++ src/main.c
@@ -210,10 +210,14 @@
210 Blob httpHeader; /* Complete text of the HTTP request header */
211 UrlData url; /* Information about current URL */
212 const char *zLogin; /* Login name. NULL or "" if not logged in. */
213 const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
214 ** SSL client identity */
215 #if defined(_WIN32) && USE_SEE
216 const char *zPidKey; /* Saved value of the --usepidkey option. Only
217 * applicable when using SEE on Windows. */
218 #endif
219 int useLocalauth; /* No login required if from 127.0.0.1 */
220 int noPswd; /* Logged in without password (on 127.0.0.1) */
221 int userUid; /* Integer user id */
222 int isHuman; /* True if access by a human, not a spider or bot */
223 int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
@@ -758,10 +762,30 @@
762 if( find_option("utc",0,0) ) g.fTimeFormat = 1;
763 if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
764 if( zChdir && file_chdir(zChdir, 0) ){
765 fossil_fatal("unable to change directories to %s", zChdir);
766 }
767 #if defined(_WIN32) && USE_SEE
768 {
769 g.zPidKey = find_option("usepidkey",0,1);
770 if( g.zPidKey ){
771 DWORD processId = 0;
772 LPVOID pAddress = NULL;
773 SIZE_T nSize = 0;
774 parse_pid_key_value(g.zPidKey, &processId, &pAddress, &nSize);
775 db_read_saved_encryption_key_from_process(processId, pAddress, nSize);
776 }else{
777 const char *zSeeDbConfig = find_option("seedbcfg",0,1);
778 if( !zSeeDbConfig ){
779 zSeeDbConfig = fossil_getenv("FOSSIL_SEE_DB_CONFIG");
780 }
781 if( zSeeDbConfig ){
782 db_read_saved_encryption_key_from_process_via_th1(zSeeDbConfig);
783 }
784 }
785 }
786 #endif
787 if( find_option("help",0,0)!=0 ){
788 /* If --help is found anywhere on the command line, translate the command
789 * to "fossil help cmdname" where "cmdname" is the first argument that
790 * does not begin with a "-" character. If all arguments start with "-",
791 * translate to "fossil help argv[1] argv[2]...". */
@@ -2363,15 +2387,20 @@
2387 void test_pid_page(void){
2388 login_check_credentials();
2389 if( !g.perm.Setup ){ login_needed(0); return; }
2390 #if defined(_WIN32) && USE_SEE
2391 if( P("usepidkey")!=0 ){
2392 if( g.zPidKey ){
2393 @ %s(g.zPidKey)
 
 
2394 return;
2395 }else{
2396 const char *zSavedKey = db_get_saved_encryption_key();
2397 size_t savedKeySize = db_get_saved_encryption_key_size();
2398 if( zSavedKey!=0 && savedKeySize>0 ){
2399 @ %lu(GetCurrentProcessId()):%p(zSavedKey):%u(savedKeySize)
2400 return;
2401 }
2402 }
2403 }
2404 #endif
2405 @ %d(GETPID())
2406 }
@@ -2441,13 +2470,10 @@
2470 const char *zInFile;
2471 const char *zOutFile;
2472 int useSCGI;
2473 int noJail;
2474 int allowRepoList;
 
 
 
2475
2476 Th_InitTraceLog();
2477
2478 /* The winhttp module passes the --files option as --files-urlenc with
2479 ** the argument being URL encoded, to avoid wildcard expansion in the
@@ -2494,21 +2520,10 @@
2520 cgi_replace_parameter("HTTPS","on");
2521 }
2522 zHost = find_option("host", 0, 1);
2523 if( zHost ) cgi_replace_parameter("HTTP_HOST",zHost);
2524
 
 
 
 
 
 
 
 
 
 
 
2525 /* We should be done with options.. */
2526 verify_all_options();
2527
2528 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
2529 g.cgiOutput = 1;
@@ -2723,13 +2738,10 @@
2738 const char *zAltBase; /* Argument to the --baseurl option */
2739 const char *zFileGlob; /* Static content must match this */
2740 char *zIpAddr = 0; /* Bind to this IP address */
2741 int fCreate = 0; /* The --create flag */
2742 const char *zInitPage = 0; /* Start on this page. --page option */
 
 
 
2743
2744 #if defined(_WIN32)
2745 const char *zStopperFile; /* Name of file used to terminate server */
2746 zStopperFile = find_option("stopper", 0, 1);
2747 #endif
@@ -2773,21 +2785,10 @@
2785 }
2786 if( find_option("localhost", 0, 0)!=0 ){
2787 flags |= HTTP_SERVER_LOCALHOST;
2788 }
2789
 
 
 
 
 
 
 
 
 
 
 
2790 /* We should be done with options.. */
2791 verify_all_options();
2792
2793 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
2794 if( isUiCmd ){
2795
--- src/repolist.c
+++ src/repolist.c
@@ -141,10 +141,12 @@
141141
}
142142
n = db_int(0, "SELECT count(*) FROM sfile");
143143
if( n==0 ){
144144
sqlite3_close(g.db);
145145
g.db = 0;
146
+ g.repositoryOpen = 0;
147
+ g.localOpen = 0;
146148
return 0;
147149
}else{
148150
Stmt q;
149151
double rNow;
150152
blob_append_sql(&html,
151153
--- src/repolist.c
+++ src/repolist.c
@@ -141,10 +141,12 @@
141 }
142 n = db_int(0, "SELECT count(*) FROM sfile");
143 if( n==0 ){
144 sqlite3_close(g.db);
145 g.db = 0;
 
 
146 return 0;
147 }else{
148 Stmt q;
149 double rNow;
150 blob_append_sql(&html,
151
--- src/repolist.c
+++ src/repolist.c
@@ -141,10 +141,12 @@
141 }
142 n = db_int(0, "SELECT count(*) FROM sfile");
143 if( n==0 ){
144 sqlite3_close(g.db);
145 g.db = 0;
146 g.repositoryOpen = 0;
147 g.localOpen = 0;
148 return 0;
149 }else{
150 Stmt q;
151 double rNow;
152 blob_append_sql(&html,
153
+7 -5
--- src/th_main.c
+++ src/th_main.c
@@ -30,11 +30,12 @@
3030
#define TH_INIT_NONE ((u32)0x00000000) /* No flags. */
3131
#define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */
3232
#define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */
3333
#define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH1 commands re-added? */
3434
#define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */
35
-#define TH_INIT_MASK ((u32)0x0000000F) /* All possible init flags. */
35
+#define TH_INIT_NO_REPO ((u32)0x00000010) /* Skip opening repository. */
36
+#define TH_INIT_MASK ((u32)0x0000001F) /* All possible init flags. */
3637
3738
/*
3839
** Useful and/or "well-known" combinations of flag values.
3940
*/
4041
#define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */
@@ -44,13 +45,13 @@
4445
4546
/*
4647
** Flags set by functions in this file to keep track of integration state
4748
** information. These flags should not be used outside of this file.
4849
*/
49
-#define TH_STATE_CONFIG ((u32)0x00000010) /* We opened the config. */
50
-#define TH_STATE_REPOSITORY ((u32)0x00000020) /* We opened the repository. */
51
-#define TH_STATE_MASK ((u32)0x00000030) /* All possible state flags. */
50
+#define TH_STATE_CONFIG ((u32)0x00000020) /* We opened the config. */
51
+#define TH_STATE_REPOSITORY ((u32)0x00000040) /* We opened the repository. */
52
+#define TH_STATE_MASK ((u32)0x00000060) /* All possible state flags. */
5253
5354
#ifdef FOSSIL_ENABLE_TH1_HOOKS
5455
/*
5556
** These are the "well-known" TH1 error messages that occur when no hook is
5657
** registered to be called prior to executing a command or processing a web
@@ -2085,10 +2086,11 @@
20852086
int wasInit = 0;
20862087
int needConfig = flags & TH_INIT_NEED_CONFIG;
20872088
int forceReset = flags & TH_INIT_FORCE_RESET;
20882089
int forceTcl = flags & TH_INIT_FORCE_TCL;
20892090
int forceSetup = flags & TH_INIT_FORCE_SETUP;
2091
+ int noRepo = flags & TH_INIT_NO_REPO;
20902092
static unsigned int aFlags[] = { 0, 1, WIKI_LINKSONLY };
20912093
static int anonFlag = LOGIN_ANON;
20922094
static int zeroInt = 0;
20932095
static struct _Command {
20942096
const char *zName;
@@ -2152,11 +2154,11 @@
21522154
** This function uses several settings which may be defined in the
21532155
** repository and/or the global configuration. Since the caller
21542156
** passed a non-zero value for the needConfig parameter, make sure
21552157
** the necessary database connections are open prior to continuing.
21562158
*/
2157
- Th_OpenConfig(1);
2159
+ Th_OpenConfig(!noRepo);
21582160
}
21592161
if( forceReset || forceTcl || g.interp==0 ){
21602162
int created = 0;
21612163
int i;
21622164
if( g.interp==0 ){
21632165
--- src/th_main.c
+++ src/th_main.c
@@ -30,11 +30,12 @@
30 #define TH_INIT_NONE ((u32)0x00000000) /* No flags. */
31 #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */
32 #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */
33 #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH1 commands re-added? */
34 #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */
35 #define TH_INIT_MASK ((u32)0x0000000F) /* All possible init flags. */
 
36
37 /*
38 ** Useful and/or "well-known" combinations of flag values.
39 */
40 #define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */
@@ -44,13 +45,13 @@
44
45 /*
46 ** Flags set by functions in this file to keep track of integration state
47 ** information. These flags should not be used outside of this file.
48 */
49 #define TH_STATE_CONFIG ((u32)0x00000010) /* We opened the config. */
50 #define TH_STATE_REPOSITORY ((u32)0x00000020) /* We opened the repository. */
51 #define TH_STATE_MASK ((u32)0x00000030) /* All possible state flags. */
52
53 #ifdef FOSSIL_ENABLE_TH1_HOOKS
54 /*
55 ** These are the "well-known" TH1 error messages that occur when no hook is
56 ** registered to be called prior to executing a command or processing a web
@@ -2085,10 +2086,11 @@
2085 int wasInit = 0;
2086 int needConfig = flags & TH_INIT_NEED_CONFIG;
2087 int forceReset = flags & TH_INIT_FORCE_RESET;
2088 int forceTcl = flags & TH_INIT_FORCE_TCL;
2089 int forceSetup = flags & TH_INIT_FORCE_SETUP;
 
2090 static unsigned int aFlags[] = { 0, 1, WIKI_LINKSONLY };
2091 static int anonFlag = LOGIN_ANON;
2092 static int zeroInt = 0;
2093 static struct _Command {
2094 const char *zName;
@@ -2152,11 +2154,11 @@
2152 ** This function uses several settings which may be defined in the
2153 ** repository and/or the global configuration. Since the caller
2154 ** passed a non-zero value for the needConfig parameter, make sure
2155 ** the necessary database connections are open prior to continuing.
2156 */
2157 Th_OpenConfig(1);
2158 }
2159 if( forceReset || forceTcl || g.interp==0 ){
2160 int created = 0;
2161 int i;
2162 if( g.interp==0 ){
2163
--- src/th_main.c
+++ src/th_main.c
@@ -30,11 +30,12 @@
30 #define TH_INIT_NONE ((u32)0x00000000) /* No flags. */
31 #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */
32 #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */
33 #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH1 commands re-added? */
34 #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */
35 #define TH_INIT_NO_REPO ((u32)0x00000010) /* Skip opening repository. */
36 #define TH_INIT_MASK ((u32)0x0000001F) /* All possible init flags. */
37
38 /*
39 ** Useful and/or "well-known" combinations of flag values.
40 */
41 #define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */
@@ -44,13 +45,13 @@
45
46 /*
47 ** Flags set by functions in this file to keep track of integration state
48 ** information. These flags should not be used outside of this file.
49 */
50 #define TH_STATE_CONFIG ((u32)0x00000020) /* We opened the config. */
51 #define TH_STATE_REPOSITORY ((u32)0x00000040) /* We opened the repository. */
52 #define TH_STATE_MASK ((u32)0x00000060) /* All possible state flags. */
53
54 #ifdef FOSSIL_ENABLE_TH1_HOOKS
55 /*
56 ** These are the "well-known" TH1 error messages that occur when no hook is
57 ** registered to be called prior to executing a command or processing a web
@@ -2085,10 +2086,11 @@
2086 int wasInit = 0;
2087 int needConfig = flags & TH_INIT_NEED_CONFIG;
2088 int forceReset = flags & TH_INIT_FORCE_RESET;
2089 int forceTcl = flags & TH_INIT_FORCE_TCL;
2090 int forceSetup = flags & TH_INIT_FORCE_SETUP;
2091 int noRepo = flags & TH_INIT_NO_REPO;
2092 static unsigned int aFlags[] = { 0, 1, WIKI_LINKSONLY };
2093 static int anonFlag = LOGIN_ANON;
2094 static int zeroInt = 0;
2095 static struct _Command {
2096 const char *zName;
@@ -2152,11 +2154,11 @@
2154 ** This function uses several settings which may be defined in the
2155 ** repository and/or the global configuration. Since the caller
2156 ** passed a non-zero value for the needConfig parameter, make sure
2157 ** the necessary database connections are open prior to continuing.
2158 */
2159 Th_OpenConfig(!noRepo);
2160 }
2161 if( forceReset || forceTcl || g.interp==0 ){
2162 int created = 0;
2163 int i;
2164 if( g.interp==0 ){
2165

Keyboard Shortcuts

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