This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||
2 | /* |
||
3 | * ***************************************************************************** |
||
4 | * Contributions to this work were made on behalf of the GÉANT project, a |
||
5 | * project that has received funding from the European Union’s Framework |
||
6 | * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus), |
||
7 | * Horizon 2020 research and innovation programme under Grant Agreements No. |
||
8 | * 691567 (GN4-1) and No. 731122 (GN4-2). |
||
9 | * On behalf of the aforementioned projects, GEANT Association is the sole owner |
||
10 | * of the copyright in all material which was developed by a member of the GÉANT |
||
11 | * project. GÉANT Vereniging (Association) is registered with the Chamber of |
||
12 | * Commerce in Amsterdam with registration number 40535155 and operates in the |
||
13 | * UK as a branch of GÉANT Vereniging. |
||
14 | * |
||
15 | * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. |
||
16 | * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK |
||
17 | * |
||
18 | * License: see the web/copyright.inc.php file in the file structure or |
||
19 | * <base_url>/copyright.php after deploying the software |
||
20 | */ |
||
21 | |||
22 | /** |
||
23 | * This page is used to edit a RADIUS profile by its administrator. |
||
24 | * |
||
25 | * @author Stefan Winter <[email protected]> |
||
26 | * @author Maja Gorecka-Wolniewicz <[email protected]> |
||
27 | */ |
||
28 | ?> |
||
29 | <?php |
||
30 | require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
||
31 | |||
32 | |||
33 | $deco = new \web\lib\admin\PageDecoration(); |
||
34 | $validator = new \web\lib\common\InputValidation(); |
||
35 | $uiElements = new web\lib\admin\UIElements(); |
||
36 | // initialize inputs |
||
37 | $my_inst = $validator->existingIdP($_GET['inst_id'], $_SESSION['user']); |
||
38 | $myfed = new \core\Federation($my_inst->federation); |
||
39 | if (!isset($_GET['deployment_id'])) { |
||
40 | /*if (isset($_POST['consortium']) && ( $_POST['consortium'] == "eduroam" || |
||
41 | ( $_POST['consortium'] == "OpenRoaming" && count($myfed->getAttributes("fed:openroaming")) > 0 ) |
||
42 | ) |
||
43 | ) {*/ |
||
44 | if (isset($_POST['consortium']) && $_POST['consortium'] == "eduroam") |
||
45 | { |
||
46 | $deployment = $my_inst->newDeployment(\core\AbstractDeployment::DEPLOYMENTTYPE_MANAGED, $_POST['consortium']); |
||
47 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier . '#profilebox_' . $deployment->identifier); |
||
48 | exit(0); |
||
49 | } else { |
||
50 | throw new Exception("Desired consortium for Managed SP needs to be specified, and allowed!"); |
||
51 | } |
||
52 | } |
||
53 | |||
54 | // if we have come this far, we are editing an existing deployment |
||
55 | |||
56 | $deployment = $validator->existingDeploymentManaged($_GET['deployment_id'], $my_inst); |
||
57 | if (isset($_POST['submitbutton'])) { |
||
58 | switch ($_POST['submitbutton']) { |
||
59 | case web\lib\common\FormElements::BUTTON_TERMSOFUSE_NEEDACCEPTANCE: |
||
60 | if (count($deployment->getAttributes("hiddenmanagedsp:tou_accepted")) == 0) { |
||
61 | //terms of use popup, going interactive |
||
62 | echo $deco->defaultPagePrelude(sprintf(_("%s: %s Terms of Use"), \config\Master::APPEARANCE['productname'], $uiElements->nomenclatureHotspot)); |
||
63 | ?> |
||
64 | </head> |
||
65 | <body> |
||
66 | <?php |
||
67 | echo $deco->productheader("ADMIN-SP"); |
||
68 | ?> |
||
69 | <h1> |
||
70 | <?php |
||
71 | echo _("Terms of Use Acceptance"); |
||
72 | ?> |
||
73 | </h1> |
||
74 | <div id="sb-popup-message" > |
||
75 | <div id="overlay"></div> |
||
76 | <div id="msgbox"> |
||
77 | <div style="top: 100px;"> |
||
78 | <div class="graybox"> |
||
79 | <h1><?php echo sprintf(_("%s - Terms of Use"), core\DeploymentManaged::PRODUCTNAME); ?></h1> |
||
80 | <div class="containerbox" style="position: relative;"> |
||
81 | <hr> |
||
82 | <?php echo $deployment->termsAndConditions; ?> |
||
83 | <hr> |
||
84 | <form enctype='multipart/form-data' action='edit_hotspot.php?inst_id=<?php echo $my_inst->identifier; ?>&deployment_id=<?php echo $deployment->identifier; ?>' method='post' accept-charset='UTF-8'> |
||
85 | <div style="position: relative; padding-bottom: 5px;"> |
||
86 | <input type="checkbox" name="agreement" value="true"> <label><?php echo _("I have read and agree to the terms."); ?></label> |
||
87 | </div> |
||
88 | <button type="submit" name="submitbutton" value="<?php echo \web\lib\common\FormElements::BUTTON_TERMSOFUSE_ACCEPTED ?>"><?php echo _("Continue"); ?></button> |
||
89 | <button class="delete" type="submit" name="command" value="<?php echo \web\lib\common\FormElements::BUTTON_CLOSE ?>"><?php echo _("Abort"); ?></button> |
||
90 | </form> |
||
91 | </div> |
||
92 | </div> |
||
93 | </div> |
||
94 | </div> |
||
95 | </div> |
||
96 | <?php |
||
97 | echo $deco->footer(); |
||
98 | } |
||
99 | exit(0); |
||
100 | case web\lib\common\FormElements::BUTTON_TERMSOFUSE_ACCEPTED: |
||
101 | if (isset($_POST['agreement']) && $_POST['agreement'] == "true") { |
||
102 | $deployment->addAttribute("hiddenmanagedsp:tou_accepted", NULL, 1); |
||
103 | } |
||
104 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier . '#profilebox_' . $deployment->identifier); |
||
105 | exit(0); |
||
106 | case web\lib\common\FormElements::BUTTON_DELETE: |
||
107 | $response = $deployment->setRADIUSconfig(); |
||
108 | if (in_array('OK', $response)) { |
||
109 | $deployment->deactivate(); |
||
110 | } |
||
111 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier . '&' . urldecode(http_build_query($response)) . '#profilebox_' . |
||
112 | $deployment->identifier); |
||
113 | exit(0); |
||
114 | case web\lib\common\FormElements::BUTTON_REMOVESP: |
||
115 | $deployment->remove(); |
||
116 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier); |
||
117 | exit(0); |
||
118 | case web\lib\common\FormElements::BUTTON_RENEWTLS: |
||
119 | $data = openssl_x509_parse($deployment->radsec_cert); |
||
120 | $certdata = array( |
||
121 | $data['serialNumberHex'], |
||
122 | date_create_from_format('ymdGis', substr($data['validTo'], 0, -1))->format('YmdHis') |
||
123 | ); |
||
124 | $torevoke = implode('#', $certdata); |
||
125 | $response = $deployment->setRADIUSconfig(0, 0, $torevoke); |
||
126 | $deployment->renewtls(); |
||
127 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier . '#profilebox_' . $deployment->identifier); |
||
128 | exit(0); |
||
129 | case web\lib\common\FormElements::BUTTON_USECSR: |
||
130 | if (isset($_FILES['upload']) && $_FILES['upload']['size'] > 0) { |
||
131 | $csrpem = file_get_contents($_FILES['upload']['tmp_name']); |
||
132 | if ($csrpem === FALSE) { |
||
133 | // seems we can't work with this file for some reason. Ignore. |
||
134 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier . '&errormsg=NOCSR_' . $deployment->identifier . '#profilebox_' . $deployment->identifier); |
||
135 | exit(0); |
||
136 | } |
||
137 | $csr = new \phpseclib3\File\X509(); |
||
138 | $csr->loadCSR($csrpem); |
||
139 | if ($csr->validateSignature()) { |
||
140 | // valid signature |
||
141 | $data = openssl_x509_parse($deployment->radsec_cert); |
||
142 | $certdata = array( |
||
143 | $data['serialNumberHex'], |
||
144 | date_create_from_format('ymdGis', substr($data['validTo'], 0, -1))->format('YmdHis') |
||
145 | ); |
||
146 | $torevoke = implode('#', $certdata); |
||
147 | $response = $deployment->setRADIUSconfig(0, 0, $torevoke); |
||
148 | $deployment->tlsfromcsr($csr); |
||
149 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier . '#profilebox_' . $deployment->identifier); |
||
150 | exit(0); |
||
151 | } else { |
||
152 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier . '&errormsg=WRONGCSR_' . $deployment->identifier . '#profilebox_' . $deployment->identifier); |
||
153 | exit(0); |
||
154 | } |
||
155 | } |
||
156 | case web\lib\common\FormElements::BUTTON_ACTIVATE: |
||
157 | if (count($deployment->getAttributes("hiddenmanagedsp:tou_accepted")) > 0) { |
||
158 | $response = $deployment->setRADIUSconfig(); |
||
159 | if (in_array('OK', $response)) { |
||
160 | $deployment->activate(); |
||
161 | } |
||
162 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier . '&' . urldecode(http_build_query($response)) . '#profilebox_' . $deployment->identifier); |
||
163 | exit(0); |
||
164 | } else { |
||
165 | throw new Exception("Activate button pushed without acknowledged ToUs!"); |
||
166 | } |
||
167 | case web\lib\common\FormElements::BUTTON_SAVE: |
||
168 | $optionParser = new web\lib\admin\OptionParser(); |
||
169 | $postArray = $_POST; |
||
170 | if (isset($postArray['vlan'])) { |
||
171 | $postArray['option']['S1234567892'] = "managedsp:vlan#int##"; |
||
172 | $postArray['value']['S1234567892-integer'] = $postArray['vlan']; |
||
173 | } |
||
174 | if (isset($postArray['guest_vlan'])) { |
||
175 | $postArray['option']['S1234567890'] = "managedsp:guest_vlan#int##"; |
||
176 | $postArray['value']['S1234567890-integer'] = $postArray['guest_vlan']; |
||
177 | } |
||
178 | if (isset($postArray['opname'])) { |
||
179 | $postArray['option']['S1234567891'] = "managedsp:operatorname#string##"; |
||
180 | $postArray['value']['S1234567891-string'] = $postArray['opname']; |
||
181 | } |
||
182 | $optionParser->processSubmittedFields($deployment, $postArray, $_FILES); |
||
183 | // if ToU were already accepted, keep them (would otherwise be auto-deleted |
||
184 | if (count($deployment->getAttributes("hiddenmanagedsp:tou_accepted")) > 0) { |
||
185 | $deployment->addAttribute("hiddenmanagedsp:tou_accepted", NULL, 1); |
||
186 | } |
||
187 | // reinstantiate object with new values |
||
188 | $deploymentReinstantiated = $validator->existingDeploymentManaged($deployment->identifier, $my_inst); |
||
189 | if ($deploymentReinstantiated->status == core\DeploymentManaged::ACTIVE) { |
||
190 | $deploymentReinstantiated->status = core\DeploymentManaged::INACTIVE; |
||
191 | $response = $deploymentReinstantiated->setRADIUSconfig(); |
||
192 | } else { |
||
193 | $response = ['NOOP', 'NOOP']; |
||
194 | } |
||
195 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier . '&' . urldecode(http_build_query($response)) . '#profilebox_' . $deployment->identifier); |
||
196 | exit(0); |
||
197 | default: |
||
198 | throw new Exception("Unknown button action requested!"); |
||
199 | } |
||
200 | } |
||
201 | if (isset($_POST['command'])) { |
||
202 | switch ($_POST['command']) { |
||
203 | case web\lib\common\FormElements::BUTTON_CLOSE: |
||
204 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier) . '#profilebox_' . $deployment->identifier; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() Are you sure the usage of
header('Location: overvi.... $my_inst->identifier) is correct as it seems to always return null .
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
205 | exit(0); |
||
206 | default: |
||
207 | header("Location: overview_org.php?inst_id=" . $my_inst->identifier . '#profilebox_' . $deployment->identifier); |
||
208 | exit(0); |
||
209 | } |
||
210 | } |
||
211 | $vlan = $deployment->getAttributes("managedsp:vlan")[0]['value'] ?? NULL; |
||
212 | $guest_vlan = $deployment->getAttributes("managedsp:guest_vlan")[0]['value'] ?? NULL; |
||
213 | $opname = $deployment->getAttributes("managedsp:operatorname")[0]['value'] ?? ""; |
||
214 | echo $deco->defaultPagePrelude(sprintf(_("%s: Enrollment Wizard (Step 3)"), \config\Master::APPEARANCE['productname'])); |
||
215 | ?> |
||
216 | <script src="js/XHR.js" type="text/javascript"></script> |
||
217 | <script src="js/option_expand.js" type="text/javascript"></script> |
||
218 | |||
219 | </head> |
||
220 | <body> |
||
221 | <?php |
||
222 | echo $deco->productheader("ADMIN-SP"); |
||
223 | ?> |
||
224 | <h1> |
||
225 | <?php |
||
226 | printf(_("Editing %s deployment"), $uiElements->nomenclatureHotspot); |
||
227 | ?> |
||
228 | </h1> |
||
229 | <?php |
||
230 | echo $uiElements->instLevelInfoBoxes($my_inst); |
||
231 | $deploymentOptions = $deployment->getAttributes(); |
||
232 | echo "<form enctype='multipart/form-data' action='edit_hotspot.php?inst_id=$my_inst->identifier&deployment_id=$deployment->identifier' method='post' accept-charset='UTF-8'> |
||
233 | <input type='hidden' name='MAX_FILE_SIZE' value='" . \config\Master::MAX_UPLOAD_SIZE . "'>"; |
||
234 | $optionDisplay = new \web\lib\admin\OptionDisplay($deploymentOptions, \core\Options::LEVEL_PROFILE); |
||
235 | ?> |
||
236 | <fieldset class='option_container' id='managedsp_override'> |
||
237 | <legend> |
||
238 | <strong> |
||
239 | <?php |
||
240 | $tablecaption = _("Options for this deployment"); |
||
241 | echo $tablecaption; |
||
242 | ?> |
||
243 | </strong> |
||
244 | </legend> |
||
245 | <table> |
||
246 | <caption><?php echo $tablecaption; ?></caption> |
||
247 | <tr> |
||
248 | <th class="wai-invisible" scope="col"><?php echo _("Property Type"); ?></th> |
||
249 | <th class="wai-invisible" scope="col"><?php echo _("Language if applicable"); ?></th> |
||
250 | <th class="wai-invisible" scope="col"><?php echo _("Property Value"); ?></th> |
||
251 | </tr> |
||
252 | <tr> |
||
253 | <!-- input for Operator-Name override--> |
||
254 | <td> |
||
255 | <span id1='opname_label'> |
||
256 | <?php echo _("Custom Operator-Name:"); ?> |
||
257 | </span> |
||
258 | </td> |
||
259 | <td> |
||
260 | <input type='text' width="20" name="opname" value="<?php echo $opname; ?>"/> |
||
261 | </td> |
||
262 | </tr> |
||
263 | <tr> |
||
264 | <!-- input for VLAN identifier for guests--> |
||
265 | <td> |
||
266 | <span id='guest_vlan_label'> |
||
267 | <?php echo sprintf(_("VLAN tag for guests:"), ($guest_vlan === NULL ? "" : " " . _("(unset with '0')"))); ?> |
||
268 | </span> |
||
269 | </td> |
||
270 | <td> |
||
271 | <input type='number' width="4" name='guest_vlan' <?php |
||
272 | if ($guest_vlan !== NULL) { |
||
273 | echo "value='$guest_vlan'"; |
||
274 | } |
||
275 | ?> |
||
276 | > |
||
277 | </td> |
||
278 | </tr> |
||
279 | <tr> |
||
280 | <!-- input for VLAN identifier for home users--> |
||
281 | <td> |
||
282 | <span id='vlan_label'> |
||
283 | <?php echo sprintf(_("VLAN tag for own users%s:"), ($vlan === NULL ? "" : " " . _("(unset with '0')"))); ?> |
||
284 | </span> |
||
285 | </td> |
||
286 | <td> |
||
287 | <input type='number' width="4" name='vlan' <?php |
||
288 | if ($vlan !== NULL) { |
||
289 | echo "value='$vlan'"; |
||
290 | } |
||
291 | ?> |
||
292 | > |
||
293 | </td> |
||
294 | </tr> |
||
295 | </table> |
||
296 | <?php |
||
297 | echo $optionDisplay->prefilledOptionTable("managedsp", $my_inst->federation); |
||
298 | ?> |
||
299 | <button type='button' class='newoption' onclick='getXML("managedsp", "<?php echo $my_inst->federation ?>")'><?php echo _("Add new option (a realm for own users)"); ?></button> |
||
300 | </fieldset> |
||
301 | |||
302 | <?php |
||
303 | echo "<p><button type='submit' name='submitbutton' class='deploymentopts' value='" . web\lib\common\FormElements::BUTTON_SAVE . "'>" . _("Save data") . "</button><button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_org.php?inst_id=$my_inst->identifier\"'>" . _("Discard changes") . "</button></p></form>"; |
||
304 | echo $deco->footer(); |
||
305 | ?> |
||
306 | <script> |
||
307 | $(document).ready(function () { |
||
308 | $('.deploymentopts').on('click', function () { |
||
309 | var emptyvlan = "<?php echo _("VLAN tag for own users not set, realm setting will be not used."); ?>"; |
||
310 | var emptyrealm = "<?php echo _("A realm to be considered own users is not set, VLAN tag setting will be not used."); ?>"; |
||
311 | var query = "<?php echo _("Do you want to save this data after all?"); ?>"; |
||
312 | |||
313 | var vlan = $("[name='vlan']"); |
||
314 | var ids= []; |
||
315 | var realms = []; |
||
316 | $("#expandable_managedsp_options").find('tr').each(function(idx, el) { |
||
317 | var val = $("#" + el.id.substring(7) + "-input-string").val(); |
||
318 | if (val !== undefined && val != '') { |
||
319 | realms.push(val); |
||
320 | } |
||
321 | }); |
||
322 | ack = true; |
||
323 | if (realms.length > 0 && vlan.val() == '' ) { |
||
324 | ack = confirm (emptyvlan + ' ' + query); |
||
325 | } |
||
326 | if (vlan.val() != '' && realms.length == 0) { |
||
327 | ack = confirm (emptyrealm + ' ' + query); |
||
328 | } |
||
329 | if (!ack) { |
||
330 | event.preventDefault(); |
||
331 | } |
||
332 | return; |
||
333 | }); |
||
334 | }); |
||
335 | </script> |
||
336 | |||
337 |