ldapu-changes.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <!-- BEGIN COPYRIGHT BLOCK
  2. Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. Copyright (C) 2005 Red Hat, Inc.
  4. All rights reserved.
  5. License: GPL (version 3 or any later version).
  6. See LICENSE for details.
  7. END COPYRIGHT BLOCK -->
  8. <HTML>
  9. <HEAD>
  10. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
  11. <META NAME="Author" CONTENT="Nitin More">
  12. <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (WinNT; U) [Netscape]">
  13. </HEAD>
  14. <BODY>
  15. <CENTER>
  16. <H1>
  17. Change Log for the ldaputil library</H1></CENTER>
  18. <DT>
  19. Author: Nitin More</DT>
  20. <DT>
  21. E-mail:&nbsp; <A HREF="mailto:[email protected]">[email protected]</A></DT>
  22. <DT>
  23. Phone: (415) 937-4240</DT>
  24. <CENTER></CENTER>
  25. <CENTER>
  26. <HR WIDTH="100%"></CENTER>
  27. <CENTER></CENTER>
  28. <CENTER><B><FONT SIZE=+1>Changes since Apr 17, 1997</FONT></B></CENTER>
  29. <P>Last Update: Aug 25, 1997
  30. <P>All the new changes have been checked into the server3_tier_branch.&nbsp;
  31. The server3_branch is frozen &amp; contains the version of 'ldaputil' for
  32. the SuiteSpot 3.0 release.
  33. <H2>
  34. Changed:</H2>
  35. Several bug fixes went in since I last modified this file.&nbsp; The important
  36. ones are:
  37. <UL>
  38. <LI>
  39. <A HREF="http://scopus/bugsplat/show_bug.cgi?id=79373">79373</A>: Attributes
  40. listed multiple times in certmap.conf were turining that attribute off
  41. and enabling some other attribute.&nbsp; (For example, if you have "E"
  42. as well as "MAIL" in FilterComps, they cancelled each other).</LI>
  43. <LI>
  44. <A HREF="http://scopus/bugsplat/show_bug.cgi?id=58474">58474</A>: If nested
  45. group checks goes on for 30 recursions, a circular groups error is returned.</LI>
  46. <LI>
  47. <A HREF="http://scopus/bugsplat/show_bug.cgi?id=80004">80004</A>: after
  48. thoroughly testing the certmap utility, several (mostly minor) oddities
  49. were found &amp; fixed.</LI>
  50. </UL>
  51. <H2>
  52. Added:</H2>
  53. <UL>
  54. <LI>
  55. <A HREF="http://scopus/bugsplat/show_bug.cgi?id=79370">79370</A>: Group
  56. membership check is optimized now through the new function <B>ldapu_auth_userdn_groupids</B>.&nbsp;
  57. Use this new function to get the optimization.&nbsp; This function's algorithm
  58. is as follows:</LI>
  59. <BR>The first search uses the following filter (w/o the group names!):
  60. <OL><TT>(| (&amp; (objectclass=groupofuniquenames)</TT>
  61. <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (uniquemember=&lt;userDN>))</TT>
  62. <BR><TT>&nbsp;&nbsp; (&amp; (objectclass=groupofnames)(member=&lt;userDN>)))</TT>
  63. <BR>&nbsp;</OL>
  64. This gives us all the groups the user is member of.&nbsp; We ask for only
  65. the "CN" attributes of the returned groups.&nbsp; We check if "CN" of any
  66. of the returned groups is one of the groups we have.&nbsp; If yes, we have
  67. succeeded.&nbsp; If there are no groups returned then we have failed.&nbsp;
  68. Otherwise, we continue with the nested group check.&nbsp; To perform that
  69. check, we need DNs of all the groups the user is member of, which we already
  70. have from the previous search.&nbsp; Now we repeat the search as follows:
  71. <OL><TT>(| (&amp; (objectclass=groupofuniquenames)</TT>
  72. <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (| (uniquemember=&lt;grp1DN>)...
  73. (uniquemember=&lt;grpNDN>))</TT>
  74. <BR><TT>&nbsp;&nbsp; (&amp; (objectclass=groupofnames)</TT>
  75. <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (| (member=&lt;grp1DN>)... (member=&lt;grpNDN>))</TT></OL>
  76. We check the list of groups returned by this search with the groups in
  77. the ACL and recursively continue until we succeed or no more groups are
  78. returned from the searches.
  79. <P>Advantages of this new function is it checks multiple groups at the
  80. same time.&nbsp; Previously we were performing 2 ldap lookups per group.&nbsp;
  81. Now we achieve this in a single ldap lookup!
  82. <P><B><BLINK>Caution</BLINK></B>: this function allows multiple groups
  83. with the same "CN".
  84. <P>To use this function, you need to provide a list of group names in any
  85. form (e.g comma separated string, a hash table, array of strings, etc.)
  86. and a function to compare the name returned by the ldap lookup with your
  87. group names.</UL>
  88. <CENTER><B><FONT SIZE=+1>Changes since Mar 22, 1997</FONT></B></CENTER>
  89. <P>Last Update: Apr 17, 1997
  90. <P>Now that all beta releases are out for servers using this library, I
  91. could do some incompatible changes to make this library more flexible.
  92. No more incompatible changes are planned (except for possibly one: see
  93. http://scopus/bugsplat/show_bug.cgi?id=58482). <B><BLINK>All 3.0 SuiteSpot
  94. servers supporting client auth need to upgrade to this version.</BLINK></B>
  95. <H2>
  96. Changed:</H2>
  97. <UL>
  98. <LI>
  99. <B>Exchanged certmap.h &amp; ldaputil.h: </B>ldaputil.h had public API
  100. but when the file was installed on the server root, it was called certmap.h.
  101. Since we already had a certmap.h, this was causing lot of confusion. If
  102. you were including "certmap.h", now include "ldaputil.h" and vice versa.</LI>
  103. <LI>
  104. <B>Renamed 'SearchComps' to 'FilterComps'</B>: Shouldn't affect your code
  105. but may affect tests and documentation.</LI>
  106. <LI>
  107. <B>'VerifyCert' must be either "on" or "off"</B>: VerifyCert didn't have
  108. a value. Now it must have a value. If it has a value of "on" then the "verification"
  109. step is on, otherwise it is off.</LI>
  110. <LI>
  111. <B>Important bug fixes</B>: One bug was causing stack corruption &amp;
  112. weird unpredictable results. The other important bug was to map 'E' in
  113. cert to 'MAIL' in LDAP.</LI>
  114. </UL>
  115. <H2>
  116. Added:</H2>
  117. <UL>
  118. <LI>
  119. <B>Settable 'search function'</B>: User defined search function can be
  120. set for cert to ldap mapping.</LI>
  121. <LI>
  122. <B>ldapu_get_cert_ava_val &amp; ldapu_free_cert_ava_val</B>: API functions
  123. to get &amp; free an attribute's value(s) from either the subject DN or
  124. the issuer DN from a cert.</LI>
  125. </UL>
  126. <H2>
  127. Open Bugs:</H2>
  128. <UL>Following bugs may not get fixed by RTM.</UL>
  129. <UL>
  130. <LI>
  131. <A HREF="http://scopus/bugsplat/show_bug.cgi?id=51279">51279</A>: 'uniquemember'
  132. bug</LI>
  133. <LI>
  134. <A HREF="http://scopus/bugsplat/show_bug.cgi?id=58474">58474</A>:&nbsp;
  135. 'circular groups' results in infinite loop</LI>
  136. <LI>
  137. <A HREF="http://scopus/bugsplat/show_bug.cgi?id=58478">58478</A>: Don't
  138. allow a space as a valid delimeter for DNComps &amp; FilterComps.</LI>
  139. <LI>
  140. <A HREF="http://scopus/bugsplat/show_bug.cgi?id=58482">58482</A>: Make
  141. the 'search function' configurable.</LI>
  142. <BR>
  143. <HR WIDTH="100%"></UL>
  144. <CENTER>
  145. <H3>
  146. Changes since Mar 18, 1997</H3></CENTER>
  147. <DT>
  148. Last Update: Mar 22, 1997</DT>
  149. <DT>
  150. A query on how to map a verisign certificate prompted these changes.&nbsp;
  151. I was hoping I don't have to do any major changes when I wrote this document
  152. on Mar 18. These are incompatible changes -- please review them before
  153. you upgrade.&nbsp; I have checked in this file in CVS under "ns/netsite/lib/ldaputil/ldapu-changes.html".
  154. I have added all the "XYZ_branch" and "XYZ_point" tags to this file so
  155. that you can easily see this file in your tree.&nbsp; When I make significant
  156. changes to this file/library, I will retag this file for your branch to
  157. make it same as the server3_branch. [Let me know if I shouldn't do it for
  158. your branch].</DT>
  159. <H2>
  160. Changed:</H2>
  161. <UL>
  162. <LI>
  163. <B>ldapu_cert_to_ldap_entry</B>: The major change was to allow for the
  164. mapped DN to be NULL and in that case, start the search from the basedn
  165. of the LDAP server. This required API change so that the basedn can be
  166. passed to the ldapu_cert_to_ldap_entry function. This change was required
  167. for correctly mapping certs from verisign w/o writing plugins. The Verisign
  168. certs can be mapped correctly using the following setting in the &lt;ServerRoot>/userdb/certmap.conf
  169. file:</LI>
  170. <UL><TT><FONT SIZE=+1>certmap verisign &lt;verisign's DN></FONT></TT>
  171. <BR><TT><FONT SIZE=+1>verisign:dncomps</FONT></TT>
  172. <BR><TT><FONT SIZE=+1>verisign:searchcomps cn, e</FONT></TT></UL>
  173. The mapped DN will be NULL so basedn will be used.&nbsp; The filter will
  174. be
  175. <BR>(&amp; (cn="&lt;user's CN>") (mail="&lt;user's mail>")).&nbsp; The
  176. new signature of ldapu_cert_to_ldap_entry is as follows:
  177. <BR>&nbsp;&nbsp;&nbsp; int ldapu_cert_to_ldap_entry(void *cert, LDAP *ld,
  178. const char *basedn, LDAPMessage **res);
  179. <LI>
  180. <B>verify cert functions</B>: A major change in how verify cert functions
  181. work.&nbsp; This is function is now called even when multiple potential
  182. matches are found for the cert.&nbsp; The mapping is successful if the
  183. verify function can reduce the number of matches to exactly one.&nbsp;
  184. For example, if there are multiple "Joe Smith" entries, at most one of
  185. those will have the cert in it's "userCertificate" attr.&nbsp; The verify
  186. function will select that entry.&nbsp; The verify function is called with
  187. "LDAPMessage *res" containing all the potential matches.&nbsp; It should
  188. return a pointer to the matched entry in the new "LDAPMessage **entry"
  189. parameter.&nbsp; The new signature for CertVerifyFn_t is as follows:</LI>
  190. <BR>&nbsp;&nbsp;&nbsp; typedef int (*CertVerifyFn_t)(void *cert, LDAP *ld,
  191. LDAPMessage *res,
  192. <BR>&nbsp;
  193. <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  194. LDAPMessage **entry);
  195. <LI>
  196. typedef int (*<B>CertMapInitiFn_t)</B>: Renamed from CertmapInitFn_t.&nbsp;
  197. Now this has two extra parameters to make it easy to use it in a plugin.
  198. Other API functions require "issuerDN" but this function was called with
  199. "LDAPUCertMapInfo_t *certinfo".&nbsp; There was no public API function
  200. to get the issuerDN from "certinfo". The new signature for CertMapInitFn_t
  201. is as follows:</LI>
  202. <BR>&nbsp;&nbsp;&nbsp; typedef int (*CertMapInitFn_t)(void *certmap_info,
  203. const char *issuerName,
  204. <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  205. const char *issuerDN);
  206. <LI>
  207. (ldapauth.h) <B>ldapu_auth_* functions:</B> For multiple matches, these
  208. functions now return LDAPU_ERR_MULTIPLE_MATCHES instead of LDAPU_FAILED.
  209. This change was required to make nested group membership work efficiently
  210. and enable the new functionality of verify cert function.</LI>
  211. </UL>
  212. <DT>
  213. <HR WIDTH="100%"></DT>
  214. <CENTER>
  215. <H3>
  216. Changes since Feb 1, 1997</H3></CENTER>
  217. <DT>
  218. Last Update: Mar 18, 1997</DT>
  219. <DT>
  220. There have been several changes to the netsite/lib/ldaputil recently. If
  221. you use this library, please start using the latest version of ldaputil
  222. on the server3_branch so that all the servers go out with the same API
  223. and behavior. Review the changes before you upgrade. If you don't plan
  224. to upgrade, please let me know.</DT>
  225. <H2>
  226. Renamed:</H2>
  227. Following structures and functions are renamed. But this shouldn't affect
  228. you unless you have written a certmap plugin.
  229. <DD>
  230. <TT><FONT SIZE=+1>struct CertMappingFunction_t ---> CertMapFn_t</FONT></TT></DD>
  231. <DD>
  232. <TT><FONT SIZE=+1>struct CertVerifyFunction_t ---> CertVerifyFn_t</FONT></TT></DD>
  233. <DD>
  234. <TT><FONT SIZE=+1>ldapu_set_cert_mapping_function ---> ldapu_set_cert_mapfn</FONT></TT></DD>
  235. <DD>
  236. <TT><FONT SIZE=+1>ldapu_get_cert_mapping_function ---> ldapu_get_cert_mapfn</FONT></TT></DD>
  237. <DD>
  238. <TT><FONT SIZE=+1>ldapu_set_cert_verify_function ---> ldapu_set_cert_verifyfn</FONT></TT></DD>
  239. <DD>
  240. <TT><FONT SIZE=+1>ldapu_get_cert_verify_function ---> ldapu_get_cert_verifyfn</FONT></TT></DD>
  241. <H2>
  242. Removed: (from .h)</H2>
  243. Removed the following functions from .h files. They are still in the .c
  244. file as static functions. I don't think these should be public. If you
  245. think otherwise, let me know.
  246. <DD>
  247. <TT><FONT SIZE=+1>ldapu_cert_mapping_function_default</FONT></TT></DD>
  248. <DD>
  249. <TT><FONT SIZE=+1>ldapu_cert_verify_function_default</FONT></TT></DD>
  250. <DD>
  251. <TT><FONT SIZE=+1>ldapu_search_cert_dn</FONT></TT></DD>
  252. <DD>
  253. <TT><FONT SIZE=+1>ldapu_subject_dn_to_ldap_dn</FONT></TT></DD>
  254. <H2>
  255. Changed:</H2>
  256. The following changes may affect you. Please review them carefully before
  257. you upgrade to the latest version of ldaputil.
  258. <UL>
  259. <LI>
  260. <TT>ldapu_auth_userdn_groupdn</TT> -- added <TT>const char *base</TT> argument
  261. for group within group membership check</LI>
  262. <LI>
  263. ldap_init and bind calls using <TT>LDAPDatabase_t *ldb</TT> retry once
  264. if the LDAP server is/went down.</LI>
  265. <LI>
  266. <TT>typedef CertVerifyFn_t</TT> has different arguments.</LI>
  267. <LI>
  268. DNs from cert with escaped/quoted characters are correctly handled now.</LI>
  269. <LI>
  270. cert to ldap entry mapping is optimized by not using string comparisons
  271. during thruntime. A bitmask is created when the config file is read, cert
  272. data is mapped to bits and compared against the bitmask.</LI>
  273. <LI>
  274. Only the required attrs are retrieved in most <TT>ldap_search_s </TT>calls
  275. from ldaputil. Some new functions were added to keep older functions the
  276. same.</LI>
  277. <LI>
  278. Fixed a core dump in ldapu_free_LDAPDatabase_t when using the local db.</LI>
  279. <LI>
  280. ldaputil functions for initializing connection to the LDAP server and binding
  281. to the server are thread-safe now. This requires linking to netsite/lib/base.
  282. If you don't use libbase, you can turn off the thread-safe code using a
  283. compile time option.</LI>
  284. </UL>
  285. <H2>
  286. Added:</H2>
  287. <UL>
  288. <LI>
  289. Documentation to functions in ldaputil.h (customer API) - ldaputil.h is
  290. the external public API for customers to write there plugins.</LI>
  291. <LI>
  292. <TT>ldapu_get_cert_der</TT> - returns raw DER encoded cert data</LI>
  293. <LI>
  294. <TT>ldapu_cert_to_user</TT> - Similar to ldapu_cert_to_ldap_entry but only
  295. retrieves the 'uid' and 'userCertificate' attributes from LDAP and also
  296. extracts the user id.</LI>
  297. <LI>
  298. <TT>ldapu_find_uid_attrs</TT> and <TT>ldapu_find_group_attrs</TT> - Similar
  299. to ldapu_find_uid and ldapu_find_group resp., but only retrieves the specified
  300. attributes. Internally used during password verification and group membership
  301. checks.</LI>
  302. <LI>
  303. <TT>ldapu_certinfo_delete, ldapu_certinfo_modify and ldapu_certinfo_save</TT>
  304. - API for the certmap config file GUI tool which is not yet developed.
  305. Any volunteers?</LI>
  306. </UL>
  307. <H2>
  308. <FONT SIZE=+1>TODO/Bugs:</FONT></H2>
  309. <UL>
  310. <LI>
  311. uniquemember attribute is not handled correctly in the group membership
  312. check. If the user's entry has 'x500UniqueIdentifier' attribute populated,
  313. the group could refer to the user entry by the user's dn followed by '#'
  314. and an unique identifier. For example, the group entry could have:</LI>
  315. <DD>
  316. uniquemember: cn=Joe Smith,o=Netscape,c=US#jsmith</DD>
  317. <DT>
  318. where, 'jsmith' is one of the values of the 'x500UniqueIdentifier' attribute
  319. for the Joe Smith entry.</DT>
  320. <DT>
  321. </DT>
  322. </UL>
  323. </BODY>
  324. </HTML>