| @@ 20-33 (lines=14) @@ | ||
| 17 | foreach ($options as $index => $iterate_option) { |
|
| 18 | foreach ($iterate_option as $name => $value) { |
|
| 19 | switch ($name) { |
|
| 20 | case "eap:ca_url": // eap:ca_url becomes eap:ca_file by downloading the file |
|
| 21 | if (empty($value)) { |
|
| 22 | break; |
|
| 23 | } |
|
| 24 | $content = downloadFile($value); |
|
| 25 | unset($options[$index]); |
|
| 26 | if (check_upload_sanity("eap:ca_file", $content)) { |
|
| 27 | $content = base64_encode($content); |
|
| 28 | $options[] = ["eap:ca_file" => $content]; |
|
| 29 | $good[] = $name; |
|
| 30 | } else { |
|
| 31 | $bad[] = $name; |
|
| 32 | } |
|
| 33 | break; |
|
| 34 | case "eap:ca_file": // CA files get split (PEM files can contain more than one CA cert) |
|
| 35 | // the data being processed here is always "good": |
|
| 36 | // if it was eap:ca_file initially then its sanity was checked in step 1; |
|
| @@ 49-61 (lines=13) @@ | ||
| 46 | } |
|
| 47 | $good[] = $name; |
|
| 48 | break; |
|
| 49 | case "general:logo_url": // logo URLs become logo files by downloading the file |
|
| 50 | if (empty($value)) { |
|
| 51 | break; |
|
| 52 | } |
|
| 53 | $bindata = downloadFile($value); |
|
| 54 | unset($options[$index]); |
|
| 55 | if (check_upload_sanity("general:logo_file", $bindata)) { |
|
| 56 | $good[] = $name; |
|
| 57 | $options[] = ["general:logo_file" => base64_encode($bindata)]; |
|
| 58 | } else { |
|
| 59 | $bad[] = $name; |
|
| 60 | } |
|
| 61 | break; |
|
| 62 | default: |
|
| 63 | $good[] = $name; // all other options were checked and are sane in step 1 already |
|
| 64 | break; |
|