function smtp_sasl_password_maps() { smtp_sasl_password_maps_build(); if (!is_array($GLOBALS["smtp_sasl_password_maps"])) { echo "Starting......: 0 smtp password rule(s)\n"; shell_exec("{$GLOBALS["postconf"]} -e \"smtp_sasl_password_maps =\" >/dev/null 2>&1"); shell_exec("{$GLOBALS["postconf"]} -e \"smtp_sasl_auth_enable =no\" >/dev/null 2>&1"); } echo "Starting......: " . count($GLOBALS["smtp_sasl_password_maps"]) . " smtp password rule(s)\n"; @file_put_contents("/etc/postfix/smtp_sasl_password", implode("\n", $GLOBALS["smtp_sasl_password_maps"])); shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/smtp_sasl_password >/dev/null 2>&1"); shell_exec("{$GLOBALS["postconf"]} -e \"smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_password\" >/dev/null 2>&1"); shell_exec("{$GLOBALS["postconf"]} -e \"smtp_sasl_auth_enable = yes\" >/dev/null 2>&1"); }
function smtp_sasl_password_maps() { smtp_sasl_password_maps_build(); if (!isset($GLOBALS["smtp_sasl_password_maps"])) { $GLOBALS["smtp_sasl_password_maps"] = null; } if (!is_array($GLOBALS["smtp_sasl_password_maps"])) { echo "Starting......: " . date("H:i:s") . " 0 smtp password rule(s)\n"; shell_exec("{$GLOBALS["postconf"]} -X \"smtp_sasl_password_maps\" >/dev/null 2>&1"); shell_exec("{$GLOBALS["postconf"]} -e \"smtp_sasl_auth_enable =no\" >/dev/null 2>&1"); return; } reset($GLOBALS["smtp_sasl_password_maps"]); while (list($index, $value) = each($GLOBALS["smtp_sasl_password_maps"])) { $newarray[$value] = $value; } while (list($index, $value) = each($newarray)) { $newarray2[] = $value; } echo "Starting......: " . date("H:i:s") . " Postfix " . count($newarray2) . " smtp password rule(s)\n"; @file_put_contents("/etc/postfix/smtp_sasl_password", implode("\n", $newarray2)); shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/smtp_sasl_password >/dev/null 2>&1"); shell_exec("{$GLOBALS["postconf"]} -e \"smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_password\" >/dev/null 2>&1"); shell_exec("{$GLOBALS["postconf"]} -e \"smtp_sasl_auth_enable = yes\" >/dev/null 2>&1"); }