25.06.2018 13:18, David Woodhouse ?????: > On Mon, 2018-06-25 at 12:32 +0300, Basin Ilya wrote: >> Hi. >> I'm trying to make a wrapper for Openconnect that uses its own >> password manager. The wrapper should relaunch Openconnect infinitely, >> when it fails to connect (possibly due to a temporary network >> problem), but it shouldn't when the password is bad to avoid a user >> lockout. >> >> How can the wrapper distinguish the failure reason? The exit code is >> always 1. > > Er... shouldn't we be returning '2' for an auth failure? I thought I > 'inherited' that behaviour from vpnc? > > I'd do this by separating out the auth from the connection. First do > 'openconnect --authenticate', entirely under your own control. Then use > the resulting cookie until it expires (at which point I'm fairly sure > you *do* get a '2' return code). Repeat. > Yeah, but in this case the the exit code of the second stage is useless. What really important is to know the reason why `openconnect --authenticate` failed.