|
@@ -209,7 +209,7 @@ discard block |
|
|
block discarded – undo |
|
209
|
209
|
$serverCandidates[IdPlist::geoDistance($adminLocation, ['lat' => $iterator->location_lat, 'lon' => $iterator->location_lon])] = $iterator->server_id; |
|
210
|
210
|
} |
|
211
|
211
|
if ($clients > $maxSupportedClients * 0.9) { |
|
212
|
|
- $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (" . $iterator->server_id . ") is serving at more than 90% capacity!"); |
|
|
212
|
+ $this->loggerInstance->debug(1, "A RADIUS server for Managed SP (".$iterator->server_id.") is serving at more than 90% capacity!"); |
|
213
|
213
|
} |
|
214
|
214
|
} |
|
215
|
215
|
if (count($serverCandidates) == 0) { |
|
@@ -239,7 +239,7 @@ discard block |
|
|
block discarded – undo |
|
239
|
239
|
$foundFreePort1 = 0; |
|
240
|
240
|
while ($foundFreePort1 == 0) { |
|
241
|
241
|
$portCandidate = random_int(1025, 65535); |
|
242
|
|
- $check = $this->databaseHandle->exec("SELECT port_instance_1 FROM deployment WHERE radius_instance_1 = '" . $ourserver . "' AND port_instance_1 = $portCandidate"); |
|
|
242
|
+ $check = $this->databaseHandle->exec("SELECT port_instance_1 FROM deployment WHERE radius_instance_1 = '".$ourserver."' AND port_instance_1 = $portCandidate"); |
|
243
|
243
|
if (mysqli_num_rows(/** @scrutinizer ignore-type */ $check) == 0) { |
|
244
|
244
|
$foundFreePort1 = $portCandidate; |
|
245
|
245
|
} |
|
@@ -248,14 +248,14 @@ discard block |
|
|
block discarded – undo |
|
248
|
248
|
$foundFreePort2 = 0; |
|
249
|
249
|
while ($foundFreePort2 == 0) { |
|
250
|
250
|
$portCandidate = random_int(1025, 65535); |
|
251
|
|
- $check = $this->databaseHandle->exec("SELECT port_instance_2 FROM deployment WHERE radius_instance_2 = '" . $ourSecondServer . "' AND port_instance_2 = $portCandidate"); |
|
|
251
|
+ $check = $this->databaseHandle->exec("SELECT port_instance_2 FROM deployment WHERE radius_instance_2 = '".$ourSecondServer."' AND port_instance_2 = $portCandidate"); |
|
252
|
252
|
if (mysqli_num_rows(/** @scrutinizer ignore-type */ $check) == 0) { |
|
253
|
253
|
$foundFreePort2 = $portCandidate; |
|
254
|
254
|
} |
|
255
|
255
|
} |
|
256
|
256
|
// and make up a shared secret that is halfways readable |
|
257
|
257
|
$futureSecret = $this->randomString(16, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
|
258
|
|
- $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"); |
|
|
258
|
+ $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"); |
|
259
|
259
|
return ["port_instance_1" => $foundFreePort1, "port_instance_2" => $foundFreePort2, "secret" => $futureSecret, "radius_instance_1" => $ourserver, "radius_instance_2" => $ourserver]; |
|
260
|
260
|
} |
|
261
|
261
|
|
|
@@ -298,7 +298,7 @@ discard block |
|
|
block discarded – undo |
|
298
|
298
|
* @return void |
|
299
|
299
|
*/ |
|
300
|
300
|
public function deactivate() { |
|
301
|
|
- $this->databaseHandle->exec("UPDATE deployment SET status = " . DeploymentManaged::INACTIVE . " WHERE deployment_id = $this->identifier"); |
|
|
301
|
+ $this->databaseHandle->exec("UPDATE deployment SET status = ".DeploymentManaged::INACTIVE." WHERE deployment_id = $this->identifier"); |
|
302
|
302
|
} |
|
303
|
303
|
|
|
304
|
304
|
/** |
|
@@ -308,7 +308,7 @@ discard block |
|
|
block discarded – undo |
|
308
|
308
|
* @return void |
|
309
|
309
|
*/ |
|
310
|
310
|
public function activate() { |
|
311
|
|
- $this->databaseHandle->exec("UPDATE deployment SET status = " . DeploymentManaged::ACTIVE . " WHERE deployment_id = $this->identifier"); |
|
|
311
|
+ $this->databaseHandle->exec("UPDATE deployment SET status = ".DeploymentManaged::ACTIVE." WHERE deployment_id = $this->identifier"); |
|
312
|
312
|
} |
|
313
|
313
|
|
|
314
|
314
|
} |