Fossil SCM
Add the 'test-pid' web page.
Commit
d6e900a58153bcd0da2c07d4fd621a34d71d41f97834935ef005c0ff220a1137
Parent
81960e1faab71bf…
1 file changed
+28
+28
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -2345,10 +2345,38 @@ | ||
| 2345 | 2345 | }else{ |
| 2346 | 2346 | fossil_fatal("failed to parse pid key"); |
| 2347 | 2347 | } |
| 2348 | 2348 | } |
| 2349 | 2349 | #endif |
| 2350 | + | |
| 2351 | +/* | |
| 2352 | +** WEBPAGE: test-pid | |
| 2353 | +** | |
| 2354 | +** Return the process identifier of the running Fossil server instance. | |
| 2355 | +** | |
| 2356 | +** Query parameters: | |
| 2357 | +** | |
| 2358 | +** usepidkey When present and available, also return the | |
| 2359 | +** address and size, within this server process, | |
| 2360 | +** of the saved database encryption key. This | |
| 2361 | +** is only supported when using SEE on Windows. | |
| 2362 | +*/ | |
| 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 | +} | |
| 2350 | 2378 | |
| 2351 | 2379 | /* |
| 2352 | 2380 | ** COMMAND: http* |
| 2353 | 2381 | ** |
| 2354 | 2382 | ** Usage: %fossil http ?REPOSITORY? ?OPTIONS? |
| 2355 | 2383 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2345,10 +2345,38 @@ | |
| 2345 | }else{ |
| 2346 | fossil_fatal("failed to parse pid key"); |
| 2347 | } |
| 2348 | } |
| 2349 | #endif |
| 2350 | |
| 2351 | /* |
| 2352 | ** COMMAND: http* |
| 2353 | ** |
| 2354 | ** Usage: %fossil http ?REPOSITORY? ?OPTIONS? |
| 2355 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2345,10 +2345,38 @@ | |
| 2345 | }else{ |
| 2346 | fossil_fatal("failed to parse pid key"); |
| 2347 | } |
| 2348 | } |
| 2349 | #endif |
| 2350 | |
| 2351 | /* |
| 2352 | ** WEBPAGE: test-pid |
| 2353 | ** |
| 2354 | ** Return the process identifier of the running Fossil server instance. |
| 2355 | ** |
| 2356 | ** Query parameters: |
| 2357 | ** |
| 2358 | ** usepidkey When present and available, also return the |
| 2359 | ** address and size, within this server process, |
| 2360 | ** of the saved database encryption key. This |
| 2361 | ** is only supported when using SEE on Windows. |
| 2362 | */ |
| 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 | } |
| 2378 | |
| 2379 | /* |
| 2380 | ** COMMAND: http* |
| 2381 | ** |
| 2382 | ** Usage: %fossil http ?REPOSITORY? ?OPTIONS? |
| 2383 |