Skip to content

Instantly share code, notes, and snippets.

@thilko
Created March 21, 2010 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thilko/339217 to your computer and use it in GitHub Desktop.
Save thilko/339217 to your computer and use it in GitHub Desktop.
// Taken from: http://www.ietf.org/rfc/rfc1823.txt
/* step through each entry returned */
for ( e = ldap_first_entry( ld, res ); e != NULL;
e = ldap_next_entry( ld, e ) ) {
/* print each attribute */
for ( a = ldap_first_attribute( ld, e, &ptr );
a != NULL;
a = ldap_next_attribute( ld, e, ptr ) ) {
printf( "attribute: %s0, a );
/* print each value */
vals = ldap_get_values( ld, e, a );
for ( i = 0; vals[i] != NULL; i++ ) {
printf( "value: %s0, vals[i] );
}
ldap_value_free( vals );
}
}
/* free the search results */
ldap_msgfree( res );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment