It's bed time over here in CET, but i will take a closer look at it tomorrow. The root of the problem is now known, i think, we just need to find the right combination.
(sent from a mobile device - please excuse brevity, typos, and top-posting) ----- stephan beal http://wanderinghorse.net On Sep 25, 2013 10:04 PM, "Krister Johnson" <krist...@gmail.com> wrote: > Stephan: > > I changed main.c to look as follows. I wasn't sure which code block you > meant by first and second so I tried both instances. With the code as > shown, I get no sqlite_warning, but I also get a big "Not Found" message > (if I view page source, <h1>Not Found</h1> is the only thing there). > > When I comment out close in the top instance and comment out open in the > bottom instance, I get the same not found message, but with the > sqlite_warning above it. So maybe the instance shown below represents some > kind of progress? > > > static char *enter_chroot_jail(char *zRepo){ > #if !defined(_WIN32) > if( getuid()==0 ){ > int i; > struct stat sStat; > Blob dir; > char *zDir; > > if( g.db!=0 ){ > db_close(1); > // db_open_repository(zRepo); > } > file_canonical_name(zRepo, &dir, 0); > zDir = blob_str(&dir); > if( file_isdir(zDir)==1 ){ > if( file_chdir(zDir, 1) ){ > fossil_fatal("unable to chroot into %s", zDir); > } > zRepo = "/"; > }else{ > for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){} > if( zDir[i]!='/' ) fossil_fatal("bad repository name: %s", zRepo); > if( i>0 ){ > zDir[i] = 0; > if( file_chdir(zDir, 1) ){ > 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); > } > i = setgid(sStat.st_gid); > i = i || setuid(sStat.st_uid); > if(i){ > fossil_fatal("setgid/uid() failed with errno %d", errno); > } > if( g.db!=0 ){ > // db_close(1); > db_open_repository(zRepo); > } > } > > > > On Wed, Sep 25, 2013 at 1:54 PM, Stephan Beal <sgb...@googlemail.com>wrote: > >> On Wed, Sep 25, 2013 at 8:49 PM, Ron Wilson <ronw.m...@gmail.com> wrote: >> >>> Why would the database be opened before doing the chroot? >>> >> >> i believe the reason is that because the bit which does the db-open does >> not know that a chroot may (depending on the UID) be pending. The chroot >> only happens when UID==0 (root user). The chroot never happens for non-root >> cases, so it's only "wrong" for that particular case. >> >> -- >> ----- stephan beal >> http://wanderinghorse.net/home/stephan/ >> http://gplus.to/sgbeal >> >> _______________________________________________ >> fossil-users mailing list >> fossil-users@lists.fossil-scm.org >> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users >> >> > > _______________________________________________ > fossil-users mailing list > fossil-users@lists.fossil-scm.org > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users > >
_______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users