fun default () = List.exists (fn s' => s = s') Config.Apache.proxyTargets
in
case String.fields (fn ch => ch = #":") s of
- ["http", "//localhost", rest] =>
- (case String.fields (fn ch => ch = #"/") rest of
- port :: _ =>
- (case Int.fromString port of
- NONE => default ()
- | SOME n => n > 1024 orelse default ())
- | _ => default ())
+ "http" :: "//localhost" :: rest =>
+ let
+ val rest = String.concatWith ":" rest
+ in
+ CharVector.all (fn ch => Char.isPrint ch andalso not (Char.isSpace ch)
+ andalso ch <> #"\"" andalso ch <> #"'") rest
+ andalso case String.fields (fn ch => ch = #"/") rest of
+ port :: _ =>
+ (case Int.fromString port of
+ NONE => default ()
+ | SOME n => n > 1024 orelse default ())
+ | _ => default ()
+ end
| _ => default ()
end)
val vhostsChanged = ref false
val logDeleted = ref false
+val delayedLogMoves = ref (fn () => ())
val () = Slave.registerPreHandler
(fn () => (vhostsChanged := false;
- logDeleted := false))
+ logDeleted := false;
+ delayedLogMoves := (fn () => print "Executing delayed log moves/deletes.\n")))
fun findVhostUser fname =
let
Slave.Delete _ =>
let
val ldir = realLogDir oldUser
+ val dlm = !delayedLogMoves
in
if !logDeleted then
()
else
- (ignore (OS.Process.system (down ()));
+ ((*ignore (OS.Process.system (down ()));*)
ignore (OS.Process.system (fixperms ()));
logDeleted := true);
ignore (OS.Process.system (Config.rm
^ " -rf "
^ realVhostFile));
- Slave.moveDirCreate {from = ldir,
- to = backupLogs ()}
+ delayedLogMoves := (fn () => (dlm ();
+ Slave.moveDirCreate {from = ldir,
+ to = backupLogs ()}))
end
| Slave.Add =>
let
let
val old = realLogDir oldUser
val rld = realLogDir user
+
+ val dlm = !delayedLogMoves
in
if !logDeleted then
()
else
- (ignore (OS.Process.system (down ()));
+ ((*ignore (OS.Process.system (down ()));*)
logDeleted := true);
- ignore (OS.Process.system (Config.rm
- ^ " -rf "
- ^ realLogDir oldUser));
+ delayedLogMoves := (fn () => (dlm ();
+ ignore (OS.Process.system (Config.rm
+ ^ " -rf "
+ ^ realLogDir oldUser))));
if Posix.FileSys.access (rld, []) then
()
else
val () = Slave.registerPostHandler
(fn () =>
(if !vhostsChanged then
- Slave.shellF ([if !logDeleted then undown () else reload ()],
- fn cl => "Error reloading Apache with " ^ cl)
+ (Slave.shellF ([reload ()],
+ fn cl => "Error reloading Apache with " ^ cl);
+ if !logDeleted then !delayedLogMoves () else ())
else
()))
TextIO.output (file, group))
else
(TextIO.output (file, "\n\tSuexecUserGroup ");
+ TextIO.output (file, user);
+ TextIO.output (file, " ");
+ TextIO.output (file, group);
+ TextIO.output (file, "\n\tsuPHP_UserGroup ");
TextIO.output (file, user);
TextIO.output (file, " ");
TextIO.output (file, group))
inLocal := false;
localRewriteEnabled := false))
+val () = Env.container_one "filesMatch"
+ ("regexp", Env.string)
+ (fn prefix =>
+ (write "\t<FilesMatch \"";
+ write prefix;
+ write "\">\n"),
+ fn () => (write "\t</FilesMatch>\n";
+ localRewriteEnabled := false))
+
fun checkRewrite () =
if !inLocal then
if !localRewriteEnabled then