Simple patch to allow execute: to point to interprepter.

After applying patch, you can use execute\:/path/to/whatever to run
scripts.

Please note that this is not intended use of suPHP and is not guaranteed
to work or to be safe.

Please be aware that this might allow remote user to bypass your server
security.

Aki Tuomi
--- suphp-0.7.0/src/Application.cpp     2008-03-30 17:43:59.000000000 +0300
+++ suphp-0.7.0-new/src/Application.cpp 2008-12-27 22:57:33.000000000 +0200
@@ -506,6 +506,8 @@
         return TARGETMODE_PHP;
     else if (interpreter == "execute:!self")
         return TARGETMODE_SELFEXECUTE;
+    else if (interpreter.substr(0, 8) == "execute:")
+       return TARGETMODE_EXECUTE;
     else
         throw SecurityException("Unknown Interpreter: " + interpreter,
                                 __FILE__, __LINE__);
@@ -527,6 +529,12 @@
             CommandLine cline;
             cline.putArgument(interpreterPath);
             API_Helper::getSystemAPI().execute(interpreterPath, cline, env);
+       } else if (mode == TARGETMODE_EXECUTE) {
+            std::string interpreterPath = interpreter.substr(8);
+            CommandLine cline;
+            cline.putArgument(interpreterPath);
+            cline.putArgument(scriptFilename);
+            API_Helper::getSystemAPI().execute(interpreterPath, cline, env);
         } else if (mode == TARGETMODE_SELFEXECUTE) {
             CommandLine cline;
             cline.putArgument(scriptFilename);
--- suphp-0.7.0/src/Application.hpp     2008-03-29 19:48:59.000000000 +0200
+++ suphp-0.7.0-new/src/Application.hpp 2008-12-27 22:55:59.000000000 +0200
@@ -26,7 +26,8 @@

 enum TargetMode {
     TARGETMODE_PHP,
-    TARGETMODE_SELFEXECUTE
+    TARGETMODE_SELFEXECUTE,
+    TARGETMODE_EXECUTE
 };

 #define SUPHP_APPLICATION_H

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
suPHP mailing list
suPHP@lists.marsching.biz
http://lists.marsching.com/mailman/listinfo/suphp

Reply via email to