Handle ACL DNs with spaces
authorJamie Cameron <jcameron@webmin.com>
Wed, 27 Feb 2008 20:12:44 +0000 (20:12 +0000)
committerJamie Cameron <jcameron@webmin.com>
Wed, 27 Feb 2008 20:12:44 +0000 (20:12 +0000)
ldap-server/acl_save.cgi
ldap-server/ldap-server-lib.pl

index 44c9b45..a410df4 100644 (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"};
                        }
index 665a012..d42f4ba 100644 (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'}});
        }