Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | 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.) |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
324d232c2553c14604a8514f360da0f2 |
| User & Date: | wyoung 2022-08-13 22:14:19.862 |
Context
|
2022-08-13
| ||
| 22:15 | Moved the chdir() call within enter_chroot_jail() down below the new repo name canonicalization code to allow use of relative path names. Before, you had to give an absolute path to the repo, since we'd cd'd away from that directory before we started to validate the path. ... (check-in: e94621186f user: wyoung tags: trunk) | |
| 22:14 | 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.) ... (check-in: 324d232c25 user: wyoung tags: trunk) | |
| 21:21 | Fixed the --chroot flag to "fossil server" and "fossil http" to allow it to work in conjunction with the single-repository case. Before, it blindly assumed --repolist mode. ... (check-in: 6f92ad99d9 user: wyoung tags: trunk) | |
Changes
Changes to src/main.c.
| ︙ | ︙ | |||
1500 1501 1502 1503 1504 1505 1506 |
file_canonical_name(zRepo, &dir, 0);
zDir = blob_str(&dir);
if( !noJail ){
if( file_isdir(zDir, ExtFILE)==1 ){
if( file_chdir(zDir, 1) ){
fossil_panic("unable to chroot into %s", zDir);
}
| < > | 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 |
file_canonical_name(zRepo, &dir, 0);
zDir = blob_str(&dir);
if( !noJail ){
if( file_isdir(zDir, ExtFILE)==1 ){
if( file_chdir(zDir, 1) ){
fossil_panic("unable to chroot into %s", zDir);
}
if( g.zRepositoryName ){
size_t n = strlen(zDir);
Blob repo;
file_canonical_name(g.zRepositoryName, &repo, 0);
zRepo = blob_str(&repo);
if( strncmp(zRepo, zDir, n)!=0 ){
fossil_fatal("repo %s not under chroot dir %s", zRepo, zDir);
}
zRepo += n;
if( *zRepo == '\0' ) zRepo = "/";
}else {
zRepo = "/";
g.fJail = 1;
}
}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) ){
|
| ︙ | ︙ |