From eda338944005ba86c03eb995b1f8c96a3246d89f Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 7 Oct 2007 11:01:21 +0000 Subject: [PATCH] Adding Apache SetEnv --- lib/easy_domain.dtl | 1 + lib/mod_env.dtl | 5 +++++ src/domain.sml | 4 ++-- src/plugins/apache.sml | 8 ++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 lib/mod_env.dtl diff --git a/lib/easy_domain.dtl b/lib/easy_domain.dtl index 03af55f..fbc5e7a 100644 --- a/lib/easy_domain.dtl +++ b/lib/easy_domain.dtl @@ -42,3 +42,4 @@ val nameserver = \host -> dns (dnsNS host); val dnsIP = \from -> \to -> dns (dnsA from to); val dnsMail = \num -> \host -> dns (dnsMX num host); val dnsAlias = \from -> \to -> dns (dnsCNAME from to); +val dnsDefault = \to -> dns (dnsDefaultA to); diff --git a/lib/mod_env.dtl b/lib/mod_env.dtl new file mode 100644 index 0000000..21f2021 --- /dev/null +++ b/lib/mod_env.dtl @@ -0,0 +1,5 @@ +{{Support for Apache's mod_env, which deals with UNIX environment variables}} + +extern val setEnv : no_spaces -> no_spaces -> [^Vhost]; +{{See the + Apache documentation.}} diff --git a/src/domain.sml b/src/domain.sml index ed26bcd..c097128 100644 --- a/src/domain.sml +++ b/src/domain.sml @@ -114,10 +114,10 @@ val validGroup = validUser val _ = Env.type_one "no_spaces" Env.string - (CharVector.all (fn ch => not (Char.isSpace ch))) + (CharVector.all (fn ch => not (Char.isSpace ch) andalso ch <> #"\"" andalso ch <> #"'")) val _ = Env.type_one "no_newlines" Env.string - (CharVector.all (fn ch => ch <> #"\n" andalso ch <> #"\r")) + (CharVector.all (fn ch => ch <> #"\n" andalso ch <> #"\r" andalso ch <> #"\"" andalso ch <> #"'")) val _ = Env.type_one "ip" Env.string diff --git a/src/plugins/apache.sml b/src/plugins/apache.sml index 09dbf98..e4e96ea 100644 --- a/src/plugins/apache.sml +++ b/src/plugins/apache.sml @@ -864,6 +864,14 @@ val () = Env.action_one "readmeName" write name; write "\n")) +val () = Env.action_two "setEnv" + ("key", Env.string, "value", Env.string) + (fn (key, value) => (write "\tSetEnv \""; + write key; + write "\" \""; + write value; + write "\"\n")) + val () = Domain.registerResetLocal (fn () => ignore (OS.Process.system (Config.rm ^ " -rf /var/domtool/vhosts/*"))) -- 2.20.1