msmtp-scripts: Make conn_test default nc

On OpenWrt nc (netcat) connectivity test makes more sense than
ping because a) for non-root users ping is not permitted, and
b) nc is a default binary included with OpenWrt.
We do, however, have to change the upstream default from using
`nc -vz` to `printf "<http head request>"|nc` (with openwrt
nc if text is sent then nc closes after a response and fails
if no connection is made; the response is already thrown away
(to /dev/null) by the existing code).

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
This commit is contained in:
Daniel F. Dickinson 2019-08-27 01:53:51 -04:00
parent 9c43805ae5
commit 3c15d410a9
3 changed files with 8 additions and 7 deletions

View File

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=msmtp-scripts
PKG_VERSION:=1.2.4
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://launchpad.net/$(PKG_NAME)/1.2/$(PKG_VERSION)/+download
@ -116,6 +116,7 @@ define Package/msmtpq-ng/install
$(INSTALL_DATA) ./files/msmtpq-ng.rc $(1)/etc/msmtpq-ng.rc
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_BUILD_DIR)/src/usr/bin/msmtpq-ng $(1)/usr/bin/
$(SED) "s,nc -vz,printf \"HEAD / HTTP/1.1\\\\r\\\\nHost: \$$$${EMAIL_CONN_TEST_SITE}\\\\r\\\\n\\\\r\\\\n\"|nc," $(1)/usr/bin/msmtpq-ng
$(CP) $(PKG_BUILD_DIR)/src/usr/bin/msmtpq-ng-queue $(1)/usr/bin/
endef

View File

@ -14,9 +14,9 @@
#MSMTPQ_NG=msmtpq-ng
#MSMTPQ_NG_QUEUE=msmtpq-ng-queue
#MSMTP_CONF=/etc/msmtprc
#EMAIL_CONN_TEST=p
EMAIL_CONN_TEST_PING=openwrt.org
EMAIL_CONN_TEST=n
#EMAIL_CONN_TEST_PING=openwrt.org
#EMAIL_CONN_TEST_IP=8.8.8.8
#EMAIL_CONN_TEST_SITE=www.debian.org
EMAIL_CONN_TEST_SITE=openwrt.org
#MSMTP_HOLD_SMTP_MAIL=true
#MSMTP_HOLD_CLI_MAIL=false

View File

@ -4,10 +4,10 @@
#LOG=~/log/.msmtp.queue.log
#MAXLOGLEVEL=7
#MSMTP_LOCK_DIR=~/.msmtp.lock
EMAIL_CONN_TEST=p
EMAIL_CONN_TEST_PING=openwrt.org
EMAIL_CONN_TEST=n
#EMAIL_CONN_TEST_PING=openwrt.org
#EMAIL_CONN_TEST_IP=8.8.8.8
#EMAIL_CONN_TEST_SITE=www.debian.org
EMAIL_CONN_TEST_SITE=openwrt.org
#MSMTP_UMASK=077
#MSMTP_LOG_UMASK=077
#MSMTP_QUEUE_QUIET=false