Make openconnect_args optional also in code.

This commit is contained in:
Andris Raugulis
2018-09-06 17:09:40 +03:00
parent d397a4cc20
commit 73c88aeb16
+2 -4
View File
@@ -348,7 +348,7 @@ def main():
cmd = conf.get('openconnect_cmd') or 'openconnect' cmd = conf.get('openconnect_cmd') or 'openconnect'
cmd += ' --protocol=gp -u "{0}"' cmd += ' --protocol=gp -u "{0}"'
cmd += ' --usergroup portal:portal-userauthcookie' cmd += ' --usergroup portal:portal-userauthcookie'
cmd += ' --passwd-on-stdin ' + conf.get('openconnect_args') + ' "{1}"' cmd += ' --passwd-on-stdin ' + conf.get('openconnect_args', '') + ' "{1}"'
cmd = cmd.format(saml_username, conf.get('vpn_url')) cmd = cmd.format(saml_username, conf.get('vpn_url'))
gw = (conf.get('gateway') or '').strip() gw = (conf.get('gateway') or '').strip()
nlbug = '\\n' if conf.get('bug.nl', '').lower() in ['1', 'true'] else '' nlbug = '\\n' if conf.get('bug.nl', '').lower() in ['1', 'true'] else ''
@@ -363,10 +363,8 @@ def main():
pp = subprocess.Popen(shlex.split(pcmd), stdout=subprocess.PIPE) pp = subprocess.Popen(shlex.split(pcmd), stdout=subprocess.PIPE)
cp = subprocess.Popen(cmd, stdin=pp.stdout, stdout=sys.stdout) cp = subprocess.Popen(cmd, stdin=pp.stdout, stdout=sys.stdout)
pp.stdout.close() pp.stdout.close()
# Do not abort on SIGINT. openconnect will perform proper exit & cleanup
# Do not abort on SIGINT. openconnect will see it, and perform proper exit & cleanup
signal.signal(signal.SIGINT, signal.SIG_IGN) signal.signal(signal.SIGINT, signal.SIG_IGN)
cp.communicate() cp.communicate()
else: else:
print('{0} | {1}'.format(pcmd, cmd)) print('{0} | {1}'.format(pcmd, cmd))