From: Daniel Lenski Date: Fri, 22 May 2020 01:01:16 +0000 (-0700) Subject: Don't save `portal-*cookie` values if they're "empty" X-Git-Tag: v8.20~115^2~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=086ff432447265a3befff509c4928d37ed85bfbc;p=users%2Fdwmw2%2Fopenconnect.git Don't save `portal-*cookie` values if they're "empty" Signed-off-by: Daniel Lenski --- 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; + } + } } } }