Преглед на файлове

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 <[email protected]>
Travis LaDuke преди 2 години
родител
ревизия
e0e21dfdda
променени са 1 файла, в които са добавени 1 реда и са изтрити 10 реда
  1. 1 10
      service/OneService.cpp

+ 1 - 10
service/OneService.cpp

@@ -406,15 +406,6 @@ public:
 		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);