]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
implement `auth_expiration` for Pulse protocol
authorDaniel Lenski <dlenski@gmail.com>
Wed, 9 Dec 2020 03:24:00 +0000 (19:24 -0800)
committerDaniel Lenski <dlenski@gmail.com>
Mon, 14 Dec 2020 22:44:03 +0000 (14:44 -0800)
We have many examples of this field (AVP 0x583/0xd5c) being multiples of 60 or 3600,
strongly suggesting that it's the remaining auth lifetime:

- https://gitlab.com/openconnect/openconnect/-/issues/98: `AVP 0x583/0xd5c: 00 01 fa 40` (0x1fa40 seconds = 36 hours)
- private communication: `AVP 0x583/0xd5c: 00 00 a9 ec` (0xa9ec seconds = 12 hours)
- private communication: `AVP 0x583/0xd5c: 00 00 0a 70` (0xa70 seconds = 44 minutes)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
pulse.c

diff --git a/pulse.c b/pulse.c
index 067edbd35bafe61176840f77151fe7acc44b8d57..fb8676d18134e8331e31fd697ba82a618ccc4fe3 100644 (file)
--- a/pulse.c
+++ b/pulse.c
@@ -1761,6 +1761,15 @@ static int pulse_authenticate(struct openconnect_info *vpninfo, int connecting)
                        realms_found++;
                } else if (avp_vendor == VENDOR_JUNIPER2 && avp_code == 0xd4f) {
                        realm_entry++;
+               } else if (avp_vendor == VENDOR_JUNIPER2 && avp_code == 0xd5c) {
+                       uint32_t val;
+
+                       if (avp_len != 4)
+                               goto auth_unknown;
+                       val = load_be32(avp_p);
+
+                       if (val)
+                               vpninfo->auth_expiration = time(NULL) + val;
                } else if (avp_vendor == VENDOR_JUNIPER2 && avp_code == 0xd53) {
                        free(vpninfo->cookie);
                        vpninfo->cookie = strndup(avp_p, avp_len);