- spec cleanup
- simplified packaging (merge -perl in -utils) - remove obsoleted and/or unmaintained additional sources/patches - remove long time not used files from the cvs/srpm - update additional sources/patches from their upstream step 1
This commit is contained in:
parent
cadb86d4d2
commit
9d65fa65ac
@ -1,31 +0,0 @@
|
||||
With this rpm, you should usually find backups of your mailboxes.db
|
||||
in /var/lib/imap/backup/. If you don't have them, for any reason,
|
||||
you can recreate it like this.
|
||||
|
||||
Note: The scripts doesn't care with different hashing schemes of
|
||||
the mailspool. Adjust as needed!
|
||||
And please, check the permissions mailboxes.db after creating it.
|
||||
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
# stop cyrus-imapd
|
||||
service cyrus-imapd stop
|
||||
|
||||
# backup existing mailboxes.db
|
||||
mv /var/lib/imap/mailboxes.db /var/lib/imap/mailboxes.db.$$
|
||||
find /var/spool/imap/?/user -maxdepth 1 -mindepth 1 | \
|
||||
while read i; do
|
||||
echo $(basename $i)
|
||||
echo "user.$i<\t>default<\t>$i<\t>lrswipcda<\t>cyrus<\t>lrswipcda" >> /tmp/newmboxlist.txt
|
||||
done
|
||||
|
||||
# we have everyone's base directory in /tmp/newmboxlist.txt, now we
|
||||
# import the new list
|
||||
/usr/lib/cyrus-imapd/ctl_mboxlist -u </tmp/newmboxlist.txt
|
||||
|
||||
# and reconstruct to get subfolders into the list
|
||||
find /var/spool/imap/?/user -maxdepth 1 -mindepth 1 | \
|
||||
while read i; do
|
||||
/usr/lib/cyrus-imapd/reconstruct -rf user.$i
|
||||
done
|
@ -1,21 +0,0 @@
|
||||
From http://article.gmane.org/gmane.mail.imap.cyrus/18840
|
||||
|
||||
We have also seen skiplist corruption in seen databases. I don't have a
|
||||
recovery tool, but I have been able to manually recover seen db's to the
|
||||
point of corruption so that at least most of the users mails are in the
|
||||
correct 'read' state. Typically, you will see errors like:
|
||||
|
||||
DBERROR: skiplist recovery /usr/local/imap/user/k/kdelaney.seen: 0D2C
|
||||
should be ADD or DELETE
|
||||
|
||||
If you truncate the file at this point, it should fix the problem, and
|
||||
the users mail read state will be valid upto the point of corruption.
|
||||
To do this, convert the hex to decimal (above would be 1372) and use the
|
||||
dd command:
|
||||
|
||||
dd if=kdelaney.seen of=kdelaney.seen.fixed bs=1 count=1372
|
||||
|
||||
replace the corrupted .seen file with the fixed one and have user log in
|
||||
and should be ok.
|
||||
|
||||
Seems to work on the couple I have tried it on.
|
@ -1,28 +0,0 @@
|
||||
--- imap/imapd.c
|
||||
+++ imap/imapd.c 2004/01/16 12:25:51
|
||||
@@ -578,8 +578,11 @@
|
||||
fatal("SASL failed initializing: sasl_server_new()", EC_TEMPFAIL);
|
||||
}
|
||||
|
||||
- /* never allow plaintext, since IMAP has the LOGIN command */
|
||||
- secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
|
||||
+ if( (config_getswitch(IMAPOPT_ALLOWPLAINWITHOUTTLS) == 0) ) {
|
||||
+ secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
|
||||
+ } else {
|
||||
+ secprops = mysasl_secprops(0);
|
||||
+ }
|
||||
sasl_setprop(imapd_saslconn, SASL_SEC_PROPS, secprops);
|
||||
sasl_setprop(imapd_saslconn, SASL_SSF_EXTERNAL, &extprops_ssf);
|
||||
|
||||
--- lib/imapoptions
|
||||
+++ lib/imapoptions 2004/01/16 12:27:52
|
||||
@@ -684,6 +684,9 @@
|
||||
to set this to yes, especially if OpenLDAP is used as authentication
|
||||
source. */
|
||||
|
||||
+{ "allowplainwithouttls", 0, SWITCH }
|
||||
+/* Allow plain login mechanism without an encrypted connection. */
|
||||
+
|
||||
/*
|
||||
.SH SEE ALSO
|
||||
.PP
|
@ -1,32 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Usage: batchreconstruct inputfile
|
||||
#
|
||||
# Purpose: Runs the Cyrus reconstruct command on each newly-created
|
||||
# Cyrus mailbox created by folderxfer
|
||||
#
|
||||
# Input: List of usernames, one per line
|
||||
#
|
||||
#$Id: batchreconstruct,v 1.1 2005/04/15 20:24:15 jdennis Exp $
|
||||
|
||||
#$whoami = "/usr/ucb/whoami"; # Solaris
|
||||
$whoami = "/usr/bin/whoami";
|
||||
$reconstruct = "/usr/lib/cyrus-imapd/reconstruct";
|
||||
$cmd = "$reconstruct -r";
|
||||
|
||||
chop ($iam = `$whoami`);
|
||||
if ($iam ne "cyrus" ) {
|
||||
die "You must be cyrus to run this script!\n";
|
||||
}
|
||||
|
||||
$users = "$ARGV[0]";
|
||||
if (!$users) { die "Usage: $0 input_file\n"; }
|
||||
|
||||
open(MB,"$users") || die "can't open $users";
|
||||
|
||||
while (<MB>) {
|
||||
chop;
|
||||
system("$cmd user.$_");
|
||||
}
|
||||
close MB;
|
||||
|
81
bsd2cyrus
81
bsd2cyrus
@ -1,81 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
|
||||
if $running_under_some_shell;
|
||||
#
|
||||
# Usage: bsd2cyrus inputfile
|
||||
#
|
||||
# Purpose: Maps a user's Berkeley-format mail folder names into the
|
||||
# Cyrus namespace
|
||||
#
|
||||
# Input: List of usernames, one per line
|
||||
#
|
||||
# Output: Lines of the format
|
||||
# username:Cyrus-mailbox-name:BSD-mailbox-name
|
||||
#
|
||||
#$Id: bsd2cyrus,v 1.1 2004/02/04 12:59:42 karsten Exp $
|
||||
|
||||
require "find.pl";
|
||||
|
||||
# User's subdirectory where personal mail folders are stored
|
||||
# (typically $HOME/mail)
|
||||
$maildir = "mail";
|
||||
|
||||
$inputfile = "$ARGV[0]";
|
||||
if (! $inputfile) { die "Usage: $0 inputfile\n"; }
|
||||
|
||||
open (DATA, $inputfile) || die "can't open $inputfile";
|
||||
while (<DATA>) {
|
||||
chop;
|
||||
($user,$pw,$uid,$gid,$quota,$cmnt,$gcos,$home) = getpwnam $_;
|
||||
next if $home eq "";
|
||||
&find("$home/$maildir");
|
||||
}
|
||||
close DATA;
|
||||
|
||||
foreach (@folders) {
|
||||
|
||||
($user,$folder) = split(/:/,$_,2);
|
||||
if (! rfc822($folder) ) { next; }
|
||||
@tokens = split(/\//, $folder);
|
||||
$mailbox = $tokens[$#tokens];
|
||||
|
||||
# Sanity checks - earlier tests should have caught these.
|
||||
|
||||
next if ($mailbox =~ /\.gz$/); # Skip gzipped files
|
||||
next if ($mailbox =~ /\.Z$/); # Skip compressed files
|
||||
next if ($mailbox =~ /^\./); # Skip hidden files
|
||||
|
||||
# Replace "bad" characters with an underscore followed by
|
||||
# the ASCII representation of the "bad" character.
|
||||
|
||||
$mailbox = rm_badchars($mailbox);
|
||||
print "$user:user.$user.$mailbox:$folder\n";
|
||||
}
|
||||
|
||||
sub wanted {
|
||||
(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
|
||||
-f _;
|
||||
if ($_ ne '.') { push @folders, "$user:$dir/$_"; }
|
||||
}
|
||||
|
||||
sub rfc822 {
|
||||
|
||||
my ($file) = @_;
|
||||
my ($rc) = 1;
|
||||
if (-d $file || -z $file || -B $file || -x $file) {
|
||||
$rc = 0;
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
|
||||
sub rm_badchars {
|
||||
|
||||
my ($mailbox) = @_;
|
||||
$mailbox =~ s/ /_040/g;
|
||||
$mailbox =~ s/\!/_041/g;
|
||||
$mailbox =~ s/\"/_042/g;
|
||||
$mailbox =~ s/\#/_043/g;
|
||||
|
||||
return $mailbox;
|
||||
}
|
||||
|
26
cpmsg
26
cpmsg
@ -1,26 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Usage: cat mailbox.txt | formail -s cpmsg
|
||||
#
|
||||
# where 'cpmsg' is the name of this script
|
||||
#
|
||||
# Purpose: Called by formail once for each mail message in a Berkeley-
|
||||
# format mailbox
|
||||
#
|
||||
#$Id: cpmsg,v 1.1 2005/04/15 20:24:15 jdennis Exp $
|
||||
|
||||
$maildir = "$ARGV[0]";
|
||||
if (!$maildir) { die "Usage: $0 $maildir"; }
|
||||
|
||||
# Formail increments this number for each message. The
|
||||
# leading "0"'s must be removed (e.g. 001 becomes 1)
|
||||
|
||||
$filenum = ($ENV{FILENO} - 0) + 1;
|
||||
|
||||
open (OUTFILE,">$maildir/$filenum.");
|
||||
while (<STDIN>) {
|
||||
chop;
|
||||
print OUTFILE "$_\015\012"; # Add CRLF to each line!
|
||||
}
|
||||
close OUTFILE;
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Wrapper for cyrus 'deliver' to allow anyone to run it -
|
||||
* I hope this is secure! Should be setgid mail.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sysexits.h>
|
||||
|
||||
#ifndef LIBEXECDIR
|
||||
#define LIBEXECDIR "/usr/lib/cyrus-imapd"
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *const envp[] = { NULL };
|
||||
struct passwd *ent = getpwuid(getuid());
|
||||
const char *uname = (ent && ent->pw_name && ent->pw_name[0])
|
||||
? ent->pw_name : "anonymous";
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s mailbox\n", argv[0]);
|
||||
return EX_USAGE;
|
||||
}
|
||||
|
||||
execle(LIBEXECDIR"/deliver", "deliver", "-e",
|
||||
"-a", uname, "-m", argv[1],
|
||||
NULL, envp);
|
||||
|
||||
perror("exec "LIBEXECDIR"/deliver");
|
||||
return EX_OSERR;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
--- cyrus-imapd-2.1.16/master/master.c.getrlimit 2003-12-28 17:32:46.000000000 +0100
|
||||
+++ cyrus-imapd-2.1.16/master/master.c 2003-12-28 17:43:56.000000000 +0100
|
||||
@@ -1208,12 +1208,10 @@
|
||||
rl.rlim_cur = x;
|
||||
rl.rlim_max = x;
|
||||
if (setrlimit(RLIMIT_NUMFDS, &rl) < 0) {
|
||||
- syslog(LOG_ERR, "setrlimit: Unable to set file descriptors limit to %ld: %m", x);
|
||||
|
||||
#ifdef HAVE_GETRLIMIT
|
||||
|
||||
if (!getrlimit(RLIMIT_NUMFDS, &rl)) {
|
||||
- syslog(LOG_ERR, "retrying with %ld (current max)", rl.rlim_max);
|
||||
rl.rlim_cur = rl.rlim_max;
|
||||
if (setrlimit(RLIMIT_NUMFDS, &rl) < 0) {
|
||||
syslog(LOG_ERR, "setrlimit: Unable to set file descriptors limit to %ld: %m", x);
|
||||
@@ -1228,6 +1226,7 @@
|
||||
rl.rlim_max);
|
||||
}
|
||||
#else
|
||||
+ syslog(LOG_ERR, "setrlimit: Unable to set file descriptors limit to %ld: %m", x);
|
||||
}
|
||||
#endif /* HAVE_GETRLIMIT */
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
diff -Naur cyrus-imapd-2.2.12.orig/doc/Makefile.dist cyrus-imapd-2.2.12/doc/Makefile.dist
|
||||
--- cyrus-imapd-2.2.12.orig/doc/Makefile.dist Wed Oct 22 20:50:04 2003
|
||||
+++ cyrus-imapd-2.2.12/doc/Makefile.dist Wed Nov 9 13:23:58 2005
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
rm -f groff-html-*.png pod2htm*
|
||||
|
||||
- fig2dev -L png murder.fig murder.png
|
||||
- fig2dev -L png netnews.fig netnews.png
|
||||
+# fig2dev -L png murder.fig murder.png
|
||||
+# fig2dev -L png netnews.fig netnews.png
|
||||
|
||||
(cd text; make)
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
diff -Naur cyrus-imapd-2.3.12p2/README.autosievefolder cyrus-imapd-2.3.12p2-autosieve.uncompiled/README.autosievefolder
|
||||
--- cyrus-imapd-2.3.12p2/README.autosievefolder 1970-01-01 02:00:00.000000000 +0200
|
||||
+++ cyrus-imapd-2.3.12p2-autosieve.uncompiled/README.autosievefolder 2008-05-06 15:16:21.000000000 +0300
|
||||
diff -Naur cyrus-imapd-2.3.16/README.autosievefolder cyrus-imapd-2.3.16-autosieve.uncompiled/README.autosievefolder
|
||||
--- cyrus-imapd-2.3.16/README.autosievefolder 1970-01-01 02:00:00.000000000 +0200
|
||||
+++ cyrus-imapd-2.3.16-autosieve.uncompiled/README.autosievefolder 2009-12-23 01:08:09.000000000 +0200
|
||||
@@ -0,0 +1,42 @@
|
||||
+Cyrus IMAP autosievefolder patch
|
||||
+----------------------------------
|
||||
@ -44,9 +44,9 @@ diff -Naur cyrus-imapd-2.3.12p2/README.autosievefolder cyrus-imapd-2.3.12p2-auto
|
||||
+
|
||||
+For more information and updates please visit http://email.uoa.gr/projects/cyrus/autosievefolder
|
||||
+
|
||||
diff -Naur cyrus-imapd-2.3.12p2/imap/lmtp_sieve.c cyrus-imapd-2.3.12p2-autosieve.uncompiled/imap/lmtp_sieve.c
|
||||
--- cyrus-imapd-2.3.12p2/imap/lmtp_sieve.c 2008-03-24 19:09:17.000000000 +0200
|
||||
+++ cyrus-imapd-2.3.12p2-autosieve.uncompiled/imap/lmtp_sieve.c 2008-05-06 15:16:21.000000000 +0300
|
||||
diff -Naur cyrus-imapd-2.3.16/imap/lmtp_sieve.c cyrus-imapd-2.3.16-autosieve.uncompiled/imap/lmtp_sieve.c
|
||||
--- cyrus-imapd-2.3.16/imap/lmtp_sieve.c 2009-03-31 07:11:18.000000000 +0300
|
||||
+++ cyrus-imapd-2.3.16-autosieve.uncompiled/imap/lmtp_sieve.c 2009-12-23 01:08:09.000000000 +0200
|
||||
@@ -88,6 +88,9 @@
|
||||
struct auth_state *authstate;
|
||||
} script_data_t;
|
||||
@ -160,10 +160,10 @@ diff -Naur cyrus-imapd-2.3.12p2/imap/lmtp_sieve.c cyrus-imapd-2.3.12p2-autosieve
|
||||
+ return IMAP_MAILBOX_NONEXISTENT;
|
||||
+}
|
||||
+
|
||||
diff -Naur cyrus-imapd-2.3.12p2/lib/imapoptions cyrus-imapd-2.3.12p2-autosieve.uncompiled/lib/imapoptions
|
||||
--- cyrus-imapd-2.3.12p2/lib/imapoptions 2008-04-11 23:07:00.000000000 +0300
|
||||
+++ cyrus-imapd-2.3.12p2-autosieve.uncompiled/lib/imapoptions 2008-05-06 15:16:21.000000000 +0300
|
||||
@@ -942,6 +942,15 @@
|
||||
diff -Naur cyrus-imapd-2.3.16/lib/imapoptions cyrus-imapd-2.3.16-autosieve.uncompiled/lib/imapoptions
|
||||
--- cyrus-imapd-2.3.16/lib/imapoptions 2009-12-21 13:25:22.000000000 +0200
|
||||
+++ cyrus-imapd-2.3.16-autosieve.uncompiled/lib/imapoptions 2009-12-23 01:08:09.000000000 +0200
|
||||
@@ -1043,6 +1043,15 @@
|
||||
/* If enabled, lmtpd will look for Sieve scripts in user's home
|
||||
directories: ~user/.sieve. */
|
||||
|
@ -1,23 +0,0 @@
|
||||
--- cyrus-imapd-2.3.7/imap/version.c.krb4 2005-02-16 22:06:19.000000000 +0100
|
||||
+++ cyrus-imapd-2.3.7/imap/version.c 2007-01-22 15:36:27.000000000 +0100
|
||||
@@ -169,7 +169,7 @@
|
||||
"; lock = %s", lock_method_desc);
|
||||
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
|
||||
"; nonblock = %s", nonblock_method_desc);
|
||||
-#ifdef HAVE_KRB
|
||||
+#if 0
|
||||
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
|
||||
" (%s)", krb4_version);
|
||||
#endif
|
||||
|
||||
--- cyrus-imapd-2.3.7/imap/pop3d.c.krb4 2007-01-22 15:41:14.000000000 +0100
|
||||
+++ cyrus-imapd-2.3.7/imap/pop3d.c 2007-01-22 15:41:15.000000000 +0100
|
||||
@@ -88,8 +88,6 @@
|
||||
#include "statuscache.h"
|
||||
|
||||
#ifdef HAVE_KRB
|
||||
-/* kerberos des is purported to conflict with OpenSSL DES */
|
||||
-#define DES_DEFS
|
||||
#include <krb.h>
|
||||
|
||||
/* MIT's kpop authentication kludge */
|
@ -1,308 +0,0 @@
|
||||
diff -up cyrus-imapd-2.3.15/doc/man/imapd.conf.5.html.notify_sms cyrus-imapd-2.3.15/doc/man/imapd.conf.5.html
|
||||
--- cyrus-imapd-2.3.15/doc/man/imapd.conf.5.html.notify_sms 2009-09-09 15:19:50.000000000 +0200
|
||||
+++ cyrus-imapd-2.3.15/doc/man/imapd.conf.5.html 2009-09-18 11:49:42.207115959 +0200
|
||||
@@ -3469,6 +3469,24 @@ proxying CREATE.</p>
|
||||
<tr valign="top" align="left">
|
||||
<td width="10%"></td>
|
||||
<td width="89%">
|
||||
+<p><b>sendsms:</b> /usr/bin/sendsms</p></td>
|
||||
+</table></p>
|
||||
+<!-- INDENTATION -->
|
||||
+<table width="100%" border=0 rules="none" frame="void"
|
||||
+ cols="2" cellspacing="0" cellpadding="0">
|
||||
+<tr valign="top" align="left">
|
||||
+<td width="19%"></td>
|
||||
+<td width="80%">
|
||||
+<p>The pathname of the sendsms executable. Sieve invokes
|
||||
+sendsms for sending SMS notifications.</p>
|
||||
+</td>
|
||||
+</table>
|
||||
+<!-- INDENTATION -->
|
||||
+<p><table width="100%" border=0 rules="none" frame="void"
|
||||
+ cols="2" cellspacing="0" cellpadding="0">
|
||||
+<tr valign="top" align="left">
|
||||
+<td width="10%"></td>
|
||||
+<td width="89%">
|
||||
<p><b>servername:</b> <none></p></td>
|
||||
</table>
|
||||
<!-- INDENTATION -->
|
||||
diff -up cyrus-imapd-2.3.15/doc/man/notifyd.8.html.notify_sms cyrus-imapd-2.3.15/doc/man/notifyd.8.html
|
||||
--- cyrus-imapd-2.3.15/doc/man/notifyd.8.html.notify_sms 2009-09-09 15:19:51.000000000 +0200
|
||||
+++ cyrus-imapd-2.3.15/doc/man/notifyd.8.html 2009-09-18 11:49:42.208116026 +0200
|
||||
@@ -181,6 +181,18 @@ a Sieve ’notify’ action as i
|
||||
<td width="11%"></td>
|
||||
<td width="10%">
|
||||
|
||||
+<p><b>sms</b></p>
|
||||
+</td>
|
||||
+<td width="77%">
|
||||
+
|
||||
+<p>Send the notification as SMS. This method can ONLY be used in
|
||||
+a Sieve ’notify’ action as it requires a
|
||||
+<i>sms:</i> URL to be specified as an <i>:option</i>.</p>
|
||||
+</td>
|
||||
+<tr valign="top" align="left">
|
||||
+<td width="11%"></td>
|
||||
+<td width="10%">
|
||||
+
|
||||
<p><b>zephyr</b></p>
|
||||
</td>
|
||||
<td width="77%">
|
||||
diff -up cyrus-imapd-2.3.15/lib/imapoptions.notify_sms cyrus-imapd-2.3.15/lib/imapoptions
|
||||
--- cyrus-imapd-2.3.15/lib/imapoptions.notify_sms 2009-09-18 11:49:42.189116010 +0200
|
||||
+++ cyrus-imapd-2.3.15/lib/imapoptions 2009-09-18 11:50:38.230115954 +0200
|
||||
@@ -966,6 +966,10 @@ are listed with ``<none>''.
|
||||
/* The pathname of the sendmail executable. Sieve invokes sendmail
|
||||
for sending rejections, redirects and vacation responses. */
|
||||
|
||||
+{ "sendsms", "/usr/bin/sendsms", STRING }
|
||||
+/* The pathname of the sendsms executable. Sieve invokes sendsms
|
||||
+ for sending SMS notifications. */
|
||||
+
|
||||
{ "serverlist", NULL, STRING }
|
||||
/* Whitespace separated list of backend server names. Used for
|
||||
finding server with the most available free space for proxying
|
||||
diff -up cyrus-imapd-2.3.15/man/imapd.conf.5.notify_sms cyrus-imapd-2.3.15/man/imapd.conf.5
|
||||
--- cyrus-imapd-2.3.15/man/imapd.conf.5.notify_sms 2009-09-09 15:19:48.000000000 +0200
|
||||
+++ cyrus-imapd-2.3.15/man/imapd.conf.5 2009-09-18 11:51:26.441839866 +0200
|
||||
@@ -771,6 +771,9 @@ Allowed values: \fIflat\fR, \fIberkeley\
|
||||
.IP "\fBsendmail:\fR /usr/lib/sendmail" 5
|
||||
The pathname of the sendmail executable. Sieve invokes sendmail
|
||||
for sending rejections, redirects and vacation responses.
|
||||
+.IP "\fBsendsms:\fR /usr/bin/sendsms" 5
|
||||
+The pathname of the sendsms executable. Sieve invokes sendsms
|
||||
+for sending SMS notifications.
|
||||
.IP "\fBserverlist:\fR <none>" 5
|
||||
Whitespace separated list of backend server names. Used for
|
||||
finding server with the most available free space for proxying
|
||||
diff -up cyrus-imapd-2.3.15/man/notifyd.8.notify_sms cyrus-imapd-2.3.15/man/notifyd.8
|
||||
--- cyrus-imapd-2.3.15/man/notifyd.8.notify_sms 2008-04-04 14:47:00.000000000 +0200
|
||||
+++ cyrus-imapd-2.3.15/man/notifyd.8 2009-09-18 11:49:42.225115999 +0200
|
||||
@@ -111,6 +111,11 @@ Email the notification. This method can
|
||||
Sieve 'notify' action as it requires a \fImailto:\fR URL to be
|
||||
specified as an \fI:option\fR.
|
||||
.TP
|
||||
+.B sms
|
||||
+Send the notification as SMS. This method can ONLY be used in a
|
||||
+Sieve 'notify' action as it requires a \fIsms:\fR URL to be
|
||||
+specified as an \fI:option\fR.
|
||||
+.TP
|
||||
.B zephyr
|
||||
Send the notification as a zephyrgram. If used in a Sieve 'notify'
|
||||
action, additional recipients can be specified as \fI:options\fR.
|
||||
diff -up cyrus-imapd-2.3.15/notifyd/Makefile.in.notify_sms cyrus-imapd-2.3.15/notifyd/Makefile.in
|
||||
--- cyrus-imapd-2.3.15/notifyd/Makefile.in.notify_sms 2009-09-18 11:49:42.172115947 +0200
|
||||
+++ cyrus-imapd-2.3.15/notifyd/Makefile.in 2009-09-18 11:49:42.225115999 +0200
|
||||
@@ -85,7 +85,7 @@ all: notifyd
|
||||
install:
|
||||
$(INSTALL) -m 755 notifyd $(DESTDIR)$(service_path)
|
||||
|
||||
-OBJS= notifyd.o notify_null.o notify_log.o notify_mailto.o notify_zephyr.o
|
||||
+OBJS= notifyd.o notify_null.o notify_log.o notify_mailto.o notify_sms.o notify_zephyr.o
|
||||
|
||||
notifytest: notifytest.o
|
||||
$(CC) $(LDFLAGS) -o notifytest \
|
||||
diff -up cyrus-imapd-2.3.15/notifyd/notifyd.h.notify_sms cyrus-imapd-2.3.15/notifyd/notifyd.h
|
||||
--- cyrus-imapd-2.3.15/notifyd/notifyd.h.notify_sms 2008-03-24 20:59:32.000000000 +0100
|
||||
+++ cyrus-imapd-2.3.15/notifyd/notifyd.h 2009-09-18 11:49:42.233116003 +0200
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "notify_null.h"
|
||||
#include "notify_log.h"
|
||||
#include "notify_mailto.h"
|
||||
+#include "notify_sms.h"
|
||||
#include "notify_zephyr.h"
|
||||
|
||||
/* Notify method dispatch table definition */
|
||||
@@ -63,6 +64,7 @@ notifymethod_t methods[] = {
|
||||
{ "null", notify_null }, /* do nothing */
|
||||
{ "log", notify_log }, /* use syslog (for testing) */
|
||||
{ "mailto", notify_mailto }, /* send an email */
|
||||
+ { "sms", notify_sms }, /* send an sms */
|
||||
#ifdef HAVE_ZEPHYR
|
||||
{ "zephyr", notify_zephyr }, /* send a zephyrgram */
|
||||
#endif
|
||||
diff -up /dev/null cyrus-imapd-2.3.15/notifyd/notify_sms.c
|
||||
--- /dev/null 2009-09-11 15:21:01.808252010 +0200
|
||||
+++ cyrus-imapd-2.3.15/notifyd/notify_sms.c 2009-09-18 11:49:42.233116003 +0200
|
||||
@@ -0,0 +1,116 @@
|
||||
+/* notify_sms.c -- SMS notification method
|
||||
+ * Simon Matter
|
||||
+ */
|
||||
+/*
|
||||
+ * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ *
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ *
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in
|
||||
+ * the documentation and/or other materials provided with the
|
||||
+ * distribution.
|
||||
+ *
|
||||
+ * 3. The name "Carnegie Mellon University" must not be used to
|
||||
+ * endorse or promote products derived from this software without
|
||||
+ * prior written permission. For permission or any other legal
|
||||
+ * details, please contact
|
||||
+ * Office of Technology Transfer
|
||||
+ * Carnegie Mellon University
|
||||
+ * 5000 Forbes Avenue
|
||||
+ * Pittsburgh, PA 15213-3890
|
||||
+ * (412) 268-4387, fax: (412) 268-7395
|
||||
+ * tech-transfer@andrew.cmu.edu
|
||||
+ *
|
||||
+ * 4. Redistributions of any form whatsoever must retain the following
|
||||
+ * acknowledgment:
|
||||
+ * "This product includes software developed by Computing Services
|
||||
+ * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
|
||||
+ *
|
||||
+ * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
+ * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
|
||||
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
+ *
|
||||
+ * notify_sms is based on code from notify_mailto by Ken Murchison.
|
||||
+ * Copyright (c) 2005-2006 Simon Matter, Invoca Systems.
|
||||
+ * Release 2006071300/2.3.7
|
||||
+*/
|
||||
+
|
||||
+#include <config.h>
|
||||
+
|
||||
+#include "notify_sms.h"
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/wait.h>
|
||||
+
|
||||
+#include "global.h"
|
||||
+#include "libconfig.h"
|
||||
+#include "sieve_interface.h"
|
||||
+
|
||||
+static int global_outgoing_count = 0;
|
||||
+
|
||||
+char* notify_sms(const char *class __attribute__((unused)),
|
||||
+ const char *priority,
|
||||
+ const char *user,
|
||||
+ const char *mailbox __attribute__((unused)),
|
||||
+ int nopt, char **options,
|
||||
+ const char *message)
|
||||
+{
|
||||
+ FILE *sm;
|
||||
+ const char *smbuf[10];
|
||||
+ int sm_stat;
|
||||
+ pid_t sm_pid;
|
||||
+ int fds[2];
|
||||
+
|
||||
+ /* XXX check/parse options (sms URI) */
|
||||
+ if (nopt < 1)
|
||||
+ return strdup("NO sms URI not specified");
|
||||
+
|
||||
+ smbuf[0] = "sendsms";
|
||||
+ smbuf[1] = "-u";
|
||||
+ smbuf[2] = user;
|
||||
+ smbuf[3] = "-p";
|
||||
+ smbuf[4] = priority;
|
||||
+ smbuf[5] = "-o";
|
||||
+ smbuf[6] = options[0];
|
||||
+ smbuf[7] = NULL;
|
||||
+
|
||||
+ pipe(fds);
|
||||
+ if ((sm_pid = fork()) == 0) {
|
||||
+ /* i'm the child! run sendsms! */
|
||||
+ close(fds[1]);
|
||||
+ /* make the pipe be stdin */
|
||||
+ dup2(fds[0], 0);
|
||||
+ execv(config_getstring(IMAPOPT_SENDSMS), (char **) smbuf);
|
||||
+
|
||||
+ /* if we're here we suck */
|
||||
+ return strdup("NO sms couldn't exec");
|
||||
+ }
|
||||
+ /* i'm the parent */
|
||||
+ close(fds[0]);
|
||||
+ sm = fdopen(fds[1], "w");
|
||||
+
|
||||
+ if (!sm)
|
||||
+ return strdup("NO sms could not spawn sendsms process");
|
||||
+
|
||||
+ fprintf(sm, message);
|
||||
+
|
||||
+ fclose(sm);
|
||||
+ while (waitpid(sm_pid, &sm_stat, 0) < 0);
|
||||
+
|
||||
+ /* XXX check for sendsms exit code */
|
||||
+
|
||||
+ return strdup("OK sms notification successful");
|
||||
+}
|
||||
diff -up /dev/null cyrus-imapd-2.3.15/notifyd/notify_sms.h
|
||||
--- /dev/null 2009-09-11 15:21:01.808252010 +0200
|
||||
+++ cyrus-imapd-2.3.15/notifyd/notify_sms.h 2009-09-18 11:49:42.233116003 +0200
|
||||
@@ -0,0 +1,61 @@
|
||||
+/* notify_sms.h -- SMS notification method
|
||||
+ * Simon Matter
|
||||
+ */
|
||||
+/*
|
||||
+ * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ *
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ *
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in
|
||||
+ * the documentation and/or other materials provided with the
|
||||
+ * distribution.
|
||||
+ *
|
||||
+ * 3. The name "Carnegie Mellon University" must not be used to
|
||||
+ * endorse or promote products derived from this software without
|
||||
+ * prior written permission. For permission or any other legal
|
||||
+ * details, please contact
|
||||
+ * Office of Technology Transfer
|
||||
+ * Carnegie Mellon University
|
||||
+ * 5000 Forbes Avenue
|
||||
+ * Pittsburgh, PA 15213-3890
|
||||
+ * (412) 268-4387, fax: (412) 268-7395
|
||||
+ * tech-transfer@andrew.cmu.edu
|
||||
+ *
|
||||
+ * 4. Redistributions of any form whatsoever must retain the following
|
||||
+ * acknowledgment:
|
||||
+ * "This product includes software developed by Computing Services
|
||||
+ * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
|
||||
+ *
|
||||
+ * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
+ * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
|
||||
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
+ *
|
||||
+ * notify_sms is based on code from notify_mailto by Ken Murchison.
|
||||
+ * Copyright (c) 2005-2006 Simon Matter, Invoca Systems.
|
||||
+ * Release 2006071300/2.3.7
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#ifndef _NOTIFY_SMS_H_
|
||||
+#define _NOTIFY_SMS_H_
|
||||
+
|
||||
+#include <config.h>
|
||||
+
|
||||
+char* notify_sms(const char *class __attribute__((unused)),
|
||||
+ const char *priority,
|
||||
+ const char *user,
|
||||
+ const char *mailbox __attribute__((unused)),
|
||||
+ int nopt, char **options,
|
||||
+ const char *message);
|
||||
+
|
||||
+#endif /* _NOTIFY_SMS_H_ */
|
@ -1,514 +0,0 @@
|
||||
diff -Naur cyrus-imapd-2.3.9/imap/ctl_cyrusdb.c cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/ctl_cyrusdb.c
|
||||
--- cyrus-imapd-2.3.9/imap/ctl_cyrusdb.c 2007-03-30 21:40:20.000000000 +0300
|
||||
+++ cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/ctl_cyrusdb.c 2007-08-21 16:49:06.000000000 +0300
|
||||
@@ -133,7 +133,7 @@
|
||||
/* if it is MBTYPE_RESERVED, unset it & call mboxlist_delete */
|
||||
if(!r && (mbtype & MBTYPE_RESERVE)) {
|
||||
if(!r) {
|
||||
- r = mboxlist_deletemailbox(name, 1, NULL, NULL, 0, 0, 1);
|
||||
+ r = mboxlist_deletemailbox(name, 1, NULL, NULL, 0, 0, 1, 1);
|
||||
if(r) {
|
||||
/* log the error */
|
||||
syslog(LOG_ERR,
|
||||
diff -Naur cyrus-imapd-2.3.9/imap/ctl_mboxlist.c cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/ctl_mboxlist.c
|
||||
--- cyrus-imapd-2.3.9/imap/ctl_mboxlist.c 2007-07-18 21:56:11.000000000 +0300
|
||||
+++ cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/ctl_mboxlist.c 2007-08-21 16:49:06.000000000 +0300
|
||||
@@ -484,7 +484,7 @@
|
||||
|
||||
wipe_head = wipe_head->next;
|
||||
|
||||
- ret = mboxlist_deletemailbox(me->mailbox, 1, "", NULL, 0, 1, 1);
|
||||
+ ret = mboxlist_deletemailbox(me->mailbox, 1, "", NULL, 0, 1, 1, 1);
|
||||
if(!ret) sync_log_mailbox(me->mailbox);
|
||||
if(ret) {
|
||||
fprintf(stderr, "couldn't delete defunct mailbox %s\n",
|
||||
diff -Naur cyrus-imapd-2.3.9/imap/imapd.c cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/imapd.c
|
||||
--- cyrus-imapd-2.3.9/imap/imapd.c 2007-08-02 17:18:51.000000000 +0300
|
||||
+++ cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/imapd.c 2007-08-21 16:49:28.000000000 +0300
|
||||
@@ -4994,7 +4994,7 @@
|
||||
|
||||
r = mboxlist_deletemailbox(name, imapd_userisadmin,
|
||||
imapd_userid, imapd_authstate,
|
||||
- 0, 0, 0);
|
||||
+ 0, 0, 0, 1);
|
||||
|
||||
if (!r) sync_log_mailbox(name);
|
||||
|
||||
@@ -5018,6 +5018,12 @@
|
||||
char *p;
|
||||
int domainlen = 0;
|
||||
int sync_lockfd = (-1);
|
||||
+ int keepQuota = 1;
|
||||
+
|
||||
+ if(name && *name == '+') {
|
||||
+ keepQuota = 0;
|
||||
+ name++;
|
||||
+ }
|
||||
|
||||
r = (*imapd_namespace.mboxname_tointernal)(&imapd_namespace, name,
|
||||
imapd_userid, mailboxname);
|
||||
@@ -5076,7 +5082,7 @@
|
||||
|
||||
r = mboxlist_deletemailbox(mailboxname, imapd_userisadmin,
|
||||
imapd_userid, imapd_authstate, 1-force,
|
||||
- localonly, 0);
|
||||
+ localonly, 0, keepQuota);
|
||||
}
|
||||
|
||||
/* was it a top-level user mailbox? */
|
||||
@@ -6434,6 +6440,7 @@
|
||||
{
|
||||
int newquota = -1;
|
||||
int badresource = 0;
|
||||
+ int rmquota = 0;
|
||||
int c;
|
||||
int force = 0;
|
||||
static struct buf arg;
|
||||
@@ -6450,7 +6457,8 @@
|
||||
if (c != ')' || arg.s[0] != '\0') {
|
||||
for (;;) {
|
||||
if (c != ' ') goto badlist;
|
||||
- if (strcasecmp(arg.s, "storage") != 0) badresource = 1;
|
||||
+ if (strcasecmp(arg.s, "remove") == 0) rmquota = 1;
|
||||
+ else if (strcasecmp(arg.s, "storage") != 0) badresource = 1;
|
||||
c = getword(imapd_in, &arg);
|
||||
if (c != ' ' && c != ')') goto badlist;
|
||||
if (arg.s[0] == '\0') goto badlist;
|
||||
@@ -6519,7 +6527,10 @@
|
||||
|
||||
/* local mailbox */
|
||||
if (!r || (r == IMAP_MAILBOX_NONEXISTENT)) {
|
||||
- r = mboxlist_setquota(mailboxname, newquota, force);
|
||||
+ if(!rmquota)
|
||||
+ r = mboxlist_setquota(mailboxname, newquota, force);
|
||||
+ else
|
||||
+ r = mboxlist_unsetquota(mailboxname);
|
||||
}
|
||||
|
||||
imapd_check(NULL, 0, 0);
|
||||
@@ -8237,7 +8248,7 @@
|
||||
/* note also that we need to remember to let proxyadmins do this */
|
||||
r = mboxlist_deletemailbox(mailboxname,
|
||||
imapd_userisadmin || imapd_userisproxyadmin,
|
||||
- imapd_userid, imapd_authstate, 0, 1, 0);
|
||||
+ imapd_userid, imapd_authstate, 0, 1, 0, 1);
|
||||
if(r) syslog(LOG_ERR,
|
||||
"Could not delete local mailbox during move of %s",
|
||||
mailboxname);
|
||||
diff -Naur cyrus-imapd-2.3.9/imap/mailbox.c cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/mailbox.c
|
||||
--- cyrus-imapd-2.3.9/imap/mailbox.c 2007-07-20 17:21:57.000000000 +0300
|
||||
+++ cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/mailbox.c 2007-08-21 16:49:06.000000000 +0300
|
||||
@@ -2745,27 +2745,7 @@
|
||||
|
||||
seen_delete_mailbox(mailbox);
|
||||
|
||||
- if (delete_quota_root && !rquota) {
|
||||
- quota_delete(&mailbox->quota, &tid);
|
||||
- free(mailbox->quota.root);
|
||||
- mailbox->quota.root = NULL;
|
||||
- } else if (!rquota) {
|
||||
- /* Free any quota being used by this mailbox */
|
||||
- if (mailbox->quota.used >= mailbox->quota_mailbox_used) {
|
||||
- mailbox->quota.used -= mailbox->quota_mailbox_used;
|
||||
- }
|
||||
- else {
|
||||
- mailbox->quota.used = 0;
|
||||
- }
|
||||
- r = quota_write(&mailbox->quota, &tid);
|
||||
- if (r) {
|
||||
- syslog(LOG_ERR,
|
||||
- "LOSTQUOTA: unable to record free of " UQUOTA_T_FMT " bytes in quota %s",
|
||||
- mailbox->quota_mailbox_used, mailbox->quota.root);
|
||||
- }
|
||||
- else
|
||||
- quota_commit(&tid);
|
||||
- }
|
||||
+ mailbox_updatequota(mailbox,NULL);
|
||||
|
||||
/* Flush data (message file) directory */
|
||||
mailbox_delete_files(mailbox->path);
|
||||
@@ -3394,3 +3374,48 @@
|
||||
if (*p == '.') *p = '/';
|
||||
}
|
||||
}
|
||||
+
|
||||
+/* This function is used to update the quota. Can be used to replace
|
||||
+ * identical parts of the code, and can be quite handy some times
|
||||
+ * The tid is used in order to make possible to make the quota update
|
||||
+ * being a part of a bigger transaction to the quota db */
|
||||
+int mailbox_updatequota(struct mailbox *mailbox, struct txn **tid)
|
||||
+{
|
||||
+ int r = 0, havetid = 0;
|
||||
+ struct txn **ltid = NULL;
|
||||
+
|
||||
+ if(tid) {
|
||||
+ ltid = tid;
|
||||
+ havetid = 1;
|
||||
+ }
|
||||
+ /* Ensure that we are locked */
|
||||
+ if(!mailbox->header_lock_count) return IMAP_INTERNAL;
|
||||
+
|
||||
+
|
||||
+ if(mailbox->quota.root) {
|
||||
+ r = quota_read(&mailbox->quota, ltid, 1);
|
||||
+ if( r == 0 ) {
|
||||
+ if (mailbox->quota.used >= mailbox->quota_mailbox_used) {
|
||||
+ mailbox->quota.used -= mailbox->quota_mailbox_used;
|
||||
+ }
|
||||
+ else {
|
||||
+ mailbox->quota.used = 0;
|
||||
+ }
|
||||
+ r = quota_write(&mailbox->quota, ltid);
|
||||
+ if (r) {
|
||||
+ syslog(LOG_ERR,
|
||||
+ "LOSTQUOTA: unable to record free of %lu bytes in quota %s",
|
||||
+ mailbox->quota_mailbox_used, mailbox->quota.root);
|
||||
+ }
|
||||
+ else if(!havetid)
|
||||
+ quota_commit(tid);
|
||||
+ }
|
||||
+ /* It is not a big mistake not to have quota .. just remove from the mailbox */
|
||||
+ else if ( r == IMAP_QUOTAROOT_NONEXISTENT) {
|
||||
+ free(mailbox->quota.root);
|
||||
+ r = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ return r;
|
||||
+}
|
||||
+
|
||||
diff -Naur cyrus-imapd-2.3.9/imap/mailbox.h cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/mailbox.h
|
||||
--- cyrus-imapd-2.3.9/imap/mailbox.h 2006-11-30 19:11:19.000000000 +0200
|
||||
+++ cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/mailbox.h 2007-08-21 16:49:06.000000000 +0300
|
||||
@@ -364,6 +364,8 @@
|
||||
struct mailbox *mailboxp);
|
||||
extern int mailbox_delete(struct mailbox *mailbox, int delete_quota_root);
|
||||
|
||||
+extern int mailbox_updatequota(struct mailbox *mailbox, struct txn **tid);
|
||||
+
|
||||
extern int mailbox_rename_copy(struct mailbox *oldmailbox,
|
||||
const char *newname, char *newpartition,
|
||||
bit32 *olduidvalidityp, bit32 *newuidvalidityp,
|
||||
diff -Naur cyrus-imapd-2.3.9/imap/mboxlist.c cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/mboxlist.c
|
||||
--- cyrus-imapd-2.3.9/imap/mboxlist.c 2007-08-15 20:20:55.000000000 +0300
|
||||
+++ cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/mboxlist.c 2007-08-21 16:49:06.000000000 +0300
|
||||
@@ -95,6 +95,12 @@
|
||||
static int mboxlist_opensubs();
|
||||
static void mboxlist_closesubs();
|
||||
|
||||
+static int child_cb(char *name,
|
||||
+ int matchlen __attribute__((unused)),
|
||||
+ int maycreate __attribute__((unused)),
|
||||
+ void *rock);
|
||||
+
|
||||
+
|
||||
static int mboxlist_rmquota(const char *name, int matchlen, int maycreate,
|
||||
void *rock);
|
||||
static int mboxlist_changequota(const char *name, int matchlen, int maycreate,
|
||||
@@ -102,6 +108,7 @@
|
||||
|
||||
struct change_rock {
|
||||
struct quota *quota;
|
||||
+ struct quota *oldquota;
|
||||
struct txn **tid;
|
||||
};
|
||||
|
||||
@@ -889,9 +896,9 @@
|
||||
*/
|
||||
int mboxlist_deletemailbox(const char *name, int isadmin, char *userid,
|
||||
struct auth_state *auth_state, int checkacl,
|
||||
- int local_only, int force)
|
||||
+ int local_only, int force, int keepQuota)
|
||||
{
|
||||
- int r;
|
||||
+ int r, has_children = 0;
|
||||
char *acl;
|
||||
long access;
|
||||
struct mailbox mailbox;
|
||||
@@ -902,6 +909,7 @@
|
||||
int mbtype;
|
||||
const char *p;
|
||||
mupdate_handle *mupdate_h = NULL;
|
||||
+ char *quotaroot = NULL;
|
||||
|
||||
if(!isadmin && force) return IMAP_PERMISSION_DENIED;
|
||||
|
||||
@@ -1014,15 +1022,47 @@
|
||||
|
||||
if ((r && !force) || isremote) goto done;
|
||||
|
||||
- if (!r || force) r = mailbox_delete(&mailbox, deletequotaroot);
|
||||
+ if (!r || force) {
|
||||
+ /* first we have to keep the previous quota root in order to delete it */
|
||||
+ if(mailbox.quota.root)
|
||||
+ quotaroot = xstrdup(mailbox.quota.root);
|
||||
+ r = mailbox_delete(&mailbox, deletequotaroot);
|
||||
+ }
|
||||
+
|
||||
|
||||
/*
|
||||
* See if we have to remove mailbox's quota root
|
||||
*/
|
||||
- if (!r && mailbox.quota.root != NULL) {
|
||||
- /* xxx look for any other mailboxes in this quotaroot */
|
||||
+ if (!r && quotaroot != NULL) {
|
||||
+ /* xxx look for any other mailboxes in this quotaroot */
|
||||
+ /* If we have not asked to remove the quota (default behaviour), we check
|
||||
+ * whether there are any subfolders beneeth the quota root. If there aren't
|
||||
+ * any subfolders the reasonable thing is to delete the quota */
|
||||
+ if(keepQuota) {
|
||||
+ char pattern[MAX_MAILBOX_PATH+1];
|
||||
+ strlcpy(pattern, quotaroot, sizeof(pattern));
|
||||
+ if (config_virtdomains && name[strlen(name)-1] == '!') {
|
||||
+ strlcat(pattern, "*", sizeof(pattern));
|
||||
+ }
|
||||
+ else {
|
||||
+ strlcat(pattern, ".*", sizeof(pattern));
|
||||
+ }
|
||||
+ /* find if there are subfolders. Then we want to
|
||||
+ * keep the existing quota */
|
||||
+ mboxlist_findall(NULL, pattern, isadmin, userid,
|
||||
+ auth_state, child_cb, (void *) &has_children);
|
||||
+
|
||||
+ if(!has_children)
|
||||
+ if(!mboxlist_mylookup(quotaroot, NULL, NULL, NULL, NULL, NULL, 0, 1))
|
||||
+ has_children = 1;
|
||||
+ }
|
||||
+ /* If we want to remove the quota explicitely or the quota root folder has no subfolders
|
||||
+ * we execute the rmquota patch */
|
||||
+ if(!keepQuota || !has_children )
|
||||
+ mboxlist_unsetquota(quotaroot);
|
||||
+ free(quotaroot);
|
||||
}
|
||||
-
|
||||
+
|
||||
done:
|
||||
if(r && tid && !force) {
|
||||
/* Abort the transaction if it is still in progress */
|
||||
@@ -2483,6 +2523,7 @@
|
||||
if (r) return r;
|
||||
|
||||
crock.quota = "a;
|
||||
+ crock.oldquota = NULL;
|
||||
crock.tid = &tid;
|
||||
/* top level mailbox */
|
||||
if(have_mailbox)
|
||||
@@ -2501,15 +2542,19 @@
|
||||
*/
|
||||
int mboxlist_unsetquota(const char *root)
|
||||
{
|
||||
+ char newquota[MAX_MAILBOX_PATH+1];
|
||||
char pattern[MAX_MAILBOX_PATH+1];
|
||||
struct quota quota;
|
||||
- int r=0;
|
||||
+ struct change_rock crock;
|
||||
+ int r=0, k=0;
|
||||
|
||||
if (!root[0] || root[0] == '.' || strchr(root, '/')
|
||||
|| strchr(root, '*') || strchr(root, '%') || strchr(root, '?')) {
|
||||
return IMAP_MAILBOX_BADNAME;
|
||||
}
|
||||
|
||||
+ crock.tid=NULL;
|
||||
+
|
||||
quota.root = (char *) root;
|
||||
r = quota_read("a, NULL, 0);
|
||||
if (r == IMAP_QUOTAROOT_NONEXISTENT) {
|
||||
@@ -2534,9 +2579,47 @@
|
||||
/* submailboxes - we're using internal names here */
|
||||
mboxlist_findall(NULL, pattern, 1, 0, 0, mboxlist_rmquota, (void *)root);
|
||||
|
||||
- r = quota_delete("a, NULL);
|
||||
+ r = quota_delete("a, crock.tid);
|
||||
+
|
||||
+ /* If we cannot delete the quota then abort the operation */
|
||||
+ if(!r) {
|
||||
+ /* quota_findroot performs several checks that we can
|
||||
+ * assume that are already done, and don't have to perform
|
||||
+ * them again. One of them is that it returns 1 only if
|
||||
+ * quotaroot exists.
|
||||
+ */
|
||||
+ if(quota_findroot(newquota, sizeof(newquota), root)) {
|
||||
+ struct quota rootquota;
|
||||
+ rootquota.root = newquota;
|
||||
+ k = quota_read(&rootquota, crock.tid, 0);
|
||||
+ if (!k) {
|
||||
+ crock.quota = &rootquota;
|
||||
+ crock.oldquota = "a;
|
||||
+ /* top level mailbox */
|
||||
+ k = mboxlist_changequota(root, 0, 0, &crock);
|
||||
+ }
|
||||
+ /* submailboxes - we're using internal names here */
|
||||
+ if (!k)
|
||||
+ k = mboxlist_findall(NULL, pattern, 1, 0, 0, mboxlist_changequota, &crock);
|
||||
+ if(!k)
|
||||
+ k = quota_write(&rootquota, crock.tid);
|
||||
+
|
||||
+ }
|
||||
+ else {
|
||||
+ /* top level mailbox */
|
||||
+ mboxlist_rmquota(root, 0, 0, (void *)root);
|
||||
+ /* submailboxes - we're using internal names here */
|
||||
+ mboxlist_findall(NULL, pattern, 1, 0, 0, mboxlist_rmquota, (void *)root);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if(!r && !k)
|
||||
+ quota_commit(crock.tid);
|
||||
+ else
|
||||
+ quota_abort(crock.tid);
|
||||
|
||||
return r;
|
||||
+
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2632,6 +2715,7 @@
|
||||
struct mailbox mailbox;
|
||||
struct change_rock *crock = (struct change_rock *) rock;
|
||||
struct quota *mboxlist_newquota = crock->quota;
|
||||
+ struct quota *mboxlist_oldquota = crock->oldquota;
|
||||
struct txn **tid = crock->tid;
|
||||
|
||||
assert(rock != NULL);
|
||||
@@ -2649,27 +2733,24 @@
|
||||
if (r) goto error;
|
||||
|
||||
if (mailbox.quota.root) {
|
||||
- if (strlen(mailbox.quota.root) >= strlen(mboxlist_newquota->root)) {
|
||||
- /* Part of a child quota root */
|
||||
- mailbox_close(&mailbox);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- r = quota_read(&mailbox.quota, tid, 1);
|
||||
- if (r) goto error;
|
||||
- if (mailbox.quota.used >= mailbox.quota_mailbox_used) {
|
||||
- mailbox.quota.used -= mailbox.quota_mailbox_used;
|
||||
- }
|
||||
- else {
|
||||
- mailbox.quota.used = 0;
|
||||
- }
|
||||
- r = quota_write(&mailbox.quota, tid);
|
||||
- if (r) {
|
||||
- syslog(LOG_ERR,
|
||||
- "LOSTQUOTA: unable to record free of " UQUOTA_T_FMT " bytes in quota %s",
|
||||
- mailbox.quota_mailbox_used, mailbox.quota.root);
|
||||
- }
|
||||
- free(mailbox.quota.root);
|
||||
+ if(mboxlist_oldquota) {
|
||||
+ if (strlen(mailbox.quota.root) > strlen(mboxlist_oldquota->root)) {
|
||||
+ /* Part of a child quota root */
|
||||
+ mailbox_close(&mailbox);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+ if (strlen(mailbox.quota.root) >= strlen(mboxlist_newquota->root)) {
|
||||
+ /* Part of a child quota root */
|
||||
+ mailbox_close(&mailbox);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ r = mailbox_updatequota(&mailbox,tid);
|
||||
+ if (r)
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
mailbox.quota.root = xstrdup(mboxlist_newquota->root);
|
||||
@@ -2682,6 +2763,11 @@
|
||||
|
||||
error:
|
||||
mailbox_close(&mailbox);
|
||||
+ syslog(LOG_ERR, "LOSTQUOTA: unable to change quota root for %s to %s: %s. \
|
||||
+ Command aborted. Run reconstruct to make sure mailboxes \
|
||||
+ are in consistent state",
|
||||
+ name, mboxlist_newquota->root, error_message(r));
|
||||
+ return 1;
|
||||
error_noclose:
|
||||
syslog(LOG_ERR, "LOSTQUOTA: unable to change quota root for %s to %s: %s",
|
||||
name, mboxlist_newquota->root, error_message(r));
|
||||
diff -Naur cyrus-imapd-2.3.9/imap/mboxlist.h cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/mboxlist.h
|
||||
--- cyrus-imapd-2.3.9/imap/mboxlist.h 2006-11-30 19:11:19.000000000 +0200
|
||||
+++ cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/mboxlist.h 2007-08-21 16:49:06.000000000 +0300
|
||||
@@ -126,7 +126,7 @@
|
||||
* the planet */
|
||||
int mboxlist_deletemailbox(const char *name, int isadmin, char *userid,
|
||||
struct auth_state *auth_state, int checkacl,
|
||||
- int local_only, int force);
|
||||
+ int local_only, int force, int keepQuota);
|
||||
|
||||
/* Rename/move a mailbox (hierarchical) */
|
||||
int mboxlist_renamemailbox(char *oldname, char *newname, char *partition,
|
||||
diff -Naur cyrus-imapd-2.3.9/imap/nntpd.c cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/nntpd.c
|
||||
--- cyrus-imapd-2.3.9/imap/nntpd.c 2007-03-30 21:51:01.000000000 +0300
|
||||
+++ cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/nntpd.c 2007-08-21 16:49:06.000000000 +0300
|
||||
@@ -3358,7 +3358,7 @@
|
||||
/* XXX should we delete right away, or wait until empty? */
|
||||
|
||||
r = mboxlist_deletemailbox(mailboxname, 0,
|
||||
- newsmaster, newsmaster_authstate, 1, 0, 0);
|
||||
+ newsmaster, newsmaster_authstate, 1, 0, 0, 1);
|
||||
|
||||
if (!r) sync_log_mailbox(mailboxname);
|
||||
|
||||
diff -Naur cyrus-imapd-2.3.9/imap/sync_reset.c cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/sync_reset.c
|
||||
--- cyrus-imapd-2.3.9/imap/sync_reset.c 2007-03-30 21:40:21.000000000 +0300
|
||||
+++ cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/sync_reset.c 2007-08-21 16:49:06.000000000 +0300
|
||||
@@ -258,7 +258,7 @@
|
||||
if (r) goto fail;
|
||||
|
||||
for (item = list->head ; item ; item = item->next) {
|
||||
- r=mboxlist_deletemailbox(item->name, 1, NULL, sync_authstate, 1, 0, 0);
|
||||
+ r=mboxlist_deletemailbox(item->name, 1, NULL, sync_authstate, 1, 0, 0, 1);
|
||||
|
||||
if (r) goto fail;
|
||||
}
|
||||
@@ -274,7 +274,7 @@
|
||||
if (r) goto fail;
|
||||
|
||||
for (item = list->head ; item ; item = item->next) {
|
||||
- r=mboxlist_deletemailbox(item->name, 1, NULL, sync_authstate, 1, 0, 0);
|
||||
+ r=mboxlist_deletemailbox(item->name, 1, NULL, sync_authstate, 1, 0, 0, 1);
|
||||
|
||||
if (r) goto fail;
|
||||
}
|
||||
@@ -282,7 +282,7 @@
|
||||
|
||||
/* Nuke inbox (recursive nuke possible?) */
|
||||
snprintf(buf, sizeof(buf)-1, "user.%s", user);
|
||||
- r = mboxlist_deletemailbox(buf, 1, "cyrus", sync_authstate, 1, 0, 0);
|
||||
+ r = mboxlist_deletemailbox(buf, 1, "cyrus", sync_authstate, 1, 0, 0, 1);
|
||||
if (r && (r != IMAP_MAILBOX_NONEXISTENT)) goto fail;
|
||||
|
||||
if ((r=user_deletedata(user, sync_userid, sync_authstate, 1)))
|
||||
diff -Naur cyrus-imapd-2.3.9/imap/sync_server.c cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/sync_server.c
|
||||
--- cyrus-imapd-2.3.9/imap/sync_server.c 2007-08-01 22:19:03.000000000 +0300
|
||||
+++ cyrus-imapd-2.3.9-rmquota+deletemailbox.uncompiled/imap/sync_server.c 2007-08-21 16:49:06.000000000 +0300
|
||||
@@ -1590,7 +1590,7 @@
|
||||
|
||||
for (item = list->head ; item ; item = item->next) {
|
||||
r=mboxlist_deletemailbox(item->name, sync_userisadmin, sync_userid,
|
||||
- sync_authstate, 0, 0, 1);
|
||||
+ sync_authstate, 0, 0, 1, 1);
|
||||
|
||||
if (r) goto fail;
|
||||
}
|
||||
@@ -1600,7 +1600,7 @@
|
||||
(sync_namespacep->mboxname_tointernal)(sync_namespacep, "INBOX",
|
||||
user, buf);
|
||||
r = mboxlist_deletemailbox(buf, sync_userisadmin, sync_userid,
|
||||
- sync_authstate, 0, 0, 1);
|
||||
+ sync_authstate, 0, 0, 1, 1);
|
||||
if (r && (r != IMAP_MAILBOX_NONEXISTENT)) goto fail;
|
||||
|
||||
if ((r=user_deletedata(user, sync_userid, sync_authstate, 1)))
|
||||
@@ -2546,7 +2546,7 @@
|
||||
|
||||
/* Delete with admin priveleges */
|
||||
r = mboxlist_deletemailbox(name, sync_userisadmin, sync_userid,
|
||||
- sync_authstate, 0, 0, 1);
|
||||
+ sync_authstate, 0, 0, 1, 1);
|
||||
|
||||
if (r)
|
||||
prot_printf(sync_out, "NO Failed to delete %s: %s\r\n",
|
@ -12,7 +12,7 @@ The following steps should lead you to a running Cyrus IMAP server:
|
||||
your box. Upgrading any Invoca rpm based installation should be fine.
|
||||
3) Make sure you understand that this RPM installs in FHS compliant
|
||||
directories, like /var/lib/imap and /var/spool/imap
|
||||
4) Make sure cyrus-sasl 2.x is installed.
|
||||
4) Make sure cyrus-sasl is installed.
|
||||
5) Make sure saslauthd is running. If not, edit /etc/sysconfig/saslauthd as
|
||||
needed and do 'chkconfig saslauthd on ; service saslauthd start'
|
||||
6) Install the cyrus-imapd RPMs.
|
||||
|
@ -1,30 +0,0 @@
|
||||
If you have a lot of groups or very large groups, cyrus-imapd login can become
|
||||
quite slow due to the way cyrus-imapd handles groups. This may become worse
|
||||
when using nss_ldap or other slow nss backends to resolve groups.
|
||||
Caching using nscd can increase speed dramatically but unfortunately not for
|
||||
all functions cyrus-imapd uses. nscd helps speeding up getgrnam() calls but not
|
||||
getgrent() calls, which are used by cyrus-imapd to get a complete list of all
|
||||
groups available.
|
||||
The groupfile patch implements a quick fix to the problem by using a separate
|
||||
group.cache file to speed up those operations using getgrent() calls.
|
||||
Calls to getgrnam() are not touched which means that the group.cache
|
||||
file must be kept in sync with the group source you are using with nss
|
||||
configured in /etc/nsswitch.conf. If group.cache doesn't exist,
|
||||
the patch has no effect and cyrus-imapd handles groups through getgrent().
|
||||
|
||||
Quick HOWTO:
|
||||
- configure group lookup in /etc/nsswitch.conf if not already done
|
||||
- configure name service cache in /etc/nscd.conf (not mandatory)
|
||||
- start nscd with "service nscd start" (not mandatory)
|
||||
- configure a service which periodically updates the group.cache file using the
|
||||
upd_groupcache script. Either set up a cronjob or use a event in the cyrus
|
||||
configuration.
|
||||
|
||||
Sample /etc/cyrus.conf event to update the group cache every 10 minutes:
|
||||
EVENTS {
|
||||
# some events removed here ***
|
||||
...........................***
|
||||
|
||||
# this is only necessary if using group cache feature
|
||||
groupcache cmd="upd_groupcache" period=10
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
--- cyrus-imapd-2.2.6/imap/message.c.acceptinvalidfrom 2004-10-30 15:03:02.220642392 -0700
|
||||
+++ cyrus-imapd-2.2.6/imap/message.c 2004-10-30 15:06:01.838336352 -0700
|
||||
@@ -229,6 +229,8 @@
|
||||
int reject8bit = config_getswitch(IMAPOPT_REJECT8BIT);
|
||||
int munge8bit = config_getswitch(IMAPOPT_MUNGE8BIT);
|
||||
int inheader = 1, blankline = 1;
|
||||
+ char is_from;
|
||||
+ static const char * from_header = "From ";
|
||||
|
||||
while (size) {
|
||||
n = prot_read(from, buf, size > 4096 ? 4096 : size);
|
||||
@@ -294,8 +296,20 @@
|
||||
/* Check for valid header name */
|
||||
if (sawnl && buf[0] != ' ' && buf[0] != '\t') {
|
||||
if (buf[0] == ':') return IMAP_MESSAGE_BADHEADER;
|
||||
- for (p = (unsigned char *)buf; *p != ':'; p++) {
|
||||
- if (*p <= ' ') return IMAP_MESSAGE_BADHEADER;
|
||||
+ p = (unsigned char *) buf;
|
||||
+ if (*p == '>')
|
||||
+ p++;
|
||||
+ if (*p == from_header[0])
|
||||
+ is_from = 0;
|
||||
+ else
|
||||
+ is_from = -1;
|
||||
+ for (; *p != ':' && is_from < 5; p++) {
|
||||
+ if (is_from > 0 && *p != from_header[is_from])
|
||||
+ is_from = -1;
|
||||
+ if (is_from >= 0)
|
||||
+ is_from++;
|
||||
+ else
|
||||
+ if (*p <= ' ') return IMAP_MESSAGE_BADHEADER;
|
||||
}
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
divert(-1)
|
||||
include(`../m4/cf.m4')
|
||||
define(`confDEF_USER_ID',``8:12'')
|
||||
OSTYPE(`linux')
|
||||
undefine(`UUCP_RELAY')
|
||||
undefine(`BITNET_RELAY')
|
||||
FEATURE(redirect)
|
||||
FEATURE(always_add_domain)
|
||||
FEATURE(use_cw_file)
|
||||
FEATURE(local_procmail)
|
||||
define(`CYRUS_MAILER_FLAGS',`Aw5:/|@o')
|
||||
define(`confLOCAL_MAILER',`cyrus')
|
||||
dnl # Note: CYUSER isn't needed, but must put $u in mailer args otherwise
|
||||
dnl # it uses SMTP for delivery!
|
||||
define(`CYRUS_MAILER_ARGS', `procmail -p /etc/procmailrc.cyrus CYUSER=$u')
|
||||
define(`CYRUS_MAILER_PATH', `/usr/bin/procmail')
|
||||
MAILER(cyrus)
|
||||
MAILER(procmail)
|
||||
MAILER(smtp)
|
||||
HACK(check_mail3,`hash -a@JUNK /etc/mail/deny')
|
||||
HACK(use_ip,`/etc/mail/ip_allow')
|
||||
HACK(use_names,`/etc/mail/name_allow')
|
||||
HACK(use_relayto,`/etc/mail/relay_allow')
|
||||
HACK(check_rcpt4)
|
||||
HACK(check_relay3)
|
||||
dnl Not yet tested...
|
||||
dnl LOCAL_RULE_0
|
||||
dnl Rbb + $+ < @ $=w . > $#cyrusbb $: $1
|
@ -1,29 +0,0 @@
|
||||
PUSHDIVERT(-1)
|
||||
#
|
||||
# Copyright (c) 2002 Sendmail, Inc. and its suppliers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# By using this file, you agree to the terms and conditions set
|
||||
# forth in the LICENSE file which can be found at the top level of
|
||||
# the sendmail distribution.
|
||||
#
|
||||
# Contributed by Kenneth Murchison.
|
||||
#
|
||||
|
||||
_DEFIFNOT(`_DEF_CYRUSV2_MAILER_FLAGS', `lsDFMnqXz')
|
||||
_DEFIFNOT(`CYRUSV2_MAILER_FLAGS', `A@/:|m')
|
||||
ifdef(`CYRUSV2_MAILER_ARGS',, `define(`CYRUSV2_MAILER_ARGS', `FILE /var/imap/socket/lmtp')')
|
||||
define(`_CYRUSV2_QGRP', `ifelse(defn(`CYRUSV2_MAILER_QGRP'),`',`', ` Q=CYRUSV2_MAILER_QGRP,')')dnl
|
||||
|
||||
POPDIVERT
|
||||
|
||||
#########################################
|
||||
### Cyrus V2 Mailer specification ###
|
||||
#########################################
|
||||
|
||||
VERSIONID(`$Id: cyrus-imapd-sendmail-8.12.9-cyrusv2.m4,v 1.1 2004/02/04 12:59:42 karsten Exp $')
|
||||
|
||||
Mcyrusv2, P=[IPC], F=_MODMF_(CONCAT(_DEF_CYRUSV2_MAILER_FLAGS, CYRUSV2_MAILER_FLAGS), `CYRUSV2'),
|
||||
S=EnvFromSMTP/HdrFromL, R=EnvToL/HdrToL, E=\r\n,
|
||||
_OPTINS(`CYRUSV2_MAILER_MAXMSGS', `m=', `, ')_OPTINS(`CYRUSV2_MAILER_MAXRCPTS', `r=', `, ')_OPTINS(`CYRUSV2_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,_CYRUSV2_QGRP
|
||||
A=CYRUSV2_MAILER_ARGS
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -97,16 +97,62 @@
|
||||
#
|
||||
# v1.2.1, Jan 13 2006 Simon Matter <simon.matter@invoca.ch>
|
||||
# - code cleanup
|
||||
#
|
||||
# v1.2.2, Nov 29 2007 Simon Matter <simon.matter@invoca.ch>
|
||||
# - add ability to handle "@include" options in imapd.conf, patch
|
||||
# provided by Tim Bannister
|
||||
#
|
||||
# v1.2.3, Feb 07 2008 Simon Matter <simon.matter@invoca.ch>
|
||||
# - add ability to handle tabs in imapd.conf, patch provided
|
||||
# by Franz Knipp
|
||||
# - disable default values for some config options like sievedir
|
||||
#
|
||||
# v1.2.4, Apr 23 2008 Simon Matter <simon.matter@invoca.ch>
|
||||
# - add support for statuscache.db
|
||||
#
|
||||
# v1.3.0, Sep 29 2008 Simon Matter <simon.matter@invoca.ch>
|
||||
# - add multi-instance support
|
||||
#
|
||||
# v1.3.1, Oct 09 2008 Simon Matter <simon.matter@invoca.ch>
|
||||
# - improve variable handling
|
||||
#
|
||||
# v1.3.2, May 26 2009 Simon Matter <simon.matter@invoca.ch>
|
||||
# - add some sanity checks to multi-instance support
|
||||
#
|
||||
# v1.3.3, May 27 2009 Simon Matter <simon.matter@invoca.ch>
|
||||
# - make some cosmetic changes
|
||||
#
|
||||
# v1.3.4, Dec 22 2009 Simon Matter <simon.matter@invoca.ch>
|
||||
# - add support for user_deny.db
|
||||
|
||||
VERSION=1.2.1
|
||||
VERSION=1.3.4
|
||||
|
||||
if [ -n "$(/sbin/pidof cyrus-master)" ]; then
|
||||
echo "ERROR: cyrus-master is running, unable to convert mailboxes!"
|
||||
exit 1
|
||||
PIDFILE=/var/run/cyrus-master${INSTANCE}.pid
|
||||
|
||||
# instance config
|
||||
CYRUSCONF=/etc/cyrus${INSTANCE}.conf
|
||||
IMAPDCONF=/etc/imapd${INSTANCE}.conf
|
||||
|
||||
# make sure what we have is a valid instance
|
||||
# and that config files are present
|
||||
if [ -n "$INSTANCE" ]; then
|
||||
[ -L /etc/rc.d/init.d/${BASENAME} ] || exit 0
|
||||
fi
|
||||
[ -f $CYRUSCONF ] || exit 0
|
||||
[ -f $IMAPDCONF ] || exit 0
|
||||
|
||||
if [ -f $PIDFILE ]; then
|
||||
read CYRUS_PID < $PIDFILE
|
||||
if [ -n "$CYRUS_PID" ]; then
|
||||
if ps -p $CYRUS_PID > /dev/null 2>&1; then
|
||||
echo "ERROR: cyrus-master is running, unable to convert mailboxes!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/imapd.conf ]; then
|
||||
echo "ERROR: configuration file not found."
|
||||
if [ ! -f $IMAPDCONF ]; then
|
||||
echo "ERROR: configuration file '${IMAPDCONF}' not found, exiting!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -119,7 +165,7 @@ fi
|
||||
|
||||
# force cyrus user for security reasons
|
||||
if [ ! $(whoami) = "cyrus" ]; then
|
||||
exec $RUNUSER - cyrus -c "cd $PWD < /dev/null ; $0 $*"
|
||||
exec $RUNUSER - cyrus -c "cd $PWD < /dev/null ; INSTANCE=$INSTANCE $0 $*"
|
||||
fi
|
||||
|
||||
# special function for migration
|
||||
@ -131,14 +177,33 @@ umask 166
|
||||
# show version info in log files
|
||||
echo "cvt_cyrusdb_all version: $VERSION"
|
||||
|
||||
# get_config [config default]
|
||||
# expand_config <path>
|
||||
# handle "@include" sections from imapd style config file
|
||||
expand_config() {
|
||||
while read line; do
|
||||
if printf "%s\n" "${line}" | grep -q '^@include:'; then
|
||||
expand_config "$( printf "%s\n" "${line}" | cut -d : -f 2- | sed -e 's/^[\t ]*//' )"
|
||||
else
|
||||
printf "%s\n" "${line}"
|
||||
fi
|
||||
done < $1
|
||||
}
|
||||
|
||||
# get_config <config> [<default>]
|
||||
# extracts config option from config file
|
||||
get_config() {
|
||||
if config=$(grep "^$1" /etc/imapd.conf); then
|
||||
echo $config | cut -d: -f2 | sed -e 's/^ *//' -e 's/-nosync//' -e 's/ *$//'
|
||||
searchstr=$1
|
||||
if config="$(expand_config $IMAPDCONF | egrep "^${searchstr}:")"; then
|
||||
CFGVAL="$(printf "%s\n" "$config" | cut -d : -f 2- | sed -e 's/^[\t ]*//')"
|
||||
else
|
||||
echo $2
|
||||
if [ -z "$2" ]; then
|
||||
echo "ERROR: config option '$1' not found in ${IMAPDCONF}, exiting!" 1>&2
|
||||
return 1
|
||||
fi
|
||||
CFGVAL="$2"
|
||||
fi
|
||||
echo "get_config ${1}: $CFGVAL" 1>&2
|
||||
echo "$CFGVAL"
|
||||
}
|
||||
|
||||
# where to find files and directories
|
||||
@ -149,8 +214,8 @@ cyrus_magic=${data_dir}/magic
|
||||
cvt_cyrusdb=${lib_dir}/cvt_cyrusdb
|
||||
sievec=${lib_dir}/sievec
|
||||
masssievec=${lib_dir}/masssievec
|
||||
imap_prefix=$(get_config configdirectory /var/lib/imap)
|
||||
sieve_dir=$(get_config sievedir /var/lib/imap/sieve)
|
||||
imap_prefix=$(get_config configdirectory) || exit 1
|
||||
sieve_dir=$(get_config sievedir) || exit 1
|
||||
db_cfg=${data_dir}/db.cfg
|
||||
db_current=${imap_prefix}/rpm/db.cfg.current
|
||||
db_cache=${imap_prefix}/rpm/db.cfg.cache
|
||||
@ -159,33 +224,37 @@ db_cache=${imap_prefix}/rpm/db.cfg.cache
|
||||
. $db_cfg
|
||||
|
||||
# get configured db backend config
|
||||
duplicate_db=$(get_config duplicate_db $duplicate_db)
|
||||
mboxlist_db=$(get_config mboxlist_db $mboxlist_db)
|
||||
seenstate_db=$(get_config seenstate_db $seenstate_db)
|
||||
subscription_db=$(get_config subscription_db $subscription_db)
|
||||
tlscache_db=$(get_config tlscache_db $tlscache_db)
|
||||
annotation_db=$(get_config annotation_db $annotation_db)
|
||||
mboxkey_db=$(get_config mboxkey_db $mboxkey_db)
|
||||
ptscache_db=$(get_config ptscache_db $ptscache_db)
|
||||
quota_db=$(get_config quota_db $quota_db)
|
||||
duplicate_db=$(get_config duplicate_db $duplicate_db) || exit 1
|
||||
mboxlist_db=$(get_config mboxlist_db $mboxlist_db) || exit 1
|
||||
seenstate_db=$(get_config seenstate_db $seenstate_db) || exit 1
|
||||
subscription_db=$(get_config subscription_db $subscription_db) || exit 1
|
||||
tlscache_db=$(get_config tlscache_db $tlscache_db) || exit 1
|
||||
annotation_db=$(get_config annotation_db $annotation_db) || exit 1
|
||||
mboxkey_db=$(get_config mboxkey_db $mboxkey_db) || exit 1
|
||||
ptscache_db=$(get_config ptscache_db $ptscache_db) || exit 1
|
||||
quota_db=$(get_config quota_db $quota_db) || exit 1
|
||||
statuscache_db=$(get_config statuscache_db $statuscache_db) || exit 1
|
||||
userdeny_db=$(get_config userdeny_db $userdeny_db) || exit 1
|
||||
|
||||
# remember current db backend config
|
||||
{
|
||||
echo "duplicate_db=$duplicate_db"
|
||||
echo "mboxlist_db=$mboxlist_db"
|
||||
echo "seenstate_db=$seenstate_db"
|
||||
echo "subscription_db=$subscription_db"
|
||||
echo "tlscache_db=$tlscache_db"
|
||||
echo "annotation_db=$annotation_db"
|
||||
echo "mboxkey_db=$mboxkey_db"
|
||||
echo "ptscache_db=$ptscache_db"
|
||||
echo "quota_db=$quota_db"
|
||||
echo "sieve_version=$sieve_version"
|
||||
echo "duplicate_db=${duplicate_db}"
|
||||
echo "mboxlist_db=${mboxlist_db}"
|
||||
echo "seenstate_db=${seenstate_db}"
|
||||
echo "subscription_db=${subscription_db}"
|
||||
echo "tlscache_db=${tlscache_db}"
|
||||
echo "annotation_db=${annotation_db}"
|
||||
echo "mboxkey_db=${mboxkey_db}"
|
||||
echo "ptscache_db=${ptscache_db}"
|
||||
echo "quota_db=${quota_db}"
|
||||
echo "statuscache_db=${statuscache_db}"
|
||||
echo "userdeny_db=${userdeny_db}"
|
||||
echo "sieve_version=${sieve_version}"
|
||||
} | sort > $db_current
|
||||
|
||||
# file_type [file]
|
||||
# file_type <file>
|
||||
file_type() {
|
||||
this_type=$(file -b -m "$cyrus_magic:$system_magic" "$1" 2> /dev/null)
|
||||
this_type=$(file -b -m "${cyrus_magic}:${system_magic}" "$1" 2> /dev/null)
|
||||
if echo "$this_type" | grep -qi skip > /dev/null 2>&1; then
|
||||
echo skiplist
|
||||
elif echo "$this_type" | grep -qi text > /dev/null 2>&1; then
|
||||
@ -195,7 +264,7 @@ file_type() {
|
||||
fi
|
||||
}
|
||||
|
||||
# cvt_file [file] [db]
|
||||
# cvt_file <file> <db>
|
||||
cvt_file() {
|
||||
target="$1"
|
||||
new_db="$2"
|
||||
@ -208,21 +277,21 @@ cvt_file() {
|
||||
if [ "$old_db" = "skiplist" ]; then
|
||||
cp -a "$target" "${target}.skiplist"
|
||||
else
|
||||
$cvt_cyrusdb "$target" "$old_db" "${target}.skiplist" skiplist
|
||||
$cvt_cyrusdb -C $IMAPDCONF "$target" "$old_db" "${target}.skiplist" skiplist
|
||||
fi
|
||||
RETVAL=$?
|
||||
ERRVAL=$[ $ERRVAL + $RETVAL ]
|
||||
ERRVAL=$(( $ERRVAL + $RETVAL ))
|
||||
if [ $RETVAL -eq 0 ]; then
|
||||
rm -f "$target"
|
||||
if [ -s "${target}.skiplist" ]; then
|
||||
if [ "$new_db" = "skiplist" ]; then
|
||||
cp -a "${target}.skiplist" "$target"
|
||||
else
|
||||
$cvt_cyrusdb "${target}.skiplist" skiplist "$target" "$new_db"
|
||||
$cvt_cyrusdb -C $IMAPDCONF "${target}.skiplist" skiplist "$target" "$new_db"
|
||||
fi
|
||||
fi
|
||||
RETVAL=$?
|
||||
ERRVAL=$[ $ERRVAL + $RETVAL ]
|
||||
ERRVAL=$(( $ERRVAL + $RETVAL ))
|
||||
if [ $RETVAL -eq 0 ]; then
|
||||
rm -f "${target}.skiplist"
|
||||
else
|
||||
@ -235,18 +304,18 @@ cvt_file() {
|
||||
fi
|
||||
}
|
||||
|
||||
# cvt_to_utf8 [file]
|
||||
# cvt_to_utf8 <file>
|
||||
cvt_to_utf8() {
|
||||
target="$1"
|
||||
if [ -s "$target" ]; then
|
||||
if ! $sievec "$target" "${target}.sievec"; then
|
||||
if ! $sievec -C $IMAPDCONF "$target" "${target}.sievec"; then
|
||||
iconv --from-code=ISO-8859-1 --to-code=UTF-8 --output="${target}.UTF-8" "$target"
|
||||
if [ -s "${target}.UTF-8" ]; then
|
||||
# preserve timestamp
|
||||
touch --reference="$target" "${target}.UTF-8"
|
||||
touch --reference="${target}" "${target}.UTF-8"
|
||||
mv -f "${target}.UTF-8" "$target"
|
||||
else
|
||||
ERRVAL=$[ $ERRVAL + 1 ]
|
||||
ERRVAL=$(( $ERRVAL + 1 ))
|
||||
fi
|
||||
fi
|
||||
rm -f "${target}.sievec"
|
||||
@ -257,7 +326,7 @@ ERRVAL=0
|
||||
|
||||
# make sure our Berkeley databases are in a sane state
|
||||
# wait for db_checkpoint to end successfully or kill it after a timeout
|
||||
db_checkpoint -v -1 -h $imap_prefix/db &
|
||||
db_checkpoint -v -1 -h ${imap_prefix}/db &
|
||||
DB_CHECK_PID=$!
|
||||
CNT=0
|
||||
while [ $CNT -lt 60 ]; do
|
||||
@ -275,43 +344,47 @@ if kill -0 $DB_CHECK_PID > /dev/null 2>&1; then
|
||||
fi
|
||||
|
||||
# do a normal recovery
|
||||
db_recover -v -h $imap_prefix/db
|
||||
db_recover -v -h ${imap_prefix}/db
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
# try a catastrophic recovery instead of normal recovery
|
||||
db_recover -v -c -h $imap_prefix/db
|
||||
db_recover -v -c -h ${imap_prefix}/db
|
||||
RETVAL=$?
|
||||
ERRVAL=$[ $ERRVAL + $RETVAL ]
|
||||
ERRVAL=$(( $ERRVAL + $RETVAL ))
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "ERROR: catastrophic recovery of Berkeley databases failed"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$EXPORT" = "export" ]; then
|
||||
# convert all db files to skiplist for migration
|
||||
# convert all db files to portable format for migration
|
||||
# TODO: quota_db, we don't touch it for now
|
||||
cvt_file $imap_prefix/deliver.db "skiplist"
|
||||
cvt_file $imap_prefix/mailboxes.db "skiplist"
|
||||
cvt_file $imap_prefix/tls_sessions.db "skiplist"
|
||||
cvt_file $imap_prefix/annotations.db "skiplist"
|
||||
cvt_file $imap_prefix/ptclient/ptscache.db "skiplist"
|
||||
rm -vf $imap_prefix/db/log.*
|
||||
rm -vf $imap_prefix/db/__db.*
|
||||
cvt_file ${imap_prefix}/deliver.db "skiplist"
|
||||
cvt_file ${imap_prefix}/mailboxes.db "skiplist"
|
||||
cvt_file ${imap_prefix}/tls_sessions.db "skiplist"
|
||||
cvt_file ${imap_prefix}/annotations.db "skiplist"
|
||||
cvt_file ${imap_prefix}/ptclient/ptscache.db "skiplist"
|
||||
cvt_file ${imap_prefix}/statuscache.db "skiplist"
|
||||
cvt_file ${imap_prefix}/user_deny.db "flat"
|
||||
rm -vf ${imap_prefix}/db/log.*
|
||||
rm -vf ${imap_prefix}/db/__db.*
|
||||
else
|
||||
# always convert db files which have been converted to skiplist
|
||||
# TODO: quota_db, we don't touch it for now
|
||||
cvt_file $imap_prefix/deliver.db "$duplicate_db"
|
||||
cvt_file $imap_prefix/mailboxes.db "$mboxlist_db"
|
||||
cvt_file $imap_prefix/tls_sessions.db "$tlscache_db"
|
||||
cvt_file $imap_prefix/annotations.db "$annotation_db"
|
||||
cvt_file $imap_prefix/ptclient/ptscache.db "$ptscache_db"
|
||||
cvt_file ${imap_prefix}/deliver.db "$duplicate_db"
|
||||
cvt_file ${imap_prefix}/mailboxes.db "$mboxlist_db"
|
||||
cvt_file ${imap_prefix}/tls_sessions.db "$tlscache_db"
|
||||
cvt_file ${imap_prefix}/annotations.db "$annotation_db"
|
||||
cvt_file ${imap_prefix}/ptclient/ptscache.db "$ptscache_db"
|
||||
cvt_file ${imap_prefix}/statuscache.db "$statuscache_db"
|
||||
cvt_file ${imap_prefix}/user_deny.db "$userdeny_db"
|
||||
# do we have to convert all databases?
|
||||
if ! cmp -s $db_current $db_cache; then
|
||||
# we treat sieve scripts the same way like db files
|
||||
find ${sieve_dir}/ -name "*.script" -type f | while read db_file trash; do
|
||||
cvt_to_utf8 "$db_file"
|
||||
done
|
||||
$masssievec $sievec
|
||||
$masssievec $sievec $IMAPDCONF
|
||||
# convert all db files left
|
||||
find ${imap_prefix}/user/ -name "*.seen" -type f | while read db_file trash; do
|
||||
cvt_file "$db_file" "$seenstate_db"
|
||||
|
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
IMAPCONF=/etc/imapd.conf
|
||||
|
||||
CONFDIR=$(grep -se "^configdirectory:" $IMAPCONF | cut -d":" -f2)
|
||||
if [ "x$CONFDIR" = "x" ]; then
|
||||
echo "$0 error: configdirectory not found in /etc/imapd.conf, exiting!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find $CONFDIR -type d ! -name "lost+found" -exec chmod 700 {} \; -exec chown cyrus:mail {} \;
|
||||
grep -sE "^(meta|)partition-.*:" $IMAPCONF | cut -d":" -f2 | while read SPOOLDIR; do
|
||||
if [ "x$SPOOLDIR" = "x" ]; then
|
||||
echo "$0 warning: invalid (meta)partition configuration in /etc/imapd.conf found!"
|
||||
else
|
||||
find $SPOOLDIR -type d ! -name "lost+found" -exec chmod 700 {} \; -exec chown cyrus:mail {} \;
|
||||
fi
|
||||
done
|
||||
|
||||
find $CONFDIR -type f ! -name "lost+found" -exec chmod 600 {} \; -exec chown cyrus:mail {} \;
|
||||
grep -sE "^(meta|)partition-.*:" $IMAPCONF | cut -d":" -f2 | while read SPOOLDIR; do
|
||||
if [ "x$SPOOLDIR" = "x" ]; then
|
||||
echo "$0 warning: invalid (meta)partition configuration in /etc/imapd.conf found!"
|
||||
else
|
||||
find $SPOOLDIR -type f ! -name "lost+found" -exec chmod 600 {} \; -exec chown cyrus:mail {} \;
|
||||
fi
|
||||
done
|
||||
|
||||
# lmtp socket must be accessible by group mail
|
||||
chmod 750 $CONFDIR
|
||||
chmod 750 ${CONFDIR}/socket
|
101
cyrus-imapd.spec
101
cyrus-imapd.spec
@ -1,11 +1,10 @@
|
||||
#TODO: merge all sub-packages (except -devel) into cyrus-imapd, they are all required
|
||||
|
||||
Name: cyrus-imapd
|
||||
Version: 2.3.16
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
|
||||
%define ssl_pem_file %{_sysconfdir}/pki/%{name}/%{name}.pem
|
||||
|
||||
#uid/gid reserved, see setup:/usr/share/doc/setup*/uidgid
|
||||
%define uid 76
|
||||
%define gid 76
|
||||
|
||||
@ -18,43 +17,26 @@ License: BSD
|
||||
Group: System Environment/Daemons
|
||||
URL: http://cyrusimap.web.cmu.edu/
|
||||
Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus/%{name}-%{version}.tar.gz
|
||||
Source3: cyrus-deliver-wrapper.c
|
||||
Source4: cyrus-user-procmailrc.template
|
||||
Source5: cyrus-imapd.logrotate
|
||||
Source6: cyrus-imapd.imap-2.3.x-conf
|
||||
Source7: cyrus-imapd.pam-config
|
||||
Source8: http://email.uoa.gr/projects/cyrus/autocreate/README.autocreate-cyrus-2.3
|
||||
Source9: http://email.uoa.gr/projects/cyrus/autosievefolder/README.autosievefolder
|
||||
Source10: http://oss.netfarm.it/download/skiplist.py
|
||||
Source11: cyrus-imapd.init
|
||||
Source12: cyrus-imapd.sysconfig
|
||||
Source13: cyrus-imapd.cvt_cyrusdb_all
|
||||
Source14: cyrus-imapd.magic
|
||||
Source15: http://clement.hermann.free.fr/scripts/Cyrus/imapcreate.pl
|
||||
Source16: http://eu.dl.sourceforge.net/cyrus-utils/cyrus_ldap_quota.pl
|
||||
Source17: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/batchreconstruct
|
||||
Source18: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/bsd2cyrus
|
||||
Source19: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/cpmsg
|
||||
Source20: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/folderxfer
|
||||
Source21: ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/inboxfer
|
||||
Source22: http://email.uoa.gr/download/cyrus/cyrus_sharedbackup/cyrus_sharedbackup-0.1.tar.gz
|
||||
Source24: README.HOWTO-recover-mailboxes.db
|
||||
Source25: cyrus-imapd.cron-daily
|
||||
Source26: cyrus-procmailrc
|
||||
Source27: cyrus-imapd-procmail+cyrus.mc
|
||||
Source28: cyrus-imapd.rpm_set_permissions
|
||||
Source29: cyrus-imapd-sendmail-8.12.9-cyrusv2.m4
|
||||
Source33: README.skiplist_recovery
|
||||
Patch0: cyrus-imapd-2.2.12-no_transfig.patch
|
||||
Patch1: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.12/cyrus-imapd-2.3.12p2-autocreate-0.10-0.diff
|
||||
Patch2: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.12/cyrus-imapd-2.3.12p2-autosieve-0.6.0.diff
|
||||
Patch4: http://servercc.oakton.edu/~jwade/cyrus/cyrus-imapd-2.1.3/cyrus-imapd-2.1.3-flock.patch
|
||||
Patch6: cyrus-imapd-2.1.16-getrlimit.patch
|
||||
Patch10: cyrus-imapd-acceptinvalidfrom.patch
|
||||
Patch12: cyrus-imapd-2.3.7-notify_sms.patch
|
||||
|
||||
Patch1: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.16/cyrus-imapd-2.3.16-autocreate-0.10-0.diff
|
||||
|
||||
Patch2: http://email.uoa.gr/download/cyrus/cyrus-imapd-2.3.16/cyrus-imapd-2.3.16-autosieve-0.6.0.diff
|
||||
|
||||
Patch4: http://www.oakton.edu/~jwade/cyrus/cyrus-imapd-2.1.3/cyrus-imapd-2.1.3-flock.patch
|
||||
|
||||
Patch14: cyrus-imapd-2.3.1-authid_normalize.patch
|
||||
|
||||
Patch15: cyrus-imapd-2.3.1-make_md5_defaults.patch
|
||||
Patch18: cyrus-imapd-2.3.7-krb4.patch
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=461875
|
||||
Patch19: cyrus-imapd-2.3.12p2-current-db.patch
|
||||
@ -74,6 +56,7 @@ BuildRequires: flex, bison, groff, automake
|
||||
BuildRequires: openldap-devel
|
||||
BuildRequires: krb5-devel
|
||||
BuildRequires: net-snmp-devel
|
||||
BuildRequires: transfig
|
||||
|
||||
Requires(post): e2fsprogs, chkconfig, initscripts, perl, grep, coreutils, findutils
|
||||
Requires(preun): chkconfig, initscripts, coreutils
|
||||
@ -119,21 +102,13 @@ Summary: Cyrus IMAP server development files
|
||||
The %{name}-devel package contains header files and libraries
|
||||
necessary for developing applications which use the imclient library.
|
||||
|
||||
%package perl
|
||||
Group: System Environment/Libraries
|
||||
Summary: Cyrus IMAP server utility Perl modules
|
||||
|
||||
%description perl
|
||||
The %{name}-perl contains Perl modules necessary to use the
|
||||
Cyrus IMAP server administration utilities.
|
||||
|
||||
%package utils
|
||||
Group: Applications/System
|
||||
Summary: Cyrus IMAP server administration utilities
|
||||
Requires(pre): shadow-utils
|
||||
Requires(post): grep, coreutils, make, openssl
|
||||
Requires(postun): shadow-utils
|
||||
Requires: %{name}-perl = %{version}-%{release}
|
||||
Obsoletes: %{name}-perl < 2.3.16-5
|
||||
|
||||
%description utils
|
||||
The %{name}-utils package contains administrative tools for the
|
||||
@ -142,27 +117,15 @@ one running the server.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1 -b .no_transfig
|
||||
%patch1 -p1 -b .autocreate
|
||||
%patch2 -p1 -b .autosieve
|
||||
%patch4 -p1 -b .flock
|
||||
%patch6 -p1 -b .getrlimit
|
||||
%patch10 -p1 -b .acceptinvalidfrom
|
||||
%patch12 -p1 -b .notify_sms
|
||||
%patch14 -p1 -b .authid_normalize
|
||||
%patch15 -p1 -b .make_md5_defaults
|
||||
%patch18 -p1 -b .krb4
|
||||
%patch19 -p1 -b .db4.7
|
||||
%patch20 -p1 -b .nodenny
|
||||
%patch21 -p1 -b .qos
|
||||
|
||||
# add additional sources
|
||||
mkdir doc/{m4,contrib}
|
||||
%{__install} -m 644 %{SOURCE10} %{SOURCE15} %{SOURCE16} %{SOURCE17} \
|
||||
%{SOURCE18} %{SOURCE19} %{SOURCE20} %{SOURCE21} doc/contrib/
|
||||
%{__install} -m 644 %{SOURCE24} %{SOURCE33} %{SOURCE8} %{SOURCE9} doc/
|
||||
%{__install} -m 644 %{SOURCE26} %{SOURCE4} %{SOURCE27} %{SOURCE29} doc/m4/
|
||||
|
||||
# only to update config.* files
|
||||
automake -a -f -c || :
|
||||
aclocal -I cmulocal
|
||||
@ -178,11 +141,13 @@ autoconf -f
|
||||
find . -type f -name "*.pl" | xargs %{__perl} -pi -e "s@/usr/local/bin/perl@%{__perl}@"
|
||||
|
||||
# modify lmtp socket path in .conf files
|
||||
%{__perl} -pi -e "s@/var/imap/@%{_var}/lib/imap/@" master/conf/*.conf doc/cyrusv2.mc doc/m4/%{name}-sendmail-8.12.9-cyrusv2.m4
|
||||
%{__perl} -pi -e "s@/var/imap/@%{_var}/lib/imap/@" master/conf/*.conf doc/cyrusv2.mc #doc/m4/%{name}-sendmail-8.12.9-cyrusv2.m4
|
||||
|
||||
# enable idled in .conf files to prevent error messages
|
||||
%{__perl} -pi -e "s/# idled/ idled/" master/conf/*.conf
|
||||
|
||||
# Fix permissions on perl programs
|
||||
find . -type f -name "*.pl" -exec %{__chmod} 755 {} \;
|
||||
|
||||
%build
|
||||
CPPFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/et -I%{_includedir}/kerberosIV"; export CPPFLAGS
|
||||
@ -218,9 +183,6 @@ LDFLAGS="$LDFLAGS -pie"; export LDFLAGS
|
||||
%install
|
||||
%{__rm} -rf %{buildroot}
|
||||
|
||||
# Fix permissions on perl programs
|
||||
find . -type f -name "*.pl" -exec %{__chmod} 755 {} \;
|
||||
|
||||
# This is needed to install the perl files correctly
|
||||
pushd perl/imap
|
||||
%{__perl} Makefile.PL PREFIX=%{buildroot}%{_prefix} INSTALLDIRS=vendor
|
||||
@ -255,7 +217,6 @@ done
|
||||
|
||||
# Install additional files
|
||||
%{__install} -m 755 %{SOURCE13} %{buildroot}%{_cyrexecdir}/cvt_cyrusdb_all
|
||||
%{__install} -m 755 %{SOURCE28} %{buildroot}%{_cyrexecdir}/rpm_set_permissions
|
||||
%{__install} -m 644 %{SOURCE14} %{buildroot}%{_datadir}/%{name}/rpm/magic
|
||||
%{__install} -p -m 644 master/conf/prefork.conf %{buildroot}%{_sysconfdir}/cyrus.conf
|
||||
%{__install} -p -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/imapd.conf
|
||||
@ -272,8 +233,8 @@ done
|
||||
%{__install} -p -m 755 %{SOURCE25} %{buildroot}%{_sysconfdir}/cron.daily/%{name}
|
||||
|
||||
# Cleanup of doc dir
|
||||
find doc perl -name CVS -type d | xargs -r %{__rm} -rf
|
||||
find doc perl -name .cvsignore -type f | xargs -r %{__rm} -f
|
||||
find doc perl -name CVS -type d -prune -exec echo %{__rm} -rf {} \;
|
||||
find doc perl -name .cvsignore -type f -exec %{__rm} -rf {} \;
|
||||
%{__rm} -f doc/Makefile.dist*
|
||||
%{__rm} -f doc/text/htmlstrip.c
|
||||
%{__rm} -f doc/text/Makefile
|
||||
@ -308,9 +269,6 @@ touch %{buildroot}%{ssl_pem_file}
|
||||
%{__perl} -pi -e 's|fetchnews|cyrfetchnews|g;s|Fetchnews|Cyrfetchnews|g;s/FETCHNEWS/CYRFETCHNEWS/g' \
|
||||
%{buildroot}%{_mandir}/man8/cyrfetchnews.8
|
||||
|
||||
# compress manpages
|
||||
[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress
|
||||
|
||||
#remove executable bit from docs
|
||||
for ddir in doc perl/imap/examples
|
||||
do
|
||||
@ -339,7 +297,7 @@ find %{buildroot}%{perl_vendorarch} -name "*.bs" -exec %{__rm} -f {} \;
|
||||
%post
|
||||
/sbin/chkconfig --add %{name}
|
||||
|
||||
# Force synchronous updates, usually only on ext2 filesystems
|
||||
# Force synchronous updates, usually only on extX filesystems
|
||||
chattr -R +S $i %{_var}/lib/imap/{user,quota} %{_var}/spool/imap 2>/dev/null ||:
|
||||
|
||||
# Create SSL certificates
|
||||
@ -374,14 +332,6 @@ if [ $1 != 0 ]; then
|
||||
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%post utils
|
||||
# FIXME: remove when setup > 2.8.10 is released
|
||||
# Add service entries if necessary
|
||||
if ! %{__grep} -q ^csync %{_sysconfdir}/services; then
|
||||
echo -e 'csync\t\t2005/tcp\t\t\t# Cyrus IMAP Replication Daemon' >> %{_sysconfdir}/services
|
||||
echo -e 'csync\t\t2005/udp\t\t\t# Cyrus IMAP Replication Daemon' >> %{_sysconfdir}/services
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc COPYRIGHT README
|
||||
@ -444,7 +394,6 @@ fi
|
||||
%{_cyrexecdir}/unexpunge
|
||||
%{_cyrexecdir}/upgradesieve
|
||||
%{_cyrexecdir}/cvt_cyrusdb_all
|
||||
%{_cyrexecdir}/rpm_set_permissions
|
||||
%{_cyrexecdir}/idled
|
||||
%{_cyrexecdir}/compile_sieve
|
||||
%{_cyrexecdir}/mupdate
|
||||
@ -489,11 +438,12 @@ fi
|
||||
%{_libdir}/lib*.a
|
||||
%{_mandir}/man3/imclient.3*
|
||||
|
||||
%files perl
|
||||
%files utils
|
||||
%defattr(-,root,root)
|
||||
%doc perl/imap/README
|
||||
%doc perl/imap/Changes
|
||||
%doc perl/imap/examples
|
||||
%{_bindir}/*
|
||||
%dir %{perl_vendorarch}/Cyrus
|
||||
%dir %{perl_vendorarch}/Cyrus/IMAP
|
||||
%{perl_vendorarch}/Cyrus/IMAP/Admin.pm
|
||||
@ -514,13 +464,16 @@ fi
|
||||
%{_mandir}/man3/Cyrus::IMAP.3pm.gz
|
||||
%{_mandir}/man3/Cyrus::IMAP::IMSP.3pm.gz
|
||||
%{_mandir}/man3/Cyrus::SIEVE::managesieve.3pm.gz
|
||||
|
||||
%files utils
|
||||
%defattr(0644,root,root,0755)
|
||||
%attr(0755,root,root) %{_bindir}/*
|
||||
%{_mandir}/man1/*
|
||||
|
||||
%changelog
|
||||
* Mon Jun 07 2010 Michal Hlavinka <mhlavink@redhat.com> - 2.3.16-5
|
||||
- spec cleanup
|
||||
- simplified packaging (merge -perl in -utils)
|
||||
- remove obsoleted and/or unmaintained additional sources/patches
|
||||
- remove long time not used files from the cvs/srpm
|
||||
- update additional sources/patches from their upstream
|
||||
|
||||
* Tue Jun 01 2010 Marcela Maslanova <mmaslano@redhat.com> - 2.3.16-4
|
||||
- Mass rebuild with perl-5.12.0
|
||||
|
||||
|
@ -1,66 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# This script updates a cache of the unix group database. It's purpose is to
|
||||
# speedup group authorization when using large groups with slow nss backends.
|
||||
# For more info consult the README.groupcache file.
|
||||
#
|
||||
# This script can safely be run as root, it will reexec itself as user
|
||||
# cyrus if needed.
|
||||
#
|
||||
# author: Simon Matter, Invoca Systems <simon.matter@invoca.ch>
|
||||
|
||||
# changelog
|
||||
# v1.0.0, Dec 15 2004 Simon Matter <simon.matter@invoca.ch>
|
||||
# - initial release
|
||||
|
||||
if [ ! -f /etc/imapd.conf ]; then
|
||||
echo "ERROR: configuration file not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# fallback to su if runuser not available
|
||||
if [ -x /sbin/runuser ]; then
|
||||
RUNUSER=runuser
|
||||
else
|
||||
RUNUSER=su
|
||||
fi
|
||||
|
||||
# force cyrus user for security reasons
|
||||
if [ ! $(whoami) = "cyrus" ]; then
|
||||
exec $RUNUSER - cyrus -c "cd $PWD < /dev/null ; $0"
|
||||
fi
|
||||
|
||||
# files get mode 0600
|
||||
umask 166
|
||||
|
||||
# get_config [config default]
|
||||
# extracts config option from config file
|
||||
get_config() {
|
||||
if config=$(grep "^$1" /etc/imapd.conf); then
|
||||
echo $config | cut -d: -f2
|
||||
else
|
||||
echo $2
|
||||
fi
|
||||
}
|
||||
|
||||
# where to find files and directories
|
||||
imap_prefix=$(get_config configdirectory /var/lib/imap)
|
||||
group_cache=${imap_prefix}/group.cache
|
||||
|
||||
TMPCACHE=$(mktemp ${group_cache}.XXXXXX) || exit 1
|
||||
getent group >> $TMPCACHE
|
||||
mv -f $TMPCACHE $group_cache
|
129
cyrus-procmailrc
129
cyrus-procmailrc
@ -1,129 +0,0 @@
|
||||
#################################################
|
||||
# procmailrc
|
||||
# This is the main procmail file with common SPAM recipes
|
||||
# Based on the article at
|
||||
# http://www.ncworldmag.com/ncw-05-1998/ncw-05-imap.html
|
||||
#
|
||||
#
|
||||
# First we define some basics
|
||||
|
||||
PATH=/usr/bin:/bin
|
||||
SHELL=/bin/sh
|
||||
|
||||
# We define DELIVERTO just to prevent a lot of extra
|
||||
# typing later on. We define SPAMIT to prevent even more
|
||||
# repetitive typing, as it's the same action for every user.
|
||||
# This assumes we set up a SPAM folder right off the INBOX
|
||||
# for every user on the system. If we neglect to do that, we'll
|
||||
# get in a bit of trouble.
|
||||
|
||||
DELIVERTO=/usr/cyrus/bin/deliver-wrapper
|
||||
SPAMIT="$DELIVERTO user.$LOGNAME.SPAM"
|
||||
|
||||
# This file includes the appropriate procmail.$LOGNAME
|
||||
# file so that each user has his or her own recipe techniques
|
||||
# for subscribed lists, e-mail alerts, etc.
|
||||
|
||||
# Before we begin any recipes, let's make a backup
|
||||
# copy of any incoming mail.
|
||||
#
|
||||
# Remember to comment out the next recipe once
|
||||
# you know everything is working fine, otherwise
|
||||
# you'll fill up the backup directory very quickly.
|
||||
# Some procmail tutorials demonstrate how you can
|
||||
# set a quota on the backup directory so that you can
|
||||
# leave it in force at all times.
|
||||
|
||||
:0 ic
|
||||
| $DELIVERTO user.$LOGNAME.Backup
|
||||
|
||||
###############################
|
||||
# If there used to be an existing system-wide procmailrc, you can
|
||||
# include it here
|
||||
#INCLUDERC=/etc/procmailrc
|
||||
|
||||
# We shouldn't be running as a privileged user, but just in case,
|
||||
# make sure we drop any privileges we have
|
||||
DROPPRIVS=1
|
||||
|
||||
###############################
|
||||
# If users want to be able to define their own private recipes
|
||||
# and put them in their home .procmailrc files, comment out
|
||||
# the next definition.
|
||||
#
|
||||
# These recipes will be processed BEFORE the user-specific
|
||||
# recipes that are kept in the /home/cyrus directory
|
||||
#
|
||||
# setup some variables, before we start
|
||||
ALERTSBOX=user.$LOGNAME.Folders.Alerts
|
||||
LISTSBOX=user.$LOGNAME.Folders.Lists
|
||||
#
|
||||
INCLUDERC=$HOME/.procmailrc
|
||||
|
||||
# If you want to define user-specific recipes that
|
||||
# you manage centrally (perhaps because you don't want
|
||||
# to allow your users to "roll their own," then
|
||||
# uncomment the following line. In this case, you have
|
||||
# to create a file for each user in the form:
|
||||
# procmail.username -- for example, procmail.Joe
|
||||
#
|
||||
# INCLUDERC=/usr/cyrus/etc/procmail.$LOGNAME
|
||||
|
||||
#############################
|
||||
# Now we begin our recipes
|
||||
|
||||
#############################
|
||||
# Email-specific SPAM recipes
|
||||
# Here's one example
|
||||
|
||||
#### NOTE: surely cyrus 'deliver' does its own locking? There should
|
||||
#### thus be no need for :0:$LOGNAME.lock
|
||||
|
||||
:0
|
||||
* ^To:.*anyplace@juno.com
|
||||
| $SPAMIT
|
||||
|
||||
#############################
|
||||
# General SPAM Recipes
|
||||
# Here are a few examples
|
||||
#
|
||||
# The "To:" line doesn't exist
|
||||
|
||||
#:0
|
||||
#* !^To:
|
||||
#| $SPAMIT
|
||||
|
||||
# The "To:" line is empty
|
||||
|
||||
#:0
|
||||
#* ^To: $
|
||||
#| $SPAMIT
|
||||
|
||||
# The "From:" line is empty
|
||||
|
||||
#:0
|
||||
#* ^From: $
|
||||
#| $SPAMIT
|
||||
|
||||
#############################
|
||||
# All the mail that falls
|
||||
# through the above recipes
|
||||
# will be put into the user's
|
||||
# inbox. This is always the LAST
|
||||
# recipe to appear in the file.
|
||||
|
||||
:0W
|
||||
| $DELIVERTO user.$LOGNAME
|
||||
|
||||
# If that fails - maybe because the user is out of quota, or the mailbox
|
||||
# hasn't been created - then force a bounce (otherwise the message would
|
||||
# get silently appended to /var/spool/mail/$LOGNAME).
|
||||
|
||||
# This is EX_CANTCREAT (Can't create output)
|
||||
EXITCODE=73
|
||||
:0
|
||||
/dev/null
|
||||
|
||||
#
|
||||
# End of procmailrc file
|
||||
##############################
|
@ -1,58 +0,0 @@
|
||||
##############################
|
||||
# Begin procmailrc.joe file
|
||||
#
|
||||
# This is Joe's specific set of procmail
|
||||
# recipes. It assumes that Joe has a
|
||||
# number of specific folders created
|
||||
# to which these recipes refer. Otherwise
|
||||
# the mail cannot be sorted properly.
|
||||
#
|
||||
# First, let's define some high-level
|
||||
# folder macros to save typing later on.
|
||||
# The ALERTSBOX points to the
|
||||
# folder where we'll sort out various
|
||||
# incoming news alerts.
|
||||
# The LISTSBOX will point to a
|
||||
# folder where we'll sort out various
|
||||
# list services to which we're subscribed.
|
||||
#
|
||||
# Both ALERTSBOX and LISTSBOX
|
||||
# are subfolders of a generic folder called,
|
||||
# duh, Folders, which is right off the
|
||||
# user's INBOX.
|
||||
#
|
||||
# So if a Linux-kernel message comes in
|
||||
# it gets deposited in the folder
|
||||
# Folders/Lists/Linux_Kernel which is
|
||||
# represented in Cyrus IMAP terms as
|
||||
# user.Joe.Folders.Lists.Linux_kernel
|
||||
#
|
||||
|
||||
############################
|
||||
# Put anchordesk alerts in news alerts folder
|
||||
|
||||
:0:$LOGNAME.lock
|
||||
* ^From:.*anchordesk
|
||||
| $DELIVERTO $ALERTSBOX.News-Alerts
|
||||
|
||||
# Put NC World alerts in their own folder
|
||||
|
||||
:0:$LOGNAME.lock
|
||||
* ^From:.*NCWorld@FDDS.com
|
||||
| $DELIVERTO $ALERTSBOX.NCWorld-Alerts
|
||||
|
||||
#############################
|
||||
# List processing & Misc Alerts
|
||||
|
||||
:0:$LOGNAME.lock
|
||||
* (^Cc:|^CC:|^To:|^Sender:).*linux-kernel@vger.rutgers.edu
|
||||
| $DELIVERTO $LISTSBOX.Linux_Kernel
|
||||
|
||||
:0:$LOGNAME.lock
|
||||
* (^Cc:|^CC:|^To:|^Sender:).*linux-net@vger.rutgers.edu
|
||||
| $DELIVERTO $LISTSBOX.Linux_Net
|
||||
|
||||
#
|
||||
# End of procmailrc.joe file
|
||||
##############################
|
||||
|
@ -1,127 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
use Cyrus::IMAP::Admin;
|
||||
|
||||
# This script was created by Kevin J. Menard, Jr. <kmenard@wpi.edu>.
|
||||
# It requires root privileges to write to a file in /etc. Best use is
|
||||
# to set this up as cron job. Works for me. Hope it does for you.
|
||||
# Any questions/complaints/praise/whatever, send 'em to the address
|
||||
# above. -- 08/16/2001
|
||||
|
||||
|
||||
# These are the variables you might want to tweak.
|
||||
my $quota_attr = "mailQuota";
|
||||
my $mail_attr = "mailRoutingAddress";
|
||||
my $user = "cyrus";
|
||||
my $passwd = "blah";
|
||||
|
||||
# These are the ones that you shouldn't have to.
|
||||
my @entries = ();
|
||||
my $index = 0;
|
||||
my $counter = 0;
|
||||
my $old_timestamp = 0;
|
||||
my $timestamp = "199412161032Z";
|
||||
|
||||
# Open the /etc/cyrus_ldap_quota_time file; it's a long name, but
|
||||
# shouldn't interfere with existing files :) This file contains 1 line,
|
||||
# the generalized time format of the last time the script ran. This is
|
||||
# used for the search, so we only update quotas that have been modified
|
||||
# since then.
|
||||
|
||||
{
|
||||
if (-e "/etc/cyrus_ldap_quota_time")
|
||||
{
|
||||
open(TIME_FILE, "/etc/cyrus_ldap_quota_time") or die "could not
|
||||
open the time file: $!\n";
|
||||
|
||||
while(<TIME_FILE>) { $old_timestamp = $_; }
|
||||
|
||||
close(TIME_FILE);
|
||||
}
|
||||
|
||||
# Now we deal with the case where the file doesn't exist, that is to
|
||||
# say the first time the script was run.
|
||||
|
||||
unless ($old_timestamp == 0) { $timestamp = $old_timestamp; }
|
||||
|
||||
|
||||
# Now that we have that information, we can overwrite the file with
|
||||
# the new timestamp. Maybe this overkill, but this is only a
|
||||
# temporary solution anyway.
|
||||
|
||||
open(TIME_FILE, ">/etc/cyrus_ldap_quota_time") or die "could not
|
||||
create file: $!\n";
|
||||
|
||||
my @time = (localtime)[0..5];
|
||||
|
||||
printf TIME_FILE $time[5] + 1900;
|
||||
printf TIME_FILE "%02d", $time[4] + 1;
|
||||
for (my $i = 3; $i >= 0; $i--) { printf TIME_FILE "%02d", $time[$i];}
|
||||
print TIME_FILE 'Z';
|
||||
|
||||
close(TIME_FILE);
|
||||
}
|
||||
|
||||
|
||||
# This is where we do the search and then parse the results into a
|
||||
# useable form. In this case, an arry of hash entries.
|
||||
{
|
||||
# Okay, this very ugly line sets up the LDAP search, and the strips
|
||||
# away the meaningless stuff. This could be prettier, but I didn't
|
||||
# want to add a dependency for an LDAP module, and everyone should
|
||||
# have LDAP search. The greps are just to make things simpler.
|
||||
|
||||
(my $query = "ldapsearch -x '(&(modifyTimestamp>=$timestamp)($quota_attr=*))' $quota_attr $mail_attr
|
||||
| grep -v ^# | grep -v ^dn | grep -v ^version | grep -v ^search | grep -v ^result | grep -v ^\$") =~ s!\n!!;
|
||||
|
||||
# Now actually do the commands in the above line.
|
||||
my $result = `$query`;
|
||||
|
||||
|
||||
# Split the output into an array, one entry per line.
|
||||
my @output = split(/\n/, $result);
|
||||
|
||||
# Now go through each line . . .
|
||||
foreach (@output)
|
||||
{
|
||||
# Split on the attribute:value boundary.
|
||||
(my $key, my $value) = split(/: /);
|
||||
|
||||
# Handle mailRoutingAddress; strip away everything after '@'.
|
||||
if ($value =~ m!@!)
|
||||
{
|
||||
($value, undef) = split (/@/, $value);
|
||||
}
|
||||
|
||||
# Add each doctored up attribute:value pair to the entries array.
|
||||
$entries[$index]{$key} = $value;
|
||||
|
||||
# A crude hack to make sure each of the two attributes makes it
|
||||
# into one of the entries array element.
|
||||
if ($counter % 2)
|
||||
{
|
||||
$index++;
|
||||
}
|
||||
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
|
||||
# Now here's the actual interaction with Cyrus IMAPd. It's all pretty
|
||||
# self-explanatory.
|
||||
{
|
||||
my $imap = Cyrus::IMAP::Admin->new('localhost') or die "imap:
|
||||
cannot connect to server: $!\n";
|
||||
|
||||
$imap->send(undef, undef, "LOGIN %s %s", $user, $passwd) or die
|
||||
"could not send user:pass to the server: $!\n";
|
||||
|
||||
for (my $i = 0; $i <= $#entries; $i++)
|
||||
{
|
||||
$imap->setquota("user." . $entries[$i]{$mail_attr}, "STORAGE",
|
||||
$entries[$i]{$quota_attr})
|
||||
or die "imap: could not set quota for
|
||||
user.$entries[$i]{$mail_attr}: $!\n";
|
||||
}
|
||||
|
||||
$imap=undef;
|
||||
}
|
46
folderxfer
46
folderxfer
@ -1,46 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Usage: folderxfer inputfile
|
||||
#
|
||||
# Purpose: Converts contents of Berkeley-format mail folders
|
||||
# to Cyrus mailboxes
|
||||
#
|
||||
# Input: Output of 'bsd2cyrus'
|
||||
# (username:Cyrus-folder-name:Berkeley-folder-path)
|
||||
#
|
||||
# Warnings: The root mailbox and empty Cyrus folder must
|
||||
# exist before conversion takes place, and source folders
|
||||
# should be checked for RFC 822 content before being processed
|
||||
#
|
||||
#$Id: folderxfer,v 1.1 2004/02/04 12:59:42 karsten Exp $
|
||||
|
||||
$pwd = "/usr/lib/cyrus-imapd";
|
||||
$mailstore = "/var/spool/imap"; # Cyrus mailstore
|
||||
$cat = "/bin/cat";
|
||||
$cmd = "/usr/bin/formail -n 20 -s $pwd/cpmsg";
|
||||
|
||||
$folders = "$ARGV[0]";
|
||||
if (!$folders) { die "Usage: $0 filename"; }
|
||||
|
||||
open (MB,"$folders") || die "can't open $folders";
|
||||
|
||||
while (<MB>) {
|
||||
|
||||
chop;
|
||||
|
||||
# Be careful with this split - the last token might have
|
||||
# whitespace we want to preserve
|
||||
|
||||
($user,$cyrusfolder,$folder) = split(/:/,$_,3);
|
||||
@fields = split(/\./,$cyrusfolder);
|
||||
$cyrfol = $fields[$#fields];
|
||||
|
||||
$fcat = "$cat \"$folder\"";
|
||||
print $fcat;
|
||||
$prefix = substr($user,0,1);
|
||||
system ("$fcat | $cmd '$mailstore/$prefix/user/$user/$cyrfol'");
|
||||
#print "'$mailstore/$prefix/user/$user/$cyrfol";
|
||||
}
|
||||
close MB;
|
||||
|
||||
|
159
imapcreate.pl
159
imapcreate.pl
@ -1,159 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# imapcreate: create IMAP mailboxes with quotas
|
||||
# Reads user names from standard input.
|
||||
# launch without argument for a short help.
|
||||
#
|
||||
# originally found on http://cyrus-utils.sourceforge.net
|
||||
# (could not find any copyright info, thought)
|
||||
#
|
||||
# enhanced by Clément "nodens" Hermann <clement.hermann@free.fr>
|
||||
#
|
||||
# I'd like to consider this as GPL'd (cf www.gnu.org), but won't add any copyright without the original author's consent.
|
||||
#
|
||||
|
||||
use Getopt::Long;
|
||||
use Cyrus::IMAP::Admin;
|
||||
use strict;
|
||||
|
||||
|
||||
my $debug;
|
||||
my $user;
|
||||
my $pass;
|
||||
my $quota;
|
||||
my @part;
|
||||
my $useunixhierarchy;
|
||||
my @mailboxes;
|
||||
my $delete;
|
||||
my $cyrus;
|
||||
|
||||
sub usage {
|
||||
print <<EOU;
|
||||
imapcreate - create IMAP mailboxes with quotas
|
||||
usage:
|
||||
imapcreate [-d] [-u user] [-p pass] [-m mailbox1[,mailbox2][,mailbox<n>]]
|
||||
[-q quota] [-t partition:list] [-s] [-v] <server>
|
||||
|
||||
Options:
|
||||
-t : the partition to use. Default to the \"default\" partition
|
||||
-q ; the quota, if a quota is needed. It is normally in KiloBytes, but you can use m,M,g or G suffix to use MB or GB instead, e.g 10k, 2048M or 100g
|
||||
-m : a comma-separated mailbox list
|
||||
-u : your cyrus admin user (usually cyrus or cyradm)
|
||||
-p : your cyrus admin password (if not provided, it will be asked for)
|
||||
-s : use the unix hierarchy separator (see imapd.conf(1))
|
||||
-d : delete mailboxes instead of creating them
|
||||
-v : run in debug mode, and print information on stdout
|
||||
|
||||
If no password is submitted with -p, we'll prompt for one.
|
||||
if no mailbox name is specified with -m, read user names from standard input
|
||||
|
||||
examples:
|
||||
imapcreate -u cyradm -m foo,bar,joe -q 50000 -t p1:p2 mail.testing.umanitoba.ca
|
||||
cat list.txt | imapcreate -u cyradm -p 'cyruspass' -q 50M mail.testing.umanitoba.ca
|
||||
EOU
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Create a mailbox... usage : &CreateMailBox(user,partition[,quota]).
|
||||
# You have to be authentified already. We use "$cyrus" as the connection name.
|
||||
# partition can be 'default'
|
||||
sub CreateMailBox {
|
||||
my $mbuser = $_[0];
|
||||
my $mbpart = $_[1];
|
||||
my $mbquota = $_[2];
|
||||
|
||||
print "Creating $mbuser on $mbpart\n" if $debug;
|
||||
if ($mbpart eq 'default') {
|
||||
$cyrus->createmailbox($mbuser);
|
||||
}
|
||||
else {
|
||||
$cyrus->createmailbox($mbuser, $mbpart);
|
||||
}
|
||||
warn $cyrus->error if $cyrus->error;
|
||||
|
||||
# Set the quota
|
||||
if ($mbquota) {
|
||||
print "Setting quota for $mbuser to $mbquota\n" if $debug;
|
||||
$cyrus->setquota($mbuser, 'STORAGE', $mbquota);
|
||||
warn $cyrus->error if $cyrus->error;
|
||||
}
|
||||
}
|
||||
|
||||
# Delete a mailbox. Usage: $DeleteMailBox($user)
|
||||
# Assuming we use $user as the admin.
|
||||
sub DeleteMailBox {
|
||||
my $mbuser = $_[0];
|
||||
my $delacl = "c";
|
||||
|
||||
print "Deleting $mbuser\n" if $debug;
|
||||
$cyrus->setaclmailbox($mbuser, $user, $delacl);
|
||||
$cyrus->deletemailbox($mbuser);
|
||||
warn $cyrus->error if $cyrus->error;
|
||||
}
|
||||
|
||||
GetOptions("d|delete" => \$delete, "u|user=s" => \$user, "p|pass=s" => \$pass, "m|mailboxes=s" => \@mailboxes, "q|quota=s" => \$quota,
|
||||
"t|part=s" => \@part, "s|UnixHierarchy" => \$useunixhierarchy, "v|verbose" => \$debug );
|
||||
@part = split(/:/, join(':', @part));
|
||||
push @part, 'default' unless @part;
|
||||
my $pn = 0;
|
||||
@mailboxes = split(/,/, join(',', @mailboxes));
|
||||
|
||||
my $server = shift(@ARGV) if (@ARGV);
|
||||
usage unless $server;
|
||||
|
||||
# quotas formatting:
|
||||
if ($quota) {
|
||||
if ($quota =~ /^(\d+)([mk]?)$/i) {
|
||||
my $numb = $1;
|
||||
my $letter = $2;
|
||||
if ($letter =~ /^m$/i) {
|
||||
$quota = $numb * 1024;
|
||||
print "debug: quota=$quota\n" if $debug;
|
||||
} elsif ($letter =~ /^k$/i) {
|
||||
$quota = $numb;
|
||||
print "debug: quota=$quota\n" if $debug;
|
||||
} else {
|
||||
die "malformed quota: $quota (must be at least one digit eventually followed by m, M, k or K\n";
|
||||
# $quota = $numb;
|
||||
# print "debug: quota=$quota\n" if $debug;
|
||||
}
|
||||
} else {
|
||||
die "malformed quota: $quota (must be at least one digit eventually followed by m, M, k or K\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Authenticate
|
||||
$cyrus = Cyrus::IMAP::Admin->new($server);
|
||||
$cyrus->authenticate(-mechanism => 'login', -user => $user,
|
||||
-password => $pass);
|
||||
die $cyrus->error if $cyrus->error;
|
||||
|
||||
# if there isn't any mailbox defined yet, get them from standard input
|
||||
if (! (defined $mailboxes[0])) {
|
||||
# For all users
|
||||
while (<>) {
|
||||
chomp;
|
||||
my $mbox = $_;
|
||||
push @mailboxes, $mbox;
|
||||
}
|
||||
}
|
||||
|
||||
# create/delete mailboxes for each user
|
||||
foreach my $mailbox (@mailboxes) {
|
||||
if ($useunixhierarchy) {
|
||||
$mailbox = 'user/' . $mailbox;
|
||||
} else {
|
||||
$mailbox = 'user.' . $mailbox;
|
||||
}
|
||||
|
||||
if ($delete) {
|
||||
&DeleteMailBox($mailbox)
|
||||
} else {
|
||||
# Select the partition
|
||||
my $pt = $part[$pn];
|
||||
$pn += 1;
|
||||
$pn = 0 unless $pn < @part;
|
||||
&CreateMailBox($mailbox,$pt,$quota)
|
||||
}
|
||||
}
|
||||
|
36
inboxfer
36
inboxfer
@ -1,36 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Usage: inboxfer inputfile
|
||||
#
|
||||
# Purpose: Transfer messages from Berkeley-format inbox to Cyrus inbox
|
||||
#
|
||||
# Input: Text file containing one username per line
|
||||
#
|
||||
# Warning: Do not use this script to transfer messages into a Cyrus
|
||||
# mailbox that already contain messages. Existing messages
|
||||
# will be overwritten.
|
||||
#
|
||||
#$Id: inboxfer,v 1.1 2005/04/15 20:24:15 jdennis Exp $
|
||||
|
||||
$mailstore = "/var/spool/imap"; # Cyrus mailstore
|
||||
$oldspool = "/var/spool/mail"; # Old mail spool
|
||||
$cat = "/bin/cat"; # /usr/bin/cat on Solaris
|
||||
$formail = "/usr/bin/formail";
|
||||
$pwd = "/usr/lib/cyrus-imapd";
|
||||
$cpmsg = "cpmsg";
|
||||
|
||||
$cmd = "$formail -n 20 -s $pwd/$cpmsg";
|
||||
|
||||
$users = "$ARGV[0]";
|
||||
if (!$users) { die "Usage: $0 $users\n"; }
|
||||
|
||||
open(USERS,"$users") || die "can't open $users";
|
||||
|
||||
while (<USERS>) {
|
||||
chop;
|
||||
$inbox = "$oldspool/$_";
|
||||
$prefix = substr($_,0,1);
|
||||
system("$cat $inbox | $cmd $mailstore/$prefix/user/$_");
|
||||
}
|
||||
|
||||
|
172
skiplist.py
172
skiplist.py
@ -1,172 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- Mode: Python; tab-width: 4 -*-
|
||||
#
|
||||
# Cyrus Imapd Skiplist db recovery tool
|
||||
#
|
||||
# Copyright (C) 2004 Gianluigi Tiesi <sherpya@netfarm.it>
|
||||
# Copyright (C) 2004 NetFarm S.r.l. [http://www.netfarm.it]
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# for more details.
|
||||
# ======================================================================
|
||||
|
||||
__version__= '0.1'
|
||||
__doc__="""Cyrus skiplist db recover"""
|
||||
|
||||
from sys import argv,exit,stdout,stderr
|
||||
from struct import unpack
|
||||
from time import localtime, strftime
|
||||
|
||||
### User Conf
|
||||
debug = 0
|
||||
###
|
||||
|
||||
TIMEFMT ='%a, %d %b %Y %H:%M:%S %z'
|
||||
PADDING = '\xff' * 4
|
||||
INORDER = 1
|
||||
ADD = 2
|
||||
DELETE = 4
|
||||
COMMIT = 255
|
||||
DUMMY = 257
|
||||
HEADER = -1
|
||||
MAIN = -2
|
||||
|
||||
types = {
|
||||
1: 'INORDER',
|
||||
2: 'ADD',
|
||||
4: 'DELETE',
|
||||
255: 'COMMIT',
|
||||
257: 'DUMMY',
|
||||
-1: 'HEADER',
|
||||
-2: '*'
|
||||
}
|
||||
|
||||
def log(rtype, text):
|
||||
global debug
|
||||
if debug:
|
||||
out = '[%s] %s\n' % (types[rtype], text)
|
||||
stdout.write(out)
|
||||
stdout.flush()
|
||||
|
||||
def roundto4(value):
|
||||
if value % 4:
|
||||
return ((value / 4) + 1) * 4
|
||||
return value
|
||||
|
||||
def get_header(fp):
|
||||
#### Magic ??
|
||||
fp.seek(4)
|
||||
|
||||
sign = fp.read(16)
|
||||
log(HEADER, sign[:-3])
|
||||
|
||||
version = unpack('>I', fp.read(4))[0]
|
||||
version_minor = unpack('>I', fp.read(4))[0]
|
||||
|
||||
log(HEADER, 'Version %d,%d' % (version, version_minor))
|
||||
|
||||
maxlevel = unpack('>I', fp.read(4))[0]
|
||||
curlevel = unpack('>I', fp.read(4))[0]
|
||||
|
||||
log(HEADER, 'Level %d/%d' % (curlevel, maxlevel))
|
||||
|
||||
listsize = unpack('>I', fp.read(4))[0]
|
||||
log(HEADER, 'List size %d' % listsize)
|
||||
|
||||
logstart = unpack('>I', fp.read(4))[0]
|
||||
log(HEADER, 'Offset %d' % logstart)
|
||||
|
||||
lastrecovery = localtime(unpack('>I', fp.read(4))[0])
|
||||
lastrecovery = strftime(TIMEFMT, lastrecovery)
|
||||
|
||||
log(HEADER, 'Last Recovery %s' % lastrecovery)
|
||||
|
||||
return { 'version' : [version, version_minor],
|
||||
'level' : [curlevel, maxlevel],
|
||||
'listsize' : listsize,
|
||||
'logstart' : logstart,
|
||||
'lastrecover': lastrecovery
|
||||
}
|
||||
|
||||
def getkeys(fp):
|
||||
values = []
|
||||
keys = {}
|
||||
keystring = ''
|
||||
datastring = ''
|
||||
|
||||
while 1:
|
||||
log(MAIN, '-'*78)
|
||||
|
||||
stype = fp.read(4)
|
||||
|
||||
### EOF
|
||||
if len(stype) != 4:
|
||||
break
|
||||
|
||||
rtype = unpack('>I', stype)[0]
|
||||
if not types.has_key(rtype):
|
||||
log(MAIN, 'Invalid type %d' % rtype)
|
||||
continue
|
||||
|
||||
log(rtype, 'Record type %s' % types[rtype])
|
||||
|
||||
if rtype == DELETE:
|
||||
ptr = unpack('>I', fp.read(4))[0]
|
||||
log(rtype, 'DELETE %d (0x%x)' % (ptr, ptr))
|
||||
continue
|
||||
|
||||
if rtype == COMMIT:
|
||||
continue
|
||||
|
||||
ksize = unpack('>I', fp.read(4))[0]
|
||||
log(rtype, 'Key size %d (%d)' % (ksize, roundto4(ksize)))
|
||||
|
||||
if ksize:
|
||||
keystring = fp.read(roundto4(ksize))[:ksize]
|
||||
log(rtype, 'Key String %s' % keystring)
|
||||
|
||||
datasize = unpack('>I', fp.read(4))[0]
|
||||
log(rtype, 'Data size %d (%d)' % (datasize, roundto4(datasize)))
|
||||
|
||||
if datasize:
|
||||
datastring = fp.read(roundto4(datasize))[:datasize]
|
||||
log(rtype, 'Data String %s' % datastring)
|
||||
|
||||
n = 0
|
||||
while 1:
|
||||
str_p = fp.read(4)
|
||||
if str_p == PADDING:
|
||||
break
|
||||
spointer = unpack('>I', str_p)[0]
|
||||
n = n +1
|
||||
if spointer: log(rtype, 'Skip pointer %d' % spointer)
|
||||
|
||||
log(rtype, 'Total Skip pointers: %d' % n)
|
||||
|
||||
if rtype != DUMMY:
|
||||
if keystring not in values:
|
||||
values.append(keystring)
|
||||
keys[keystring] = datastring
|
||||
|
||||
return values, keys
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(argv) != 2:
|
||||
print 'Usage: %s skiplist.file' % argv[0]
|
||||
exit()
|
||||
|
||||
fp = open(argv[1], 'rb')
|
||||
header = get_header(fp)
|
||||
values, keys = getkeys(fp)
|
||||
fp.close()
|
||||
|
||||
if debug: exit()
|
||||
for v in values:
|
||||
print '%s\t%s' % (v, keys[v])
|
Loading…
Reference in New Issue
Block a user