|
@@ -214,7 +214,7 @@ discard block |
|
|
block discarded – undo |
|
214
|
214
|
$serverCandidates[IdPlist::geoDistance($adminLocation, ['lat' => $iterator->location_lat, 'lon' => $iterator->location_lon])] = $iterator->server_id; |
|
215
|
215
|
} |
|
216
|
216
|
if ($clients > $maxSupportedClients * 0.9) { |
|
217
|
|
- $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (" . $iterator->server_id . ") is serving at more than 90% capacity!"); |
|
|
217
|
+ $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (".$iterator->server_id.") is serving at more than 90% capacity!"); |
|
218
|
218
|
} |
|
219
|
219
|
} |
|
220
|
220
|
if (count($serverCandidates) == 0 && $federation != "DEFAULT") { |
|
@@ -245,28 +245,28 @@ discard block |
|
|
block discarded – undo |
|
245
|
245
|
$ourLocation = ['lon' => $geoip['geo']['lon'], 'lat' => $geoip['geo']['lat']]; |
|
246
|
246
|
} |
|
247
|
247
|
$inst = new IdP($this->institution); |
|
248
|
|
- $ourserver = $this->findGoodServerLocation($ourLocation, $inst->federation , []); |
|
|
248
|
+ $ourserver = $this->findGoodServerLocation($ourLocation, $inst->federation, []); |
|
249
|
249
|
// now, find an unused port in the preferred server |
|
250
|
250
|
$foundFreePort1 = 0; |
|
251
|
251
|
while ($foundFreePort1 == 0) { |
|
252
|
252
|
$portCandidate = random_int(1025, 65535); |
|
253
|
|
- $check = $this->databaseHandle->exec("SELECT port_instance_1 FROM deployment WHERE radius_instance_1 = '" . $ourserver . "' AND port_instance_1 = $portCandidate"); |
|
|
253
|
+ $check = $this->databaseHandle->exec("SELECT port_instance_1 FROM deployment WHERE radius_instance_1 = '".$ourserver."' AND port_instance_1 = $portCandidate"); |
|
254
|
254
|
if (mysqli_num_rows(/** @scrutinizer ignore-type */ $check) == 0) { |
|
255
|
255
|
$foundFreePort1 = $portCandidate; |
|
256
|
256
|
} |
|
257
|
257
|
} |
|
258
|
|
- $ourSecondServer = $this->findGoodServerLocation($ourLocation, $inst->federation , [$ourserver]); |
|
|
258
|
+ $ourSecondServer = $this->findGoodServerLocation($ourLocation, $inst->federation, [$ourserver]); |
|
259
|
259
|
$foundFreePort2 = 0; |
|
260
|
260
|
while ($foundFreePort2 == 0) { |
|
261
|
261
|
$portCandidate = random_int(1025, 65535); |
|
262
|
|
- $check = $this->databaseHandle->exec("SELECT port_instance_2 FROM deployment WHERE radius_instance_2 = '" . $ourSecondServer . "' AND port_instance_2 = $portCandidate"); |
|
|
262
|
+ $check = $this->databaseHandle->exec("SELECT port_instance_2 FROM deployment WHERE radius_instance_2 = '".$ourSecondServer."' AND port_instance_2 = $portCandidate"); |
|
263
|
263
|
if (mysqli_num_rows(/** @scrutinizer ignore-type */ $check) == 0) { |
|
264
|
264
|
$foundFreePort2 = $portCandidate; |
|
265
|
265
|
} |
|
266
|
266
|
} |
|
267
|
267
|
// and make up a shared secret that is halfways readable |
|
268
|
268
|
$futureSecret = $this->randomString(16, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
|
269
|
|
- $this->databaseHandle->exec("UPDATE deployment SET radius_instance_1 = '" . $ourserver . "', radius_instance_2 = '" . $ourSecondServer . "', port_instance_1 = $foundFreePort1, port_instance_2 = $foundFreePort2, secret = '$futureSecret' WHERE deployment_id = $this->identifier"); |
|
|
269
|
+ $this->databaseHandle->exec("UPDATE deployment SET radius_instance_1 = '".$ourserver."', radius_instance_2 = '".$ourSecondServer."', port_instance_1 = $foundFreePort1, port_instance_2 = $foundFreePort2, secret = '$futureSecret' WHERE deployment_id = $this->identifier"); |
|
270
|
270
|
return ["port_instance_1" => $foundFreePort1, "port_instance_2" => $foundFreePort2, "secret" => $futureSecret, "radius_instance_1" => $ourserver, "radius_instance_2" => $ourserver]; |
|
271
|
271
|
} |
|
272
|
272
|
|
|
@@ -309,7 +309,7 @@ discard block |
|
|
block discarded – undo |
|
309
|
309
|
* @return void |
|
310
|
310
|
*/ |
|
311
|
311
|
public function deactivate() { |
|
312
|
|
- $this->databaseHandle->exec("UPDATE deployment SET status = " . DeploymentManaged::INACTIVE . " WHERE deployment_id = $this->identifier"); |
|
|
312
|
+ $this->databaseHandle->exec("UPDATE deployment SET status = ".DeploymentManaged::INACTIVE." WHERE deployment_id = $this->identifier"); |
|
313
|
313
|
} |
|
314
|
314
|
|
|
315
|
315
|
/** |
|
@@ -319,7 +319,7 @@ discard block |
|
|
block discarded – undo |
|
319
|
319
|
* @return void |
|
320
|
320
|
*/ |
|
321
|
321
|
public function activate() { |
|
322
|
|
- $this->databaseHandle->exec("UPDATE deployment SET status = " . DeploymentManaged::ACTIVE . " WHERE deployment_id = $this->identifier"); |
|
|
322
|
+ $this->databaseHandle->exec("UPDATE deployment SET status = ".DeploymentManaged::ACTIVE." WHERE deployment_id = $this->identifier"); |
|
323
|
323
|
} |
|
324
|
324
|
|
|
325
|
325
|
} |