openconnect: Fix secondary password script overwriting primary 14400/head
authorFrederick Morlock <FrederickGeek8@gmail.com>
Wed, 23 Dec 2020 16:48:52 +0000 (00:48 +0800)
committerFrederick Morlock <FrederickGeek8@gmail.com>
Fri, 1 Jan 2021 09:18:27 +0000 (17:18 +0800)
When specifying a secondary password script, the output should be appended to the temporary password file and shouldn't overwrite it. If you refer to the case where there is a static secondary password, you can see that the secondary password is appended. Without this fix, only the secondary password is passed to the `openconnect` session.

Signed-off-by: Frederick Morlock <FrederickGeek8@gmail.com>
net/openconnect/files/openconnect.sh

index d310cf5c13d54964b7e7141992fcc739692ccb61..37f1945f41c7a6d8f1364049ceb7e0007196e27d 100755 (executable)
@@ -115,7 +115,7 @@ proto_openconnect_setup() {
                        [ -n "$password2" ] && echo "$password2" >> "$pwfile"
                }
                [ "$token_mode" = "script" ] && {
-                       $token_script > "$pwfile" 2> /dev/null || {
+                       $token_script >> "$pwfile" 2> /dev/null || {
                                logger -t openconenct "Cannot get password from script '$token_script'"
                                proto_setup_failed "$config"
                        }