[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#5456) inaccurate interpretation of LDIF in back perl



Please do not email me directly unless you are a paying client of my company.
This thread started on the ITS. It should remain on the ITS.

I already explained to you what the RFC spec says about valid LDIF. Valid LDIF 
does not start with an empty line. There is nothing further to explain.

Uwe Werler wrote:
> Dear Howard,
>
> after some testing again I determined that back_perl doesn't accept
> ldif_entries which are starting with an empty line. Then slapd tells me
> "str2entry: entry -1 has no dn".
>
> Is this behavior correct? If so it will be good to explain in the man
> page or the example that an entry should start with a dn line and
> shouldn't contain any empty lines nor the version information at the
> first line.
>
> I think that my mistake was to use sample code I've found like this:
>
> sub search
> {
>
>      my $this = shift;
>      my($base, $scope, $deref, $sizeLim, $timeLim, $filterStr, $attrOnly, @attrs ) = @_;
>      if (! defined($this->{'LDAP'})) {
>          $ldap = Net::LDAP->new( 'localhost' ) ;
>          $this->{'LDAP'} = $ldap;
>      }
>      $mesg=$this->{'LDAP'}->search(base=>$base,
> 				  scope=>$scope,
> 				  deref=>$deref,
> 				  sizelimit =>$sizeLim,
> 				  timelimit =>$timeLim,
> 				  filter =>$filterStr,
> 				  attrs=>  @attrs );
>
>      my @list = ();
>
>
>      foreach $entry ($mesg->all_entries) {
> 	my $data;
> 	$LDIF = new IO::Scalar \$data;
> 	$dump=Net::LDAP::LDIF->new($LDIF,"w");
> 	$dump->write($entry);
> 	$LDIF->close;
> 	push @list,$data;
>      }
>      return ( 0 , @list);
>
> }
>
> Because the entries returned by Net::LDAP::LDIF are starting with a leading SEP it won't work as is in back_perl.
>
> Thank You very much for Your attention.
>
> Regards Uwe
>
>


-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/