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

Overview
Comment:Extra resilience on the automatic chroot mechanism.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:13d3cad50c52037d54d9a1fbf6570e4291ba3d14
User & Date: drh 2011-01-17 23:47:23
Context
2011-01-17
23:49
Fix an off-by-one error in stash_add_file_or_dir. Windows only. Ticket [d6132e4d66a7c994f9]. check-in: abdedb21 user: drh tags: trunk
23:47
Extra resilience on the automatic chroot mechanism. check-in: 13d3cad5 user: drh tags: trunk
16:14
Do not build clusters on a "rebuild" command unless the --cluster command-line option is used. But do build clusters on an "import" or a "reconstruct". check-in: afc4bf41 user: drh tags: trunk
Changes

Changes to src/main.c.

832
833
834
835
836
837
838
839
840

841
842
843
844
845
846
847

848
849
850
851
852
853
854
    struct stat sStat;
    Blob dir;
    char *zDir;

    file_canonical_name(zRepo, &dir);
    zDir = blob_str(&dir);
    if( file_isdir(zDir)==1 ){
      chdir(zDir);
      chroot(zDir);

      zRepo = "/";
    }else{
      for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
      if( zDir[i]!='/' ) fossil_panic("bad repository name: %s", zRepo);
      zDir[i] = 0;
      chdir(zDir);
      chroot(zDir);

      zDir[i] = '/';
      zRepo = &zDir[i];
    }
    if( stat(zRepo, &sStat)!=0 ){
      fossil_fatal("cannot stat() repository: %s", zRepo);
    }
    setgid(sStat.st_gid);







|
|
>





|
|
>







832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
    struct stat sStat;
    Blob dir;
    char *zDir;

    file_canonical_name(zRepo, &dir);
    zDir = blob_str(&dir);
    if( file_isdir(zDir)==1 ){
      if( chdir(zDir) || chroot(zDir) || chdir("/") ){
        fossil_fatal("unable to chroot into %s", zDir);
      }
      zRepo = "/";
    }else{
      for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
      if( zDir[i]!='/' ) fossil_panic("bad repository name: %s", zRepo);
      zDir[i] = 0;
      if( chdir(zDir) || chroot(zDir) || chdir("/") ){
        fossil_fatal("unable to chroot into %s", zDir);
      }
      zDir[i] = '/';
      zRepo = &zDir[i];
    }
    if( stat(zRepo, &sStat)!=0 ){
      fossil_fatal("cannot stat() repository: %s", zRepo);
    }
    setgid(sStat.st_gid);