Projects
Kolab:3.4
cyrus-imapd
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 13
View file
cyrus-imapd.spec
Changed
@@ -15,6 +15,14 @@ #%%global snapshot_version git201204161439 #%%global dot_snapshot_version .%{snapshot_version} +%if 0%{?suse_version} +%define with_systemd 1 +%endif + +%if 0%{?rhel} > 6 || 0%{?fedora} > 16 +%define with_systemd 1 +%endif + Name: cyrus-imapd Summary: A high-performance mail server with IMAP, POP3, NNTP and SIEVE support Version: 2.4.17 @@ -25,43 +33,32 @@ # Upstream sources Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus/%{_name}-%{real_version}%{?dot_snapshot_version}.tar.gz +Source1: cyrus-imapd.imap-2.3.x-conf +Source2: cyrus-imapd.cvt_cyrusdb_all +Source3: cyrus-imapd.magic # Distribution specific sources -Source5: cyrus-imapd.logrotate -Source7: cyrus-imapd.pam-config -Source11: cyrus-imapd.init -Source12: cyrus-imapd.sysconfig -Source25: cyrus-imapd.cron-daily - -Source3: cyrus-deliver-wrapper.c -Source4: cyrus-user-procmailrc.template -Source6: cyrus-imapd.imap-2.3.x-conf -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 -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 -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 - -Patch002: %{name}-2.3.16-002-strip-out-krb4.patch - -# Generally accepted patches -#Patch101: %{name}-2.3.16-101-autocreate-0.10.0.patch -#Patch102: %{name}-2.3.16-102-autosieve-0.6.0.patch - -# Patches cherry-picked from GIT stable branch(es) - +Source11: cyrus-imapd.logrotate +Source12: cyrus-imapd.pam-config +Source13: cyrus-imapd.cron-daily + +# SysVinit +Source21: cyrus-imapd.init +Source22: cyrus-imapd.sysconfig + +# Systemd support +Source31: cyrus-imapd.service +Source32: cyr_systemd_helper + +## +## Patches +## +Patch1: http://www.oakton.edu/~jwade/cyrus/cyrus-imapd-2.1.3/cyrus-imapd-2.1.3-flock.patch +# fedora/rhel specific, find current db lib, rhbz#461875 +Patch11: cyrus-imapd-2.3.12p2-current-db.patch +# for c-i <= 2.4.12 +Patch12: cyrus-imapd-2.4.12-debugopt.patch +Patch13: %{name}-2.3.16-002-strip-out-krb4.patch # Patches of which the status or upstream is unknown Patch903: %{name}-2.4.15-903-normalize-authorization-id.patch Patch905: cyrus-imapd-2.4.10-ptloader-ldap_user_attribute.patch @@ -112,16 +109,23 @@ Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires(post): e2fsprogs -Requires(post): chkconfig -Requires(post): initscripts Requires(post): perl Requires(post): grep Requires(post): coreutils Requires(post): findutils +Requires(preun): coreutils + +%if 0%{?with_systemd} +Requires(post): systemd-units +Requires(preun): systemd-units, coreutils +Requires(postun): systemd-units +%else Requires(preun): chkconfig Requires(preun): initscripts -Requires(preun): coreutils +Requires(post): chkconfig +Requires(post): initscripts Requires(postun): initscripts +%endif %description The %{name} package contains the core of the Cyrus IMAP server. @@ -182,7 +186,10 @@ %prep %setup -q -n %{_name}-%{real_version}%{?dot_snapshot_version} -%patch002 -p1 +%patch1 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 %patch903 -p1 %patch905 -p1 @@ -307,10 +314,16 @@ %{__install} -p -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/nntp %{__install} -p -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/csync %{__install} -p -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/%{_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} +%if 0%{?with_systemd} +%{__install} -p -D -m 644 %{SOURCE12} %{buildroot}%{_unitdir}/cyrus-imapd.service +%{__install} -p -D -m 755 %{SOURCE13} %{buildroot}%{_cyrexecdir}/cyr_systemd_helper +%else +%{__install} -p -m 755 %{SOURCE11} %{buildroot}%{_sysconfdir}/rc.d/init.d/%{_name} +%endif + # 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 @@ -351,7 +364,7 @@ # compress manpages -x /usr/lib/rpm/brp-compress && /usr/lib/rpm/brp-compress -#remove executable bit from docs +# remove executable bit from docs for ddir in doc perl/imap/examples do find $ddir -type f -exec %{__chmod} -x {} \; @@ -377,7 +390,10 @@ -G saslauth -s /sbin/nologin -u %{uid} -r %{_cyrususer} 2> /dev/null || : %post -/sbin/chkconfig --add %{_name} +%if 0%{?with_systemd} +%else + /sbin/chkconfig --add %{_name} +%endif CHATTRSYNC=0 @@ -414,16 +430,26 @@ popd fi +%systemd_post cyrus-imapd.service + %preun -if $1 = 0 ; then - /sbin/service %{_name} stop >/dev/null 2>&1 || : - /sbin/chkconfig --del %{_name} -fi +%if 0%{?with_systemd} + %systemd_preun cyrus-imapd.service +%else + if $1 = 0 ; then + /sbin/service %{_name} stop >/dev/null 2>&1 || : + /sbin/chkconfig --del %{_name} + fi +%endif %postun -if $1 != 0 ; then - /sbin/service %{_name} condrestart >/dev/null 2>&1 || : -fi +%if 0%{?with_systemd} + %systemd_postun_with_restart cyrus-imapd.service +%else + if $1 != 0 ; then + /sbin/service %{_name} condrestart >/dev/null 2>&1 || : + fi +%endif %post utils # FIXME: remove when setup > 2.8.10 is released
View file
README.autocreate-cyrus-2.3
Deleted
@@ -1,211 +0,0 @@ -Cyrus IMAP autocreate Inbox patch ----------------------------------- - -NOTE : This patch has been created at the University of Athens. For more info, as well -as more patches on Cyrus IMAPD server, please visit http://email.uoa.gr/ - -The design of Cyrus IMAP server does not predict the automatic creation of users' -INBOX folders. The creation of a user's INBOX is considered to be an external task, -that has to be completed as part of the user email account creation procedure. -Hence, to create a new email account the site administrator has to: - - a) Include the new account in the user database for the authentication procedure - (e.g. sasldb, shadow, mysql, ldap). - b) Create the corresponding INBOX folder. - -Alternatively, the user, if succesfully authenticated, may create his own INBOX folder, -as long as the configuration of the site allows it (see "autocreatequota" in imapd.conf). -Unlike what not careful readers may think, enabling the "autocreatequota" option, doesn't -lead to the automatic INBOX folder creation by Cyrus IMAP server. -In fact, "autocreate" means that the IMAP clients are allowed to automatically create -the user INBOX. - -This patch adds the functionality of automatic creation of the users' INBOX folders into -the Cyrus IMAP server. It is implemented as two features, namely the "create on login" -and "create on post". - - - -Create on login -=============== -This feauture provides automatic creation of a user's INBOX folder when all of the -following requirements are met: - -i) The user has succesfully passed the authentication procedure. - -ii) The user's authorisation ID (typically the same as the user's -authentication ID) doesn't belong to the imap_admins or admins -accounts (see imapd.conf). - -iii) The "autocreatequota" option in the imap configuration file -has been set to a non zero value. - -iv) The corresponding to the user's authorisation ID INBOX folder -does not exist. - -The user's first login is the most typical case when all four requirements are met. -Note that if the authenticated ID is allowed to proxy to another account for which -all of the above requirements are met, the corresponding INBOX folder for that account -will be created. - - - -Create on post -============== -This feauture provides automatic creation of a user's INBOX folder when all of the -following requirements are met. - -i) An email message addressed to the user has been received. - -ii) The recipient is not any of the imap_admins or admins accounts. -Note that passing emails to admins or imap_admins accounts from -the MTA to LMTP should be avoided in any case. - -iii) The recipient's INBOX does not exist. - -iv) The "autocreatequota" option in the imap configuration file -has been set to a non zero value. - -v) The "createonpost" option in the imap configuration file -has been switched on. - - -Besides the automatic creation of INBOX folder, additional functionalities are -provided: - - (A) Automatic creation of INBOX subfolders controlled by "autocreateinboxfolders" -configuration option. eg - -autocreateinboxfolders: sent|drafts|spam|templates - - (B) Automatic subscription of INBOX subfolders controlled by "autosubscribeinboxfolders" -configuration option. eg - -autosubscribeinboxfolders: sent|spam - -Obviously, only subscription to subfolders included in the "autocreateinboxfolder" -list is meaningful. - - (C) Automatic subscription to shared folders (bulletin boards). The user gets -automatically subscribed to the shared folders declared in the "autosubscribesharedfolders" -configuration option in imapd.conf. -eg autosubscribesharedfolders: public_folder | public_folder.subfolder - -In order the above action to succeed, the shared folder has to pre-exist the INBOX creation -and the user must have the appropriate permissions in order to be able to subscribe to the -shared folder. - -* A new config option has been added. 'autosubscribe_all_sharedfolders' is a yes/no -option. When set to yes, the user is automatically subscribed to all shared folders one -has permission to subscribe to. Please, note that when this option is set to yes, then -'autosubscribesharedfolders' option is overriden. - - (D) Automatic creation of a predefined default sieve script. - -This is very useful when a default sieve script is used for every user. Usually, a -default anti-spam script may me be written in a file and copied to each user -sieve scripts upon the INBOX creation. The imapd.conf options that have been added -are 'autocreate_sieve_script', 'autocreate_sieve_compiledscript' and -'generate_compiled_sieve_script'. - -autocreate_sieve_script configuration option refers to the full path of the file -that contains the sieve script. The default value is null and if no file is defined, -then no default script is created upon INBOX creation. (The feature is disabled) -eg autocreate_sieve_script: /etc/default_sieve_script - -autocreate_sieve_compiledscript configuration option refers to the full path of the -file that contains the bytecode compiled sieve script. If this filename is defined -in imapd.conf and the file exists, then it is automatically copied in the user's sieve -directory. If it is not defined, then a bytecode sieve script gets on the fly compiled -by the daemon. -eg autocreate_sieve_compiledscript: /etc/default_sieve_script.bc - -generate_compiled_sieve_script is a boolean option that triggers the compilation of the -source sieve script to bytecode sieve script. The file that the bytecode script will -be saved is pointed by autocreate_sieve_compiledscript. - -Ways of compiling a sieve script : -1. Compile a sieve script using the standard sievec utility, distributed by CMU -2. Compile a sieve script using the compile_sieve utility, released by UoA. This - tool is almost identical to the sievec utility, with the difference that it - reads the input and output file from autocreate_sieve_script and - autocreate_sieve_compiledscript options in imapd.conf -3. Let cyrus create a compiled sieve script using a source script. Cyrus can be - instructed to save the compiled script any time a compiled script does not exist. - -NOTES : -1. In order this functionality to work, the following requirements must have been met: - - 'sieveusehomedir' option must be 'no' in the configuration (default). - - 'sievedir' option must have a valid value. -2. Currently, this patch checks the validity of the source script while generating a - bytecode compiled script, but not the validity of the bytecode sieve script file. - The administrator should make sure that the provided files contain a valid sieve - script as well as the compiled script is updated every time the source script changes. - - - (E) The administrator may control for which users and/or groups may the INBOXes -automatically be created. The autocreate_users option restricts the groups -for which the patch will create the mailboxes. - -The default value of autocreate_users is anyone. So, if not set at all, the patch will -work for all users. However, one may set: - -autocreate_users: user1 user2 group:group1 group:group2 - -In that case, the INBOX will be created only for user1, user2 and the users that belong -to group1 and group2. - -More refined control per service is provided by the options imap_autocreate_users, -pop3_autocreate_users and lmtp_autocreate_users. These options override the -autocreate_users option and offer per service control. - -Example: -One may want to restrict the create on post functionality only for a specific group -of users. To achieve this, the following lines must be added in the imapd.conf file: - -createonpost: yes -lmtp_autocreate_users: group:groupname - - - -Issues to be considered -======================= - -I) In order to use the create on post feauture one should be absolutely sure that: -a) The MTA checks the validity of the email recipient before sending the email to -LMTP. This is an RFC821 requirement. This usually expands to "the mta should be -able to use the account database as user mailbox database". -b) Only authorised accounts/services can talk to LMTP. - -II) Especially in the case of imap logins, the current patch implementation checks -for the INBOX folder existence upon login, causing an extra mailbox lookup in most -of the cases. -A better approach would be to chase the "IMAP_MAILBOX_NONEXISTENT" error code and -check if the error is associated with an INBOX folder. However, this would mess up -Cyrus code. The way it was implemented may not have been the most performance -optimised, but it produces a much cleaner and simple patch. - - - -Virtual Domains Support -======================= - -Virtual domains are supported by all versions of the patch for cyrus-imapd-2.2.1-BETA and -later. However, it is not possible to declare different INBOX subfolders to be created or -shared folders to be subscribed to for every domain. - - - -Things to be done -================= - -1. Support MUPDATE - -It is within the developers' intentions to support the mupdate protocol, but serious -design issues on future cyrus releases have to resolved first. - -2. Select different attributes (quota, partition, sieve filter, etc) depending on the group -a user belongs to. - -For more information and updates please visit http://email.uoa.gr/projects/cyrus/autocreate -
View file
README.autosievefolder
Deleted
@@ -1,42 +0,0 @@ -Cyrus IMAP autosievefolder patch ----------------------------------- - -NOTE : This patch has been created at the University of Athens. For more info, as well -as more patches on Cyrus IMAPD server, please visit http://email.uoa.gr - - - When the lmtpd daemon receives an email message prior to delivering it to the -INBOX folder of the user, checks if the user has specified sieve filters. If the -user has specified sieve filters the filters are evaluated. If the message matches -any of the filters the action that is specified in the filter is executed. If the action -is FileInto it is stored in the subfolder specified in the filter. If the -subfolder doesn't exist then the message is sent to the INBOX folder of the user. - - With this patch if the folder doesn't exist AND the name of the subfolder is -specified in the autosievefolders option, OR the anysievefolder is set to -yes in the cyrus-imap configuration file then the subfolder is created and the mail -is stored there. - - -Check the following options of the imapd.conf file -================================================== - -* anysievefolder : It must be "yes" in order to permit the autocreation of any -INBOX subfolder requested by a sieve filter, through the "fileinto" action. (default = no) -* autosievefolders : It is a "|" separated list of subfolders of INBOX that will be -automatically created, if requested by a sieve filter, through the "fileinto" -action. (default = null) - i.e. autosievefolders: Junk | Spam - -WARNING: anysievefolder, takes precedence over autosievefolders . Which means that if -anysievefolder is set to "yes", cyrus will create any INBOX subfolder requested, no-matter what the value of autosievefolders is. - - -Things to be done -================= - -1. Support cyrus wildcards in the autosievefolders option. - - -For more information and updates please visit http://email.uoa.gr/projects/cyrus/autosievefolder -
View file
README.skiplist_recovery
Deleted
@@ -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.
View file
batchreconstruct
Deleted
@@ -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 2004/02/04 12:59:42 karsten 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 = "$ARGV0"; -if (!$users) { die "Usage: $0 input_file\n"; } - -open(MB,"$users") || die "can't open $users"; - -while (<MB>) { - chop; - system("$cmd user.$_"); -} -close MB; -
View file
bsd2cyrus
Deleted
@@ -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 = "$ARGV0"; -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; -} -
View file
cpmsg
Deleted
@@ -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 2004/02/04 12:59:42 karsten Exp $ - -$maildir = "$ARGV0"; -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; -
View file
cyr_systemd_helper
Added
@@ -0,0 +1,38 @@ +#!/bin/sh +# get_config config default +# extracts config option from config file +get_config() { + if conf=$(grep "^$1" /etc/imapd.conf); then + echo $conf | cut -d: -f2 + else + echo $2 + fi +} + +CONFIGDIRECTORY=$(get_config configdirectory /var/lib/imap) +RETVAL=0 + +start() { + cd $CONFIGDIRECTORY + runuser - cyrus -s /bin/sh -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all > ${CONFIGDIRECTORY}/rpm/db_import.log 2>&1" < /dev/null + RETVAL=$? +} + +stop() { + cd $CONFIGDIRECTORY + runuser - cyrus -s /bin/sh -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all export > ${CONFIGDIRECTORY}/rpm/db_export.log 2>&1" < /dev/null + RETVAL=$? +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + *) + ;; +esac + +exit $RETVAL
View file
cyrus-deliver-wrapper.c
Deleted
@@ -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_name0) - ? ent->pw_name : "anonymous"; - - if (argc != 2) { - fprintf(stderr, "Usage: %s mailbox\n", argv0); - return EX_USAGE; - } - - execle(LIBEXECDIR"/deliver", "deliver", "-e", - "-a", uname, "-m", argv1, - NULL, envp); - - perror("exec "LIBEXECDIR"/deliver"); - return EX_OSERR; -}
View file
cyrus-imapd-procmail+cyrus.mc
Deleted
@@ -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
View file
cyrus-imapd-sendmail-8.12.9-cyrusv2.m4
Deleted
@@ -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
View file
cyrus-imapd.rpm_set_permissions
Deleted
@@ -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
View file
cyrus-imapd.service
Added
@@ -0,0 +1,14 @@ +Unit +Description=Cyrus-imapd IMAP/POP3 email server +After=local-fs.target network.target + +Service +Type=simple +EnvironmentFile=/etc/sysconfig/cyrus-imapd +ExecStartPre=/usr/lib/cyrus-imapd/cyr_systemd_helper start +ExecStart=/usr/lib/cyrus-imapd/cyrus-master $CYRUSOPTIONS +ExecStopPost=/usr/lib/cyrus-imapd/cyr_systemd_helper stop +PrivateTmp=true + +Install +WantedBy=multi-user.target
View file
cyrus-procmailrc
Deleted
@@ -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 -##############################
View file
cyrus-user-procmailrc.template
Deleted
@@ -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 -############################## -
View file
cyrus_ldap_quota.pl
Deleted
@@ -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 $time5 + 1900; - printf TIME_FILE "%02d", $time4 + 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; -}
View file
folderxfer
Deleted
@@ -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 = "$ARGV0"; -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; - -
View file
imapcreate.pl
Deleted
@@ -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 $mailboxes0)) { - # 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) - } -} -
View file
inboxfer
Deleted
@@ -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 2004/02/04 12:59:42 karsten 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 = "$ARGV0"; -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/$_"); -} - -
View file
skiplist.py
Deleted
@@ -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' % (typesrtype, 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' % typesrtype) - - 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) - keyskeystring = datastring - - return values, keys - -if __name__ == '__main__': - if len(argv) != 2: - print 'Usage: %s skiplist.file' % argv0 - exit() - - fp = open(argv1, 'rb') - header = get_header(fp) - values, keys = getkeys(fp) - fp.close() - - if debug: exit() - for v in values: - print '%s\t%s' % (v, keysv)
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.