开发者

Retrieve empty attributes of LDAP DN

I am currently programming a tool (in ANSI C) for my company which reads from an LDAP Directory and outputs all the data in a specific format (that is: the name format of our old proprietary directory db). This is then handled by another tool which reads the output and so on ... don't ask.

Anyways, for my "ldaplist ..." command I need to print out all attributes belonging to that entry, even those which have no value set.

Unfortunately ldap_first_attribute / ldap_next_attribute does not return them, only those which have a value set, and I can't find an ldap开发者_运维技巧_search_ext_s parameter or an ldap_set_option switch that would help me here. Hope one of you knows how to do that.

Thanks for your time and help in advance!


I agree, with skwllsp. You will need to return the schema for each objectclass on each entry and display each attribute. Unfortunately this will probably be a lot more than you expected as there maybe a lot of "useless" data in that type of return.

You would well served to show the populated attributes and then a list of desired attributes that are not populated.

You might get some help by looking at: http://developer.novell.com/documentation/samplecode/cldap_sample/index.htm Good luck -jim


I have not used ldap_search_ext_s so I don't know its options and I can't tell you a solution based on using this function. However I would like to suggest one idea.

  1. You need to retrieve a schema from an LDAP server. DN of the schema entry is in the root node. After that you have to retrieve the schema entry and its "objectClasses" attribute. It contains specifications of each class and its allowed attribute types (the schema).

  2. When you run LDAP search you normally get zero, one or more entries. Each entry has an objectClass attribute. Read its values which are names of object classes. And then find each object classs in the schema and retrieve its attribute types. If in the returned entry there is no one or a few attributes it means that either an attribute doesn't have any values or you are not allowed to read the attribute in this entry.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜