Hello Howard,
in my last message (see below) the question was not wether is an entry starting with a blank line or not or what is a correct ldif. My question was if back_perl is only accepting "ldif-like" entries starting with dn-spec.
If I return an entry like this:
version: 1 dn: ou=foo,dc=bar ou: foo objectClass: organizationalUnit objectClass: top description: users from foo
or with SEP after version-spec
version: 1
dn: ou=foo,dc=bar ou: foo objectClass: organizationalUnit objectClass: top description: users from foo
then the debug output from slapd is: "str2entry: entry -1 has no dn"
That means that back_perl doesn't accept ldif files but only "ldif-like" entries without version-spec.
If this is intended than I suggest to explain this in the man page or at least in the example shipped with back_perl.
Thank You for Your attention.
Regards Uwe
Am Sonntag, den 06.04.2008, 12:41 -0700 schrieb Howard Chu:
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