Hi:

Thanks for your replies.  You both said pretty much the same thing - it can't
be done.  I trust you will agree that when you create a record with
ldapmodify, the attributes are stored in the order you enter them, and when
you retrieve the record with ldapsearch, the record is returned with the
attributes in the original order.  So it's not a limitation of the LDAP
protcol, it's just a question of why perldap doesn't do it.

I've done some poking around in the perldap code and I think I see where the
problem is.  The programmer goes to considerable lengths to maintain the
attribute ordering in the perl code:  defining a 'Mozilla::LDAP::Enty' data
type to tie the data storage hash to, having the STORE function maintain the
order in the '_oc_order_' array, etc.  But it is all for naught, since the
Conn->add routine to actually store the record, copies all the attributes
into a plain hash to pass them to the C API routines for storage.  The
attribute ordering gets 'hashed' at this point, since the C 'hash2mod'
routine that converts the hash into a list of LDAPmod pointers just extracts
them from the hash in the order they are physically stored.

It looks to me that the only way to preserve the ordering would be to change
the interface between the perl and C routines so that Conn->add could pass
the '_oc_order_' array or something similar, to the C routines to specify the
desired ordering.  This could be an optional parameter which if supplied
would specify the ordering and if not, the current algorithm would be used.

I realize the ordering is completely immaterial to the operation of the LDAP
directory and therefore, this is not a high priority item for perldap
development, but it would be a nice feature.  When doing program development
and debugging, extracting records manually with ldapsearch to see if data is
being stored properly, it would be a lot more convenient for visually
scanning the attributes if they came back in the same order your stored them.

Maybe somebody doing perldap development will implement something like this
in a future version - I don't think it would be that difficult.  Thanks again
for your time.

Russ

Michelle Wyner wrote:

> Russ Wilton wrote:
> >
> > attributes stored in a particular order?  I pass the data to Perldap
> > using calls to "entry->setValues" in the order I want the attributes
> > stored, but they end up in a different order in the LDAP database, as
> > shown by retreiving the entry with ldapsearch.  Am I missing something
> > here, or is it not possible to control the order?  I am running Solaris
> > 8, Perl 5.6.0, Perldap 1.4.1 and ldapsdk 4.1.
> >  Thanks.
>
> Hi Russ,
>
> Nope, values of attributes are not guaranteed to be stored in a
> particular order.
>
> -- Michelle

--
Russell D. Wilton                     E Mail: [EMAIL PROTECTED]
Network Services Manager              Voice:   (403) 329-2525
University of Lethbridge              FAX:     (403) 382-7108
4401 University Drive   Lethbridge, Alberta, CANADA   T1K 3M4


Reply via email to