[Date Prev][Date Next] [Chronological] [Thread] [Top]

Enhancement to implement V3 Referral / Search Reference Handling (ITS#546)



This is a MIME message. If you are reading this text, you may want to 
consider changing to a mail reader or gateway that understands how to 
properly handle MIME multipart messages.

--=_D68ECEE4.6405DB0B
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Full_Name: Steven Sonntag
Version: devel
OS: Linux / NetWare / WinNT
URL: ftp://ftp.openldap.org/incoming/vtag-000524.patch


Here is the patch for the implementation of V3 referrals.  It is based on =
the development tree, current code revisions (as of 05/24).

I have tried to not break V2 referrals, but since I don't currently have a =
way to test them, I don't know for sure if V2 referrals still work.

This code has been built, and run on Netware, WinNT, and Linux and I =
believe it is pretty solid.

I don't know of any bugs in the current code, however there are some =
deficiencies.

1 - The rebind proc needs some work.  It should indicate to the application=
 whether the URL is a reference or a referral.  It should really be more =
general and be called before connect whether or not a bind is needed.  =
This would change its nature from a rebind_proc to a referral_proc. The =
application can then decide:
 - If a new connection is needed - should the application allow one to be =
created?
 - If a bind is necessary, the application decides what kind of bind to =
perform and performs it
 - Should the referral be followed.
Anyway for now, it is just a rebind proc with somewhat changed parameters. =
 The rebind proc has the task of performing what ever synchronous bind is =
appropriate.  If not provided, the API performs an anonymous bind as =
before.

2 - The client control to turn referrals on / off on a per request basis =
is not implemented.

3 - When the BER is re-encoded the code does not replace the filter in the =
BER if one is specified in the referral or reference.  It only replaces =
the DN in the BER.

The following is a brief description of the changes in the various files.

 include/ldap.h
 - Redefine rebind_proc prototype
 libraries/libldap/bind.c
 - Remove previous implementation of rebind proc, now in options.c
 libraries/libldap/cldap.c
 - modify call to ldap_new_connection for changed prototype
 libraries/libldap/ldap-int.h
 - Add rebind proc to ldapoptions structure
 - Add new variables to connection structure to support V3 referrals
 - Add new status definition to request structure
 - Define structure used to provide data needed for the rebind proc. This =
structure is passed to the ldap_new_connection function and replaces the =
current 0/1 flag.  It is now NULL/pointer.
 - Remove previous rebind_proc storage from the ld structure.
 - Add prototypes for the ldap_chase_v3referrals function and modify =
prototypes for ldap_new_connection,   and ldap_send_server_request.
 libraries/libldap/open.c
 - Modify call to ldap_new_connection to conform with new function =
prototype.
 libraries/libldap/options.c
 - Add support for ldap_set_rebind_proc to ldap_set_option.
 libraries/libldap/request.c
 - Added Novell Copyright header
 - Add type variable to ber_reencode_request to return the request type
 - Change bind variable passed to ldap_send_server_request and ldap_new_con=
nection from int to structure pointer
 - Rewrite code that calls rebind_proc in ldap_new_connection
 - Add code to ldap_free_connection to free resources associated with =
referral handling
 - Add code in ldap_dump_requests_and_responses function to display new =
status code
 - Add new function ldap_chase_v3referrals.
 - Minor modification to ldap_chase_referrals for ldap_send_server_request =
prototype change
 libraries/libldap/result.c
 - Added Novell Copyright header
 - Modified read1msg function to recognize and handle referrals and search =
references.
 libraries/libldap/search.c
 - Fix return so results are returned from a search reference
 libraries/libldap/test.c
 - Modified for new rebind_proc function prototype.
 libraries/libldap/url.c
 - Kluge to ldap_url_parse so it correctly interprets URLs from early =
versions of LDAP in NetWare.

-Steve Sonntag
Consulting Engineer
Novell Directory Services
vtag@novell.com

--=_D68ECEE4.6405DB0B
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3D"text/html; charset=3Diso-8859-1" http-equiv=3DContent-Type=
>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY style=3D"FONT: 8pt MS Sans Serif; MARGIN-LEFT: 2px; MARGIN-TOP: =
2px">
<DIV><FONT size=3D1>Full_Name: Steven Sonntag</FONT></DIV>
<DIV><FONT size=3D1>Version: devel<BR>OS: Linux / NetWare / WinNT<BR>URL: =
<A=20
href=3D"ftp://ftp.openldap.org/incoming/vtag-000524.patch";>ftp://ftp.openld=
ap.org/incoming/vtag-000524.patch</A><BR></FONT><FONT=20
size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT></DIV>
<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT>&nbsp;</DIV>=

<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff">Here is the patch =
for the=20
implementation of V3 referrals.&nbsp; It is based on the development =
tree,=20
current code revisions (as of 05/24).</FONT></DIV>
<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT>&nbsp;</DIV>=

<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff">I have tried to =
not break V2=20
referrals, but since I don't currently have a way to test them, I don't =
know for=20
sure if V2 referrals still work.</FONT></DIV>
<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT>&nbsp;</DIV>=

<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff">This code has been =
built,=20
and run on Netware, WinNT, and Linux and I believe it is pretty=20
solid.</FONT></DIV>
<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT>&nbsp;</DIV>=

<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff">I don't know of =
any bugs in=20
the current code, however there are some deficiencies.</FONT></DIV>
<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT>&nbsp;</DIV>=

<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff">1 - The rebind =
proc needs=20
some work.&nbsp; It should indicate to the application whether the URL is =
a=20
reference or a referral.&nbsp; It should really be more general and be =
called=20
before connect whether or not a bind is needed.&nbsp; This would change =
its=20
nature from a rebind_proc to a referral_proc. The application can then=20
decide:<BR>&nbsp;- If a new connection is needed - should the application =
allow=20
one to be created?<BR>&nbsp;- If a bind is necessary, the application =
decides=20
what kind of bind to perform and performs it<BR>&nbsp;- Should the =
referral be=20
followed.<BR>Anyway for now, it is just a rebind proc with somewhat =
changed=20
parameters.&nbsp; The rebind proc has the task of performing what ever=20
synchronous bind is appropriate.&nbsp; If not provided, the API performs =
an=20
anonymous bind as before.</FONT></DIV>
<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT>&nbsp;</DIV>=

<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff">2 - The client =
control to=20
turn referrals on / off on a per request basis is not implemented.</FONT></=
DIV>
<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT>&nbsp;</DIV>=

<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff">3 - When the BER =
is=20
re-encoded the code does not replace the filter in the BER if one is =
specified=20
in the referral or reference.&nbsp; It only replaces the DN in the=20
BER.</FONT></DIV>
<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT>&nbsp;</DIV>=

<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff">The following is a =
brief=20
description of the changes in the various files.</FONT></DIV>
<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT>&nbsp;</DIV>=

<DIV><FONT size=3D1=20
style=3D"BACKGROUND-COLOR: #ffffff">&nbsp;include/ldap.h<BR>&nbsp;- =
Redefine=20
rebind_proc prototype<BR>&nbsp;libraries/libldap/bind.c<BR>&nbsp;- =
Remove=20
previous implementation of rebind proc, now in=20
options.c<BR>&nbsp;libraries/libldap/cldap.c<BR>&nbsp;- modify call to=20
ldap_new_connection for changed=20
prototype<BR>&nbsp;libraries/libldap/ldap-int.h<BR>&nbsp;- Add rebind proc =
to=20
ldapoptions structure<BR>&nbsp;- Add new variables to connection structure =
to=20
support V3 referrals<BR>&nbsp;- Add new status definition to request=20
structure<BR>&nbsp;- Define structure used to provide data needed for the =
rebind=20
proc. This structure is passed to the ldap_new_connection function and =
replaces=20
the current 0/1 flag.&nbsp; It is now NULL/pointer.<BR>&nbsp;- Remove =
previous=20
rebind_proc storage from the ld structure.<BR>&nbsp;- Add prototypes for =
the=20
ldap_chase_v3referrals function and modify prototypes for=20
ldap_new_connection,&nbsp;&nbsp; and=20
ldap_send_server_request.<BR>&nbsp;libraries/libldap/open.c<BR>&nbsp;- =
Modify=20
call to ldap_new_connection to conform with new function=20
prototype.<BR>&nbsp;libraries/libldap/options.c<BR>&nbsp;- Add support =
for=20
ldap_set_rebind_proc to=20
ldap_set_option.<BR>&nbsp;libraries/libldap/request.c<BR>&nbsp;- Added =
Novell=20
Copyright header<BR>&nbsp;- Add type variable to ber_reencode_request to =
return=20
the request type<BR>&nbsp;- Change bind variable passed to=20
ldap_send_server_request and ldap_new_connection from int to structure=20
pointer<BR>&nbsp;- Rewrite code that calls rebind_proc in=20
ldap_new_connection<BR>&nbsp;- Add code to ldap_free_connection to free=20
resources associated with referral handling<BR>&nbsp;- Add code in=20
ldap_dump_requests_and_responses function to display new status code<BR>&nb=
sp;-=20
Add new function ldap_chase_v3referrals.<BR>&nbsp;- Minor modification =
to=20
ldap_chase_referrals for ldap_send_server_request prototype=20
change<BR>&nbsp;libraries/libldap/result.c<BR>&nbsp;- Added Novell =
Copyright=20
header<BR>&nbsp;- Modified read1msg function to recognize and handle =
referrals=20
and search references.<BR>&nbsp;libraries/libldap/search.c<BR>&nbsp;- Fix =
return=20
so results are returned from a search=20
reference<BR>&nbsp;libraries/libldap/test.c<BR>&nbsp;- Modified for new=20
rebind_proc function prototype.<BR>&nbsp;libraries/libldap/url.c<BR>&nbsp;-=
=20
Kluge to ldap_url_parse so it correctly interprets URLs from early =
versions of=20
LDAP in NetWare.</FONT></DIV>
<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff"></FONT>&nbsp;</DIV>=

<DIV><FONT size=3D1 style=3D"BACKGROUND-COLOR: #ffffff">-Steve Sonntag<BR>C=
onsulting=20
Engineer<BR>Novell Directory Services<BR><A=20
href=3D"mailto:vtag@novell.com";>vtag@novell.com</A></FONT></DIV></BODY></HT=
ML>

--=_D68ECEE4.6405DB0B--