]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Don't save `portal-*cookie` values if they're "empty"
authorDaniel Lenski <dlenski@gmail.com>
Fri, 22 May 2020 01:01:16 +0000 (18:01 -0700)
committerDaniel Lenski <dlenski@gmail.com>
Tue, 15 Jun 2021 17:24:18 +0000 (10:24 -0700)
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
auth-globalprotect.c

index 163848f339b756a0db25e28b40c6a01fae8abafb..a41975c2a8e0119f0ffea3d6fee06889ff0d07e9 100644 (file)
@@ -451,8 +451,18 @@ static int parse_portal_xml(struct openconnect_info *vpninfo, xmlNode *xml_node,
                                }
                        } else {
                                xmlnode_get_val(x, "portal-name", &portal);
-                               xmlnode_get_val(x, "portal-userauthcookie", &ctx->portal_userauthcookie);
-                               xmlnode_get_val(x, "portal-prelogonuserauthcookie", &ctx->portal_prelogonuserauthcookie);
+                               if (!xmlnode_get_val(x, "portal-userauthcookie", &ctx->portal_userauthcookie)) {
+                                       if (!*ctx->portal_userauthcookie || !strcmp(ctx->portal_userauthcookie, "empty")) {
+                                               free(ctx->portal_userauthcookie);
+                                               ctx->portal_userauthcookie = NULL;
+                                       }
+                               }
+                               if (!xmlnode_get_val(x, "portal-prelogonuserauthcookie", &ctx->portal_prelogonuserauthcookie)) {
+                                       if (!*ctx->portal_prelogonuserauthcookie || !strcmp(ctx->portal_prelogonuserauthcookie, "empty")) {
+                                               free(ctx->portal_prelogonuserauthcookie);
+                                               ctx->portal_prelogonuserauthcookie = NULL;
+                                       }
+                               }
                        }
                }
        }