ldapu-changes.html 16 KB

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