mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-18 20:47:53 +00:00
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:
parent
981d09cc28
commit
e0e21dfdda
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user