bernd commited on 2009-06-01 14:35:31
Zeige 2 geänderte Dateien mit 9 Einfügungen und 5 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1382 87cf0b9e-d624-0410-a070-f6ee81989793
| ... | ... |
@@ -64,21 +64,25 @@ function verify_input_username( $input ) |
| 64 | 64 |
|
| 65 | 65 |
|
| 66 | 66 |
|
| 67 |
-function filter_input_hostname( $input ) |
|
| 67 |
+function filter_input_hostname( $input, $wildcard=false ) |
|
| 68 | 68 |
{
|
| 69 |
+ // FIXME: Eine "filter"-Funktion sollte keinen system_failure verursachen sondern einfach einen bereinigten String liefern. |
|
| 70 |
+ |
|
| 69 | 71 |
$input = str_replace(array('Ä', 'Ö', 'Ü'), array('ä', 'ö', 'ü'), strtolower($input));
|
| 70 | 72 |
$input = rtrim($input, "\t\n\r\x00 ."); |
| 71 | 73 |
$input = ltrim($input, "\t\n\r\x00 ."); |
| 72 |
- if (ereg_replace("[^[:alnum:]äöü\.\-]", "", $input ) != $input)
|
|
| 74 |
+ if (ereg_replace("[^[:alnum:]äöü*\.\-]", "", $input ) != $input)
|
|
| 73 | 75 |
system_failure("Ihre Daten enthielten ungültige Zeichen!");
|
| 76 |
+ if (! $wildcard && ereg_replace("\*", "", $input ) != $input)
|
|
| 77 |
+ system_failure("Ihre Daten enthielten ungültige Zeichen (Keine Wildcards erlaubt)!");
|
|
| 74 | 78 |
if (strstr($input, '..')) |
| 75 | 79 |
system_failure("Ungültiger Hostname");
|
| 76 | 80 |
return $input; |
| 77 | 81 |
} |
| 78 | 82 |
|
| 79 |
-function verify_input_hostname( $input ) |
|
| 83 |
+function verify_input_hostname( $input, $wildcard=false ) |
|
| 80 | 84 |
{
|
| 81 |
- if (filter_input_hostname( $input ) != $input) {
|
|
| 85 |
+ if (filter_input_hostname( $input, $wildcard ) != $input) {
|
|
| 82 | 86 |
logger('inc/security', 'verify_input_hostname', 'Ungültige Daten: '.$input);
|
| 83 | 87 |
system_failure("Ihre Daten enthielten ungültige Zeichen!");
|
| 84 | 88 |
} |
| ... | ... |
@@ -177,7 +177,7 @@ function save_dns_record($id, $record) |
| 177 | 177 |
$dom = new Domain( (int) $record['domain'] ); |
| 178 | 178 |
if (! $dom->id) |
| 179 | 179 |
system_failure('invalid domain');
|
| 180 |
- verify_input_hostname($record['hostname']); |
|
| 180 |
+ verify_input_hostname($record['hostname'], true); |
|
| 181 | 181 |
if ($record['ttl'] && (int) $record['ttl'] < 1) |
| 182 | 182 |
system_failure('Fehler bei TTL');
|
| 183 | 183 |
switch ($record['type']) |
| 184 | 184 |