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

Re: Why ldap_<first,next>_attribute ?



Jochen Keutel writes:
> The only reason I could imagine why ldap_first/next_attribute() is
> better: if next_attribute() returns an error you can simply skip this
> attribute (and print some error message).
> The array which would be returned by ldap_get_attributes() had to have a
> field "error" for each attribute returned to have the same property.

I think you have found a bug in the draft: It should say that NULL
return due to an error also terminates the attribute list.  I believe
this is intended because almost the same wording occurs in 12.1 and
allows more entries after a NULL ldap_next_entry.  Thus, the following
ldap_next_entry call would receive NULL as 2nd argument instead of an
entry pointer to work from.

The relevant paragraphs are:

In 12.1:

  ldap_first_entry() and ldap_next_entry() will return NULL when no more
  entries or references exist in the result set to be returned.  NULL is
  also returned if an error occurs while stepping through the entries, in
  which case the error parameters in the session handle ld will be set to
  indicate the error.

In 12.2:

  ldap_first_attribute() and ldap_next_attribute() will return NULL when
  the end of the attributes is reached, or if there is an error, in which
  case the error parameters in the session handle ld will be set to indi-
  cate the error.

-- 
Hallvard