3 messages in net.sourceforge.lists.courier-users[courier-users] LDAP patch
FromSent OnAttachments
Michael RichardOct 28, 2005 10:52 am.patch
Mark BucciarelliOct 28, 2005 12:19 pm 
Michael RichardOct 28, 2005 1:10 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[courier-users] LDAP patchActions...
From:Michael Richard (mich@cesart.com)
Date:Oct 28, 2005 10:52:48 am
List:net.sourceforge.lists.courier-users
Attachments:

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);