14.02.2014 Views

ldapv3.pdf 7947KB Apr 17 2013 11:30:42 AM - mirror omadata

ldapv3.pdf 7947KB Apr 17 2013 11:30:42 AM - mirror omadata

ldapv3.pdf 7947KB Apr 17 2013 11:30:42 AM - mirror omadata

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Simple C LDAP Query<br />

Walk the Attributes<br />

for (a = ldap_first_attribute(ld, e, &b);<br />

a != NULL;<br />

a = ldap_next_attribute(ld, e, b)) {<br />

if ((v = ldap_get_values(ld, e, a)) != NULL) {<br />

for (i = 0; v[i] != NULL; i++) {<br />

printf ("%s: %s\n", a, v[i]);<br />

}<br />

ldap_value_free(v);<br />

}<br />

}<br />

ldap_memfree(a);<br />

Point a at the first attribute of the<br />

object found at e. b maintains<br />

information on the ber data model.<br />

Loop until a doesn't refer<br />

to an attribute.<br />

Point a at the attribute<br />

following a<br />

Place the values of the attribute<br />

found at a in the NULL terminated<br />

array v<br />

Display the values found in v<br />

Toss the contents of the array<br />

Release the memory used to hold<br />

the attribute information.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!