From 705f21b59cda33a99ad4192e65d8425cc7104b35 Mon Sep 17 00:00:00 2001 From: travis laduke Date: Fri, 16 Jun 2023 14:38:33 -0700 Subject: [PATCH] fix oidc auth url memory leak getAuthURL() was not calling zeroidc::free_cstr(url); the only place authAuthURL is called, the url can be retrieved from the network config instead. You could alternatively copy the string and call free_cstr in getAuthURL. If that's better we can change the PR. Since now there are no callers of getAuthURL I deleted it. --- service/OneService.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/service/OneService.cpp b/service/OneService.cpp index 2945bfdae..683db6e24 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -406,15 +406,6 @@ class NetworkState return _managedRoutes; } - const char* getAuthURL() { -#if ZT_SSO_ENABLED - if (_idc != nullptr) { - return zeroidc::zeroidc_get_auth_url(_idc); - } - fprintf(stderr, "_idc is null\n"); -#endif - return ""; - } char* doTokenExchange(const char *code) { char *ret = nullptr; @@ -572,7 +563,7 @@ static void _networkToJson(nlohmann::json &nj,NetworkState &ns) } nj["dns"] = m; if (ns.config().ssoEnabled) { - const char* authURL = ns.getAuthURL(); + const char* authURL = ns.config().authenticationURL; //fprintf(stderr, "Auth URL: %s\n", authURL); nj["authenticationURL"] = authURL; nj["authenticationExpiryTime"] = (ns.getExpiryTime()*1000);