Fossil

Check-in [119f971335]
Login

Check-in [119f971335]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Some changes for Windows.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | enhSee
Files: files | file ages | folders
SHA3-256: 119f97133522f661dcac7d5a846e7bd29b211c56677f032a218ebbcf142db3b1
User & Date: mistachkin 2023-05-20 00:25:37.206
Context
2023-05-20
01:53
Fixes to tracing. ... (check-in: 0de3d90787 user: mistachkin tags: enhSee)
00:25
Some changes for Windows. ... (check-in: 119f971335 user: mistachkin tags: enhSee)
2023-05-18
23:24
Comment fixes. ... (check-in: 1ff19a468d user: mistachkin tags: enhSee)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
                                  FALSE, processId);
    if( hProcess!=NULL ){
      SIZE_T nWrite = 0;
      if( WriteProcessMemory(hProcess, pAddress, p, nSize, &nWrite) ){
        CloseHandle(hProcess);
        if( nWrite!=nSize ){
          fossil_panic("bad size write, %u out of %u bytes at %p from pid %lu",
                       nRead, nSize, pAddress, processId);
        }
      }else{
        CloseHandle(hProcess);
        fossil_panic("failed write, %u bytes at %p from pid %lu: %lu", nSize,
                     pAddress, processId, GetLastError());
      }
    }else{







|







1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
                                  FALSE, processId);
    if( hProcess!=NULL ){
      SIZE_T nWrite = 0;
      if( WriteProcessMemory(hProcess, pAddress, p, nSize, &nWrite) ){
        CloseHandle(hProcess);
        if( nWrite!=nSize ){
          fossil_panic("bad size write, %u out of %u bytes at %p from pid %lu",
                       nWrite, nSize, pAddress, processId);
        }
      }else{
        CloseHandle(hProcess);
        fossil_panic("failed write, %u bytes at %p from pid %lu: %lu", nSize,
                     pAddress, processId, GetLastError());
      }
    }else{
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
    if( hProcess!=NULL ){
      SIZE_T nWrite = 0;
      if( WriteProcessMemory(hProcess, pAddress, p, nSize, &nWrite) ){
        CloseHandle(hProcess);
        fossil_secure_free_page(p, n);
        if( nWrite!=nSize ){
          fossil_panic("bad size zero, %u out of %u bytes at %p from pid %lu",
                       nRead, nSize, pAddress, processId);
        }
      }else{
        CloseHandle(hProcess);
        fossil_secure_free_page(p, n);
        fossil_panic("failed zero, %u bytes at %p from pid %lu: %lu", nSize,
                     pAddress, processId, GetLastError());
      }







|







1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
    if( hProcess!=NULL ){
      SIZE_T nWrite = 0;
      if( WriteProcessMemory(hProcess, pAddress, p, nSize, &nWrite) ){
        CloseHandle(hProcess);
        fossil_secure_free_page(p, n);
        if( nWrite!=nSize ){
          fossil_panic("bad size zero, %u out of %u bytes at %p from pid %lu",
                       nWrite, nSize, pAddress, processId);
        }
      }else{
        CloseHandle(hProcess);
        fossil_secure_free_page(p, n);
        fossil_panic("failed zero, %u bytes at %p from pid %lu: %lu", nSize,
                     pAddress, processId, GetLastError());
      }
Changes to src/main.c.
1708
1709
1710
1711
1712
1713
1714

1715
1716
1717
1718
1719
1720
1721
    json_bootstrap_early();
  }
#endif
  /* If the repository has not been opened already, then find the
  ** repository based on the first element of PATH_INFO and open it.
  */
  if( !g.repositoryOpen ){

    const char *zRepoExt = ".fossil";
    char *zRepo;               /* Candidate repository name */
    char *zToFree = 0;         /* Malloced memory that needs to be freed */
    const char *zCleanRepo;    /* zRepo with surplus leading "/" removed */
    const char *zOldScript = PD("SCRIPT_NAME", "");  /* Original SCRIPT_NAME */
    char *zNewScript;          /* Revised SCRIPT_NAME after processing */
    int j, k;                  /* Loop variables */







>







1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
    json_bootstrap_early();
  }
#endif
  /* If the repository has not been opened already, then find the
  ** repository based on the first element of PATH_INFO and open it.
  */
  if( !g.repositoryOpen ){
    char zBuf[24];
    const char *zRepoExt = ".fossil";
    char *zRepo;               /* Candidate repository name */
    char *zToFree = 0;         /* Malloced memory that needs to be freed */
    const char *zCleanRepo;    /* zRepo with surplus leading "/" removed */
    const char *zOldScript = PD("SCRIPT_NAME", "");  /* Original SCRIPT_NAME */
    char *zNewScript;          /* Revised SCRIPT_NAME after processing */
    int j, k;                  /* Loop variables */
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
      ** Special case:  Assume any file with a basename of ".fossil" does
      ** not exist.
      */
      zCleanRepo = file_cleanup_fullpath(zRepo);
      if( szFile==0 && sqlite3_strglob("*/.fossil",zRepo)!=0 ){
        szFile = file_size(zCleanRepo, ExtFILE);
        if( g.fHttpTrace ){
          char zBuf[24];
          sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", szFile);
          @ <!-- file_size(%h(zCleanRepo)) is %s(zBuf) -->
          fprintf(stderr, "# file_size(%s) = %s\n", zCleanRepo, zBuf);
        }
      }

      /* If no file named by zRepo exists, remove the added ".fossil" suffix







<







1789
1790
1791
1792
1793
1794
1795

1796
1797
1798
1799
1800
1801
1802
      ** Special case:  Assume any file with a basename of ".fossil" does
      ** not exist.
      */
      zCleanRepo = file_cleanup_fullpath(zRepo);
      if( szFile==0 && sqlite3_strglob("*/.fossil",zRepo)!=0 ){
        szFile = file_size(zCleanRepo, ExtFILE);
        if( g.fHttpTrace ){

          sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", szFile);
          @ <!-- file_size(%h(zCleanRepo)) is %s(zBuf) -->
          fprintf(stderr, "# file_size(%s) = %s\n", zCleanRepo, zBuf);
        }
      }

      /* If no file named by zRepo exists, remove the added ".fossil" suffix
1894
1895
1896
1897
1898
1899
1900






1901
1902
1903
1904
1905
1906

1907
1908
1909
1910
1911
1912
1913
    zNewScript = mprintf("%s%.*s", zOldScript, i, zPathInfo);
    if( g.zTop ) g.zTop = mprintf("%R%.*s", i, zPathInfo);
    if( g.zBaseURL ) g.zBaseURL = mprintf("%s%.*s", g.zBaseURL, i, zPathInfo);
    cgi_replace_parameter("PATH_INFO", &zPathInfo[i+1]);
    zPathInfo += i;
    cgi_replace_parameter("SCRIPT_NAME", zNewScript);
#if USE_SEE






    if( strcmp(zPathInfo,"/setseekey")==0
     && strcmp(zRepoExt,".efossil")==0
     && !db_have_saved_encryption_key() ){
      db_set_see_key_page();
      cgi_reply();
      fossil_exit(0);

    }
#endif
    db_open_repository(file_cleanup_fullpath(zRepo));
    if( g.fHttpTrace ){
      @ <!-- repository: "%h(zRepo)" -->
      @ <!-- translated PATH_INFO: "%h(zPathInfo)" -->
      @ <!-- translated SCRIPT_NAME: "%h(zNewScript)" -->







>
>
>
>
>
>
|
|
|
|
|
|
>







1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
    zNewScript = mprintf("%s%.*s", zOldScript, i, zPathInfo);
    if( g.zTop ) g.zTop = mprintf("%R%.*s", i, zPathInfo);
    if( g.zBaseURL ) g.zBaseURL = mprintf("%s%.*s", g.zBaseURL, i, zPathInfo);
    cgi_replace_parameter("PATH_INFO", &zPathInfo[i+1]);
    zPathInfo += i;
    cgi_replace_parameter("SCRIPT_NAME", zNewScript);
#if USE_SEE
    if( zPathInfo ){
      if( g.fHttpTrace ){
        sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", i);
        @ <!-- see_path_info(%s(zBuf)) is %h(zPathInfo) -->
        fprintf(stderr, "# see_path_info(%d) = %s\n", i, zPathInfo);
      }
      if( strcmp(zPathInfo,"/setseekey")==0
       && strcmp(zRepoExt,".efossil")==0
       && !db_have_saved_encryption_key() ){
        db_set_see_key_page();
        cgi_reply();
        fossil_exit(0);
      }
    }
#endif
    db_open_repository(file_cleanup_fullpath(zRepo));
    if( g.fHttpTrace ){
      @ <!-- repository: "%h(zRepo)" -->
      @ <!-- translated PATH_INFO: "%h(zPathInfo)" -->
      @ <!-- translated SCRIPT_NAME: "%h(zNewScript)" -->