From: Graham B. <gb...@po...> - 2001-03-07 20:33:59
|
I don't think the DN should be base64 encoded, it should be encoded using rules from rfc2253, which should result in a printable string and avoid the need for base64 encoding Graham. On Wed, Mar 07, 2001 at 11:18:12AM -0000, Chris Ridd wrote: > Kartik Subbarao <sub...@co...> wrote: > > I have submitted a patch to LDIF.pm via sourceforge. It enables > > write_cmd() to print modrdn operations properly. > > > > -Kartik > > > > It doesn't handle newsuperior... > > Shouldn't the code be calling _write_attr instead of _wrap? Calling > _write_attr will automatically base-64 encode 'unsafe' values. Hm, printing > the DN should use _write_attr too... > > Does the attached patch work any better? > > Cheers, > > Chris > Index: ldap/lib/Net/LDAP/LDIF.pm > =================================================================== > RCS file: /cvsroot/perl-ldap/ldap/lib/Net/LDAP/LDIF.pm,v > retrieving revision 1.4 > diff -b -c -r1.4 LDIF.pm > *** ldap/lib/Net/LDAP/LDIF.pm 2001/02/12 09:27:08 1.4 > --- ldap/lib/Net/LDAP/LDIF.pm 2001/03/07 11:17:09 > *************** > *** 291,312 **** > my $saver = SelectSaver->new($self->{'fh'}); > > foreach $entry (grep { defined } @_) { > ! my @changes = $entry->changes or next; > my $type = $entry->changetype; > > # Skip entry if there is nothing to write > next if $type eq 'modify' and !@changes; > > - my $dn = "dn: " . $entry->dn; > - > print "\n" if tell($self->{'fh'}); > ! print _wrap($dn,$wrap),"\n","changetype: ",$type,"\n"; > > if ($type eq 'delete') { > next; > } > elsif ($type eq 'add') { > _write_attrs($entry,$wrap); > next; > } > > --- 291,317 ---- > my $saver = SelectSaver->new($self->{'fh'}); > > foreach $entry (grep { defined } @_) { > ! my @changes = $entry->changes; > my $type = $entry->changetype; > > # Skip entry if there is nothing to write > next if $type eq 'modify' and !@changes; > > print "\n" if tell($self->{'fh'}); > ! print _write_attr('dn',$entry->dn,$wrap),"\n","changetype: $type\n"; > > if ($type eq 'delete') { > next; > } > elsif ($type eq 'add') { > _write_attrs($entry,$wrap); > + next; > + } > + elsif ($type eq 'modrdn') { > + print _write_attr('newrdn',$entry->get_value('newrdn'),$wrap); > + print 'deleteoldrdn: ',$entry->get_value('deleteoldrdn')),"\n"; > + my $ns = $entry->get_value('newsuperior'); > + print _write_attr('newsuperior',$ns,$wrap) if defined $ns; > next; > } > |