gunnar: server/patches/cyrus-imapd/cyrus-imapd-2.3.12 KOLAB_cyrus-imapd-2.3.12_UID.patch, 1.1, 1.2

cvs at kolab.org cvs at kolab.org
Wed Apr 30 07:18:21 CEST 2008


Author: gunnar

Update of /kolabrepository/server/patches/cyrus-imapd/cyrus-imapd-2.3.12
In directory doto:/tmp/cvs-serv13755

Modified Files:
	KOLAB_cyrus-imapd-2.3.12_UID.patch 
Log Message:
kolab/issue1824 (cyrus-imapd segfaults on x86_64)

Index: KOLAB_cyrus-imapd-2.3.12_UID.patch
===================================================================
RCS file: /kolabrepository/server/patches/cyrus-imapd/cyrus-imapd-2.3.12/KOLAB_cyrus-imapd-2.3.12_UID.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- KOLAB_cyrus-imapd-2.3.12_UID.patch	22 Apr 2008 08:51:33 -0000	1.1
+++ KOLAB_cyrus-imapd-2.3.12_UID.patch	30 Apr 2008 05:18:18 -0000	1.2
@@ -38,13 +38,13 @@
 +    LDAP *handle;
 +    LDAPMessage *res;
 +    LDAPMessage *entry;
-+    char ** vals;
++    struct berval** vals;
 +
 +    int rc;
  
      /* check for domain */
      if (config_virtdomains &&
-@@ -380,6 +395,47 @@ char *canonify_userid(char *user, char *
+@@ -380,6 +395,49 @@
      }
  
      if (config_virtdomains) {
@@ -70,17 +70,19 @@
 +                     } else {
 +	                  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], '@')) {
++			       if ( (vals = ldap_get_values_len(handle, entry, "mail")) ) {
++  				    if (memchr(vals[0]->bv_val, '@', vals[0]->bv_len)) {
 +				        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 );
++					   int len = ((sizeof(buf) - 1) > vals[0]->bv_len ? vals[0]->bv_len : sizeof(buf) - 1);
++					strncpy( buf, vals[0]->bv_val, len);
++					buf[len] = '\0'; /* make sure it's null-terminated */
++					ldap_value_free_len( vals );
 +				        ldap_msgfree( res );
 +					ldap_unbind_s(handle); /* also frees handle */
++					syslog(LOG_DEBUG, "canonify: '%s'\n", buf);
 +				        return auth_canonifyid( buf, 0) ;
 +				    }
-+				    ldap_value_free( vals );
++				    ldap_value_free_len( vals );
 +			       }			       	
 +   	                  }
 +			  ldap_msgfree( res );





More information about the commits mailing list