openconnect: set config variable on teardown and correctly pass the password
This addresses https://dev.openwrt.org/ticket/16634 Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
This commit is contained in:
parent
99abb3ee9d
commit
45922bb086
3 changed files with 19 additions and 2 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
PKG_NAME:=openconnect
|
||||
PKG_VERSION:=6.00
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/openconnect/
|
||||
|
@ -56,6 +56,7 @@ define Package/openconnect/install
|
|||
$(INSTALL_BIN) ./files/vpnc-script $(1)/lib/netifd/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/openconnect $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/openconnect-wrapper $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,openconnect))
|
||||
|
|
14
net/openconnect/files/openconnect-wrapper
Executable file
14
net/openconnect/files/openconnect-wrapper
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This script wraps openconnect in order to obtain the password
|
||||
# file from cmd.
|
||||
|
||||
# $1 password file
|
||||
# $2... are passed to openconnect
|
||||
|
||||
test -z "$1" && exit 1
|
||||
|
||||
pwfile=$1
|
||||
shift
|
||||
|
||||
cat $pwfile|/usr/sbin/openconnect $*
|
|
@ -55,13 +55,15 @@ proto_openconnect_setup() {
|
|||
logger -t openconnect "executing 'openconnect $cmdline'"
|
||||
|
||||
if [ -f "$pwfile" ];then
|
||||
proto_run_command "$config" /usr/sbin/openconnect $cmdline <$pwfile
|
||||
proto_run_command "$config" /usr/sbin/openconnect-wrapper $pwfile $cmdline
|
||||
else
|
||||
proto_run_command "$config" /usr/sbin/openconnect $cmdline
|
||||
fi
|
||||
}
|
||||
|
||||
proto_openconnect_teardown() {
|
||||
local config="$1"
|
||||
|
||||
pwfile="/var/run/openconnect-$config.passwd"
|
||||
|
||||
rm -f $pwfile
|
||||
|
|
Loading…
Reference in a new issue