Handle ACL DNs with spaces

This commit is contained in:
Jamie Cameron
2008-02-27 20:12:44 +00:00
parent c1588ee658
commit 692fa28814
2 changed files with 14 additions and 4 deletions

View File

@@ -26,7 +26,7 @@ else {
$p->{'what'} = '*';
}
else {
$in{'what_dn'} =~ /^\S+=\S+$/ || &error($text{'eacl_edn'});
$in{'what_dn'} =~ /^\S+=\S.*$/ || &error($text{'eacl_edn'});
$p->{'what'} =
'dn'.($in{'what_style'} ? '.'.$in{'what_style'} : '').
'='.$in{'what_dn'};
@@ -53,7 +53,7 @@ else {
# Who are we granting
if ($in{"wmode_$i"} eq "other") {
# Other DN
$in{"who_$i"} =~ /^\S+=\S+$/ ||
$in{"who_$i"} =~ /^\S+=\S.*$/ ||
&error(&text('eacl_ewho', $i+1));
$by->{'who'} = $in{"who_$i"};
}

View File

@@ -486,7 +486,12 @@ sub store_ldap_access
{
local ($a, $p) = @_;
local @v = ( 'to' );
push(@v, $p->{'what'});
if ($p->{'what'} =~ /^\S+$/) {
push(@v, $p->{'what'});
}
else {
push(@v, "\"$p->{'what'}\"");
}
if ($p->{'filter'}) {
push(@v, "filter=$p->{'filter'}");
}
@@ -495,7 +500,12 @@ if ($p->{'attrs'}) {
}
foreach my $b (@{$p->{'by'}}) {
push(@v, "by");
push(@v, $b->{'who'});
if ($b->{'who'} =~ /^\S+$/) {
push(@v, $b->{'who'});
}
else {
push(@v, "\"$b->{'who'}\"");
}
push(@v, $b->{'access'});
push(@v, @{$b->{'control'}});
}