gunnar: server/imapd/patches/cyrus-imapd-2.3.16 KOLAB_cyrus-imapd-2.3.16_Cyradm_Annotations.patch, NONE, 1.1 KOLAB_cyrus-imapd-2.3.16_Folder-names.patch, NONE, 1.1 KOLAB_cyrus-imapd-2.3.16_Groups2.patch, NONE, 1.1 KOLAB_cyrus-imapd-2.3.16_Logging.patch, NONE, 1.1 KOLAB_cyrus-imapd-2.3.16_UID.patch, NONE, 1.1 KOLAB_cyrus-imapd-2.3.16_timsieved_starttls-sendcaps.patch, NONE, 1.1 series, NONE, 1.1
cvs at kolab.org
cvs at kolab.org
Wed Dec 23 20:53:21 CET 2009
Author: gunnar
Update of /kolabrepository/server/imapd/patches/cyrus-imapd-2.3.16
In directory doto:/tmp/cvs-serv31284/cyrus-imapd-2.3.16
Added Files:
KOLAB_cyrus-imapd-2.3.16_Cyradm_Annotations.patch
KOLAB_cyrus-imapd-2.3.16_Folder-names.patch
KOLAB_cyrus-imapd-2.3.16_Groups2.patch
KOLAB_cyrus-imapd-2.3.16_Logging.patch
KOLAB_cyrus-imapd-2.3.16_UID.patch
KOLAB_cyrus-imapd-2.3.16_timsieved_starttls-sendcaps.patch
series
Log Message:
Kolab patches for cyrus-imapd-2.3.16.
KOLAB_cyrus-imapd-2.3.15_Annotations2.patch really went upstream. Unbelievable...
KOLAB_cyrus-imapd-2.3.16_Logging.patch was modified and logging the expunge operation when closing a mailbox should be tested again.
--- NEW FILE: KOLAB_cyrus-imapd-2.3.16_Cyradm_Annotations.patch ---
Allows to use arbitrary annotations with the cyradm tool.
diff -r 69927cac0b1b doc/man/cyradm.1.html
--- a/doc/man/cyradm.1.html Fri Dec 04 10:32:26 2009 +0100
+++ b/doc/man/cyradm.1.html Fri Dec 04 10:32:33 2009 +0100
@@ -220,6 +220,13 @@
<dd>
<p>Sets an email address to which messages injected into the server via NNTP
will be sent.</p>
+</dd>
+</li>
+<dt><strong><a NAME="item__2fexplicit_2fannotation"><code>/explicit/annotation</code></a></strong>
+
+<dd>
+<p>Sets the annotation <em>/explicit/annotation</em>
+on <em>mailbox</em> to <em>value</em>.</p>
</dd>
<dt><strong><a name="sharedseen" class="item"><code>sharedseen</code></a></strong></dt>
diff -r 69927cac0b1b perl/imap/IMAP/Admin.pm
--- a/perl/imap/IMAP/Admin.pm Fri Dec 04 10:32:26 2009 +0100
+++ b/perl/imap/IMAP/Admin.pm Fri Dec 04 10:32:33 2009 +0100
@@ -797,11 +797,11 @@
return undef;
}
- if(!exists($values{$entry})) {
- $self->{error} = "Unknown parameter $entry";
+ if(exists($values{$entry})) {
+ $entry = $values{$entry};
+ } else {
+ $self->{error} = "Unknown parameter $entry" unless substr($entry,0,1) eq "/";
}
-
- $entry = $values{$entry};
my ($rc, $msg);
diff -r 69927cac0b1b perl/imap/IMAP/Shell.pm
--- a/perl/imap/IMAP/Shell.pm Fri Dec 04 10:32:26 2009 +0100
+++ b/perl/imap/IMAP/Shell.pm Fri Dec 04 10:32:33 2009 +0100
@@ -127,7 +127,7 @@
[\&_sc_info, '[mailbox]',
'display mailbox/server metadata'],
mboxcfg =>
- [\&_sc_mboxcfg, 'mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value',
+ [\&_sc_mboxcfg, 'mailbox [comment|condstore|news2mail|expire|sieve|squat|/<explicit annotation>] value',
'configure mailbox'],
mboxconfig => 'mboxcfg',
reconstruct =>
@@ -1437,7 +1437,7 @@
while (defined ($opt = shift(@argv))) {
last if $opt eq '--';
if ($opt =~ /^-/) {
- die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value\n";
+ die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat|/<explicit annotation>] value\n";
}
else {
push(@nargv, $opt);
@@ -1446,7 +1446,7 @@
}
push(@nargv, @argv);
if (@nargv < 2) {
- die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value\n";
+ die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat|/<explicit annotation>] value\n";
}
if (!$cyrref || !$$cyrref) {
die "mboxconfig: no connection to server\n";
diff -r 69927cac0b1b perl/imap/cyradm.sh
--- a/perl/imap/cyradm.sh Fri Dec 04 10:32:26 2009 +0100
+++ b/perl/imap/cyradm.sh Fri Dec 04 10:32:33 2009 +0100
@@ -241,6 +241,10 @@
Indicates that the mailbox should have a squat index created for it.
+=item C</explicit/annotation>
+
+Sets the annotation I</explicit/annotation> on I<mailbox> to I<value>.
+
=back
=item C<renamemailbox> [C<--partition> I<partition>] I<oldname> I<newname>
--- NEW FILE: KOLAB_cyrus-imapd-2.3.16_Folder-names.patch ---
Modifies the set of accepted characters in folder names for the cyrus imapd server [Version: 2.3.9]
diff -r 17e54b46d7b6 imap/mboxname.c
--- a/imap/mboxname.c Mon Oct 27 18:44:56 2008 +0100
+++ b/imap/mboxname.c Mon Oct 27 18:47:11 2008 +0100
@@ -713,8 +713,10 @@
/*
* Apply site policy restrictions on mailbox names.
* Restrictions are hardwired for now.
+ * original definition
+#define GOODCHARS " #$'+,-.0123456789:=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~"
*/
-#define GOODCHARS " #$'+,-.0123456789:=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~"
+#define GOODCHARS " #$%'()*+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"
int mboxname_policycheck(char *name)
{
unsigned i;
--- NEW FILE: KOLAB_cyrus-imapd-2.3.16_Groups2.patch ---
diff -r 37030bf2b2bb lib/auth_unix.c
--- a/lib/auth_unix.c Fri Dec 04 10:25:24 2009 +0100
+++ b/lib/auth_unix.c Fri Dec 04 10:32:19 2009 +0100
@@ -46,6 +46,7 @@
#include <stdlib.h>
#include <pwd.h>
#include <grp.h>
+#include <stdio.h>
#include <ctype.h>
#include <string.h>
@@ -54,6 +55,126 @@
#include "xmalloc.h"
#include "util.h"
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+/*
+ * __getgrent.c - This file is part of the libc-8086/grp package for ELKS,
+ * Copyright (C) 1995, 1996 Nat Friedman <ndf at linux.mit.edu>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+static struct group *__getgrent(int grp_fd, char *line_buff, char **members)
+{
+ short line_index;
+ short buff_size;
+ static struct group group;
+ register char *ptr;
+ char *field_begin;
+ short member_num;
+ char *endptr;
+ int line_len;
+
+ /* We use the restart label to handle malformatted lines */
+ restart:
+ line_index = 0;
+ buff_size = 256;
+
+ line_buff = realloc(line_buff, buff_size);
+ while (1) {
+ if ((line_len = read(grp_fd, line_buff + line_index,
+ buff_size - line_index)) <= 0) {
+ return NULL;
+ }
+ field_begin = strchr(line_buff, '\n');
+ if (field_begin != NULL) {
+ lseek(grp_fd,
+ (long) (1 + field_begin -
+ (line_len + line_index + line_buff)), SEEK_CUR);
+ *field_begin = '\0';
+ if (*line_buff == '#' || *line_buff == ' '
+ || *line_buff == '\n' || *line_buff == '\t')
+ goto restart;
+ break;
+ } else {
+ /* Allocate some more space */
+ line_index = buff_size;
+ buff_size += 256;
+ line_buff = realloc(line_buff, buff_size);
+ }
+ }
+
+ /* Now parse the line */
+ group.gr_name = line_buff;
+ ptr = strchr(line_buff, ':');
+ if (ptr == NULL)
+ goto restart;
+ *ptr++ = '\0';
+
+ group.gr_passwd = ptr;
+ ptr = strchr(ptr, ':');
+ if (ptr == NULL)
+ goto restart;
+ *ptr++ = '\0';
+
+ field_begin = ptr;
+ ptr = strchr(ptr, ':');
+ if (ptr == NULL)
+ goto restart;
+ *ptr++ = '\0';
+
+ group.gr_gid = (gid_t) strtoul(field_begin, &endptr, 10);
+ if (*endptr != '\0')
+ goto restart;
+
+ member_num = 0;
+ field_begin = ptr;
+
+ if (members != NULL)
+ free(members);
+ members = (char **) malloc((member_num + 1) * sizeof(char *));
+ for ( ; field_begin && *field_begin != '\0'; field_begin = ptr) {
+ if ((ptr = strchr(field_begin, ',')) != NULL)
+ *ptr++ = '\0';
+ members[member_num++] = field_begin;
+ members = (char **) realloc(members,
+ (member_num + 1) * sizeof(char *));
+ }
+ members[member_num] = NULL;
+
+ group.gr_mem = members;
+ return &group;
+}
+
+static char *line_buff = NULL;
+static char **members = NULL;
+
+struct group *fgetgrent(FILE *file)
+{
+ if (file == NULL) {
+ errno = EINTR;
+ return NULL;
+ }
+ return __getgrent(fileno(file), line_buff, members);
+}
+#endif /* __FreeBSD__ */
+
struct auth_state {
char userid[81];
char **group;
@@ -141,6 +262,25 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
+static struct group* fgetgrnam(const char* name)
+{
+ struct group *grp;
+ FILE *groupfile;
+
+ groupfile = fopen("/etc/imapd.group", "r");
+ if (!groupfile) groupfile = fopen("/etc/group", "r");
+ if (groupfile) {
+ while ((grp = fgetgrent(groupfile))) {
+ if (strcmp(grp->gr_name, name) == 0) {
+ fclose(groupfile);
+ return grp;
+ }
+ }
+ }
+ if (groupfile) fclose(groupfile);
+ return NULL;
+}
+
/*
* Convert 'identifier' into canonical form.
* Returns a pointer to a static buffer containing the canonical form
@@ -176,7 +316,7 @@
*/
if (!strncmp(retbuf, "group:", 6)) {
- grp = getgrnam(retbuf+6);
+ grp = fgetgrnam(retbuf+6);
if (!grp) return NULL;
if (strlen(grp->gr_name) >= sizeof(retbuf)-6)
return NULL;
@@ -224,11 +364,12 @@
struct auth_state *newstate;
struct passwd *pwd;
struct group *grp;
-#if defined(HAVE_GETGROUPLIST) && defined(__GLIBC__)
+#if 0 && defined(HAVE_GETGROUPLIST) && defined(__GLIBC__)
gid_t gid, *groupids = NULL;
int ret, ngroups = 10;
#else
char **mem;
+ FILE *groupfile;
#endif
identifier = mycanonifyid(identifier, 0);
@@ -246,7 +387,7 @@
pwd = getpwnam(identifier);
-#if defined(HAVE_GETGROUPLIST) && defined(__GLIBC__)
+#if 0 && defined(HAVE_GETGROUPLIST) && defined(__GLIBC__)
gid = pwd ? pwd->pw_gid : (gid_t) -1;
/* get the group ids */
@@ -284,20 +425,23 @@
if (groupids) free(groupids);
#else /* !HAVE_GETGROUPLIST */
- setgrent();
- while ((grp = getgrent())) {
- for (mem = grp->gr_mem; *mem; mem++) {
- if (!strcmp(*mem, identifier)) break;
- }
+ groupfile = fopen("/etc/imapd.group", "r");
+ if (!groupfile) groupfile = fopen("/etc/group", "r");
+ if (groupfile) {
+ while ((grp = fgetgrent(groupfile))) {
+ for (mem = grp->gr_mem; *mem; mem++) {
+ if (!strcmp(*mem, identifier)) break;
+ }
- if (*mem || (pwd && pwd->pw_gid == grp->gr_gid)) {
- newstate->ngroups++;
- newstate->group = (char **)xrealloc((char *)newstate->group,
- newstate->ngroups * sizeof(char *));
- newstate->group[newstate->ngroups-1] = xstrdup(grp->gr_name);
- }
- }
- endgrent();
+ if (*mem || (pwd && pwd->pw_gid == grp->gr_gid)) {
+ newstate->ngroups++;
+ newstate->group = (char **)xrealloc((char *)newstate->group,
+ newstate->ngroups * sizeof(char *));
+ newstate->group[newstate->ngroups-1] = xstrdup(grp->gr_name);
+ }
+ }
+ fclose(groupfile);
+ }
#endif /* HAVE_GETGROUPLIST */
return newstate;
--- NEW FILE: KOLAB_cyrus-imapd-2.3.16_Logging.patch ---
Provides improved logging for the cyrus imapd server [Version: 2.3.9]
diff -r e17e42827afc imap/append.c
--- a/imap/append.c Wed Dec 23 20:17:41 2009 +0100
+++ b/imap/append.c Wed Dec 23 20:49:56 2009 +0100
@@ -654,6 +654,9 @@
/* ok, we've successfully added a message */
as->quota_used += message_index.size;
+ syslog(LOG_DEBUG, "append_fromstage: message %d added to %s",
+ message_index.uid, mailbox->name );
+
return 0;
}
diff -r e17e42827afc imap/imapd.c
--- a/imap/imapd.c Wed Dec 23 20:17:41 2009 +0100
+++ b/imap/imapd.c Wed Dec 23 20:49:56 2009 +0100
@@ -3638,6 +3638,8 @@
if ((cmd[0] == 'C') && (imapd_mailbox->myrights & ACL_EXPUNGE)) {
if (!mailbox_expunge(imapd_mailbox, NULL, NULL, 0)) {
sync_log_mailbox(imapd_mailbox->name);
+ syslog(LOG_DEBUG, "cmd_expunge: user %s, mailbox %s, sequence %s",
+ imapd_userid, imapd_mailbox->name, "''");
}
}
diff -r e17e42827afc imap/mailbox.c
--- a/imap/mailbox.c Wed Dec 23 20:17:41 2009 +0100
+++ b/imap/mailbox.c Wed Dec 23 20:49:56 2009 +0100
@@ -2575,6 +2575,8 @@
*(fname->tail)++ = '/';
fname->len++;
for (msgno = 0; msgno < numdeleted; msgno++) {
+ syslog(LOG_DEBUG, "mailbox_expunge: removing mail %s:%d",
+ mailbox->name, deleted[msgno]);
mailbox_message_get_fname(mailbox, deleted[msgno],
fname->tail,
sizeof(fname->buf) - fname->len);
--- NEW FILE: KOLAB_cyrus-imapd-2.3.16_UID.patch ---
Allows login by uid rather than the mail address on the cyrus imapd server [Version: 2.3.9]
diff -r 2ebe14b7db9d configure
--- a/configure Mon Oct 27 18:47:12 2008 +0100
+++ b/configure Mon Oct 27 18:48:18 2008 +0100
@@ -19667,7 +19667,7 @@
done
IMAP_COM_ERR_LIBS="${COM_ERR_LIBS}"
-IMAP_LIBS="${LIB_SASL} ${LIBS} ${SQL_LIBS}"
+IMAP_LIBS="${LIB_SASL} -lldap -llber ${LIBS} ${SQL_LIBS}"
diff -r 2ebe14b7db9d imap/global.c
--- a/imap/global.c Mon Oct 27 18:47:12 2008 +0100
+++ b/imap/global.c Mon Oct 27 18:48:18 2008 +0100
@@ -52,6 +52,9 @@
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/stat.h>
+
+#include <ldap.h>
+#include <lber.h>
#if HAVE_UNISTD_H
# include <unistd.h>
@@ -378,6 +381,18 @@
char *domain = NULL;
int len = strlen(user);
char buf[81];
+ const char *uri;
+ const char *base;
+ const char *binddn;
+ const char *bindpw;
+ struct timeval timeout;
+ char filter[255];
+ LDAP *handle;
+ LDAPMessage *res;
+ LDAPMessage *entry;
+ struct berval** vals;
+
+ int rc;
/* check for domain */
if (config_virtdomains &&
@@ -396,6 +411,49 @@
}
if (config_virtdomains) {
+ if (config_virtdomains == IMAP_ENUM_VIRTDOMAINS_LDAP) {
+ uri = config_getstring(IMAPOPT_LDAP_URI);
+ base = config_getstring(IMAPOPT_LDAP_BASE);
+ binddn = config_getstring(IMAPOPT_LDAP_BIND_DN);
+ bindpw = config_getstring(IMAPOPT_LDAP_PASSWORD);
+ timeout.tv_sec = config_getint(IMAPOPT_LDAP_TIME_LIMIT);
+ timeout.tv_usec = 0;
+ sprintf(filter, "(uid=%s)", user);
+ rc = ldap_initialize(&handle, uri);
+ 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));
+ } else {
+ rc = ldap_search_st(handle, base, LDAP_SCOPE_SUBTREE, filter, NULL, 0, &timeout, &res);
+ if (rc != LDAP_SUCCESS) {
+ syslog(LOG_ERR, "ldap_search_st failed %d (%s)", rc, ldap_err2string(rc));
+ } else {
+ if ( (entry = ldap_first_entry(handle, res)) != NULL ) {
+ // read mail attribute from entry
+ 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 */
+ 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_len( 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 */
@@ -408,7 +466,7 @@
user = buf;
}
}
- else if (config_virtdomains != IMAP_ENUM_VIRTDOMAINS_USERID) {
+ else if (config_virtdomains != IMAP_ENUM_VIRTDOMAINS_USERID && config_virtdomains != IMAP_ENUM_VIRTDOMAINS_LDAP) {
socklen_t salen;
int error;
struct sockaddr_storage localaddr;
diff -r 2ebe14b7db9d lib/imapoptions
--- a/lib/imapoptions Mon Oct 27 18:47:12 2008 +0100
+++ b/lib/imapoptions Mon Oct 27 18:48:18 2008 +0100
@@ -1114,7 +1114,7 @@
mailbox hierarchy. The default is to use the netnews separator
character '.'. */
-{ "virtdomains", "off", ENUM("off", "userid", "on") }
+{ "virtdomains", "off", ENUM("off", "userid", "ldap", "on") }
/* 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
--- NEW FILE: KOLAB_cyrus-imapd-2.3.16_timsieved_starttls-sendcaps.patch ---
This patch was downloaded from https://bugzilla.andrew.cmu.edu/cgi-bin/cvsweb.cgi/src/cyrus/timsieved/parser.c.diff?r1=1.44;r2=1.45
(minus the CVS keywords)
It should be reverse-applied with patch -p2 -R to work around the kontact
behaviour described in kolab/issue2443 (kontact aborts sieve when imapd sends
capabilities after starttls) and can be dropped as soon as kontact has a way
to work with old and new cyrus imapd servers.
diff -r 1688e25afb65 timsieved/parser.c
--- a/timsieved/parser.c Thu Apr 23 23:28:07 2009 +0200
+++ b/timsieved/parser.c Thu Apr 23 23:28:54 2009 +0200
@@ -908,8 +908,7 @@
starttls_done = 1;
- return capabilities(sieved_out, sieved_saslconn, starttls_done,
- authenticated, sasl_ssf);
+ return result;
}
#else
static int cmd_starttls(struct protstream *sieved_out, struct protstream *sieved_in)
--- NEW FILE: series ---
KOLAB_Groups2.patch
KOLAB_Logging.patch
KOLAB_Folder-names.patch
KOLAB_UID.patch
KOLAB_Cyradm_Annotations.patch
KOLAB_timsieved_starttls-sendcaps.patch
More information about the commits
mailing list