Skip to content
Browse files

Ensure dashes are only output between parts of an LDAP update entry

  • Loading branch information...
1 parent 58a0a81 commit 35da62e2d045b7f809516e548bddff56fa012ebb @gbarr gbarr committed Oct 29, 2001
Showing with 21 additions and 3 deletions.
  1. +16 −0 data/00-cmp2.ldif
  2. +2 −1 lib/Net/LDAP/LDIF.pm
  3. +3 −2 t/00ldif-entry.t
View
16 data/00-cmp2.ldif
@@ -16,6 +16,12 @@ associateddomain: umich.edu
counting: one
counting: two
counting: three
+first: 1
+first: 2
+first: 3
+second: a
+second: b
+second: c
dn: o=University of Michigan, c=US
changetype: modify
@@ -29,5 +35,15 @@ counting: one
counting: two
counting: three
-
+add: first
+first: 1
+first: 2
+first: 3
+-
+add: second
+second: a
+second: b
+second: c
+-
replace: telephonenumber
telephonenumber: 911
View
3 lib/Net/LDAP/LDIF.pm
@@ -376,18 +376,19 @@ sub write_entry {
next;
}
+ my $dash=0;
foreach my $chg (@changes) {
unless (ref($chg)) {
$type = $chg;
next;
}
my $i = 0;
while ($i < @$chg) {
+ print "-\n" if $dash++;
my $attr = $chg->[$i++];
my $val = $chg->[$i++];
print $type,": ",$attr,"\n";
_write_attr($attr,$val,$wrap,$lower);
- print "-\n";
}
}
}
View
5 t/00ldif-entry.t
@@ -26,6 +26,7 @@ $e->changetype('modify');
$e->delete('objectclass');
$e->delete('o',['UM']);
$e->add('counting',[qw(one two three)]);
+$e->add('first',[qw(1 2 3)], 'second',[qw(a b c)]);
$e->replace('telephonenumber' => ['911']);
$outfile = "$TEMPDIR/00-out2.ldif";
@@ -41,10 +42,10 @@ print "ok 2\n";
$e->add('name' => 'Graham Barr');
$e->add('name;en-us' => 'Bob');
-print "not " unless join(":",sort $e->attributes) eq "associateddomain:counting:description:l:lastmodifiedby:lastmodifiedtime:name:name;en-us:o:postaladdress:st:streetaddress:telephonenumber";
+print "not " unless join(":",sort $e->attributes) eq "associateddomain:counting:description:first:l:lastmodifiedby:lastmodifiedtime:name:name;en-us:o:postaladdress:second:st:streetaddress:telephonenumber";
print "ok 3\n";
-print "not " unless join(":",sort $e->attributes(nooptions => 1)) eq "associateddomain:counting:description:l:lastmodifiedby:lastmodifiedtime:name:o:postaladdress:st:streetaddress:telephonenumber";
+print "not " unless join(":",sort $e->attributes(nooptions => 1)) eq "associateddomain:counting:description:first:l:lastmodifiedby:lastmodifiedtime:name:o:postaladdress:second:st:streetaddress:telephonenumber";
print "ok 4\n";
$r = $e->get_value('name', asref => 1);

0 comments on commit 35da62e

Please sign in to comment.
Something went wrong with that request. Please try again.