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.)
Commit
324d232c2553c14604a8514f360da0f2cce3582ff80005302cacb12221c98b96
Parent
6f92ad99d992f61…
1 file changed
+1
-1
+1
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1502,11 +1502,10 @@ | ||
| 1502 | 1502 | if( !noJail ){ |
| 1503 | 1503 | if( file_isdir(zDir, ExtFILE)==1 ){ |
| 1504 | 1504 | if( file_chdir(zDir, 1) ){ |
| 1505 | 1505 | fossil_panic("unable to chroot into %s", zDir); |
| 1506 | 1506 | } |
| 1507 | - g.fJail = 1; | |
| 1508 | 1507 | if( g.zRepositoryName ){ |
| 1509 | 1508 | size_t n = strlen(zDir); |
| 1510 | 1509 | Blob repo; |
| 1511 | 1510 | file_canonical_name(g.zRepositoryName, &repo, 0); |
| 1512 | 1511 | zRepo = blob_str(&repo); |
| @@ -1515,10 +1514,11 @@ | ||
| 1515 | 1514 | } |
| 1516 | 1515 | zRepo += n; |
| 1517 | 1516 | if( *zRepo == '\0' ) zRepo = "/"; |
| 1518 | 1517 | }else { |
| 1519 | 1518 | zRepo = "/"; |
| 1519 | + g.fJail = 1; | |
| 1520 | 1520 | } |
| 1521 | 1521 | }else{ |
| 1522 | 1522 | for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){} |
| 1523 | 1523 | if( zDir[i]!='/' ) fossil_fatal("bad repository name: %s", zRepo); |
| 1524 | 1524 | if( i>0 ){ |
| 1525 | 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 | 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 |