Skip to content

Commit d59cbfe

Browse files
committed
Fix XSS vulnerability, when import is using a file upload without a valid LDIF. Also fixes #250 and closes #251
1 parent 528081d commit d59cbfe

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

htdocs/import.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function display_pla_parse_error($request) {
103103
printf('<tr><td colspan=2><b>%s</b>:</td></tr>',_('Data'));
104104

105105
foreach ($request->error['data'] as $line)
106-
printf('<tr><td>&nbsp;</td><td>%s</td></tr>',$line);
106+
printf('<tr><td>&nbsp;</td><td>%s</td></tr>',htmlspecialchars($line));
107107

108108
echo '</table>';
109109
echo '</center>';

lib/Template.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,8 @@ public function getDN() {
660660
# If container is not set, we're probably creating the base
661661
elseif ($this->getRDN() && get_request('create_base'))
662662
return $this->getRDN();
663+
664+
return '';
663665
}
664666

665667
public function getDNEncode($url=true) {

lib/import_functions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ public function readEntry() {
175175
return $this->error(sprintf('%s %s',_('LDIF import only suppports version 1'),$version),$lines);
176176

177177
$haveVersion = true;
178-
$lines = $this->nextLines();
178+
179+
if (! $lines)
180+
$lines = $this->nextLines();
179181
}
180182

181183
$server = $this->getServer();

0 commit comments

Comments
 (0)