Commit 0ff3f159 authored by tbrehm's avatar tbrehm
Browse files

Fixed: FS#1305 - Webdav user information is not written to domains vhost file.

parent 0c05d995
...@@ -1155,26 +1155,29 @@ class apache2_plugin { ...@@ -1155,26 +1155,29 @@ class apache2_plugin {
*/ */
private function _writeHtDigestFile($filename, $username, $authname, $pwdhash ) { private function _writeHtDigestFile($filename, $username, $authname, $pwdhash ) {
$changed = false; $changed = false;
$in = fopen($filename, 'r'); if(is_file($filename)) {
$output = ''; $in = fopen($filename, 'r');
/* $output = '';
* read line by line and search for the username and authname /*
*/ * read line by line and search for the username and authname
while (preg_match("/:/", $line = fgets($in))) { */
$line = rtrim($line); while (preg_match("/:/", $line = fgets($in))) {
$tmp = explode(':', $line); $line = rtrim($line);
if ($tmp[0] == $username && $tmp[1] == $authname) { $tmp = explode(':', $line);
/* if ($tmp[0] == $username && $tmp[1] == $authname) {
* found the user. delete or change it? /*
*/ * found the user. delete or change it?
if ($pwdhash != '') { */
$output .= $tmp[0] . ':' . $tmp[1] . ':' . $pwdhash . "\n"; if ($pwdhash != '') {
} $output .= $tmp[0] . ':' . $tmp[1] . ':' . $pwdhash . "\n";
$changed = true; }
} $changed = true;
else { }
$output .= $line . "\n"; else {
$output .= $line . "\n";
}
} }
fclose($in);
} }
/* /*
* if we didn't change anything, we have to add the new user at the end of the file * if we didn't change anything, we have to add the new user at the end of the file
...@@ -1182,7 +1185,7 @@ class apache2_plugin { ...@@ -1182,7 +1185,7 @@ class apache2_plugin {
if (!$changed) { if (!$changed) {
$output .= $username . ':' . $authname . ':' . $pwdhash . "\n"; $output .= $username . ':' . $authname . ':' . $pwdhash . "\n";
} }
fclose($in);
/* /*
* Now lets write the new file * Now lets write the new file
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment