Hi,
I (finally) revisited my LDAP over SSL patch. Attached with this email is a
new patch that will allow both the "old" LDAP_SERVER / LDAP_PORT and the new
LDAP_URI settings.
I suspect there might be a memory leak caused by this patch. If someone better
than I in C wants to double check, you're highly encouraged to do so ;)
Michael
--
Michael Richard
Administrateur de Systemes
CESART
Tel: (514) 288-4333
Fax: (514) 288-6980
Web: http://www.cesart.com
--- authldaplib.c.orig 2005-09-30 23:33:06.000000000 -0400
+++ authldaplib.c 2005-10-28 12:06:56.994436152 -0400
@@ -20,7 +20,7 @@
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
+ P_
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
@@ -335,8 +335,33 @@
memset(ldap,0,sizeof(struct ldap_info));
if (!read_env("LDAP_URI",&ldap->uri,
+ "No URI specified, looking for (obsolete) SERVER and PORT",1,NULL))
+ {
+ const char *hostname;
+ int port;
+ char *uri;
+
+ if (!read_env("LDAP_SERVER",&hostname,
"You need to specify a ldap server in config file",1,NULL))
- return 0;
+ return 0;
+
+ port=LDAP_PORT;
+
+ if (!read_env("LDAP_PORT", &p, "", 0, ""))
+ return (0);
+
+ if (p)
+ sscanf(p,"%d",&port);
+
+ uri=malloc(256);
+
+ if (port==636)
+ sprintf(uri,"ldaps://%s:%d",hostname,port);
+ else
+ sprintf(uri,"ldap://%s:%d",hostname,port);
+
+ ldap->uri=uri;
+ }
if (!read_env("LDAP_AUTHBIND", &p, "", 0, ""))
return (0);