Fossil SCM

The g.fJail global variable should always be set whenever a chroot jail has been entered.

drh 2022-09-26 12:08 trunk
Commit 558cef7c6d40932da58273d42e50b658b8689d52e872faa2d1ea6615c0d8b150
2 files changed +1 -1
+1
--- src/file.c
+++ src/file.c
@@ -493,10 +493,11 @@
493493
#else
494494
rc = chdir(zPath);
495495
if( !rc && bChroot ){
496496
rc = chroot(zPath);
497497
if( !rc ) rc = chdir("/");
498
+ g.fJail = 1;
498499
}
499500
#endif
500501
fossil_path_free(zPath);
501502
return rc;
502503
}
503504
--- src/file.c
+++ src/file.c
@@ -493,10 +493,11 @@
493 #else
494 rc = chdir(zPath);
495 if( !rc && bChroot ){
496 rc = chroot(zPath);
497 if( !rc ) rc = chdir("/");
 
498 }
499 #endif
500 fossil_path_free(zPath);
501 return rc;
502 }
503
--- src/file.c
+++ src/file.c
@@ -493,10 +493,11 @@
493 #else
494 rc = chdir(zPath);
495 if( !rc && bChroot ){
496 rc = chroot(zPath);
497 if( !rc ) rc = chdir("/");
498 g.fJail = 1;
499 }
500 #endif
501 fossil_path_free(zPath);
502 return rc;
503 }
504
-1
--- src/main.c
+++ src/main.c
@@ -1511,11 +1511,10 @@
15111511
}
15121512
zRepo += n;
15131513
if( *zRepo == '\0' ) zRepo = "/";
15141514
}else {
15151515
zRepo = "/";
1516
- g.fJail = 1;
15171516
}
15181517
if( file_chdir(zDir, 1) ){
15191518
fossil_panic("unable to chroot into %s", zDir);
15201519
}
15211520
}else{
15221521
--- src/main.c
+++ src/main.c
@@ -1511,11 +1511,10 @@
1511 }
1512 zRepo += n;
1513 if( *zRepo == '\0' ) zRepo = "/";
1514 }else {
1515 zRepo = "/";
1516 g.fJail = 1;
1517 }
1518 if( file_chdir(zDir, 1) ){
1519 fossil_panic("unable to chroot into %s", zDir);
1520 }
1521 }else{
1522
--- src/main.c
+++ src/main.c
@@ -1511,11 +1511,10 @@
1511 }
1512 zRepo += n;
1513 if( *zRepo == '\0' ) zRepo = "/";
1514 }else {
1515 zRepo = "/";
 
1516 }
1517 if( file_chdir(zDir, 1) ){
1518 fossil_panic("unable to chroot into %s", zDir);
1519 }
1520 }else{
1521

Keyboard Shortcuts

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