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

(ITS#5919) URI syntaxe (ldap:///dc=my%2cdc=domaine)



This is a multi-part message in MIME format.

------=_NextPart_000_002C_01C985F1.ABA10980
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

My first work ...

-----Message d'origine-----
De : openldap-its@OpenLDAP.org [mailto:openldap-its@OpenLDAP.org]
Envoy=E9 : mardi 3 f=E9vrier 2009 11:02
=C0 : Philippe.eychart@informatique.gov.pf
Objet : Re: (ITS#5919) URI syntaxe (ldap:///dc=3Dmy%2cdc=3Ddomaine)



*** THIS IS AN AUTOMATICALLY GENERATED REPLY ***

Thanks for your report to the OpenLDAP Issue Tracking System.  Your
report has been assigned the tracking number ITS#5919.

One of our support engineers will look at your report in due course.
Note that this may take some time because our support engineers
are volunteers.  They only work on OpenLDAP when they have spare
time.

If you need to provide additional information in regards to your
issue report, you may do so by replying to this message.  Note that
any mail sent to openldap-its@openldap.org with (ITS#5919)
in the subject will automatically be attached to the issue report.

	mailto:openldap-its@openldap.org?subject=3D(ITS#5919)

You may follow the progress of this report by loading the following
URL in a web browser:
    http://www.OpenLDAP.org/its/index.cgi?findid=3D5919

Please remember to retain your issue tracking number (ITS#5919)
on any further messages you send to us regarding this report.  If
you don't then you'll just waste our time and yours because we
won't be able to properly track the report.

Please note that the Issue Tracking System is not intended to
be used to seek help in the proper use of OpenLDAP Software.
Such requests will be closed.

OpenLDAP Software is user supported.
	http://www.OpenLDAP.org/support/

--------------
Copyright 1998-2007 The OpenLDAP Foundation, All Rights Reserved.


------=_NextPart_000_002C_01C985F1.ABA10980
Content-Type: application/octet-stream;
	name="openldap-2.4.13-i486-1.rfc2782-priOnly.dnssrv.c.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="openldap-2.4.13-i486-1.rfc2782-priOnly.dnssrv.c.patch"

--- openldap-2.4.13/libraries/libldap/dnssrv.c	2009-01-23 =
20:56:43.000000000 +0000=0A=
+++ openldap-2.4.13/libraries/libldap/dnssrv.c	2009-01-24 =
01:00:47.000000000 +0000=0A=
# This patch file is derived from OpenLDAP Software. All of the =
modifications to OpenLDAP Software represented in the following =
patch(es) were developed by Philippe.EYCHART@mail.pf. I have not =
assigned rights and/or interest in this work to any party.=0A=
# this patch for more compliance with RFC 2782 : the result string is =
sorted by priorities (SRV rr) in function ldap_domain2hostlist() ... not =
yet according weight :-(=0A=
@@ -223,10 +223,14 @@=0A=
 #endif=0A=
     if (len >=3D 0) {=0A=
 	unsigned char *p;=0A=
-	char host[DNSBUFSIZ];=0A=
+	struct hostInfo {=0A=
+		char name[DNSBUFSIZ];=0A=
+		int priority;=0A=
+		/* int weight; */=0A=
+		u_short port;=0A=
+	} *host =3D NULL;=0A=
+	int curhost=3D0;=0A=
 	int status;=0A=
-	u_short port;=0A=
-	/* int priority, weight; */=0A=
 =0A=
 	/* Parse out query */=0A=
 	p =3D reply;=0A=
@@ -242,8 +246,15 @@=0A=
 	p +=3D sizeof(HEADER);=0A=
 #endif=0A=
 =0A=
-	status =3D dn_expand(reply, reply + len, p, host, sizeof(host));=0A=
+	host =3D (struct hostInfo *) LDAP_MALLOC (sizeof (struct hostInfo));=0A=
+	if ( ! host ) {=0A=
+	    rc =3D LDAP_NO_MEMORY;=0A=
+	    goto out;=0A=
+	}=0A=
+=0A=
+	status =3D dn_expand(reply, reply + len, p, host[curhost].name, =
sizeof(host[curhost].name));=0A=
 	if (status < 0) {=0A=
+	    LDAP_FREE (host);=0A=
 	    goto out;=0A=
 	}=0A=
 	p +=3D status;=0A=
@@ -251,8 +262,9 @@=0A=
 =0A=
 	while (p < reply + len) {=0A=
 	    int type, class, ttl, size;=0A=
-	    status =3D dn_expand(reply, reply + len, p, host, sizeof(host));=0A=
+	    status =3D dn_expand(reply, reply + len, p, host[curhost].name, =
sizeof(host[curhost].name));=0A=
 	    if (status < 0) {=0A=
+		LDAP_FREE (host);=0A=
 		goto out;=0A=
 	    }=0A=
 	    p +=3D status;=0A=
@@ -265,35 +277,61 @@=0A=
 	    size =3D (p[0] << 8) | p[1];=0A=
 	    p +=3D 2;=0A=
 	    if (type =3D=3D T_SRV) {=0A=
-		int buflen;=0A=
-		status =3D dn_expand(reply, reply + len, p + 6, host, sizeof(host));=0A=
+		status =3D dn_expand(reply, reply + len, p + 6, host[curhost].name, =
sizeof(host[curhost].name));=0A=
 		if (status < 0) {=0A=
+		    LDAP_FREE (host);=0A=
 		    goto out;=0A=
 		}=0A=
-		/* ignore priority and weight for now */=0A=
-		/* priority =3D (p[0] << 8) | p[1]; */=0A=
-		/* weight =3D (p[2] << 8) | p[3]; */=0A=
-		port =3D (p[4] << 8) | p[5];=0A=
+		host[curhost].priority =3D (p[0] << 8) | p[1];=0A=
+		/* ignore weight for now */=0A=
+		/* host[curhost].weight =3D (p[2] << 8) | p[3]; */=0A=
+		host[curhost].port =3D (p[4] << 8) | p[5];=0A=
 =0A=
-		if ( port =3D=3D 0 || host[ 0 ] =3D=3D '\0' ) {=0A=
+		if ( host[curhost].port =3D=3D 0 || host[curhost].name[ 0 ] =3D=3D =
'\0' ) {=0A=
 		    goto add_size;=0A=
 		}=0A=
 =0A=
-		buflen =3D strlen(host) + STRLENOF(":65355 ");=0A=
-		hostlist =3D (char *) LDAP_REALLOC(hostlist, cur + buflen + 1);=0A=
-		if (hostlist =3D=3D NULL) {=0A=
+		curhost++;=0A=
+		host =3D (struct hostInfo *) LDAP_REALLOC (host, (curhost + 1) * =
sizeof (struct hostInfo));=0A=
+		if ( ! host ) {=0A=
 		    rc =3D LDAP_NO_MEMORY;=0A=
 		    goto out;=0A=
 		}=0A=
-		if (cur > 0) {=0A=
-		    /* not first time around */=0A=
-		    hostlist[cur++] =3D ' ';=0A=
-		}=0A=
-		cur +=3D sprintf(&hostlist[cur], "%s:%hd", host, port);=0A=
+=0A=
 	    }=0A=
 add_size:;=0A=
 	    p +=3D size;=0A=
 	}=0A=
+=0A=
+	if ( host[0].name[ 0 ] ) {=0A=
+		int	nbhosts=3Dcurhost, bull;=0A=
+		unsigned char buffer[sizeof (struct hostInfo)];	// :(=0A=
+=0A=
+		// sort hosts by priorities ...=0A=
+		for (bull=3D(char)1; bull; ) { bull=3D(char)0;=0A=
+			for ( curhost=3D1; curhost < nbhosts; curhost++ ) {=0A=
+				if ( host[curhost].priority < host[curhost-1].priority ) {=0A=
+					bull =3D (char)1;=0A=
+					memcpy ( (struct hostInfo *)buffer, &host[curhost-1], sizeof =
(struct hostInfo));=0A=
+					memcpy ( &host[curhost-1],            &host[curhost], sizeof =
(struct hostInfo));=0A=
+					memcpy ( &host[curhost],   (struct hostInfo *)buffer, sizeof =
(struct hostInfo));=0A=
+		}	}	}=0A=
+=0A=
+		// do hostlist, string result ...=0A=
+		for ( cur=3Dcurhost=3D0; curhost < nbhosts; curhost++ ) {=0A=
+=0A=
+			hostlist =3D (char *) LDAP_REALLOC (hostlist, cur + =
strlen(host[curhost].name) + STRLENOF(":65535 ") + 1);=0A=
+			if (hostlist =3D=3D NULL) {=0A=
+				rc =3D LDAP_NO_MEMORY;=0A=
+				LDAP_FREE (host);=0A=
+				goto out;=0A=
+				}=0A=
+			cur +=3D sprintf(&hostlist[cur], "%s:%hd ", host[curhost].name, =
host[curhost].port);=0A=
+=0A=
+		} hostlist[cur] =3D '\0'; /* remove last ' ' */=0A=
+	}=0A=
+=0A=
+	LDAP_FREE (host);=0A=
     }=0A=
     if (hostlist =3D=3D NULL) {=0A=
 	/* No LDAP servers found in DNS. */=0A=

------=_NextPart_000_002C_01C985F1.ABA10980--