steffen: server/imapd Makefile, 1.19, 1.20 kolab-ldap.patch, 1.3, 1.4 kolab.patch, 1.15, 1.16

cvs at intevation.de cvs at intevation.de
Mon Jan 10 13:52:59 CET 2005


Author: steffen

Update of /kolabrepository/server/imapd
In directory doto:/tmp/cvs-serv2239

Modified Files:
	Makefile kolab-ldap.patch kolab.patch 
Log Message:
fix for leaking LDAP connections + data

Index: Makefile
===================================================================
RCS file: /kolabrepository/server/imapd/Makefile,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- Makefile	29 Nov 2004 22:42:03 -0000	1.19
+++ Makefile	10 Jan 2005 12:52:56 -0000	1.20
@@ -8,20 +8,21 @@
   KOLABCVSDIR = $(CURDIR)
 endif
 
+PACKAGE=imapd
 VERSION=2.2.8
 RELEASE=2.2.1
 
 RPM=/kolab/bin/openpkg rpm
  
-all: imapd-$(VERSION)-$(RELEASE).src.rpm
-	$(RPM) -ihv imapd-$(VERSION)-$(RELEASE).src.rpm
+all: $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm
+	$(RPM) -ihv $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm
 
-	cp $(KOLABCVSDIR)/imapd.annotate.patch $(KOLABRPMSRC)/imapd/
-	cp $(KOLABCVSDIR)/kolab.patch $(KOLABRPMSRC)/imapd/           # Patch for imapd.spec
-	cp $(KOLABCVSDIR)/imapd.group2.patch $(KOLABRPMSRC)/imapd/    # Patch for case insensitive group match
-	cp $(KOLABCVSDIR)/kolab-ldap.patch $(KOLABRPMSRC)/imapd/      
+	cp $(KOLABCVSDIR)/imapd.annotate.patch $(KOLABRPMSRC)/$(PACKAGE)/
+	cp $(KOLABCVSDIR)/kolab.patch $(KOLABRPMSRC)/$(PACKAGE)/           # Patch for imapd.spec
+	cp $(KOLABCVSDIR)/imapd.group2.patch $(KOLABRPMSRC)/$(PACKAGE)/    # Patch for case insensitive group match
+	cp $(KOLABCVSDIR)/kolab-ldap.patch $(KOLABRPMSRC)/$(PACKAGE)/      
 
-	cd $(KOLABRPMSRC)/imapd && patch < $(KOLABCVSDIR)/kolab.patch && $(RPM) -ba imapd.spec --define 'with_group yes' --define 'with_atvdom yes' --define 'with_annotate yes' --define 'with_ldap yes'
+	cd $(KOLABRPMSRC)/$(PACKAGE) && patch < $(KOLABCVSDIR)/kolab.patch && $(RPM) -ba $(PACKAGE).spec --define 'with_group yes' --define 'with_atvdom yes' --define 'with_annotate yes' --define 'with_ldap yes'
 
 imapd-$(VERSION)-$(RELEASE).src.rpm:
 	wget -c $(KOLABPKGURI)/imapd-$(VERSION)-$(RELEASE).src.rpm

Index: kolab-ldap.patch
===================================================================
RCS file: /kolabrepository/server/imapd/kolab-ldap.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- kolab-ldap.patch	22 Nov 2004 23:26:26 -0000	1.3
+++ kolab-ldap.patch	10 Jan 2005 12:52:56 -0000	1.4
@@ -1,7 +1,7 @@
-diff -urp ../cyrus-imapd-2.2.6.orig/configure ./configure
---- ../cyrus-imapd-2.2.6.orig/configure	2004-06-17 20:55:49.000000000 +0200
-+++ ./configure	2004-08-18 00:08:52.000000000 +0200
-@@ -14348,7 +14348,7 @@ for flag in ${ldflags} ${default_ldflags
+diff -urp ../cyrus-imapd-2.2.8.orig/configure ./configure
+--- ../cyrus-imapd-2.2.8.orig/configure	2004-07-29 18:22:18.000000000 +0200
++++ ./configure	2005-01-10 12:56:16.000000000 +0100
+@@ -14422,7 +14422,7 @@ for flag in ${ldflags} ${default_ldflags
  done
  
  IMAP_COM_ERR_LIBS="${COM_ERR_LIBS}"
@@ -10,9 +10,9 @@
  
  
  
-diff -urp ../cyrus-imapd-2.2.6.orig/imap/global.c ./imap/global.c
---- ../cyrus-imapd-2.2.6.orig/imap/global.c	2004-05-22 05:45:49.000000000 +0200
-+++ ./imap/global.c	2004-08-18 00:09:45.000000000 +0200
+diff -urp ../cyrus-imapd-2.2.8.orig/imap/global.c ./imap/global.c
+--- ../cyrus-imapd-2.2.8.orig/imap/global.c	2004-05-22 05:45:49.000000000 +0200
++++ ./imap/global.c	2005-01-10 13:40:19.000000000 +0100
 @@ -52,6 +52,9 @@
  #include <netinet/in.h>
  #include <sys/stat.h>
@@ -42,7 +42,7 @@
  
      /* check for domain */
      if (config_virtdomains &&
-@@ -367,6 +382,37 @@ char *canonify_userid(char *user, char *
+@@ -367,6 +382,47 @@ char *canonify_userid(char *user, char *
      }
  
      if (config_virtdomains) {
@@ -53,15 +53,14 @@
 +           bindpw = config_getstring(IMAPOPT_LDAP_PASSWORD);
 +           timeout.tv_sec = config_getint(IMAPOPT_LDAP_TIME_LIMIT);
 +           timeout.tv_usec = 0;
-+	   sprintf(filter, "(uid=%s)", user);
++           sprintf(filter, "(uid=%s)", user);
 +           rc = ldap_initialize(&handle, uri);
-+	   if (rc != LDAP_SUCCESS) {
++           if (rc != LDAP_SUCCESS) {
 +                syslog(LOG_ERR, "ldap_initialize failed (%s)", uri);
 +           } else {
 +	        rc = ldap_simple_bind_s(handle, binddn, bindpw);
 +	        if (rc != LDAP_SUCCESS) {
 +                     syslog(LOG_ERR, "ldap_simple_bind() failed %d (%s)", rc, ldap_err2string(rc));
-+                     ldap_unbind(handle);
 +	        } else {
 +	             rc = ldap_search_st(handle, base, LDAP_SCOPE_SUBTREE, filter, NULL, 0, &timeout, &res);
 +                     if (rc != LDAP_SUCCESS) {
@@ -70,17 +69,28 @@
 +	                  if ( (entry = ldap_first_entry(handle, res)) != NULL ) {
 +			       // read mail attribute from entry
 +			       if ( (vals = ldap_get_values(handle, entry, "mail")) ) {
-+  				    if (strchr(vals[0], '@')) return auth_canonifyid(vals[0], 0) ;
++  				    if (strchr(vals[0], '@')) {
++				        static char buf[81]; /* same size as in auth_canonifyid */
++					strncpy( buf, vals[0], sizeof(buf) );
++					buf[80] = '\0'; /* make sure it's null-terminated */
++					ldap_value_free( vals );
++				        ldap_msgfree( res );
++					ldap_unbind_s(handle); /* also frees handle */
++				        return auth_canonifyid( buf, 0) ;
++				    }
++				    ldap_value_free( vals );
 +			       }			       	
 +   	                  }
++			  ldap_msgfree( res );
 +                     }
 +                }
++		ldap_unbind_s(handle); /* also frees handle */
 +           }
 +        }
  	if (domain) {
  	    if (config_defdomain && !strcasecmp(config_defdomain, domain+1)) {
  		*domain = '\0'; /* trim the default domain */
-@@ -379,7 +425,7 @@ char *canonify_userid(char *user, char *
+@@ -379,7 +435,7 @@ char *canonify_userid(char *user, char *
  		user = buf;
  	    }
  	}
@@ -89,10 +99,11 @@
  	    socklen_t salen;
  	    int error;
  	    struct sockaddr_storage localaddr;
-diff -urp ../cyrus-imapd-2.2.6.orig/lib/imapoptions ./lib/imapoptions
---- ../cyrus-imapd-2.2.6.orig/lib/imapoptions	2004-05-25 02:03:05.000000000 +0200
-+++ ./lib/imapoptions	2004-08-18 00:08:52.000000000 +0200
-@@ -823,7 +823,7 @@ are listed with ``<none>''.
+Kun i ./imap: global.c~
+diff -urp ../cyrus-imapd-2.2.8.orig/lib/imapoptions ./lib/imapoptions
+--- ../cyrus-imapd-2.2.8.orig/lib/imapoptions	2004-07-21 21:07:45.000000000 +0200
++++ ./lib/imapoptions	2005-01-10 12:56:16.000000000 +0100
+@@ -839,7 +839,7 @@ are listed with ``<none>''.
     mailbox hierarchy.  The default is to use the netnews separator
     character '.'. */
  
@@ -101,10 +112,10 @@
  /* Enable virtual domain support.  If enabled, the user's domain will
     be determined by splitting a fully qualified userid at the last '@'
     or '%' symbol.  If the userid is unqualified, and the virtdomains
-diff -urp ../cyrus-imapd-2.2.6.orig/lib/imapopts.c ./lib/imapopts.c
---- ../cyrus-imapd-2.2.6.orig/lib/imapopts.c	2004-06-17 20:55:50.000000000 +0200
-+++ ./lib/imapopts.c	2004-08-18 00:08:52.000000000 +0200
-@@ -183,7 +183,7 @@ struct imapopt_s imapopts[] =
+diff -urp ../cyrus-imapd-2.2.8.orig/lib/imapopts.c ./lib/imapopts.c
+--- ../cyrus-imapd-2.2.8.orig/lib/imapopts.c	2004-07-29 18:22:18.000000000 +0200
++++ ./lib/imapopts.c	2005-01-10 12:56:16.000000000 +0100
+@@ -186,7 +186,7 @@ struct imapopt_s imapopts[] =
    { IMAPOPT_USERPREFIX, "userprefix", 0, {(void *)("Other Users")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
    { IMAPOPT_UNIX_GROUP_ENABLE, "unix_group_enable", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
    { IMAPOPT_UNIXHIERARCHYSEP, "unixhierarchysep", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
@@ -113,9 +124,9 @@
  
    { IMAPOPT_LAST, NULL, 0, { NULL }, OPT_NOTOPT, {  { NULL, IMAP_ENUM_ZERO } } }
  
-diff -urp ../cyrus-imapd-2.2.6.orig/lib/imapopts.h ./lib/imapopts.h
---- ../cyrus-imapd-2.2.6.orig/lib/imapopts.h	2004-06-17 20:55:50.000000000 +0200
-+++ ./lib/imapopts.h	2004-08-18 00:08:52.000000000 +0200
+diff -urp ../cyrus-imapd-2.2.8.orig/lib/imapopts.h ./lib/imapopts.h
+--- ../cyrus-imapd-2.2.8.orig/lib/imapopts.h	2004-07-29 18:22:18.000000000 +0200
++++ ./lib/imapopts.h	2005-01-10 12:56:16.000000000 +0100
 @@ -188,6 +188,7 @@ enum enum_value {
  
    IMAP_ENUM_VIRTDOMAINS_ON,

Index: kolab.patch
===================================================================
RCS file: /kolabrepository/server/imapd/kolab.patch,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- kolab.patch	29 Nov 2004 22:42:03 -0000	1.15
+++ kolab.patch	10 Jan 2005 12:52:56 -0000	1.16
@@ -15,7 +15,7 @@
  License:      BSD
  Version:      2.2.8
 -Release:      2.2.1
-+Release:      2.2.1_kolab
++Release:      2.2.1_kolab2
  
  #   package options
 -%option       with_fsl    yes





More information about the commits mailing list