| | @@ -210,10 +210,14 @@ |
| 210 | 210 | Blob httpHeader; /* Complete text of the HTTP request header */ |
| 211 | 211 | UrlData url; /* Information about current URL */ |
| 212 | 212 | const char *zLogin; /* Login name. NULL or "" if not logged in. */ |
| 213 | 213 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of |
| 214 | 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 |
| 215 | 219 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 216 | 220 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 217 | 221 | int userUid; /* Integer user id */ |
| 218 | 222 | int isHuman; /* True if access by a human, not a spider or bot */ |
| 219 | 223 | int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be |
| | @@ -758,10 +762,30 @@ |
| 758 | 762 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| 759 | 763 | if( find_option("localtime",0,0) ) g.fTimeFormat = 2; |
| 760 | 764 | if( zChdir && file_chdir(zChdir, 0) ){ |
| 761 | 765 | fossil_fatal("unable to change directories to %s", zChdir); |
| 762 | 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 |
| 763 | 787 | if( find_option("help",0,0)!=0 ){ |
| 764 | 788 | /* If --help is found anywhere on the command line, translate the command |
| 765 | 789 | * to "fossil help cmdname" where "cmdname" is the first argument that |
| 766 | 790 | * does not begin with a "-" character. If all arguments start with "-", |
| 767 | 791 | * translate to "fossil help argv[1] argv[2]...". */ |
| | @@ -2363,15 +2387,20 @@ |
| 2363 | 2387 | void test_pid_page(void){ |
| 2364 | 2388 | login_check_credentials(); |
| 2365 | 2389 | if( !g.perm.Setup ){ login_needed(0); return; } |
| 2366 | 2390 | #if defined(_WIN32) && USE_SEE |
| 2367 | 2391 | 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) |
| 2372 | 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 | + } |
| 2373 | 2402 | } |
| 2374 | 2403 | } |
| 2375 | 2404 | #endif |
| 2376 | 2405 | @ %d(GETPID()) |
| 2377 | 2406 | } |
| | @@ -2441,13 +2470,10 @@ |
| 2441 | 2470 | const char *zInFile; |
| 2442 | 2471 | const char *zOutFile; |
| 2443 | 2472 | int useSCGI; |
| 2444 | 2473 | int noJail; |
| 2445 | 2474 | int allowRepoList; |
| 2446 | | -#if defined(_WIN32) && USE_SEE |
| 2447 | | - const char *zPidKey; |
| 2448 | | -#endif |
| 2449 | 2475 | |
| 2450 | 2476 | Th_InitTraceLog(); |
| 2451 | 2477 | |
| 2452 | 2478 | /* The winhttp module passes the --files option as --files-urlenc with |
| 2453 | 2479 | ** the argument being URL encoded, to avoid wildcard expansion in the |
| | @@ -2494,21 +2520,10 @@ |
| 2494 | 2520 | cgi_replace_parameter("HTTPS","on"); |
| 2495 | 2521 | } |
| 2496 | 2522 | zHost = find_option("host", 0, 1); |
| 2497 | 2523 | if( zHost ) cgi_replace_parameter("HTTP_HOST",zHost); |
| 2498 | 2524 | |
| 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 | 2525 | /* We should be done with options.. */ |
| 2511 | 2526 | verify_all_options(); |
| 2512 | 2527 | |
| 2513 | 2528 | if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?"); |
| 2514 | 2529 | g.cgiOutput = 1; |
| | @@ -2723,13 +2738,10 @@ |
| 2723 | 2738 | const char *zAltBase; /* Argument to the --baseurl option */ |
| 2724 | 2739 | const char *zFileGlob; /* Static content must match this */ |
| 2725 | 2740 | char *zIpAddr = 0; /* Bind to this IP address */ |
| 2726 | 2741 | int fCreate = 0; /* The --create flag */ |
| 2727 | 2742 | const char *zInitPage = 0; /* Start on this page. --page option */ |
| 2728 | | -#if defined(_WIN32) && USE_SEE |
| 2729 | | - const char *zPidKey; |
| 2730 | | -#endif |
| 2731 | 2743 | |
| 2732 | 2744 | #if defined(_WIN32) |
| 2733 | 2745 | const char *zStopperFile; /* Name of file used to terminate server */ |
| 2734 | 2746 | zStopperFile = find_option("stopper", 0, 1); |
| 2735 | 2747 | #endif |
| | @@ -2773,21 +2785,10 @@ |
| 2773 | 2785 | } |
| 2774 | 2786 | if( find_option("localhost", 0, 0)!=0 ){ |
| 2775 | 2787 | flags |= HTTP_SERVER_LOCALHOST; |
| 2776 | 2788 | } |
| 2777 | 2789 | |
| 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 | 2790 | /* We should be done with options.. */ |
| 2790 | 2791 | verify_all_options(); |
| 2791 | 2792 | |
| 2792 | 2793 | if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?"); |
| 2793 | 2794 | if( isUiCmd ){ |
| 2794 | 2795 | |