Fossil

Check-in [42ba7b97]
Login

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

Overview
Comment:Get chroot jails working correctly when a particular fossil repository is specified on the "http" command. This fixes a problem introduced by the multi-repository feature added by check-in [9cd2c42e79] on 2010-01-31.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 42ba7b97aa3a479a12bc90b111bd72ce9e50fe81
User & Date: drh 2010-03-31 18:42:09
Context
2010-04-02
19:27
In file changes histories, show when the file is deleted. check-in: 4bbb437f user: drh tags: trunk
2010-03-31
18:42
Get chroot jails working correctly when a particular fossil repository is specified on the "http" command. This fixes a problem introduced by the multi-repository feature added by check-in [9cd2c42e79] on 2010-01-31. check-in: 42ba7b97 user: drh tags: trunk
17:14
Patch SQLite to provide a better error message to sqlite3_log() when it is unable to open a file. check-in: a158c4e7 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/main.c.

647
648
649
650
651
652
653




654
655
656
657
658
659
660
...
690
691
692
693
694
695
696

697
698
699
700
701
702
703
      zRepo = &zDir[i];
    }
    if( stat(zRepo, &sStat)!=0 ){
      fossil_fatal("cannot stat() repository: %s", zRepo);
    }
    setgid(sStat.st_gid);
    setuid(sStat.st_uid);




  }
#endif
  return zRepo;
}

/*
** Preconditions:
................................................................................

    /* To avoid mischief, make sure the repository basename contains no
    ** characters other than alphanumerics, "-", and "_".
    */
    for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
      if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
    }


    if( file_size(zRepo)<1024 ){
      if( zNotFound ){
        cgi_redirect(zNotFound);
      }else{
        @ <h1>Not Found</h1>
        cgi_set_status(404, "not found");







>
>
>
>







 







>







647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
...
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
      zRepo = &zDir[i];
    }
    if( stat(zRepo, &sStat)!=0 ){
      fossil_fatal("cannot stat() repository: %s", zRepo);
    }
    setgid(sStat.st_gid);
    setuid(sStat.st_uid);
    if( g.db!=0 ){
      db_close();
      db_open_repository(zRepo);
    }
  }
#endif
  return zRepo;
}

/*
** Preconditions:
................................................................................

    /* To avoid mischief, make sure the repository basename contains no
    ** characters other than alphanumerics, "-", and "_".
    */
    for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
      if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
    }
    if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++;

    if( file_size(zRepo)<1024 ){
      if( zNotFound ){
        cgi_redirect(zNotFound);
      }else{
        @ <h1>Not Found</h1>
        cgi_set_status(404, "not found");

Changes to src/style.c.

405
406
407
408
409
410
411

412
413
414
void page_test_env(void){
  style_header("Environment Test");
#if !defined(__MINGW32__)
  @ uid=%d(getuid()), gid=%d(getgid())<br>
#endif
  @ g.zBaseURL = %h(g.zBaseURL)<br>
  @ g.zTop = %h(g.zTop)<br>

  cgi_print_all();
  style_footer();
}







>



405
406
407
408
409
410
411
412
413
414
415
void page_test_env(void){
  style_header("Environment Test");
#if !defined(__MINGW32__)
  @ uid=%d(getuid()), gid=%d(getgid())<br>
#endif
  @ g.zBaseURL = %h(g.zBaseURL)<br>
  @ g.zTop = %h(g.zTop)<br>
  @ g.zRepositoryName = %h(g.zRepositoryName)<br>
  cgi_print_all();
  style_footer();
}