apacheのRlimitCPUをhtaccessで上書きさせない方法

ここまで制限する必要があるかどうかはさておき。デフォルトではhtaccessが使用可能なら上書きできてしまう(AllowOverRide Fileinfo)。なのでhtaccessは使用させたいけど、リソース制限したい場合はserver/core.cを書き換えないとダメらしい。

変更箇所

"OR_ALL"の箇所を"ACCESS_CONF|RSRC_CONF"に変更する。これで以下のようになる。

  • 変更前の使用可能範囲
    • サーバ設定ファイル, バーチャルホスト, ディレクトリ, .htaccess
  • 変更後
    • サーバ設定ファイル, バーチャルホスト, ディレクトリ

sourceはapache-2.2.11。

# diff -u core.c.org core.
--- core.c.org  2009-03-01 17:53:12.000000000 +0900
+++ core.c      2009-03-01 18:10:31.000000000 +0900
@@ -3374,26 +3374,26 @@
 #ifdef RLIMIT_CPU
 AP_INIT_TAKE12("RLimitCPU", set_limit_cpu,
   (void*)APR_OFFSETOF(core_dir_config, limit_cpu),
-  OR_ALL, "Soft/hard limits for max CPU usage in seconds"),
+  ACCESS_CONF|RSRC_CONF, "Soft/hard limits for max CPU usage in seconds"),
 #else
 AP_INIT_TAKE12("RLimitCPU", no_set_limit, NULL,
-  OR_ALL, "Soft/hard limits for max CPU usage in seconds"),
+  ACCESS_CONF|RSRC_CONF, "Soft/hard limits for max CPU usage in seconds"),
 #endif
 #if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined (RLIMIT_AS)
 AP_INIT_TAKE12("RLimitMEM", set_limit_mem,
   (void*)APR_OFFSETOF(core_dir_config, limit_mem),
-  OR_ALL, "Soft/hard limits for max memory usage per process"),
+  ACCESS_CONF|RSRC_CONF, "Soft/hard limits for max memory usage per process"),
 #else
 AP_INIT_TAKE12("RLimitMEM", no_set_limit, NULL,
-  OR_ALL, "Soft/hard limits for max memory usage per process"),
+  ACCESS_CONF|RSRC_CONF, "Soft/hard limits for max memory usage per process"),
 #endif
 #ifdef RLIMIT_NPROC
 AP_INIT_TAKE12("RLimitNPROC", set_limit_nproc,
   (void*)APR_OFFSETOF(core_dir_config, limit_nproc),
-  OR_ALL, "soft/hard limits for max number of processes per uid"),
+  ACCESS_CONF|RSRC_CONF, "soft/hard limits for max number of processes per uid"),
 #else
 AP_INIT_TAKE12("RLimitNPROC", no_set_limit, NULL,
-   OR_ALL, "soft/hard limits for max number of processes per uid"),
+  ACCESS_CONF|RSRC_CONF, "soft/hard limits for max number of processes per uid"),
 #endif

 /* internal recursion stopper */