From ef0b41900af744fd2beae7be46ef1a1889eb9ef0 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 2 Aug 2013 06:14:29 -0700 Subject: [PATCH] Don't double-enforce limited root and chroot --- chooser.cgi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chooser.cgi b/chooser.cgi index 1b4dbb5d5..d7ab137f1 100755 --- a/chooser.cgi +++ b/chooser.cgi @@ -50,6 +50,14 @@ if (&supports_users()) { } &ReadParse(undef, undef, 1); + +# If a chroot is forced which is under the allowed root, there is no need for +# a restrictred root +if ($in{'chroot'} && $in{'chroot'} ne '/' && $rootdir && $rootdir ne '/' && + $in{'chroot'} =~ /^\Q$rootdir\E/) { + $rootdir = undef; + } + if ($gconfig{'os_type'} eq 'windows') { # On Windows, chroot should be empty if not use, and default path # should be c:/