Fossil SCM

Moved the setting of g.fJail flag into the repo = "/" case since it exists only to communicate the chroot status to --repolist mode. (This confirms the speculation in the prior commit's comment: the prior behavior existed to serve repolist mode only.)

wyoung 2022-08-13 22:14 UTC trunk
Commit 324d232c2553c14604a8514f360da0f2cce3582ff80005302cacb12221c98b96
1 file changed +1 -1
+1 -1
--- src/main.c
+++ src/main.c
@@ -1502,11 +1502,10 @@
15021502
if( !noJail ){
15031503
if( file_isdir(zDir, ExtFILE)==1 ){
15041504
if( file_chdir(zDir, 1) ){
15051505
fossil_panic("unable to chroot into %s", zDir);
15061506
}
1507
- g.fJail = 1;
15081507
if( g.zRepositoryName ){
15091508
size_t n = strlen(zDir);
15101509
Blob repo;
15111510
file_canonical_name(g.zRepositoryName, &repo, 0);
15121511
zRepo = blob_str(&repo);
@@ -1515,10 +1514,11 @@
15151514
}
15161515
zRepo += n;
15171516
if( *zRepo == '\0' ) zRepo = "/";
15181517
}else {
15191518
zRepo = "/";
1519
+ g.fJail = 1;
15201520
}
15211521
}else{
15221522
for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
15231523
if( zDir[i]!='/' ) fossil_fatal("bad repository name: %s", zRepo);
15241524
if( i>0 ){
15251525
--- src/main.c
+++ src/main.c
@@ -1502,11 +1502,10 @@
1502 if( !noJail ){
1503 if( file_isdir(zDir, ExtFILE)==1 ){
1504 if( file_chdir(zDir, 1) ){
1505 fossil_panic("unable to chroot into %s", zDir);
1506 }
1507 g.fJail = 1;
1508 if( g.zRepositoryName ){
1509 size_t n = strlen(zDir);
1510 Blob repo;
1511 file_canonical_name(g.zRepositoryName, &repo, 0);
1512 zRepo = blob_str(&repo);
@@ -1515,10 +1514,11 @@
1515 }
1516 zRepo += n;
1517 if( *zRepo == '\0' ) zRepo = "/";
1518 }else {
1519 zRepo = "/";
 
1520 }
1521 }else{
1522 for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
1523 if( zDir[i]!='/' ) fossil_fatal("bad repository name: %s", zRepo);
1524 if( i>0 ){
1525
--- src/main.c
+++ src/main.c
@@ -1502,11 +1502,10 @@
1502 if( !noJail ){
1503 if( file_isdir(zDir, ExtFILE)==1 ){
1504 if( file_chdir(zDir, 1) ){
1505 fossil_panic("unable to chroot into %s", zDir);
1506 }
 
1507 if( g.zRepositoryName ){
1508 size_t n = strlen(zDir);
1509 Blob repo;
1510 file_canonical_name(g.zRepositoryName, &repo, 0);
1511 zRepo = blob_str(&repo);
@@ -1515,10 +1514,11 @@
1514 }
1515 zRepo += n;
1516 if( *zRepo == '\0' ) zRepo = "/";
1517 }else {
1518 zRepo = "/";
1519 g.fJail = 1;
1520 }
1521 }else{
1522 for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
1523 if( zDir[i]!='/' ) fossil_fatal("bad repository name: %s", zRepo);
1524 if( i>0 ){
1525

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button