@@ -105,28 +105,28 @@ |
||
105 | 105 | parent::__construct(); |
106 | 106 | common\Entity::intoThePotatoes(); |
107 | 107 | |
108 | - $this->catVersionString = sprintf(_("Unreleased %s Git Revision"), "<a href='https://github.com/GEANT/CAT/tree/master/Changes.md'>") . "</a>"; |
|
108 | + $this->catVersionString = sprintf(_("Unreleased %s Git Revision"), "<a href='https://github.com/GEANT/CAT/tree/master/Changes.md'>")."</a>"; |
|
109 | 109 | if (CAT::RELEASE_VERSION) { |
110 | 110 | $major = CAT::VERSION_MAJOR; |
111 | 111 | $minor = CAT::VERSION_MINOR; |
112 | 112 | $patch = CAT::VERSION_PATCH; |
113 | 113 | $extra = CAT::VERSION_EXTRA; |
114 | 114 | $temp_version = "CAT-$major.$minor"; |
115 | - $branch = "release_$major" . "_$minor"; |
|
115 | + $branch = "release_$major"."_$minor"; |
|
116 | 116 | if (CAT::VERSION_PATCH != 0) { |
117 | 117 | $temp_version .= ".$patch"; |
118 | 118 | } |
119 | 119 | if (CAT::VERSION_EXTRA != "") { |
120 | 120 | $temp_version .= "-$extra"; |
121 | 121 | } |
122 | - $this->catVersionString = sprintf(_("Release <a href='%s'>%s</a>"), "https://github.com/GEANT/CAT/tree/" . $branch . "/Changes.md", $temp_version); |
|
122 | + $this->catVersionString = sprintf(_("Release <a href='%s'>%s</a>"), "https://github.com/GEANT/CAT/tree/".$branch."/Changes.md", $temp_version); |
|
123 | 123 | } |
124 | 124 | $product = \config\Master::APPEARANCE['productname']; |
125 | 125 | $minYear = self::COPYRIGHT_MIN_YEAR; |
126 | 126 | $maxYear = self::COPYRIGHT_MAX_YEAR; |
127 | 127 | $holder = self::COPYRIGHT_HOLDER; |
128 | 128 | $consortia = self::COPYRIGHT_CONSORTIA; |
129 | - $this->catCopyright = "$product - " . $this->catVersionString . " © $minYear-$maxYear $holder<br/>on behalf of $consortia; and others <a href='copyright.php'>Full Copyright and Licenses</a>"; |
|
129 | + $this->catCopyright = "$product - ".$this->catVersionString." © $minYear-$maxYear $holder<br/>on behalf of $consortia; and others <a href='copyright.php'>Full Copyright and Licenses</a>"; |
|
130 | 130 | |
131 | 131 | |
132 | 132 | /* Federations are created in DB with bootstrapFederation, and listed via listFederations |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * <base_url>/copyright.php after deploying the software |
20 | 20 | */ |
21 | 21 | |
22 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
22 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
23 | 23 | |
24 | 24 | $Tests = [ |
25 | 25 | 'Directories', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $uiElements = new \web\lib\admin\UIElements(); |
45 | 45 | |
46 | -if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL" || \config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_RADIUS'] == "LOCAL" ) { |
|
46 | +if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL" || \config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_RADIUS'] == "LOCAL") { |
|
47 | 47 | $Tests[] = 'Makensis'; |
48 | 48 | $Tests[] = 'Makensis=>NSISmodules'; |
49 | 49 | } |
@@ -34,13 +34,13 @@ |
||
34 | 34 | */ |
35 | 35 | class Diagnostics |
36 | 36 | { |
37 | - /** |
|
38 | - * Various paths. |
|
39 | - * eapol_test: absolute path to the eapol_test executable. If you just fill in "eapol_test" the one from the system $PATH will be taken. |
|
40 | - * c_rehash: absolute path to the c_rehash executable. If you just fill in "c_rehash" the one from the system $PATH will be taken. |
|
41 | - * See also NSIS_VERSION further down |
|
42 | - * @var array |
|
43 | - */ |
|
37 | + /** |
|
38 | + * Various paths. |
|
39 | + * eapol_test: absolute path to the eapol_test executable. If you just fill in "eapol_test" the one from the system $PATH will be taken. |
|
40 | + * c_rehash: absolute path to the c_rehash executable. If you just fill in "c_rehash" the one from the system $PATH will be taken. |
|
41 | + * See also NSIS_VERSION further down |
|
42 | + * @var array |
|
43 | + */ |
|
44 | 44 | const PATHS = [ |
45 | 45 | 'c_rehash' => 'c_rehash', |
46 | 46 | 'eapol_test' => 'eapol_test', |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $mail->WordWrap = 72; |
83 | 83 | $mail->isHTML(FALSE); |
84 | 84 | $mail->CharSet = 'UTF-8'; |
85 | - $configuredFrom = \config\Master::APPEARANCE['from-mail'] . ""; |
|
85 | + $configuredFrom = \config\Master::APPEARANCE['from-mail'].""; |
|
86 | 86 | $mail->From = $configuredFrom; |
87 | 87 | // are we fancy? i.e. S/MIME signing? |
88 | 88 | if (isset(\config\Master::MAILSETTINGS['certfilename'], \config\Master::MAILSETTINGS['keyfilename'], \config\Master::MAILSETTINGS['keypass'])) { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $loggerInstance->debug(4, "OutsideComm::mailAddressValidSecure: no MX."); |
124 | 124 | return OutsideComm::MAILDOMAIN_NO_MX; |
125 | 125 | } |
126 | - $loggerInstance->debug(5, "Domain: $domain MX: " . /** @scrutinizer ignore-type */ print_r($mx, TRUE)); |
|
126 | + $loggerInstance->debug(5, "Domain: $domain MX: "./** @scrutinizer ignore-type */ print_r($mx, TRUE)); |
|
127 | 127 | // create a pool of A and AAAA records for all the MXes |
128 | 128 | $ipAddrs = []; |
129 | 129 | foreach ($mx as $onemx) { |
@@ -133,14 +133,14 @@ discard block |
||
133 | 133 | $ipAddrs[] = $oneipv4['ip']; |
134 | 134 | } |
135 | 135 | foreach ($v6list as $oneipv6) { |
136 | - $ipAddrs[] = "[" . $oneipv6['ipv6'] . "]"; |
|
136 | + $ipAddrs[] = "[".$oneipv6['ipv6']."]"; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | if (count($ipAddrs) == 0) { |
140 | 140 | $loggerInstance->debug(4, "OutsideComm::mailAddressValidSecure: no mailserver hosts."); |
141 | 141 | return OutsideComm::MAILDOMAIN_NO_HOST; |
142 | 142 | } |
143 | - $loggerInstance->debug(5, "Domain: $domain Addrs: " . /** @scrutinizer ignore-type */ print_r($ipAddrs, TRUE)); |
|
143 | + $loggerInstance->debug(5, "Domain: $domain Addrs: "./** @scrutinizer ignore-type */ print_r($ipAddrs, TRUE)); |
|
144 | 144 | // connect to all hosts. If all can't connect, return MAILDOMAIN_NO_CONNECT. |
145 | 145 | // If at least one does not support STARTTLS or one of the hosts doesn't connect |
146 | 146 | // , return MAILDOMAIN_NO_STARTTLS (one which we can't connect to we also |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | switch (\config\ConfAssistant::SMSSETTINGS['provider']) { |
194 | 194 | case 'Nexmo': |
195 | 195 | // taken from https://docs.nexmo.com/messaging/sms-api |
196 | - $url = 'https://rest.nexmo.com/sms/json?' . http_build_query( |
|
196 | + $url = 'https://rest.nexmo.com/sms/json?'.http_build_query( |
|
197 | 197 | [ |
198 | 198 | 'api_key' => \config\ConfAssistant::SMSSETTINGS['username'], |
199 | 199 | 'api_secret' => \config\ConfAssistant::SMSSETTINGS['password'], |
@@ -219,14 +219,14 @@ discard block |
||
219 | 219 | $loggerInstance->debug(2, 'Problem with SMS invitation: no message was sent!'); |
220 | 220 | return OutsideComm::SMS_NOTSENT; |
221 | 221 | } |
222 | - $loggerInstance->debug(2, 'Total of ' . $messageCount . ' messages were attempted to send.'); |
|
222 | + $loggerInstance->debug(2, 'Total of '.$messageCount.' messages were attempted to send.'); |
|
223 | 223 | |
224 | 224 | $totalFailures = 0; |
225 | 225 | foreach ($decoded_response['messages'] as $message) { |
226 | 226 | if ($message['status'] == 0) { |
227 | - $loggerInstance->debug(2, $message['message-id'] . ": Success"); |
|
227 | + $loggerInstance->debug(2, $message['message-id'].": Success"); |
|
228 | 228 | } else { |
229 | - $loggerInstance->debug(2, $message['message-id'] . ": Failed (failure code = " . $message['status'] . ")"); |
|
229 | + $loggerInstance->debug(2, $message['message-id'].": Failed (failure code = ".$message['status'].")"); |
|
230 | 230 | $totalFailures++; |
231 | 231 | } |
232 | 232 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $proto = "https://"; |
296 | 296 | } |
297 | 297 | // then, send out the mail |
298 | - $message = _("Hello,") . "\n\n" . wordwrap($introTexts[$introtext] . " " . $validity, 72) . "\n\n"; |
|
298 | + $message = _("Hello,")."\n\n".wordwrap($introTexts[$introtext]." ".$validity, 72)."\n\n"; |
|
299 | 299 | // default means we don't have a Reply-To. |
300 | 300 | $replyToMessage = wordwrap(_("manually. Please do not reply to this mail; this is a send-only address.")); |
301 | 301 | |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | // see if we are supposed to add a custom message |
304 | 304 | $customtext = $federation->getAttributes('fed:custominvite'); |
305 | 305 | if (count($customtext) > 0) { |
306 | - $message .= wordwrap(sprintf(_("Additional message from your %s administrator:"), Entity::$nomenclature_fed), 72) . "\n---------------------------------" . |
|
307 | - wordwrap($customtext[0]['value'], 72) . "\n---------------------------------\n\n"; |
|
306 | + $message .= wordwrap(sprintf(_("Additional message from your %s administrator:"), Entity::$nomenclature_fed), 72)."\n---------------------------------". |
|
307 | + wordwrap($customtext[0]['value'], 72)."\n---------------------------------\n\n"; |
|
308 | 308 | } |
309 | 309 | // and add Reply-To already now |
310 | 310 | foreach ($federation->listFederationAdmins() as $fedadmin_id) { |
@@ -320,19 +320,19 @@ discard block |
||
320 | 320 | } |
321 | 321 | $productname = \config\Master::APPEARANCE['productname']; |
322 | 322 | $consortium = \config\ConfAssistant::CONSORTIUM['display_name']; |
323 | - $message .= wordwrap(sprintf(_("To enlist as an administrator for that %s, please click on the following link:"), Entity::$nomenclature_participant), 72) . "\n\n" . |
|
324 | - $proto . $_SERVER['SERVER_NAME'] . \config\Master::PATHS['cat_base_url'] . "admin/action_enrollment.php?token=$newtoken\n\n" . |
|
325 | - wordwrap(sprintf(_("If clicking the link doesn't work, you can also go to the %s Administrator Interface at"), $productname), 72) . "\n\n" . |
|
326 | - $proto . $_SERVER['SERVER_NAME'] . \config\Master::PATHS['cat_base_url'] . "admin/\n\n" . |
|
327 | - _("and enter the invitation token") . "\n\n" . |
|
328 | - $newtoken . "\n\n$replyToMessage\n\n" . |
|
329 | - wordwrap(_("Do NOT forward the mail before the token has expired - or the recipients may be able to consume the token on your behalf!"), 72) . "\n\n" . |
|
330 | - wordwrap(sprintf(_("We wish you a lot of fun with the %s."), $productname), 72) . "\n\n" . |
|
323 | + $message .= wordwrap(sprintf(_("To enlist as an administrator for that %s, please click on the following link:"), Entity::$nomenclature_participant), 72)."\n\n". |
|
324 | + $proto.$_SERVER['SERVER_NAME'].\config\Master::PATHS['cat_base_url']."admin/action_enrollment.php?token=$newtoken\n\n". |
|
325 | + wordwrap(sprintf(_("If clicking the link doesn't work, you can also go to the %s Administrator Interface at"), $productname), 72)."\n\n". |
|
326 | + $proto.$_SERVER['SERVER_NAME'].\config\Master::PATHS['cat_base_url']."admin/\n\n". |
|
327 | + _("and enter the invitation token")."\n\n". |
|
328 | + $newtoken."\n\n$replyToMessage\n\n". |
|
329 | + wordwrap(_("Do NOT forward the mail before the token has expired - or the recipients may be able to consume the token on your behalf!"), 72)."\n\n". |
|
330 | + wordwrap(sprintf(_("We wish you a lot of fun with the %s."), $productname), 72)."\n\n". |
|
331 | 331 | sprintf(_("Sincerely,\n\nYour friendly folks from %s Operations"), $consortium); |
332 | 332 | |
333 | 333 | |
334 | 334 | // who to whom? |
335 | - $mail->FromName = \config\Master::APPEARANCE['productname'] . " Invitation System"; |
|
335 | + $mail->FromName = \config\Master::APPEARANCE['productname']." Invitation System"; |
|
336 | 336 | |
337 | 337 | if (isset(\config\Master::APPEARANCE['invitation-bcc-mail']) && \config\Master::APPEARANCE['invitation-bcc-mail'] !== NULL) { |
338 | 338 | $mail->addBCC(\config\Master::APPEARANCE['invitation-bcc-mail']); |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | |
106 | 106 | $attributesLowLevel = array_merge($this->deviceLevelAttributes, $this->eapLevelAttributes); |
107 | 107 | |
108 | - $this->loggerInstance->debug(5, "Device-Level Attributes: " . /** @scrutinizer ignore-type */ print_r($this->deviceLevelAttributes, true)); |
|
109 | - $this->loggerInstance->debug(5, "EAP-Level Attributes: " . /** @scrutinizer ignore-type */ print_r($this->eapLevelAttributes, true)); |
|
110 | - $this->loggerInstance->debug(5, "All low-Level Attributes: " . /** @scrutinizer ignore-type */ print_r($attributesLowLevel, true)); |
|
108 | + $this->loggerInstance->debug(5, "Device-Level Attributes: "./** @scrutinizer ignore-type */ print_r($this->deviceLevelAttributes, true)); |
|
109 | + $this->loggerInstance->debug(5, "EAP-Level Attributes: "./** @scrutinizer ignore-type */ print_r($this->eapLevelAttributes, true)); |
|
110 | + $this->loggerInstance->debug(5, "All low-Level Attributes: "./** @scrutinizer ignore-type */ print_r($attributesLowLevel, true)); |
|
111 | 111 | |
112 | 112 | // now fetch and merge profile-level attributes if not already set on deeper level |
113 | 113 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - $this->loggerInstance->debug(5, "Merged Attributes: " . /** @scrutinizer ignore-type */ print_r($attributesLowLevel, true)); |
|
140 | + $this->loggerInstance->debug(5, "Merged Attributes: "./** @scrutinizer ignore-type */ print_r($attributesLowLevel, true)); |
|
141 | 141 | |
142 | 142 | // now, fetch and merge IdP-wide attributes |
143 | 143 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // add the internal attribute to that effect |
153 | 153 | |
154 | 154 | if (isset($this->attributes['media:openroaming_always'])) { |
155 | - $this->attributes = array_merge($this->attributes, $this->addInternalAttributes([ "internal:openroaming" => TRUE ] )); |
|
155 | + $this->attributes = array_merge($this->attributes, $this->addInternalAttributes(["internal:openroaming" => TRUE])); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | $this->loggerInstance->debug(3, "--- END Constructing new Profile object ... ---\n"); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | "row" => $attributeQuery->row, |
201 | 201 | "flag" => $optinfo['flag'], |
202 | 202 | "device" => ($devicesOrEAPMethods == "DEVICES" ? $attributeQuery->deviceormethod : NULL), |
203 | - "eapmethod" => ($devicesOrEAPMethods == "DEVICES" ? 0 : (new \core\common\EAP($attributeQuery->deviceormethod))->getArrayRep() )]; |
|
203 | + "eapmethod" => ($devicesOrEAPMethods == "DEVICES" ? 0 : (new \core\common\EAP($attributeQuery->deviceormethod))->getArrayRep())]; |
|
204 | 204 | } |
205 | 205 | return $temparray; |
206 | 206 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function setAnonymousIDSupport($shallwe) |
311 | 311 | { |
312 | - $this->databaseHandle->exec("UPDATE profile SET use_anon_outer = " . ($shallwe === true ? "1" : "0") . " WHERE profile_id = $this->identifier"); |
|
312 | + $this->databaseHandle->exec("UPDATE profile SET use_anon_outer = ".($shallwe === true ? "1" : "0")." WHERE profile_id = $this->identifier"); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** Toggle special username for realm checks |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return void |
320 | 320 | */ |
321 | 321 | public function setRealmCheckUser($shallwe, $localpart = NULL) { |
322 | - $this->databaseHandle->exec("UPDATE profile SET checkuser_outer = " . ($shallwe === true ? "1" : "0") . " WHERE profile_id = $this->identifier"); |
|
322 | + $this->databaseHandle->exec("UPDATE profile SET checkuser_outer = ".($shallwe === true ? "1" : "0")." WHERE profile_id = $this->identifier"); |
|
323 | 323 | if ($localpart !== NULL) { |
324 | 324 | $this->databaseHandle->exec("UPDATE profile SET checkuser_value = ? WHERE profile_id = $this->identifier", "s", $localpart); |
325 | 325 | } |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function setInputVerificationPreference($verify, $hint) |
336 | 336 | { |
337 | - $this->databaseHandle->exec("UPDATE profile SET verify_userinput_suffix = " . ($verify === true ? "1" : "0") . |
|
338 | - ", hint_userinput_suffix = " . ($hint === true ? "1" : "0") . |
|
337 | + $this->databaseHandle->exec("UPDATE profile SET verify_userinput_suffix = ".($verify === true ? "1" : "0"). |
|
338 | + ", hint_userinput_suffix = ".($hint === true ? "1" : "0"). |
|
339 | 339 | " WHERE profile_id = $this->identifier"); |
340 | 340 | } |
341 | 341 |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | case "EXTERNAL": |
63 | 63 | case "FRONTEND": |
64 | 64 | case "DIAGNOSTICS": |
65 | - if (!isset(self::${"instance" . $theDb})) { |
|
65 | + if (!isset(self::${"instance".$theDb})) { |
|
66 | 66 | $class = __CLASS__; |
67 | - self::${"instance" . $theDb} = new $class($database); |
|
68 | - DBConnection::${"instance" . $theDb}->databaseInstance = $theDb; |
|
67 | + self::${"instance".$theDb} = new $class($database); |
|
68 | + DBConnection::${"instance".$theDb}->databaseInstance = $theDb; |
|
69 | 69 | } |
70 | - return self::${"instance" . $theDb}; |
|
70 | + return self::${"instance".$theDb}; |
|
71 | 71 | case "RADIUS": |
72 | - if (!isset(self::${"instance" . $theDb})) { |
|
72 | + if (!isset(self::${"instance".$theDb})) { |
|
73 | 73 | $class = __CLASS__; |
74 | 74 | foreach (\config\ConfAssistant::DB as $name => $oneRadiusAuthDb) { |
75 | 75 | $theInstance = new $class($name); |
76 | - self::${"instance" . $theDb}[] = $theInstance; |
|
76 | + self::${"instance".$theDb}[] = $theInstance; |
|
77 | 77 | $theInstance->databaseInstance = $theDb; |
78 | 78 | } |
79 | 79 | } |
80 | - return self::${"instance" . $theDb}; |
|
80 | + return self::${"instance".$theDb}; |
|
81 | 81 | default: |
82 | - throw new Exception("This type of database (" . strtoupper($database) . ") is not known!"); |
|
82 | + throw new Exception("This type of database (".strtoupper($database).") is not known!"); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | } |
122 | 122 | } |
123 | 123 | // log exact query to debug log, if log level is at 5 |
124 | - $this->loggerInstance->debug(5, "DB ATTEMPT: " . $querystring . "\n"); |
|
124 | + $this->loggerInstance->debug(5, "DB ATTEMPT: ".$querystring."\n"); |
|
125 | 125 | if ($types !== NULL) { |
126 | - $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: " . /** @scrutinizer ignore-type */ print_r($arguments, true)); |
|
126 | + $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: "./** @scrutinizer ignore-type */ print_r($arguments, true)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if ($this->connection->connect_error) { |
130 | - throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number" . $this->connection->connect_error . ")!"); |
|
130 | + throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number".$this->connection->connect_error.")!"); |
|
131 | 131 | } |
132 | 132 | if ($types === NULL) { |
133 | 133 | $result = $this->connection->query($querystring); |
134 | 134 | if ($result === FALSE) { |
135 | - throw new Exception("DB: Unable to execute simple statement! Error was --> " . $this->connection->error . " <--"); |
|
135 | + throw new Exception("DB: Unable to execute simple statement! Error was --> ".$this->connection->error." <--"); |
|
136 | 136 | } |
137 | 137 | } else { |
138 | 138 | // fancy! prepared statement with dedicated argument list |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | $prepResult = $statementObject->prepare($querystring); |
150 | 150 | if ($prepResult === FALSE) { |
151 | - throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> " . $statementObject->error . " <--."); |
|
151 | + throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> ".$statementObject->error." <--."); |
|
152 | 152 | } |
153 | 153 | $this->preparedStatements[$querystring] = $statementObject; |
154 | 154 | } |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | array_unshift($localArray, $types); |
162 | 162 | $retval = call_user_func_array([$statementObject, "bind_param"], $localArray); |
163 | 163 | if ($retval === FALSE) { |
164 | - throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> " . var_export($localArray, TRUE) . " <--. Error was --> " . $statementObject->error . " <--"); |
|
164 | + throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> ".var_export($localArray, TRUE)." <--. Error was --> ".$statementObject->error." <--"); |
|
165 | 165 | } |
166 | 166 | $result = $statementObject->execute(); |
167 | 167 | if ($result === FALSE) { |
168 | - throw new Exception("DB: Unable to execute prepared statement! Error was --> " . $statementObject->error . " <--"); |
|
168 | + throw new Exception("DB: Unable to execute prepared statement! Error was --> ".$statementObject->error." <--"); |
|
169 | 169 | } |
170 | 170 | $selectResult = $statementObject->get_result(); |
171 | 171 | if ($selectResult !== FALSE) { |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | |
176 | 176 | // all cases where $result could be FALSE have been caught earlier |
177 | 177 | if ($this->connection->errno) { |
178 | - throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was " . $this->connection->errno . "!"); |
|
178 | + throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was ".$this->connection->errno."!"); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
182 | 182 | if ($isMoreThanSelect) { |
183 | - $this->loggerInstance->writeSQLAudit("[DB: " . strtoupper($this->databaseInstance) . "] " . $querystring); |
|
183 | + $this->loggerInstance->writeSQLAudit("[DB: ".strtoupper($this->databaseInstance)."] ".$querystring); |
|
184 | 184 | if ($types !== NULL) { |
185 | - $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: " . /** @scrutinizer ignore-type */ print_r($arguments, true)); |
|
185 | + $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: "./** @scrutinizer ignore-type */ print_r($arguments, true)); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | return $result; |
@@ -277,13 +277,13 @@ discard block |
||
277 | 277 | if (isset(\config\Master::DB[$databaseCapitalised])) { |
278 | 278 | $this->connection = new \mysqli(\config\Master::DB[$databaseCapitalised]['host'], \config\Master::DB[$databaseCapitalised]['user'], \config\Master::DB[$databaseCapitalised]['pass'], \config\Master::DB[$databaseCapitalised]['db']); |
279 | 279 | if ($this->connection->connect_error) { |
280 | - throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ")."); |
|
280 | + throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.")."); |
|
281 | 281 | } |
282 | 282 | $this->readOnly = \config\Master::DB[$databaseCapitalised]['readonly']; |
283 | 283 | } else { // one of the RADIUS DBs |
284 | 284 | $this->connection = new \mysqli(\config\ConfAssistant::DB[$databaseCapitalised]['host'], \config\ConfAssistant::DB[$databaseCapitalised]['user'], \config\ConfAssistant::DB[$databaseCapitalised]['pass'], \config\ConfAssistant::DB[$databaseCapitalised]['db']); |
285 | 285 | if ($this->connection->connect_error) { |
286 | - throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ")."); |
|
286 | + throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.")."); |
|
287 | 287 | } |
288 | 288 | $this->readOnly = \config\ConfAssistant::DB[$databaseCapitalised]['readonly']; |
289 | 289 | } |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | class CertificationAuthorityEduPkiServer extends EntityWithDBProperties implements CertificationAuthorityInterface |
18 | 18 | { |
19 | 19 | |
20 | - private const LOCATION_RA_CERT = ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
21 | - private const LOCATION_RA_KEY = ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.clearkey"; |
|
22 | - private const LOCATION_WEBROOT = ROOT . "/config/SilverbulletClientCerts/eduPKI-webserver-root.pem"; |
|
20 | + private const LOCATION_RA_CERT = ROOT."/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
21 | + private const LOCATION_RA_KEY = ROOT."/config/SilverbulletClientCerts/edupki-test-ra.clearkey"; |
|
22 | + private const LOCATION_WEBROOT = ROOT."/config/SilverbulletClientCerts/eduPKI-webserver-root.pem"; |
|
23 | 23 | private const EDUPKI_RA_ID = 700; |
24 | 24 | private const EDUPKI_CERT_PROFILE = "Radius Server SOAP"; |
25 | 25 | private const EDUPKI_RA_PKEY_PASSPHRASE = "..."; |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | parent::__construct(); |
36 | 36 | |
37 | 37 | if (stat(CertificationAuthorityEduPkiServer::LOCATION_RA_CERT) === FALSE) { |
38 | - throw new Exception("RA operator PEM file not found: " . CertificationAuthorityEduPkiServer::LOCATION_RA_CERT); |
|
38 | + throw new Exception("RA operator PEM file not found: ".CertificationAuthorityEduPkiServer::LOCATION_RA_CERT); |
|
39 | 39 | } |
40 | 40 | if (stat(CertificationAuthorityEduPkiServer::LOCATION_RA_KEY) === FALSE) { |
41 | - throw new Exception("RA operator private key file not found: " . CertificationAuthorityEduPkiServer::LOCATION_RA_KEY); |
|
41 | + throw new Exception("RA operator private key file not found: ".CertificationAuthorityEduPkiServer::LOCATION_RA_KEY); |
|
42 | 42 | } |
43 | 43 | if (stat(CertificationAuthorityEduPkiServer::LOCATION_WEBROOT) === FALSE) { |
44 | - throw new Exception("CA website root CA file not found: " . CertificationAuthorityEduPkiServer::LOCATION_WEBROOT); |
|
44 | + throw new Exception("CA website root CA file not found: ".CertificationAuthorityEduPkiServer::LOCATION_WEBROOT); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -99,19 +99,19 @@ discard block |
||
99 | 99 | // initialise connection to eduPKI CA / eduroam RA and send the request to them |
100 | 100 | try { |
101 | 101 | $altArray = [# Array mit den Subject Alternative Names |
102 | - "email:" . $csr["USERMAIL"] |
|
102 | + "email:".$csr["USERMAIL"] |
|
103 | 103 | ]; |
104 | 104 | $soapPub = $this->initEduPKISoapSession("PUBLIC"); |
105 | 105 | $this->loggerInstance->debug(5, "FIRST ACTUAL SOAP REQUEST (Public, newRequest)!\n"); |
106 | - $this->loggerInstance->debug(5, "PARAM_1: " . CertificationAuthorityEduPkiServer::EDUPKI_RA_ID . "\n"); |
|
107 | - $this->loggerInstance->debug(5, "PARAM_2: " . $csr["CSR_STRING"] . "\n"); |
|
106 | + $this->loggerInstance->debug(5, "PARAM_1: ".CertificationAuthorityEduPkiServer::EDUPKI_RA_ID."\n"); |
|
107 | + $this->loggerInstance->debug(5, "PARAM_2: ".$csr["CSR_STRING"]."\n"); |
|
108 | 108 | $this->loggerInstance->debug(5, "PARAM_3: "); |
109 | 109 | $this->loggerInstance->debug(5, $altArray); |
110 | - $this->loggerInstance->debug(5, "PARAM_4: " . CertificationAuthorityEduPkiServer::EDUPKI_CERT_PROFILE . "\n"); |
|
111 | - $this->loggerInstance->debug(5, "PARAM_5: " . sha1("notused") . "\n"); |
|
112 | - $this->loggerInstance->debug(5, "PARAM_6: " . $csr["USERNAME"] . "\n"); |
|
113 | - $this->loggerInstance->debug(5, "PARAM_7: " . $csr["USERMAIL"] . "\n"); |
|
114 | - $this->loggerInstance->debug(5, "PARAM_8: " . ProfileSilverbullet::PRODUCTNAME . "\n"); |
|
110 | + $this->loggerInstance->debug(5, "PARAM_4: ".CertificationAuthorityEduPkiServer::EDUPKI_CERT_PROFILE."\n"); |
|
111 | + $this->loggerInstance->debug(5, "PARAM_5: ".sha1("notused")."\n"); |
|
112 | + $this->loggerInstance->debug(5, "PARAM_6: ".$csr["USERNAME"]."\n"); |
|
113 | + $this->loggerInstance->debug(5, "PARAM_7: ".$csr["USERMAIL"]."\n"); |
|
114 | + $this->loggerInstance->debug(5, "PARAM_8: ".ProfileSilverbullet::PRODUCTNAME."\n"); |
|
115 | 115 | $this->loggerInstance->debug(5, "PARAM_9: false\n"); |
116 | 116 | $soapNewRequest = $soapPub->newRequest( |
117 | 117 | CertificationAuthorityEduPkiServer::EDUPKI_RA_ID, # RA-ID |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | } catch (Exception $e) { |
134 | 134 | // PHP 7.1 can do this much better |
135 | 135 | if (is_soap_fault($e)) { |
136 | - throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: { |
|
136 | + throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: { |
|
137 | 137 | $e->faultstring |
138 | 138 | }\n"); |
139 | 139 | } |
140 | - throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage()); |
|
140 | + throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage()); |
|
141 | 141 | } |
142 | 142 | try { |
143 | 143 | $soap = $this->initEduPKISoapSession("RA"); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file |
172 | 172 | // rather than just using the string. Grr. |
173 | 173 | $tempdir = \core\common\Entity::createTemporaryDirectory("test"); |
174 | - file_put_contents($tempdir['dir'] . "/content.txt", $soapCleartext); |
|
174 | + file_put_contents($tempdir['dir']."/content.txt", $soapCleartext); |
|
175 | 175 | // retrieve our RA cert from filesystem |
176 | 176 | // the RA certificates are not needed right now because we |
177 | 177 | // have resorted to S/MIME signatures with openssl command-line |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | // sign the data, using cmdline because openssl_pkcs7_sign produces strange results |
184 | 184 | // -binary didn't help, nor switch -md to sha1 sha256 or sha512 |
185 | 185 | $this->loggerInstance->debug(5, "Actual content to be signed is this:\n $soapCleartext\n"); |
186 | - $execCmd = \config\Master::PATHS['openssl'] . " smime -sign -binary -in " . $tempdir['dir'] . "/content.txt -out " . $tempdir['dir'] . "/signature.txt -outform pem -inkey " . ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.clearkey -signer " . ROOT . "/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
186 | + $execCmd = \config\Master::PATHS['openssl']." smime -sign -binary -in ".$tempdir['dir']."/content.txt -out ".$tempdir['dir']."/signature.txt -outform pem -inkey ".ROOT."/config/SilverbulletClientCerts/edupki-test-ra.clearkey -signer ".ROOT."/config/SilverbulletClientCerts/edupki-test-ra.pem"; |
|
187 | 187 | $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n"); |
188 | 188 | $output = []; |
189 | 189 | $return = 999; |
@@ -192,21 +192,21 @@ discard block |
||
192 | 192 | throw new Exception("Non-zero return value from openssl smime!"); |
193 | 193 | } |
194 | 194 | // and get the signature blob back from the filesystem |
195 | - $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt")); |
|
195 | + $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt")); |
|
196 | 196 | $this->loggerInstance->debug(5, "Request for server approveRequest has parameters:\n"); |
197 | - $this->loggerInstance->debug(5, $soapReqnum . "\n"); |
|
198 | - $this->loggerInstance->debug(5, $soapCleartext . "\n"); // PHP magically encodes this as base64 while sending! |
|
199 | - $this->loggerInstance->debug(5, $detachedSig . "\n"); |
|
197 | + $this->loggerInstance->debug(5, $soapReqnum."\n"); |
|
198 | + $this->loggerInstance->debug(5, $soapCleartext."\n"); // PHP magically encodes this as base64 while sending! |
|
199 | + $this->loggerInstance->debug(5, $detachedSig."\n"); |
|
200 | 200 | $soapIssueCert = $soap->approveRequest($soapReqnum, $soapCleartext, $detachedSig); |
201 | - $this->loggerInstance->debug(5, "approveRequest Request was: \n" . $soap->__getLastRequest()); |
|
202 | - $this->loggerInstance->debug(5, "approveRequest Response was: \n" . $soap->__getLastResponse()); |
|
201 | + $this->loggerInstance->debug(5, "approveRequest Request was: \n".$soap->__getLastRequest()); |
|
202 | + $this->loggerInstance->debug(5, "approveRequest Response was: \n".$soap->__getLastResponse()); |
|
203 | 203 | if ($soapIssueCert === FALSE) { |
204 | 204 | throw new Exception("The locally approved request was NOT processed by the CA."); |
205 | 205 | } |
206 | 206 | } catch (SoapFault $e) { |
207 | - throw new Exception("SoapFault: Error when sending or receiving SOAP message: " . "{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
207 | + throw new Exception("SoapFault: Error when sending or receiving SOAP message: "."{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
208 | 208 | } catch (Exception $e) { |
209 | - throw new Exception("Exception: Something odd happened between the SOAP requests:" . $e->getMessage()); |
|
209 | + throw new Exception("Exception: Something odd happened between the SOAP requests:".$e->getMessage()); |
|
210 | 210 | } |
211 | 211 | return $soapReqnum; |
212 | 212 | } |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | throw new Exception("CAInfo has no root certificate for us!"); |
259 | 259 | } |
260 | 260 | } catch (SoapFault $e) { |
261 | - throw new Exception("SoapFault: Error when sending or receiving SOAP message: " . "{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
261 | + throw new Exception("SoapFault: Error when sending or receiving SOAP message: "."{$e->faultcode}: {$e->faultname}: {$e->faultstring}: {$e->faultactor}: {$e->detail}: {$e->headerfault}\n"); |
|
262 | 262 | } catch (Exception $e) { |
263 | - throw new Exception("Exception: Something odd happened between the SOAP requests:" . $e->getMessage()); |
|
263 | + throw new Exception("Exception: Something odd happened between the SOAP requests:".$e->getMessage()); |
|
264 | 264 | } |
265 | 265 | return [ |
266 | 266 | "CERT" => openssl_x509_read($parsedCert['pem']), |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | // for obnoxious reasons, we have to dump the request into a file and let pkcs7_sign read from the file |
294 | 294 | // rather than just using the string. Grr. |
295 | 295 | $tempdir = \core\common\Entity::createTemporaryDirectory("test"); |
296 | - file_put_contents($tempdir['dir'] . "/content.txt", $soapRawRevRequest); |
|
296 | + file_put_contents($tempdir['dir']."/content.txt", $soapRawRevRequest); |
|
297 | 297 | // retrieve our RA cert from filesystem |
298 | 298 | // sign the data, using cmdline because openssl_pkcs7_sign produces strange results |
299 | 299 | // -binary didn't help, nor switch -md to sha1 sha256 or sha512 |
300 | 300 | $this->loggerInstance->debug(5, "Actual content to be signed is this:\n$soapRawRevRequest\n"); |
301 | - $execCmd = \config\Master::PATHS['openssl'] . " smime -sign -binary -in " . $tempdir['dir'] . "/content.txt -out " . $tempdir['dir'] . "/signature.txt -outform pem -inkey " . CertificationAuthorityEduPkiServer::LOCATION_RA_KEY . " -signer " . CertificationAuthorityEduPkiServer::LOCATION_RA_CERT; |
|
301 | + $execCmd = \config\Master::PATHS['openssl']." smime -sign -binary -in ".$tempdir['dir']."/content.txt -out ".$tempdir['dir']."/signature.txt -outform pem -inkey ".CertificationAuthorityEduPkiServer::LOCATION_RA_KEY." -signer ".CertificationAuthorityEduPkiServer::LOCATION_RA_CERT; |
|
302 | 302 | $this->loggerInstance->debug(2, "Calling openssl smime with following cmdline: $execCmd\n"); |
303 | 303 | $output = []; |
304 | 304 | $return = 999; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | throw new Exception("Non-zero return value from openssl smime!"); |
308 | 308 | } |
309 | 309 | // and get the signature blob back from the filesystem |
310 | - $detachedSig = trim(file_get_contents($tempdir['dir'] . "/signature.txt")); |
|
310 | + $detachedSig = trim(file_get_contents($tempdir['dir']."/signature.txt")); |
|
311 | 311 | $soapIssueRev = $soap->approveRevocationRequest($soapRevocationSerial, $soapRawRevRequest, $detachedSig); |
312 | 312 | if ($soapIssueRev === FALSE) { |
313 | 313 | throw new Exception("The locally approved revocation request was NOT processed by the CA."); |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | } catch (Exception $e) { |
316 | 316 | // PHP 7.1 can do this much better |
317 | 317 | if (is_soap_fault($e)) { |
318 | - throw new Exception("Error when sending SOAP request: " . "{$e->faultcode}: {$e->faultstring}\n"); |
|
318 | + throw new Exception("Error when sending SOAP request: "."{$e->faultcode}: {$e->faultstring}\n"); |
|
319 | 319 | } |
320 | - throw new Exception("Something odd happened while doing the SOAP request:" . $e->getMessage()); |
|
320 | + throw new Exception("Something odd happened while doing the SOAP request:".$e->getMessage()); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function soapToXmlInteger($x) |
419 | 419 | { |
420 | - return '<' . $x[0] . '>' |
|
420 | + return '<'.$x[0].'>' |
|
421 | 421 | . htmlentities($x[1], ENT_NOQUOTES | ENT_XML1) |
422 | - . '</' . $x[0] . '>'; |
|
422 | + . '</'.$x[0].'>'; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
@@ -438,9 +438,9 @@ discard block |
||
438 | 438 | // dump private key into directory |
439 | 439 | $outstring = ""; |
440 | 440 | openssl_pkey_export($privateKey, $outstring); |
441 | - file_put_contents($tempdir . "/pkey.pem", $outstring); |
|
441 | + file_put_contents($tempdir."/pkey.pem", $outstring); |
|
442 | 442 | // PHP can only do one DC in the Subject. But we need three. |
443 | - $execCmd = \config\Master::PATHS['openssl'] . " req -new -sha256 -key $tempdir/pkey.pem -out $tempdir/request.csr -subj /DC=test/DC=test/DC=eduroam/C=$fed/O=" . \config\ConfAssistant::CONSORTIUM['name'] . "/OU=$fed/CN=$username/emailAddress=$username"; |
|
443 | + $execCmd = \config\Master::PATHS['openssl']." req -new -sha256 -key $tempdir/pkey.pem -out $tempdir/request.csr -subj /DC=test/DC=test/DC=eduroam/C=$fed/O=".\config\ConfAssistant::CONSORTIUM['name']."/OU=$fed/CN=$username/emailAddress=$username"; |
|
444 | 444 | $this->loggerInstance->debug(2, "Calling openssl req with following cmdline: $execCmd\n"); |
445 | 445 | $output = []; |
446 | 446 | $return = 999; |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | class CertificationAuthorityEmbeddedRSA extends EntityWithDBProperties implements CertificationAuthorityInterface |
17 | 17 | { |
18 | 18 | |
19 | - private const LOCATION_ROOT_CA = ROOT . "/config/SilverbulletClientCerts/rootca-RSA.pem"; |
|
20 | - private const LOCATION_ISSUING_CA = ROOT . "/config/SilverbulletClientCerts/real-RSA.pem"; |
|
21 | - private const LOCATION_ISSUING_KEY = ROOT . "/config/SilverbulletClientCerts/real-RSA.key"; |
|
22 | - private const LOCATION_CONFIG = ROOT . "/config/SilverbulletClientCerts/openssl-RSA.cnf"; |
|
19 | + private const LOCATION_ROOT_CA = ROOT."/config/SilverbulletClientCerts/rootca-RSA.pem"; |
|
20 | + private const LOCATION_ISSUING_CA = ROOT."/config/SilverbulletClientCerts/real-RSA.pem"; |
|
21 | + private const LOCATION_ISSUING_KEY = ROOT."/config/SilverbulletClientCerts/real-RSA.key"; |
|
22 | + private const LOCATION_CONFIG = ROOT."/config/SilverbulletClientCerts/openssl-RSA.cnf"; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * string with the PEM variant of the root CA |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | parent::__construct(); |
67 | 67 | $this->rootPem = file_get_contents(CertificationAuthorityEmbeddedRSA::LOCATION_ROOT_CA); |
68 | 68 | if ($this->rootPem === FALSE) { |
69 | - throw new Exception("Root CA PEM file not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_ROOT_CA); |
|
69 | + throw new Exception("Root CA PEM file not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_ROOT_CA); |
|
70 | 70 | } |
71 | 71 | $this->issuingCertRaw = file_get_contents(CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA); |
72 | 72 | if ($this->issuingCertRaw === FALSE) { |
73 | - throw new Exception("Issuing CA PEM file not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA); |
|
73 | + throw new Exception("Issuing CA PEM file not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA); |
|
74 | 74 | } |
75 | 75 | $rootParsed = openssl_x509_read($this->rootPem); |
76 | 76 | $issuingCertCandidate = openssl_x509_read($this->issuingCertRaw); |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | } |
81 | 81 | $this->issuingCert = $issuingCertCandidate; |
82 | 82 | if (stat(CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY) === FALSE) { |
83 | - throw new Exception("Private key not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY); |
|
83 | + throw new Exception("Private key not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY); |
|
84 | 84 | } |
85 | - $issuingKeyTemp = openssl_pkey_get_private("file://" . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY); |
|
85 | + $issuingKeyTemp = openssl_pkey_get_private("file://".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY); |
|
86 | 86 | if ($issuingKeyTemp === FALSE || is_resource($issuingKeyTemp)) { |
87 | 87 | throw new Exception("The private key did not parse correctly (or is not a PHP8 object)!"); |
88 | 88 | } |
89 | 89 | $this->issuingKey = $issuingKeyTemp; |
90 | 90 | if (stat(CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG) === FALSE) { |
91 | - throw new Exception("openssl configuration not found: " . CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG); |
|
91 | + throw new Exception("openssl configuration not found: ".CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG); |
|
92 | 92 | } |
93 | 93 | $this->conffile = CertificationAuthorityEmbeddedRSA::LOCATION_CONFIG; |
94 | 94 | } |
@@ -131,27 +131,27 @@ discard block |
||
131 | 131 | // generate stub index.txt file |
132 | 132 | $tempdirArray = \core\common\Entity::createTemporaryDirectory("test"); |
133 | 133 | $tempdir = $tempdirArray['dir']; |
134 | - $nowIndexTxt = (new \DateTime())->format("ymdHis") . "Z"; |
|
135 | - $expiryIndexTxt = $originalExpiry->format("ymdHis") . "Z"; |
|
134 | + $nowIndexTxt = (new \DateTime())->format("ymdHis")."Z"; |
|
135 | + $expiryIndexTxt = $originalExpiry->format("ymdHis")."Z"; |
|
136 | 136 | // serials for our CA are always integers |
137 | 137 | $serialHex = strtoupper(dechex((int) $cert->serial)); |
138 | 138 | if (strlen($serialHex) % 2 == 1) { |
139 | - $serialHex = "0" . $serialHex; |
|
139 | + $serialHex = "0".$serialHex; |
|
140 | 140 | } |
141 | 141 | |
142 | - $indexStatement = "$certstatus\t$expiryIndexTxt\t" . ($certstatus == "R" ? "$nowIndexTxt,unspecified" : "") . "\t$serialHex\tunknown\t/O=" . \config\ConfAssistant::CONSORTIUM['name'] . "/OU=$federation/CN=$cert->username\n"; |
|
142 | + $indexStatement = "$certstatus\t$expiryIndexTxt\t".($certstatus == "R" ? "$nowIndexTxt,unspecified" : "")."\t$serialHex\tunknown\t/O=".\config\ConfAssistant::CONSORTIUM['name']."/OU=$federation/CN=$cert->username\n"; |
|
143 | 143 | $this->loggerInstance->debug(4, "index.txt contents-to-be: $indexStatement"); |
144 | - if (!file_put_contents($tempdir . "/index.txt", $indexStatement)) { |
|
144 | + if (!file_put_contents($tempdir."/index.txt", $indexStatement)) { |
|
145 | 145 | $this->loggerInstance->debug(1, "Unable to write openssl index.txt file for revocation handling!"); |
146 | 146 | } |
147 | 147 | // index.txt.attr is dull but needs to exist |
148 | - file_put_contents($tempdir . "/index.txt.attr", "unique_subject = yes\n"); |
|
148 | + file_put_contents($tempdir."/index.txt.attr", "unique_subject = yes\n"); |
|
149 | 149 | // call "openssl ocsp" to manufacture our own OCSP statement |
150 | 150 | // adding "-rmd sha1" to the following command-line makes the |
151 | 151 | // choice of signature algorithm for the response explicit |
152 | 152 | // but it's only available from openssl-1.1.0 (which we do not |
153 | 153 | // want to require just for that one thing). |
154 | - $execCmd = \config\Master::PATHS['openssl'] . " ocsp -issuer " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA . " -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA . " -rsigner " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA . " -rkey " . CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY . " -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der"; |
|
154 | + $execCmd = \config\Master::PATHS['openssl']." ocsp -issuer ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA." -sha1 -ndays 10 -no_nonce -serial 0x$serialHex -CA ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA." -rsigner ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_CA." -rkey ".CertificationAuthorityEmbeddedRSA::LOCATION_ISSUING_KEY." -index $tempdir/index.txt -no_cert_verify -respout $tempdir/$serialHex.response.der"; |
|
155 | 155 | $this->loggerInstance->debug(2, "Calling openssl ocsp with following cmdline: $execCmd\n"); |
156 | 156 | $output = []; |
157 | 157 | $return = 999; |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | if ($return !== 0) { |
160 | 160 | throw new Exception("Non-zero return value from openssl ocsp!"); |
161 | 161 | } |
162 | - $ocsp = file_get_contents($tempdir . "/$serialHex.response.der"); |
|
162 | + $ocsp = file_get_contents($tempdir."/$serialHex.response.der"); |
|
163 | 163 | // remove the temp dir! |
164 | - unlink($tempdir . "/$serialHex.response.der"); |
|
165 | - unlink($tempdir . "/index.txt.attr"); |
|
166 | - unlink($tempdir . "/index.txt"); |
|
164 | + unlink($tempdir."/$serialHex.response.der"); |
|
165 | + unlink($tempdir."/index.txt.attr"); |
|
166 | + unlink($tempdir."/index.txt"); |
|
167 | 167 | rmdir($tempdir); |
168 | 168 | $this->databaseHandle->exec("UPDATE silverbullet_certificate SET OCSP = ?, OCSP_timestamp = NOW() WHERE serial_number = ?", "si", $ocsp, $cert->serial); |
169 | 169 | return $ocsp; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | ?> |
23 | 23 | <?php |
24 | 24 | |
25 | -require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"; |
|
25 | +require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php"; |
|
26 | 26 | |
27 | 27 | $validator = new \web\lib\common\InputValidation(); |
28 | 28 | $idRaw = $_GET["id"] ?? ""; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // Set data type and caching for 30 days |
38 | 38 | $info = new finfo(); |
39 | 39 | $filetype = $info->buffer($finalBlob, FILEINFO_MIME_TYPE); |
40 | - header("Content-type: " . $filetype); |
|
40 | + header("Content-type: ".$filetype); |
|
41 | 41 | |
42 | 42 | switch ($filetype) { |
43 | 43 | case "text/rtf": // fall-through, same treatment |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | header("Cache-Control: must-revalidate"); |
55 | 55 | $offset = 60 * 60 * 24 * 30; |
56 | 56 | // gmdate can't possibly fail, because it operates on time() and an integer offset |
57 | - $ExpStr = "Expires: " . /** @scrutinizer ignore-type */ gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"; |
|
57 | + $ExpStr = "Expires: "./** @scrutinizer ignore-type */ gmdate("D, d M Y H:i:s", time() + $offset)." GMT"; |
|
58 | 58 | header($ExpStr); |
59 | 59 | // Print out the image |
60 | 60 | echo $finalBlob; |