14 Oct 2009 23:18
Re: suphp 0.7.1 + chroot + (not working) patch
In data mercoledì 14 ottobre 2009 21:52:20, Giuseppe Iannello ha scritto:
> Looking through the code, it seems that a method to clean up the path is
> there, but...does it actually work?
After looking at it...well, there is NO method to clean scriptFilename.
here it is, in all the diff -Naur glory
----CUT HERE----
--- suphp-0.7.1/src/Application.cpp 2009-03-14 17:55:25.000000000 +0000
+++ suphp-0.7.1-edit/src/Application.cpp 2009-10-14 20:18:04.000000000
+0000
<at> <at> -106,6 +106,7 <at> <at>
PathMatcher pathMatcher = PathMatcher(targetUser, targetGroup);
std::string chrootPath =
pathMatcher.resolveVariables(config.getChrootPath());
api.chroot(chrootPath);
+ scriptFilename =
pathMatcher.rewriteChrootedScriptPath(scriptFilename, chrootPath);
}
this->changeProcessPermissions(config, targetUser, targetGroup);
--- suphp-0.7.1/src/PathMatcher.cpp 2008-03-31 00:15:54.000000000 +0000
+++ suphp-0.7.1-edit/src/PathMatcher.cpp 2009-10-14 20:32:12.000000000
+0000
<at> <at> -175,3 +175,10 <at> <at>
}
return out;
}
+
+std::string suPHP::PathMatcher::rewriteChrootedScriptPath(std::string
scriptPath, std::string chrootPath)
+{
+ std::string out;
+ out = scriptPath.erase(0, chrootPath.length());
+ return out;
+}
--- suphp-0.7.1/src/PathMatcher.hpp 2008-03-29 13:02:36.000000000 +0000
+++ suphp-0.7.1-edit/src/PathMatcher.hpp 2009-10-14 20:17:43.000000000
+0000
<at> <at> -58,6 +58,11 <at> <at>
*/
std::string resolveVariables(std::string str)
throw (KeyNotFoundException, ParsingException);
+
+ /**
+ * Cleans script path removing the chroot path
+ */
+ std::string rewriteChrootedScriptPath(std::string stringPath,
std::string chrootPath);
};
};
----CUT HERE----
This stuff adds a method that does the trick
BUT
something is still wrong somewhere
----/var/log/suphp/suphp.log----
[Wed Oct 14 20:35:58 2009] [info] Executing
"/home/prova/public_html/www/index.php" as UID 1001, GID 1003
----END LOG----
the resulting page is an awesome "No input file specified."
Something wrong somewhere else?
--
Giuseppe Iannello
System administrator
Speakage s.r.l.
RSS Feed