
Postfix Adminの設定には、短すぎるパスワードを登録できないように、パスワードの最小文字数を指定する$CONF[‘min_password_length’]というものがある。
ずっとこれが効いてるものだとおもっていたら、どうも効いてない感じがする。調べてみると、アドレス作成時にも管理者作成時にもパスワード文字数のチェックが効いてないことがわかった。
そして、パスワードを変更するときにようやく文字数チェックが行われている謎仕様・・・
しようがないので、自分でソースを修正してみた。
https://gist.github.com/krhitoshi/5755014
Postfix Admin ver. 2.3.6用です。他のバージョンでは試していません。
このために用意されていたエラー文ではないのでエラー表示時に若干スタイルが崩れます。
wget https://gist.github.com/krhitoshi/5755014/raw/2019ff1930d1a42868408b6c3f248af6f564be62/postfixadmin_create_bug_fix.patch cd postfixadmin-2.3.6 patch < ../postfixadmin_create_bug_fix.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git create-mailbox.php create-mailbox.php | |
index c8ec29a..66d6147 100644 | |
--- create-mailbox.php | |
+++ create-mailbox.php | |
@@ -131,6 +131,16 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") | |
} | |
} | |
+ $min_length = $CONF['min_password_length']; | |
+ if($min_length > 0 && strlen($fPassword) < $min_length) { | |
+ $error = 1; | |
+ $tUsername = escape_string ($_POST['fUsername']); | |
+ $tName = $fName; | |
+ $tQuota = $fQuota; | |
+ $tDomain = $fDomain; | |
+ $pCreate_mailbox_password_text = '<span class="error_msg">' . sprintf($PALANG['pPasswordTooShort'], $min_length) . '</span>'; | |
+ } | |
+ | |
if ($CONF['quota'] == "YES") | |
{ | |
if (!check_quota ($fQuota, $fDomain)) | |
diff --git functions.inc.php functions.inc.php | |
index 654dfd2..56b5afb 100644 | |
--- functions.inc.php | |
+++ functions.inc.php | |
@@ -2336,6 +2336,12 @@ function create_admin($fUsername, $fPassword, $fPassword2, $fDomains, $no_genera | |
} | |
} | |
+ $min_length = $CONF['min_password_length']; | |
+ if($min_length > 0 && strlen($fPassword) < $min_length) { | |
+ $error = 1; | |
+ $pAdminCreate_admin_password_text = '<span class="error_msg">' . sprintf($PALANG['pPasswordTooShort'], $min_length) . '</span>'; | |
+ } | |
+ | |
if ($error != 1) | |
{ | |
$password = pacrypt($fPassword); |
関連記事
- None Found