fix oidc auth url memory leak (#2031)

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.

Co-authored-by: Grant Limberg <glimberg@users.noreply.github.com>
This commit is contained in:
Travis LaDuke 2023-07-06 11:27:54 -07:00 committed by GitHub
parent 981d09cc28
commit e0e21dfdda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -406,15 +406,6 @@ public:
return _managedRoutes; 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* doTokenExchange(const char *code) {
char *ret = nullptr; char *ret = nullptr;
@ -572,7 +563,7 @@ static void _networkToJson(nlohmann::json &nj,NetworkState &ns)
} }
nj["dns"] = m; nj["dns"] = m;
if (ns.config().ssoEnabled) { if (ns.config().ssoEnabled) {
const char* authURL = ns.getAuthURL(); const char* authURL = ns.config().authenticationURL;
//fprintf(stderr, "Auth URL: %s\n", authURL); //fprintf(stderr, "Auth URL: %s\n", authURL);
nj["authenticationURL"] = authURL; nj["authenticationURL"] = authURL;
nj["authenticationExpiryTime"] = (ns.getExpiryTime()*1000); nj["authenticationExpiryTime"] = (ns.getExpiryTime()*1000);