Total Complexity | 75 |
Total Lines | 529 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like Device_W8_10 often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Device_W8_10, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
28 | class Device_W8_10 extends WindowsCommon { |
||
29 | final public function __construct() { |
||
30 | parent::__construct(); |
||
31 | $this->setSupportedEapMethods( |
||
32 | [ |
||
33 | \core\common\EAP::EAPTYPE_TLS, |
||
34 | \core\common\EAP::EAPTYPE_PEAP_MSCHAP2, |
||
35 | \core\common\EAP::EAPTYPE_TTLS_PAP, |
||
36 | \core\common\EAP::EAPTYPE_TTLS_MSCHAP2, |
||
37 | \core\common\EAP::EAPTYPE_PWD, |
||
38 | \core\common\EAP::EAPTYPE_SILVERBULLET |
||
39 | ]); |
||
40 | $this->specialities['internal:use_anon_outer'][serialize(\core\common\EAP::EAPTYPE_PEAP_MSCHAP2)] = _("Anonymous identities do not use the realm as specified in the profile - it is derived from the suffix of the user's username input instead."); |
||
41 | } |
||
42 | public function writeInstaller() { |
||
43 | $dom = textdomain(NULL); |
||
44 | textdomain("devices"); |
||
45 | // create certificate files and save their names in $caFiles arrary |
||
46 | $caFiles = $this->saveCertificateFiles('der'); |
||
47 | $this->caArray = $this->getAttibute('internal:CAs',1); |
||
|
|||
48 | $this->useAnon = $this->attributes['internal:use_anon_outer'] [0] === NULL ? FALSE : TRUE; |
||
49 | $this->servers = empty($this->attributes['eap:server_name']) ? '' : implode(';', $this->attributes['eap:server_name']); |
||
50 | $allSSID = $this->attributes['internal:SSID']; |
||
51 | $delSSIDs = $this->attributes['internal:remove_SSID']; |
||
52 | $this->prepareInstallerLang(); |
||
53 | $setWired = isset($this->attributes['media:wired'][0]) && $this->attributes['media:wired'][0] == 'on' ? 1 : 0; |
||
54 | // create a list of profiles to be deleted after installation |
||
55 | $delProfiles = []; |
||
56 | foreach ($delSSIDs as $ssid => $cipher) { |
||
57 | if ($cipher == 'DEL') { |
||
58 | $delProfiles[] = $ssid; |
||
59 | } |
||
60 | if ($cipher == 'TKIP') { |
||
61 | $delProfiles[] = $ssid . ' (TKIP)'; |
||
62 | } |
||
63 | } |
||
64 | $windowsProfile = []; |
||
65 | $eapConfig = $this->prepareEapConfig(); |
||
66 | $iterator = 0; |
||
67 | foreach ($allSSID as $ssid => $cipher) { |
||
68 | if ($cipher == 'TKIP') { |
||
69 | $windowsProfile[$iterator] = $this->writeWLANprofile($ssid . ' (TKIP)', $ssid, 'WPA', 'TKIP', $eapConfig, $iterator); |
||
70 | $iterator++; |
||
71 | } |
||
72 | $windowsProfile[$iterator] = $this->writeWLANprofile($ssid, $ssid, 'WPA2', 'AES', $eapConfig, $iterator); |
||
73 | $iterator++; |
||
74 | } |
||
75 | if ($setWired) { |
||
76 | $this->writeLANprofile($eapConfig); |
||
77 | } |
||
78 | $this->loggerInstance->debug(4, "windowsProfile"); |
||
79 | $this->loggerInstance->debug(4, print_r($windowsProfile, true)); |
||
80 | |||
81 | $this->writeProfilesNSH($windowsProfile, $caFiles); |
||
82 | $this->writeAdditionalDeletes($delProfiles); |
||
83 | if ($this->selectedEap == \core\common\EAP::EAPTYPE_SILVERBULLET) { |
||
84 | $this->writeClientP12File(); |
||
85 | } |
||
86 | $this->copyFiles($this->selectedEap); |
||
87 | $fedLogo = $this->attributes['fed:logo_file'] ?? NULL; |
||
88 | $idpLogo = $this->attributes['internal:logo_file'] ?? NULL; |
||
89 | $this->combineLogo($idpLogo, $fedLogo); |
||
90 | $this->writeMainNSH($this->selectedEap, $this->attributes); |
||
91 | $this->compileNSIS(); |
||
92 | $installerPath = $this->signInstaller(); |
||
93 | textdomain($dom); |
||
94 | return($installerPath); |
||
95 | } |
||
96 | |||
97 | private function setAuthorId() { |
||
98 | if ($this->selectedEap['OUTER'] === \core\common\EAP::TTLS) { |
||
99 | if ($this->useGeantLink) { |
||
100 | $authorId = "67532"; |
||
101 | } else { |
||
102 | $authorId = "311"; |
||
103 | } |
||
104 | } else { |
||
105 | $authorId = 0; |
||
106 | } |
||
107 | return($authorId); |
||
108 | } |
||
109 | |||
110 | private function eapConfigHeader() { |
||
111 | $authorId = $this->setAuthorId(); |
||
112 | $profileFileCont = '<EAPConfig><EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig"> |
||
113 | <EapMethod> |
||
114 | '; |
||
115 | $profileFileCont .= '<Type xmlns="http://www.microsoft.com/provisioning/EapCommon">' . |
||
116 | $this->selectedEap["OUTER"] . '</Type> |
||
117 | <VendorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorId> |
||
118 | <VendorType xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorType> |
||
119 | <AuthorId xmlns="http://www.microsoft.com/provisioning/EapCommon">' . $authorId . '</AuthorId> |
||
120 | </EapMethod> |
||
121 | '; |
||
122 | return($profileFileCont); |
||
123 | } |
||
124 | |||
125 | private function tlsServerValidation() { |
||
139 | } |
||
140 | |||
141 | private function msTtlsServerValidation() { |
||
142 | $profileFileCont = ' |
||
143 | <ServerValidation> |
||
144 | '; |
||
145 | $profileFileCont .= '<ServerNames>' . $this->servers . '</ServerNames> '; |
||
146 | foreach ($this->caArray as $certAuthority) { |
||
147 | if ($certAuthority['root']) { |
||
148 | $profileFileCont .= "<TrustedRootCAHash>" . chunk_split($certAuthority['sha1'], 2, ' ') . "</TrustedRootCAHash>\n"; |
||
149 | } |
||
150 | } |
||
151 | $profileFileCont .= '<DisablePrompt>true</DisablePrompt> |
||
152 | </ServerValidation> |
||
153 | '; |
||
154 | return($profileFileCont); |
||
155 | } |
||
156 | |||
157 | private function glTtlsServerValidation() { |
||
158 | $servers = implode('</ServerName><ServerName>', $this->attributes['eap:server_name']); |
||
159 | $profileFileCont = ' |
||
160 | <ServerSideCredential> |
||
161 | '; |
||
162 | foreach ($this->caArray as $ca) { |
||
163 | $profileFileCont .= '<CA><format>PEM</format><cert-data>'; |
||
164 | $profileFileCont .= base64_encode($ca['der']); |
||
165 | $profileFileCont .= '</cert-data></CA> |
||
166 | '; |
||
167 | } |
||
168 | $profileFileCont .= "<ServerName>$servers</ServerName>\n"; |
||
169 | |||
170 | $profileFileCont .= ' |
||
171 | </ServerSideCredential> |
||
172 | '; |
||
173 | return($profileFileCont); |
||
174 | } |
||
175 | |||
176 | private function peapServerValidation() { |
||
177 | $profileFileCont = ' |
||
178 | <ServerValidation> |
||
179 | <DisableUserPromptForServerValidation>true</DisableUserPromptForServerValidation> |
||
180 | <ServerNames>' . $this->servers . '</ServerNames>'; |
||
181 | foreach ($this->caArray as $certAuthority) { |
||
182 | if ($certAuthority['root']) { |
||
183 | $profileFileCont .= "<TrustedRootCA>" . $certAuthority['sha1'] . "</TrustedRootCA>\n"; |
||
184 | } |
||
185 | } |
||
186 | $profileFileCont .= '</ServerValidation> |
||
187 | '; |
||
188 | return($profileFileCont); |
||
189 | } |
||
190 | |||
191 | private function tlsConfig() { |
||
192 | $profileFileCont = ' |
||
193 | <Config xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1" |
||
194 | xmlns:eapTls="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV1"> |
||
195 | <baseEap:Eap> |
||
196 | <baseEap:Type>13</baseEap:Type> |
||
197 | <eapTls:EapType> |
||
198 | <eapTls:CredentialsSource> |
||
199 | <eapTls:CertificateStore /> |
||
200 | </eapTls:CredentialsSource> |
||
201 | '; |
||
202 | $profileFileCont .= $this->tlsServerValidation(); |
||
203 | if (\core\common\Entity::getAttributeValue($this->attributes, 'eap-specific:tls_use_other_id', 0) === 'on') { |
||
204 | $profileFileCont .= '<eapTls:DifferentUsername>true</eapTls:DifferentUsername>'; |
||
205 | $this->tlsOtherUsername = 1; |
||
206 | } else { |
||
207 | $profileFileCont .= '<eapTls:DifferentUsername>false</eapTls:DifferentUsername>'; |
||
208 | } |
||
209 | $profileFileCont .= ' |
||
210 | </eapTls:EapType> |
||
211 | </baseEap:Eap> |
||
212 | </Config> |
||
213 | '; |
||
214 | return($profileFileCont); |
||
215 | } |
||
216 | |||
217 | private function msTtlsConfig() { |
||
218 | $profileFileCont = '<Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig"> |
||
219 | <EapTtls xmlns="http://www.microsoft.com/provisioning/EapTtlsConnectionPropertiesV1"> |
||
220 | '; |
||
221 | $profileFileCont .= $this->msTtlsServerValidation(); |
||
222 | $profileFileCont .= '<Phase2Authentication> |
||
223 | '; |
||
224 | if ($this->selectedEap == \core\common\EAP::EAPTYPE_TTLS_PAP) { |
||
225 | $profileFileCont .= '<PAPAuthentication /> '; |
||
226 | } |
||
227 | if ($this->selectedEap == \core\common\EAP::EAPTYPE_TTLS_MSCHAP2) { |
||
228 | $profileFileCont .= '<MSCHAPv2Authentication> |
||
229 | <UseWinlogonCredentials>false</UseWinlogonCredentials> |
||
230 | </MSCHAPv2Authentication> |
||
231 | '; |
||
232 | } |
||
233 | $profileFileCont .= '</Phase2Authentication> |
||
234 | <Phase1Identity> |
||
235 | '; |
||
236 | if ($this->useAnon) { |
||
237 | $profileFileCont .= '<IdentityPrivacy>true</IdentityPrivacy> |
||
238 | '; |
||
239 | $profileFileCont .= '<AnonymousIdentity>' . $this->outerId . '</AnonymousIdentity> |
||
240 | '; |
||
241 | } else { |
||
242 | $profileFileCont .= '<IdentityPrivacy>false</IdentityPrivacy> |
||
243 | '; |
||
244 | } |
||
245 | $profileFileCont .= '</Phase1Identity> |
||
246 | </EapTtls> |
||
247 | </Config> |
||
248 | '; |
||
249 | return($profileFileCont); |
||
250 | } |
||
251 | |||
252 | private function glTtlsConfig() { |
||
253 | $profileFileCont = ' |
||
254 | <Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig"> |
||
255 | <EAPIdentityProviderList xmlns="urn:ietf:params:xml:ns:yang:ietf-eap-metadata"> |
||
256 | <EAPIdentityProvider ID="' . $this->deviceUUID . '" namespace="urn:UUID"> |
||
257 | |||
258 | <ProviderInfo> |
||
259 | <DisplayName>' . $this->translateString($this->attributes['general:instname'][0], $this->codePage) . '</DisplayName> |
||
260 | </ProviderInfo> |
||
261 | <AuthenticationMethods> |
||
262 | <AuthenticationMethod> |
||
263 | <EAPMethod>21</EAPMethod> |
||
264 | <ClientSideCredential> |
||
265 | <allow-save>true</allow-save> |
||
266 | '; |
||
267 | if ($this->useAnon) { |
||
268 | if ($this->outerUser == '') { |
||
269 | $profileFileCont .= '<AnonymousIdentity>@</AnonymousIdentity>'; |
||
270 | } else { |
||
271 | $profileFileCont .= '<AnonymousIdentity>' . $this->outerId . '</AnonymousIdentity>'; |
||
272 | } |
||
273 | } |
||
274 | $profileFileCont .= '</ClientSideCredential> |
||
275 | '; |
||
276 | $profileFileCont .= $this->glTtlsServerValidation(); |
||
277 | $profileFileCont .= ' |
||
278 | <InnerAuthenticationMethod> |
||
279 | <NonEAPAuthMethod>' . \core\common\EAP::eapDisplayName($this->selectedEap)['INNER'] . '</NonEAPAuthMethod> |
||
280 | </InnerAuthenticationMethod> |
||
281 | <VendorSpecific> |
||
282 | <SessionResumption>false</SessionResumption> |
||
283 | </VendorSpecific> |
||
284 | </AuthenticationMethod> |
||
285 | </AuthenticationMethods> |
||
286 | </EAPIdentityProvider> |
||
287 | </EAPIdentityProviderList> |
||
288 | </Config> |
||
289 | '; |
||
290 | return($profileFileCont); |
||
291 | } |
||
292 | |||
293 | private function peapConfig() { |
||
294 | $nea = (\core\common\Entity::getAttributeValue($this->attributes, 'media:wired', 0) == 'on') ? 'true' : 'false'; |
||
295 | $profileFileCont = '<Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig"> |
||
296 | <Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"> |
||
297 | <Type>25</Type> |
||
298 | <EapType xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1"> |
||
299 | '; |
||
300 | $profileFileCont .= $this->peapServerValidation(); |
||
301 | $profileFileCont .= ' |
||
302 | <FastReconnect>true</FastReconnect> |
||
303 | <InnerEapOptional>false</InnerEapOptional> |
||
304 | <Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"> |
||
305 | <Type>26</Type> |
||
306 | <EapType xmlns="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1"> |
||
307 | <UseWinLogonCredentials>false</UseWinLogonCredentials> |
||
308 | </EapType> |
||
309 | </Eap> |
||
310 | <EnableQuarantineChecks>' . $nea . '</EnableQuarantineChecks> |
||
311 | <RequireCryptoBinding>false</RequireCryptoBinding> |
||
312 | '; |
||
313 | if ($this->useAnon) { |
||
314 | $profileFileCont .= '<PeapExtensions> |
||
315 | <IdentityPrivacy xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2"> |
||
316 | <EnableIdentityPrivacy>true</EnableIdentityPrivacy> |
||
317 | '; |
||
318 | if ($this->outerUser == '') { |
||
319 | $profileFileCont .= '<AnonymousUserName/> |
||
320 | '; |
||
321 | } else { |
||
322 | $profileFileCont .= '<AnonymousUserName>' . $this->outerUser . '</AnonymousUserName> |
||
323 | '; |
||
324 | } |
||
325 | $profileFileCont .= '</IdentityPrivacy> |
||
326 | </PeapExtensions> |
||
327 | '; |
||
328 | } |
||
329 | $profileFileCont .= '</EapType> |
||
330 | </Eap> |
||
331 | </Config> |
||
332 | '; |
||
333 | return($profileFileCont); |
||
334 | } |
||
335 | |||
336 | private function pwdConfig() { |
||
337 | return('<ConfigBlob></ConfigBlob>'); |
||
338 | } |
||
339 | |||
340 | private function prepareEapConfig() { |
||
341 | if ($this->useAnon) { |
||
342 | $this->outerUser = $this->attributes['internal:anon_local_value'][0]; |
||
343 | $this->outerId = $this->outerUser . '@' . $this->attributes['internal:realm'][0]; |
||
344 | } |
||
345 | if (isset($this->options['args']) && $this->options['args'] == 'gl') { |
||
346 | $this->useGeantLink = TRUE; |
||
347 | } else { |
||
348 | $this->useGeantLink = FALSE; |
||
349 | } |
||
350 | $profileFileCont = $this->eapConfigHeader(); |
||
351 | |||
352 | switch ($this->selectedEap['OUTER']) { |
||
353 | case \core\common\EAP::TLS: |
||
354 | $profileFileCont .= $this->tlsConfig(); |
||
355 | break; |
||
356 | case \core\common\EAP::PEAP: |
||
357 | $profileFileCont .= $this->peapConfig(); |
||
358 | break; |
||
359 | case \core\common\EAP::TTLS: |
||
360 | if ($this->useGeantLink) { |
||
361 | $profileFileCont .= $this->glTtlsConfig(); |
||
362 | } else { |
||
363 | $profileFileCont .= $this->msTtlsConfig(); |
||
364 | } |
||
365 | break; |
||
366 | case \core\common\EAP::PWD: |
||
367 | $profileFileCont .= $this->pwdConfig(); |
||
368 | break; |
||
369 | default: |
||
370 | break; |
||
371 | } |
||
372 | return(['win' => $profileFileCont . '</EapHostConfig></EAPConfig>']); |
||
373 | } |
||
374 | |||
375 | /** |
||
376 | * produce PEAP, TLS and TTLS configuration files for Windows 8 |
||
377 | * |
||
378 | * @param string $wlanProfileName |
||
379 | * @param string $ssid |
||
380 | * @param string $auth can be one of "WPA", "WPA2" |
||
381 | * @param string $encryption can be one of: "TKIP", "AES" |
||
382 | * @param array $eapConfig XML configuration block with EAP config data |
||
383 | * @param int $profileNumber counter, which profile number is this |
||
384 | * @return string |
||
385 | */ |
||
386 | private function writeWLANprofile($wlanProfileName, $ssid, $auth, $encryption, $eapConfig, $profileNumber) { |
||
387 | $profileFileCont = '<?xml version="1.0"?> |
||
388 | <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> |
||
389 | <name>' . $wlanProfileName . '</name> |
||
390 | <SSIDConfig> |
||
391 | <SSID> |
||
392 | <name>' . $ssid . '</name> |
||
393 | </SSID> |
||
394 | <nonBroadcast>true</nonBroadcast> |
||
395 | </SSIDConfig> |
||
396 | <connectionType>ESS</connectionType> |
||
397 | <connectionMode>auto</connectionMode> |
||
398 | <autoSwitch>false</autoSwitch> |
||
399 | <MSM> |
||
400 | <security> |
||
401 | <authEncryption> |
||
402 | <authentication>' . $auth . '</authentication> |
||
403 | <encryption>' . $encryption . '</encryption> |
||
404 | <useOneX>true</useOneX> |
||
405 | </authEncryption> |
||
406 | '; |
||
407 | if ($auth == 'WPA2') { |
||
408 | $profileFileCont .= '<PMKCacheMode>enabled</PMKCacheMode> |
||
409 | <PMKCacheTTL>720</PMKCacheTTL> |
||
410 | <PMKCacheSize>128</PMKCacheSize> |
||
411 | <preAuthMode>disabled</preAuthMode> |
||
412 | '; |
||
413 | } |
||
414 | $profileFileCont .= '<OneX xmlns="http://www.microsoft.com/networking/OneX/v1"> |
||
415 | <cacheUserData>true</cacheUserData> |
||
416 | <authMode>user</authMode> |
||
417 | '; |
||
418 | |||
419 | $closing = ' |
||
420 | </OneX> |
||
421 | </security> |
||
422 | </MSM> |
||
423 | </WLANProfile> |
||
424 | '; |
||
425 | |||
426 | if (!is_dir('w8')) { |
||
427 | mkdir('w8'); |
||
428 | } |
||
429 | $xmlFname = "w8/wlan_prof-$profileNumber.xml"; |
||
430 | file_put_contents($xmlFname, $profileFileCont . $eapConfig['win'] . $closing); |
||
431 | $this->loggerInstance->debug(2, "Installer has been written into directory $this->FPATH\n"); |
||
432 | $this->loggerInstance->debug(4, "WWWWLAN_Profile:$wlanProfileName:$encryption\n"); |
||
433 | return("\"$wlanProfileName\" \"$encryption\""); |
||
434 | } |
||
435 | |||
436 | private function writeLANprofile($eapConfig) { |
||
460 | } |
||
461 | |||
462 | private function writeProfilesNSH($wlanProfiles, $caArray) { |
||
463 | $this->loggerInstance->debug(4, "writeProfilesNSH"); |
||
464 | $this->loggerInstance->debug(4, $wlanProfiles); |
||
465 | $fcontentsProfile = ''; |
||
466 | foreach ($wlanProfiles as $wlanProfile) { |
||
467 | $fcontentsProfile .= "!insertmacro define_wlan_profile $wlanProfile\n"; |
||
468 | } |
||
469 | |||
470 | file_put_contents('profiles.nsh', $fcontentsProfile); |
||
471 | |||
472 | $fcontentsCerts = ''; |
||
473 | $fileHandleCerts = fopen('certs.nsh', 'w'); |
||
474 | if ($fileHandleCerts === FALSE) { |
||
475 | throw new Exception("Unable to open new certs.nsh file for writing CAs."); |
||
476 | } |
||
477 | foreach ($caArray as $certAuthority) { |
||
478 | $store = $certAuthority['root'] ? "root" : "ca"; |
||
479 | $fcontentsCerts .= '!insertmacro install_ca_cert "' . $certAuthority['file'] . '" "' . $certAuthority['sha1'] . '" "' . $store . "\"\n"; |
||
480 | } |
||
481 | fwrite($fileHandleCerts, $fcontentsCerts); |
||
482 | fclose($fileHandleCerts); |
||
483 | } |
||
484 | |||
485 | private function writeMainNSH($eap, $attr) { |
||
486 | $this->loggerInstance->debug(4, "writeMainNSH"); |
||
487 | $this->loggerInstance->debug(4, $attr); |
||
488 | $this->loggerInstance->debug(4, "Device_id = " . $this->device_id . "\n"); |
||
489 | $fcontents = "!define W8\n"; |
||
490 | if ($this->device_id == 'w10') { |
||
491 | $fcontents .= "!define W10\n"; |
||
492 | } |
||
493 | if (CONFIG_CONFASSISTANT['NSIS_VERSION'] >= 3) { |
||
494 | $fcontents .= "Unicode true\n"; |
||
495 | } |
||
496 | $eapOptions = [ |
||
497 | \core\common\EAP::PEAP => ['str' => 'PEAP', 'exec' => 'user'], |
||
498 | \core\common\EAP::TLS => ['str' => 'TLS', 'exec' => 'user'], |
||
499 | \core\common\EAP::TTLS => ['str' => 'TTLS', 'exec' => 'user'], |
||
500 | \core\common\EAP::PWD => ['str' => 'PWD', 'exec' => 'user'], |
||
501 | ]; |
||
502 | if (isset($this->options['args']) && $this->options['args'] == 'gl') { |
||
503 | $eapOptions[\core\common\EAP::TTLS]['str'] = 'GEANTLink'; |
||
504 | } |
||
505 | |||
506 | // Uncomment the line below if you want this module to run under XP (only displaying a warning) |
||
507 | // $fcontents .= "!define ALLOW_XP\n"; |
||
508 | // Uncomment the line below if you want this module to produce debugging messages on the client |
||
509 | // $fcontents .= "!define DEBUG_CAT\n"; |
||
510 | if ($this->tlsOtherUsername == 1) { |
||
511 | $fcontents .= "!define PFX_USERNAME\n"; |
||
512 | } |
||
513 | $execLevel = $eapOptions[$eap["OUTER"]]['exec']; |
||
514 | $eapStr = $eapOptions[$eap["OUTER"]]['str']; |
||
515 | if ($eap == \core\common\EAP::EAPTYPE_SILVERBULLET) { |
||
516 | $fcontents .= "!define SILVERBULLET\n"; |
||
517 | } |
||
518 | $fcontents .= '!define ' . $eapStr; |
||
519 | $fcontents .= "\n" . '!define EXECLEVEL "' . $execLevel . '"'; |
||
520 | $fcontents .= $this->writeNsisDefines($attr); |
||
521 | file_put_contents('main.nsh', $fcontents); |
||
522 | } |
||
523 | |||
524 | private function copyStandardNsi() { |
||
525 | if (!$this->translateFile('eap_w8.inc', 'cat.NSI', $this->codePage)) { |
||
526 | throw new Exception("Translating needed file eap_w8.inc failed!"); |
||
527 | } |
||
528 | } |
||
529 | |||
530 | private function copyFiles($eap) { |
||
549 | } |
||
550 | |||
551 | private $tlsOtherUsername = 0; |
||
552 | private $caArray; |
||
553 | private $useAnon; |
||
554 | private $servers; |
||
555 | private $outerUser; |
||
556 | private $outerId; |
||
557 | |||
560 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.