1 message in net.sourceforge.lists.courier-maildrop[maildropl] maildrop 1.6.3 LDAP proto...
FromSent OnAttachments
Michael BrennenJun 28, 2004 9:48 pm.patch
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:[maildropl] maildrop 1.6.3 LDAP protocol version 3 source patchActions...
From:Michael Brennen (mich@fishnet.us)
Date:Jun 28, 2004 9:48:47 pm
List:net.sourceforge.lists.courier-maildrop
Attachments:

Hello,

I needed to get LDAP protocol version 3 working to get the binddn/bindpw options to work with openldap 2.2.11. I made a source patch to add a 'protocol_version' option in the maildropldap.config file. It defaults to version 2 if not specified.

I've attached a patch that will make the few modifications needed to the source tree. To apply the patch put it in the root of the maildrop-1.6.3 source tree, then run

# patch -p0 < maildrop_ldap_protocol.patch

I hope someone will consider adding it to the source tree; it should be useful to others as well. Thanks...

-- Michael

--- maildropldap.config.orig 2004-06-26 00:26:56.000000000 -0500 +++ maildropldap.config 2004-06-26 00:34:17.000000000 -0500 @@ -54,12 +54,16 @@

# binddn, bindpw - optional, binddn and password if your ldap server # requires you to authenticate before searching #binddn uid=binduser,dc=yourdomain,dc=com #bindpw yourbindpassword

+# protocol_version - defaults to LDAP protocol version 2 +# version 3 is generally required if binddn/bindpw are used +#protocol_version 2 + # timeout - specifies maximum time ( in seconds ) to wait for a response # from the LDAP server timeout 5

# search_method - used to specify whether to search on the users id, or # email address, and may be either 'mail' or 'uid' --- maildrop/mdldap.c.orig 2004-06-26 00:27:54.000000000 -0500 +++ maildrop/mdldap.c 2004-06-26 00:24:02.000000000 -0500 @@ -24,12 +24,16 @@ struct timeval tv;

ldap = ldap_init(cfg->hostname,cfg->port); if ( !ldap ) return NULL;

+ if (ldap_set_option(ldap, LDAP_OPT_PROTOCOL_VERSION, + &cfg->proto_version) != LDAP_OPT_SUCCESS) + return NULL; + if ( cfg->binddn && cfg->bindpw ) { needbind = 1; if ( ldap_simple_bind_s(ldap,cfg->binddn,cfg->bindpw) != 0 ) return NULL; } --- maildrop/mdldapconfig.h.orig 2004-06-26 00:28:32.000000000 -0500 +++ maildrop/mdldapconfig.h 2004-06-26 00:24:33.000000000 -0500 @@ -1,14 +1,16 @@ #ifndef __MDLDAPCONFIG_H #define __MDLDAPCONFIG_H 1

+#include <ldap.h> #ifdef __cplusplus extern "C" { #endif

#define LDAP_DEFAULT_PORT 389 +#define LDAP_DEFAULT_VERSION LDAP_VERSION2

#define LDAP_DEFAULT_SEARCH_METHOD "mail" #define LDAP_DEFAULT_MAIL_ATTR "mail" #define LDAP_DEFAULT_UID_ATTR "uid" #define LDAP_DEFAULT_UIDNUMBER_ATTR "uidnumber" #define LDAP_DEFAULT_GIDNUMBER_ATTR "gidnumber" @@ -35,12 +37,13 @@ char *quota_attr;

int default_uidnumber; int default_gidnumber;

int timeout; + int proto_version; } mdldapconfig;

mdldapconfig *get_ldap_config(char *configfile);

#ifdef __cplusplus } --- maildrop/mdldapconfig.c.orig 2004-06-26 00:28:18.000000000 -0500 +++ maildrop/mdldapconfig.c 2004-06-26 00:24:09.000000000 -0500 @@ -32,12 +32,14 @@ cfg->homedirectory_attr = NULL;

cfg->port = LDAP_DEFAULT_PORT;

cfg->timeout = LDAP_DEFAULT_TIMEOUT;

+ cfg->proto_version = LDAP_DEFAULT_VERSION; + while ( fgets(buf,1024,fp) ) { size_t tmp;

if (buf[0] == '#' || buf[0] == '\n') continue; @@ -93,12 +95,15 @@

if ( !strcasecmp(var,"default_uidnumber") ) cfg->default_uidnumber = atoi(val);

if ( !strcasecmp(var,"default_gidnumber") ) cfg->default_gidnumber = atoi(val); + + if ( !strcasecmp(var,"protocol_version") ) + cfg->proto_version = atoi(val); }

fclose(fp);

if ( !cfg->search_method ) cfg->search_method = (char*)strdup(LDAP_DEFAULT_SEARCH_METHOD);