From 086ff432447265a3befff509c4928d37ed85bfbc Mon Sep 17 00:00:00 2001 From: Daniel Lenski Date: Thu, 21 May 2020 18:01:16 -0700 Subject: [PATCH] Don't save `portal-*cookie` values if they're "empty" Signed-off-by: Daniel Lenski --- auth-globalprotect.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/auth-globalprotect.c b/auth-globalprotect.c index 163848f3..a41975c2 100644 --- a/auth-globalprotect.c +++ b/auth-globalprotect.c @@ -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; + } + } } } } -- 2.49.0