summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-02-13 15:02:32 -0800
committerJeremy Allison <jra@samba.org>2009-02-13 15:02:32 -0800
commitf6821a15a05248f185bb6cdd1aeb588504f12d61 (patch)
treea2f1c15bb57fa7823ca611ea208f23a4dd823e8f
parent4d83d3a286947754f1306c6493318a4ccdc869a3 (diff)
downloadsamba-f6821a15a05248f185bb6cdd1aeb588504f12d61.tar.gz
samba-f6821a15a05248f185bb6cdd1aeb588504f12d61.tar.bz2
samba-f6821a15a05248f185bb6cdd1aeb588504f12d61.zip
Noted by Vericode analysis. Correctly use chroot().
Jeremy.
-rw-r--r--source3/smbd/process.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 1262d01840..0285d00d3d 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2031,7 +2031,11 @@ void smbd_process(void)
if (*lp_rootdir()) {
if (chroot(lp_rootdir()) != 0) {
- DEBUG(0,("Failed changed root to %s\n", lp_rootdir()));
+ DEBUG(0,("Failed to change root to %s\n", lp_rootdir()));
+ exit_server("Failed to chroot()");
+ }
+ if (chdir("/") == -1) {
+ DEBUG(0,("Failed to chdir to / on chroot to %s\n", lp_rootdir()));
exit_server("Failed to chroot()");
}
DEBUG(0,("Changed root to %s\n", lp_rootdir()));