diff --git a/cyrus-imapd-README.HOWTO-recover-mailboxes.db b/README.HOWTO-recover-mailboxes.db similarity index 100% rename from cyrus-imapd-README.HOWTO-recover-mailboxes.db rename to README.HOWTO-recover-mailboxes.db diff --git a/cyrus-imapd-README.skiplist_recovery b/README.skiplist_recovery similarity index 100% rename from cyrus-imapd-README.skiplist_recovery rename to README.skiplist_recovery diff --git a/cyrus-imapd-2.3.1-config_defaults.patch b/cyrus-imapd-2.3.1-config_defaults.patch deleted file mode 100644 index f9f202d..0000000 --- a/cyrus-imapd-2.3.1-config_defaults.patch +++ /dev/null @@ -1,94 +0,0 @@ -diff -Naur cyrus-imapd-2.3.1.orig/lib/imapoptions cyrus-imapd-2.3.1/lib/imapoptions ---- cyrus-imapd-2.3.1.orig/lib/imapoptions 2005-12-13 20:36:11.000000000 +0100 -+++ cyrus-imapd-2.3.1/lib/imapoptions 2006-01-13 10:17:26.000000000 +0100 -@@ -198,9 +198,12 @@ - grant the user the ability to delete a mailbox. If a user has this - right, they will automatically be given the new 'x' right. */ - --{ "duplicate_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "skiplist") } -+{ "duplicate_db", "skiplist", STRINGLIST("berkeley", "berkeley-nosync", "skiplist") } - /* The cyrusdb backend to use for the duplicate delivery suppression -- and sieve. */ -+ and sieve. -+.PP -+ Note: This Invoca RPM build uses \fIskiplist\fR by default instead of -+ \fIberkeley-nosync\fR for \fBduplicate_db\fR. */ - - { "duplicatesuppression", 1, SWITCH } - /* If enabled, lmtpd will suppress delivery of a message to a mailbox if -@@ -220,12 +223,15 @@ - result in greater responsiveness for the client, especially when - expunging a large number of messages. */ - --{ "flushseenstate", 0, SWITCH } -+{ "flushseenstate", 1, SWITCH } - /* If enabled, changes to the seen state will be flushed to disk - immediately, otherwise changes will be cached and flushed when the - mailbox is closed. This option may be used to fix the problem of - previously read messages being marked as unread in Microsoft -- Outlook, at the expense of a loss of performance/scalability. */ -+ Outlook, at the expense of a loss of performance/scalability. -+.PP -+ Note: This Invoca RPM build uses \fI1\fR by default instead of -+ \fI0\fR for \fBflushseenstate\fR. */ - - { "foolstupidclients", 0, SWITCH } - /* If enabled, only list the personal namespace when a LIST "*" is performed. -@@ -735,8 +741,11 @@ - /* Unix domain socket that ptloader listens on. - (defaults to configdir/ptclient/ptsock) */ - --{ "ptscache_db", "berkeley", STRINGLIST("berkeley", "skiplist") } --/* The cyrusdb backend to use for the pts cache. */ -+{ "ptscache_db", "skiplist", STRINGLIST("berkeley", "skiplist") } -+/* The cyrusdb backend to use for the pts cache. -+.PP -+ Note: This Invoca RPM build uses \fIskiplist\fR by default instead of -+ \fIberkeley\fR for \fBptscache_db\fR. */ - - { "ptscache_timeout", 10800, INT } - /* The timeout (in seconds) for the PTS cache database when using the -@@ -813,9 +822,12 @@ - { "seenstate_db", "skiplist", STRINGLIST("flat", "berkeley", "skiplist") } - /* The cyrusdb backend to use for the seen state. */ - --{ "sendmail", "/usr/lib/sendmail", STRING } -+{ "sendmail", "/usr/sbin/sendmail", STRING } - /* The pathname of the sendmail executable. Sieve invokes sendmail -- for sending rejections, redirects and vacation responses. */ -+ for sending rejections, redirects and vacation responses. -+.PP -+ Note: This Invoca RPM build uses \fI/usr/sbin/sendmail\fR by default -+ instead of \fI/usr/lib/sendmail\fR for \fBsendmail\fR. */ - - { "servername", NULL, STRING } - /* This is the hostname visible in the greeting messages of the POP, -@@ -842,9 +854,12 @@ - /* Maximum number of sieve scripts any user may have, enforced at - submission by timsieved(8). */ - --{ "sievedir", "/usr/sieve", STRING } -+{ "sievedir", "/var/lib/imap/sieve", STRING } - /* If sieveusehomedir is false, this directory is searched for Sieve -- scripts. */ -+ scripts. -+.PP -+ Note: This Invoca RPM build uses \fI/var/lib/imap/sieve\fR by default -+ instead of \fI/usr/sieve\fR for \fBsievedir\fR. */ - - { "sievenotifier", NULL, STRING } - /* Notifyd(8) method to use for "SIEVE" notifications. If not set, "SIEVE" -@@ -934,8 +949,11 @@ - have filenames with the hashed value of the certificate (see - openssl(XXX)). */ - --{ "tlscache_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "skiplist") } --/* The cyrusdb backend to use for the TLS cache. */ -+{ "tlscache_db", "skiplist", STRINGLIST("berkeley", "berkeley-nosync", "skiplist") } -+/* The cyrusdb backend to use for the TLS cache. -+.PP -+ Note: This Invoca RPM build uses \fIskiplist\fR by default instead of -+ \fIberkeley-nosync\fR for \fBtlscache_db\fR. */ - - { "tls_cert_file", NULL, STRING } - /* File containing the certificate presented for server authentication diff --git a/cyrus-imapd-2.3.7-nobarenewlinescheck.patch b/cyrus-imapd-2.3.7-nobarenewlinescheck.patch deleted file mode 100644 index 2c4bb9c..0000000 --- a/cyrus-imapd-2.3.7-nobarenewlinescheck.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- cyrus-imapd-2.3.7/imap/message.c 2006-10-28 22:18:08.000000000 +0200 -+++ cyrus-imapd-2.3.7/imap/message.c.nobarenewlinescheck 2006-10-28 22:21:55.000000000 +0200 -@@ -256,8 +256,9 @@ - r = IMAP_MESSAGE_CONTAINSNULL; - } - else if (*p == '\n') { -- if (!sawcr && (inheader || !allow_null)) -- r = IMAP_MESSAGE_CONTAINSNL; -+ /* Do *NOT* check for RFC compliant line breaks (bare newlines) */ -+ /* if (!sawcr && (inheader || !allow_null)) -+ r = IMAP_MESSAGE_CONTAINSNL; */ - sawcr = 0; - if (blankline) { - inheader = 0; diff --git a/cyrus-imapd-README.RPM b/cyrus-imapd-README.RPM index 8e30f01..9786aac 100644 --- a/cyrus-imapd-README.RPM +++ b/cyrus-imapd-README.RPM @@ -31,7 +31,4 @@ The following steps should lead you to a running Cyrus IMAP server: info priority with something like 'mail.info /var/log/maillog' in /etc/syslog.conf. -Read the file "README.buildoptions" in this directory to find out which -build time options have been used to build this package. - Enjoy! diff --git a/cyrus-imapd-README.contrib b/cyrus-imapd-README.contrib deleted file mode 100644 index e9a0941..0000000 --- a/cyrus-imapd-README.contrib +++ /dev/null @@ -1,10 +0,0 @@ -The programs provided here in the contrib directory are taken from -various places on the net. Sometimes I even don't know where I found -them and the license may also be unclear. If the creator of one of the -scripts doesn't like to see it included in this contrib section, let -me know and I'll remove it from the package. - -I have never used any of the scripts here so I really don't know how -they work or whether there are better ways to complete a task. I've -been told that there are better tools to migrate from UW-IMAP. So be -warned, use at your own risk. diff --git a/cyrus-imapd.spec b/cyrus-imapd.spec index 62111d2..2e01b40 100644 --- a/cyrus-imapd.spec +++ b/cyrus-imapd.spec @@ -2,7 +2,7 @@ Name: cyrus-imapd Version: 2.3.15 -Release: 7%{?dist} +Release: 8%{?dist} %define ssl_pem_file %{_sysconfdir}/pki/%{name}/%{name}.pem @@ -13,10 +13,8 @@ Release: 7%{?dist} %define _cyrusgroup mail %define _cyrexecdir %{_exec_prefix}/lib/%{name} -%define _cyrusconf master/conf/prefork.conf - Summary: A high-performance mail server with IMAP, POP3, NNTP and SIEVE support -License: MIT +License: BSD Group: System Environment/Daemons URL: http://cyrusimap.web.cmu.edu/ Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus/%{name}-%{version}.tar.gz @@ -40,15 +38,13 @@ 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 -Source23: cyrus-imapd-README.RPM -Source24: cyrus-imapd-README.HOWTO-recover-mailboxes.db +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 -Source30: cyrus-imapd-README.contrib -Source33: cyrus-imapd-README.skiplist_recovery +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 @@ -70,8 +66,8 @@ Patch21: cyrus-imapd-2.3.15-nodebug.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) -BuildRequires: autoconf >= 2.59 -BuildRequires: cyrus-sasl-devel >= 2.1.15-1, perl-devel, tcp_wrappers +BuildRequires: autoconf +BuildRequires: cyrus-sasl-devel, perl-devel, tcp_wrappers BuildRequires: db4-devel, openssl-devel, pkgconfig BuildRequires: flex, bison, groff, automake BuildRequires: openldap-devel @@ -83,7 +79,7 @@ Requires(preun): chkconfig, initscripts, coreutils Requires(postun): initscripts Requires: %{name}-utils = %{version}-%{release} -Requires: cyrus-sasl-lib >= 2.1.15, file >= 3.35-1, db4-utils +Requires: file, db4-utils Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) %description @@ -159,21 +155,37 @@ one running the server. %patch20 -p1 -b .bufov %patch21 -p1 -b .nodebug +# 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 autoheader autoconf -f +# Modify docs master --> cyrus-master +%{__perl} -pi -e "s@master\(8\)@cyrus-master(8)@" man/*5 man/*8 lib/imapoptions +%{__sed} -i -e 's|\([^-]\)master|\1cyrus-master|g;s|^master|cyrus-master|g;s|Master|Cyrus-master|g;s|MASTER|CYRUS-MASTER|g' \ + man/master.8 doc/man.html + +# Modify path in perl scripts +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 + +# enable idled in .conf files to prevent error messages +%{__perl} -pi -e "s/# idled/ idled/" master/conf/*.conf + + %build -CPPFLAGS="-I%{_includedir}/et"; export CPPFLAGS +CPPFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/et -I%{_includedir}/kerberosIV"; export CPPFLAGS CFLAGS="$RPM_OPT_FLAGS -fPIC"; export CFLAGS -if pkg-config openssl; then - CPPFLAGS="$(pkg-config --cflags-only-I openssl) $CPPFLAGS"; export CPPFLAGS - CFLAGS="$(pkg-config --cflags openssl) $CFLAGS"; export CFLAGS - LDFLAGS="$(pkg-config --libs-only-L openssl) $LDFLAGS"; export LDFLAGS -fi -CPPFLAGS="-I%{_includedir}/kerberosIV $CPPFLAGS"; export CPPFLAGS CCDLFLAGS="-rdynamic"; export CCDLFLAGS %ifnarch ppc ppc64 LDFLAGS="$LDFLAGS -pie"; export LDFLAGS @@ -202,52 +214,13 @@ LDFLAGS="$LDFLAGS -pie"; export LDFLAGS %{__make} %{__make} -C notifyd notifytest -# Modify docs master --> cyrus-master -pushd man - %{__perl} -pi -e "s@master\(8\)@cyrus-master(8)@" $(ls *5 *8) -popd -pushd doc - %{__perl} -pi -e "s@master@cyrus-master@g;" man.html -popd -pushd doc/man - %{__perl} -pi -e "s@master\(8\)@cyrus-master(8)@;" $(ls *html) -popd - -# Modify path in perl scripts -%{__perl} -pi -e "s@/usr/local/bin/perl@%{__perl}@" $(find . -type f -name "*.pl") +%install +%{__rm} -rf %{buildroot} # Fix permissions on perl programs find . -type f -name "*.pl" -exec %{__chmod} 755 {} \; -# Cleanup of doc dir -find doc perl -name CVS -type d | xargs -r %{__rm} -fr -find doc perl -name .cvsignore -type f | xargs -r %{__rm} -f -find doc -name "*~" -type f | xargs -r %{__rm} -f -find doc -name "*.html.*" -type f | xargs -r %{__rm} -f -%{__rm} -f doc/Makefile.dist* -%{__rm} -f doc/text/htmlstrip.c - -%{__install} -m 644 %{SOURCE23} doc/README.RPM -%{__install} -m 644 %{SOURCE24} doc/README.HOWTO-recover-mailboxes.db -%{__install} -m 644 %{SOURCE33} doc/README.skiplist_recovery -%{__install} -m 644 %{SOURCE8} doc/README.autocreate -%{__install} -m 644 %{SOURCE9} doc/README.autosievefolder -%{__install} -d doc/m4 -%{__install} -m 644 %{SOURCE26} doc/m4/cyrus-procmailrc -%{__install} -m 644 %{SOURCE4} doc/m4/cyrus-user-procmailrc.template -%{__install} -m 644 %{SOURCE27} doc/m4/%{name}-procmail+cyrus.mc -%{__install} -m 644 %{SOURCE29} doc/m4/%{name}-sendmail-8.12.9-cyrusv2.m4 - -# 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 - -# enable in .conf files to prevent error messages -%{__perl} -pi -e "s/# idled/ idled/" master/conf/*.conf - -%install -%{__rm} -rf %{buildroot} - -# This hack is needed to install the perl files correctly +# This is needed to install the perl files correctly pushd perl/imap %{__perl} Makefile.PL PREFIX=%{buildroot}%{_prefix} INSTALLDIRS=vendor popd @@ -283,21 +256,7 @@ done %{__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} -m 644 %{SOURCE10} doc/contrib/ -%{__install} -m 644 %{SOURCE15} doc/contrib/imapcreate -%{__install} -m 644 %{SOURCE16} doc/contrib/cyrus_ldap_quota -%{__install} -m 644 %{SOURCE17} doc/contrib/batchreconstruct -%{__install} -m 644 %{SOURCE18} doc/contrib/bsd2cyrus -%{__install} -m 644 %{SOURCE19} doc/contrib/cpmsg -%{__install} -m 644 %{SOURCE20} doc/contrib/folderxfer -%{__install} -m 644 %{SOURCE21} doc/contrib/inboxfer -%{__install} -m 644 %{SOURCE30} doc/contrib/README - -# fix permissions on perl .so files -find %{buildroot}%{_libdir}/perl5/ -type f -name "*.so" -exec %{__chmod} 755 {} \; - -# Install config files -%{__install} -p -m 644 %{_cyrusconf} %{buildroot}%{_sysconfdir}/cyrus.conf +%{__install} -p -m 644 master/conf/prefork.conf %{buildroot}%{_sysconfdir}/cyrus.conf %{__install} -p -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/imapd.conf %{__install} -p -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/pop %{__install} -p -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/imap @@ -306,10 +265,21 @@ find %{buildroot}%{_libdir}/perl5/ -type f -name "*.so" -exec %{__chmod} 755 {} %{__install} -p -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/lmtp %{__install} -p -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/nntp %{__install} -p -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/csync -%{__install} -p -m 644 %{SOURCE12} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %{__install} -p -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} -%{__install} -p -m 755 %{SOURCE25} %{buildroot}%{_sysconfdir}/cron.daily/%{name} %{__install} -p -m 755 %{SOURCE11} %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name} +%{__install} -p -m 644 %{SOURCE12} %{buildroot}%{_sysconfdir}/sysconfig/%{name} +%{__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 +%{__rm} -f doc/Makefile.dist* +%{__rm} -f doc/text/htmlstrip.c +%{__rm} -f doc/text/Makefile +%{__rm} -rf doc/man + +# fix permissions on perl .so files +find %{buildroot}%{_libdir}/perl5/ -type f -name "*.so" -exec %{__chmod} 755 {} \; # fix conflicts with uw-imap mv %{buildroot}%{_mandir}/man8/imapd.8 %{buildroot}%{_mandir}/man8/imapd.8cyrus @@ -330,24 +300,12 @@ touch %{buildroot}%{ssl_pem_file} # Rename 'master' binary and manpage to avoid clash with postfix %{__mv} -f %{buildroot}%{_cyrexecdir}/master %{buildroot}%{_cyrexecdir}/cyrus-master %{__mv} -f %{buildroot}%{_mandir}/man8/master.8 %{buildroot}%{_mandir}/man8/cyrus-master.8 -%{__mv} -f doc/man/master.8.html doc/man/cyrus-master.8.html -%{__perl} -pi -e 's/master/cyrus-master/g' %{buildroot}%{_mandir}/man8/cyrus-master.8 -%{__perl} -pi -e 's/Master/Cyrus-master/g' %{buildroot}%{_mandir}/man8/cyrus-master.8 -%{__perl} -pi -e 's/MASTER/CYRUS-MASTER/g' %{buildroot}%{_mandir}/man8/cyrus-master.8 -%{__perl} -pi -e 's/master/cyrus-master/g' doc/man/cyrus-master.8.html -%{__perl} -pi -e 's/Master/Cyrus-master/g' doc/man/cyrus-master.8.html -%{__perl} -pi -e 's/MASTER/CYRUS-MASTER/g' doc/man/cyrus-master.8.html # Rename 'fetchnews' binary and manpage to avoid clash with leafnode %{__mv} -f %{buildroot}%{_cyrexecdir}/fetchnews %{buildroot}%{_cyrexecdir}/cyrfetchnews %{__mv} -f %{buildroot}%{_mandir}/man8/fetchnews.8 %{buildroot}%{_mandir}/man8/cyrfetchnews.8 -%{__mv} -f doc/man/fetchnews.8.html doc/man/cyrfetchnews.8.html -%{__perl} -pi -e 's/fetchnews/cyrfetchnews/g' %{buildroot}%{_mandir}/man8/cyrfetchnews.8 -%{__perl} -pi -e 's/Fetchnews/Cyrfetchnews/g' %{buildroot}%{_mandir}/man8/cyrfetchnews.8 -%{__perl} -pi -e 's/FETCHNEWS/CYRFETCHNEWS/g' %{buildroot}%{_mandir}/man8/cyrfetchnews.8 -%{__perl} -pi -e 's/fetchnews/cyrfetchnews/g' doc/man/cyrfetchnews.8.html -%{__perl} -pi -e 's/Fetchnews/Cyrfetchnews/g' doc/man/cyrfetchnews.8.html -%{__perl} -pi -e 's/FETCHNEWS/CYRFETCHNEWS/g' doc/man/cyrfetchnews.8.html +%{__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 @@ -365,29 +323,23 @@ done %{__rm} -f %{buildroot}%{_cyrexecdir}/pop3proxyd find %{buildroot} -name "perllocal.pod" -exec %{__rm} -f {} \; find %{buildroot} -name ".packlist" -exec %{__rm} -f {} \; -%{__rm} -f doc/text/Makefile %{__rm} -f %{buildroot}%{_mandir}/man8/syncnews.8* -%{__rm} -f doc/man/syncnews.8.html find %{buildroot}%{perl_vendorarch} -name "*.bs" -exec %{__rm} -f {} \; %clean %{__rm} -rf %{buildroot} %pre -# Let postun know whether cyrus-imapd was running -if [ -e /var/lock/subsys/cyrus-imapd ]; then - /sbin/service %{name} stop >/dev/null 2>&1 || : - touch /var/lock/subsys/cyrus-imapd -fi +# Create 'cyrus' user on target host +/usr/sbin/groupadd -g %{gid} -r saslauth 2> /dev/null || : +/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_var}/lib/imap -g %{_cyrusgroup} \ + -G saslauth -s /sbin/nologin -u %{uid} -r %{_cyrususer} 2> /dev/null || : %post /sbin/chkconfig --add %{name} # Force synchronous updates, usually only on ext2 filesystems -for i in %{_var}/lib/imap/{user,quota} %{_var}/spool/imap -do - chattr -R +S $i 2>/dev/null ||: -done +chattr -R +S $i %{_var}/lib/imap/{user,quota} %{_var}/spool/imap 2>/dev/null ||: # Create SSL certificates exec > /dev/null 2> /dev/null @@ -421,13 +373,8 @@ if [ $1 != 0 ]; then /sbin/service %{name} condrestart >/dev/null 2>&1 || : fi -%pre utils -# Create 'cyrus' user on target host -/usr/sbin/groupadd -g %{gid} -r saslauth 2> /dev/null || : -/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_var}/lib/imap -g %{_cyrusgroup} \ - -G saslauth -s /sbin/nologin -u %{uid} -r %{_cyrususer} 2> /dev/null || : - %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 @@ -573,6 +520,9 @@ fi %{_mandir}/man1/* %changelog +* Thu Nov 26 2009 Michal Hlavinka - 2.3.15-8 +- spec cleanup + * Tue Nov 24 2009 Michal Hlavinka - 2.3.15-7 - rebuild with new db4 (#540093) - spec cleanup diff --git a/cyrus_ldap_quota.pl b/cyrus_ldap_quota.pl deleted file mode 100644 index 2fcf052..0000000 --- a/cyrus_ldap_quota.pl +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/perl -use Cyrus::IMAP::Admin; - -# This script was created by Kevin J. Menard, Jr. . -# 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() { $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; -} diff --git a/imapcreate.pl b/imapcreate.pl deleted file mode 100644 index b26af24..0000000 --- a/imapcreate.pl +++ /dev/null @@ -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 -# -# 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 <]] - [-q quota] [-t partition:list] [-s] [-v] - -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) - } -} -