Projects
Kolab:3.4
cyrus-imapd
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 118
View file
cyrus-imapd.spec
Changed
@@ -69,6 +69,7 @@ Patch0001: cyrus-imapd-2.5-ctl_mboxlist-mbtype.patch Patch0002: cyrus-imapd-2.5-default-skiplist.patch +Patch0003: cyrus-imapd-2.5-revert-safe-skiplist.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -261,6 +262,7 @@ %patch0001 -p1 %patch0002 -p1 +%patch0003 -p1 %if 0%{?with_bdb} < 1 sed -i -e 's/,berkeley//g' cunit/db.testc
View file
cyrus-imapd-2.5-revert-safe-skiplist.patch
Added
@@ -0,0 +1,431 @@ +diff --git a/lib/cyrusdb_skiplist.c b/lib/cyrusdb_skiplist.c +index 18d3ca3..fc540e0 100644 +--- a/lib/cyrusdb_skiplist.c ++++ b/lib/cyrusdb_skiplist.c +@@ -399,7 +399,7 @@ static unsigned RECSIZE_safe(struct dbengine *db, const char *ptr) + case ADD: + level = LEVEL_safe(db, ptr); + if (!level) { +- syslog(LOG_ERR, "IOERROR: skiplist RECSIZE not safe %s, offset %u", ++ syslog(LOG_ERR, "IOERROR: skiplist2 RECSIZE_safe not safe %s, offset %u", + db->fname, (unsigned)(ptr - db->map_base)); + return 0; + } +@@ -413,20 +413,50 @@ static unsigned RECSIZE_safe(struct dbengine *db, const char *ptr) + break; + + case DELETE: +- if (!is_safe(db, ptr+8)) { +- syslog(LOG_ERR, "IOERROR: skiplist RECSIZE not safe %s, offset %u", +- db->fname, (unsigned)(ptr - db->map_base)); +- return 0; +- } + ret += 8; + break; + + case COMMIT: +- if (!is_safe(db, ptr+4)) { +- syslog(LOG_ERR, "IOERROR: skiplist RECSIZE not safe %s, offset %u", +- db->fname, (unsigned)(ptr - db->map_base)); +- return 0; +- } ++ ret += 4; ++ break; ++ } ++ ++ return ret; ++} ++ ++/* how many levels does this record have? */ ++static unsigned LEVEL(const char *ptr) ++{ ++ const uint32_t *p, *q; ++ ++ assert(TYPE(ptr) == DUMMY || TYPE(ptr) == INORDER || TYPE(ptr) == ADD); ++ p = q = (uint32_t *) FIRSTPTR(ptr); ++ while (*p != (uint32_t)-1) p++; ++ return (p - q); ++} ++ ++/* how big is this record? */ ++static unsigned RECSIZE(const char *ptr) ++{ ++ int ret = 0; ++ switch (TYPE(ptr)) { ++ case DUMMY: ++ case INORDER: ++ case ADD: ++ ret += 4; /* tag */ ++ ret += 4; /* keylen */ ++ ret += ROUNDUP(KEYLEN(ptr)); /* key */ ++ ret += 4; /* datalen */ ++ ret += ROUNDUP(DATALEN(ptr)); /* data */ ++ ret += 4 * LEVEL(ptr); /* pointers */ ++ ret += 4; /* padding */ ++ break; ++ ++ case DELETE: ++ ret += 8; ++ break; ++ ++ case COMMIT: + ret += 4; + break; + } +@@ -494,12 +524,7 @@ static int newtxn(struct dbengine *db, struct txn **tidptr) + } + + +-static unsigned PADDING_safe(struct dbengine *db, const char *ptr) +-{ +- unsigned size = RECSIZE_safe(db, ptr); +- if (!size) return 0; +- return ntohl(*((uint32_t *)((ptr) + size - 4))); +-} ++#define PADDING(ptr) (ntohl(*((uint32_t *)((ptr) + RECSIZE(ptr) - 4)))) + + /* given an open, mapped db, read in the header information */ + static int read_header(struct dbengine *db) +@@ -570,9 +595,9 @@ static int read_header(struct dbengine *db) + db->fname); + r = CYRUSDB_IOERROR; + } +- if (!r && LEVEL_safe(db, dptr) != db->maxlevel) { ++ if (!r && LEVEL(dptr) != db->maxlevel) { + syslog(LOG_ERR, "DBERROR: %s: DUMMY level(%d) != db->maxlevel(%d)", +- db->fname, LEVEL_safe(db, dptr), db->maxlevel); ++ db->fname, LEVEL(dptr), db->maxlevel); + r = CYRUSDB_IOERROR; + } + +@@ -1281,7 +1306,7 @@ static int mystore(struct dbengine *db, + return CYRUSDB_EXISTS; + } else { + /* replace with an equal height node */ +- lvl = LEVEL_safe(db, ptr); ++ lvl = LEVEL(ptr); + + /* log a removal */ + WRITEV_ADD_TO_IOVEC(iov, num_iov, (char *) &delrectype, 4); +@@ -1575,8 +1600,8 @@ static int myabort(struct dbengine *db, struct txn *tid) + + /* find the last log entry */ + for (offset = tid->logstart, ptr = db->map_base + offset; +- offset + RECSIZE_safe(db, ptr) != (uint32_t) tid->logend; +- offset += RECSIZE_safe(db, ptr), ptr = db->map_base + offset) ; ++ offset + RECSIZE(ptr) != (uint32_t) tid->logend; ++ offset += RECSIZE(ptr), ptr = db->map_base + offset) ; + + offset = ptr - db->map_base; + +@@ -1613,7 +1638,7 @@ static int myabort(struct dbengine *db, struct txn *tid) + /* re-add this record. it can't exist right now. */ + netnewoffset = *((uint32_t *)(ptr + 4)); + q = db->map_base + ntohl(netnewoffset); +- lvl = LEVEL_safe(db, q); ++ lvl = LEVEL(q); + (void) find_node(db, KEY(q), KEYLEN(q), updateoffsets); + for (i = 0; i < lvl; i++) { + /* the current pointers FROM this node are correct, +@@ -1628,7 +1653,7 @@ static int myabort(struct dbengine *db, struct txn *tid) + } + + /* remove looking at this */ +- tid->logend -= RECSIZE_safe(db, ptr); ++ tid->logend -= RECSIZE(ptr); + } + + /* truncate the file to remove log entries */ +@@ -1742,13 +1767,13 @@ static int mycheckpoint(struct dbengine *db) + uint32_t netnewoffset; + + ptr = db->map_base + offset; +- lvl = LEVEL_safe(db, ptr); ++ lvl = LEVEL(ptr); + db->listsize++; + + num_iov = 0; + WRITEV_ADD_TO_IOVEC(iov, num_iov, (char *) &iorectype, 4); + /* copy all but the rectype from the record */ +- WRITEV_ADD_TO_IOVEC(iov, num_iov, (char *) ptr + 4, RECSIZE_safe(db, ptr) - 4); ++ WRITEV_ADD_TO_IOVEC(iov, num_iov, (char *) ptr + 4, RECSIZE(ptr) - 4); + + newoffset = lseek(db->fd, 0, SEEK_END); + netnewoffset = htonl(newoffset); +@@ -1915,9 +1940,9 @@ static int dump(struct dbengine *db, int detail __attribute__((unused))) + case INORDER: + case ADD: + printf("kl=%d dl=%d lvl=%d\n", +- KEYLEN(ptr), DATALEN(ptr), LEVEL_safe(db, ptr)); ++ KEYLEN(ptr), DATALEN(ptr), LEVEL(ptr)); + printf("\t"); +- for (i = 0; i < LEVEL_safe(db, ptr); i++) { ++ for (i = 0; i < LEVEL(ptr); i++) { + printf("%04X ", FORWARD(ptr, i)); + } + printf("\n"); +@@ -1932,7 +1957,7 @@ static int dump(struct dbengine *db, int detail __attribute__((unused))) + break; + } + +- ptr += RECSIZE_safe(db, ptr); ++ ptr += RECSIZE(ptr); + } + + unlock(db); +@@ -1961,7 +1986,7 @@ static int myconsistent(struct dbengine *db, struct txn *tid, int locked) + + ptr = db->map_base + offset; + +- for (i = 0; i < LEVEL_safe(db, ptr); i++) { ++ for (i = 0; i < LEVEL(ptr); i++) { + offset = FORWARD(ptr, i); + + if (offset > db->map_size) { +@@ -2005,11 +2030,9 @@ static int myconsistent(struct dbengine *db, struct txn *tid, int locked) + static int recovery(struct dbengine *db, int flags) + { + const char *ptr, *keyptr; +- unsigned filesize = db->map_size; + unsigned updateoffsets[SKIPLIST_MAXLEVEL+1]; + uint32_t offset, offsetnet, myoff = 0; +- int r = 0; +- int need_checkpoint = libcyrus_config_getswitch(CYRUSOPT_SKIPLIST_ALWAYS_CHECKPOINT); ++ int r = 0, need_checkpoint = 0; + time_t start = time(NULL); + unsigned i; + +@@ -2063,11 +2086,11 @@ static int recovery(struct dbengine *db, int flags) + }
View file
cyrus-imapd.cvt_cyrusdb_all
Changed
@@ -1,428 +1,95 @@ #!/bin/bash +# Simplified version of Simon Matter's cvt_cyrusdb_all. -# 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 +[ -f "/etc/sysconfig/cyrus-imapd" ] && \ + . /etc/sysconfig/cyrus-imapd -# This script converts all db files of a cyrus installation from their -# existing format to the format required by the current installation. -# The format of current db files is determined using the 'file' command -# with a magic file added for skiplist db, the new format is read from -# a config file usually in /usr/share/cyrus-imapd/rpm/db.cfg, which is -# created while compiling. After converting, the db.cfg file is -# copied to a cache file usually at /var/lib/imap/rpm/db.cfg.cache to -# allow bypassing this converting script if both files are identical. -# While this is a bit less secure, it may be useful on big server where -# db converting is done automatically. -# -# 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> +[ -f "/etc/default/cyrus-imapd" ] && \ + . /etc/default/cyrus-imapd -# changelog -# v1.0.1, Oct 22 2002 Simon Matter <simon.matter@invoca.ch> -# - added two-step conversion method -# -# v1.0.2, Jan 10 2003 Simon Matter <simon.matter@invoca.ch> -# - fixed a bug where cvt_cyrusdb was called to convert empty or -# nonexistent files -# -# v1.0.3, Mar 14 2003 Simon Matter <simon.matter@invoca.ch> -# - fixed a problem with new versions of the file command -# -# v1.0.4 -# - added GPL license -# -# v1.0.5, May 02 2003 Simon Matter <simon.matter@invoca.ch> -# - modified exec path -# -# v1.0.6, Jul 18 2003 Simon Matter <simon.matter@invoca.ch> -# - changed db3 to berkeley -# - added new db backends for 2.2 -# -# v1.0.7, Jan 23 2004 Simon Matter <simon.matter@invoca.ch> -# - included some modifications from Luca Olivetti <luca@olivetti.cjb.net> -# - added masssievec functionality -# -# v1.0.8, Jan 28 2004 Simon Matter <simon.matter@invoca.ch> -# - convert sieve scripts to UTF-8 before calling masssievec -# -# v1.0.9, Jan 29 2004 Simon Matter <simon.matter@invoca.ch> -# - convert sieve scripts to UTF-8 only if sievec failed before -# -# v1.0.10, Feb 24 2004 Simon Matter <simon.matter@invoca.ch> -# - change su within init script to get input from -# /dev/null, this prevents hang when running in SELinux -# -# v1.0.11, Mar 02 2004 Simon Matter <simon.matter@invoca.ch> -# - fixed SELinux fix -# -# v1.0.12, Dec 16 2004 Simon Matter <simon.matter@invoca.ch> -# - use runuser instead of su if available -# -# v1.0.13, Jul 15 2005 Simon Matter <simon.matter@invoca.ch> -# - don't use flat in the two step conversion, use skiplist instead -# -# v1.0.14, Jul 18 2005 Simon Matter <simon.matter@invoca.ch> -# - replace the order of the magic files in the file call to make -# sure skiplist is detected correctly. -# -# v1.0.15, Aug 17 2005 Simon Matter <simon.matter@invoca.ch> -# - add functionality to export all berkeley db files to skiplist -# -# v1.1.0, Aug 18 2005 Simon Matter <simon.matter@invoca.ch> -# - fix export functionality, try to recover Berkeley databases -# as much as possible before any conversion. -# -# v1.1.1, Dec 05 2005 Simon Matter <simon.matter@invoca.ch> -# - run db_checkpoint in background with a timeout to prevent -# that cyrus-imapd doesn't start at all if it hangs. -# -# v1.1.2, Dec 06 2005 Simon Matter <simon.matter@invoca.ch> -# - make handling of db_checkpoint more robust -# -# v1.2.0, Jan 12 2006 Simon Matter <simon.matter@invoca.ch> -# - adopt for cyrus-imapd-2.3 -# -# 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 -# -# v1.3.5, Mar 6 2014 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> -# - use default database configuration values if not specified in -# configuration - -VERSION=1.3.5 - -[ -f /etc/sysconfig/cyrus-imapd${INSTANCE} ] && \ - . /etc/sysconfig/cyrus-imapd${INSTANCE} - -[ "${QUICK}" == "1" ] && exit 0 - -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 ${IMAPDCONF} ]; then - echo "ERROR: configuration file '${IMAPDCONF}' not found, exiting!" - exit 1 -fi - -# fallback to su if runuser not available -if [ -x /sbin/runuser ]; then - RUNUSER=runuser +# Ensure this script is run as the cyrus user. +if [ -x "$(which runuser 2>/dev/null)" ]; then + SWITCHUSER=runuser else - RUNUSER=su -fi - -# force cyrus user for security reasons -if [ ! $(whoami) = "cyrus" ]; then - if [ ! -z "${INSTANCE}" ]; then - exec $RUNUSER -s /bin/bash - cyrus -c "cd \$HOME < /dev/null ; INSTANCE=${INSTANCE} $0 $*" - else - exec $RUNUSER -s /bin/bash - cyrus -c "cd \$HOME < /dev/null ; INSTANCE=$0 $*" - fi + SWITCHUSER=su fi -# special function for migration -EXPORT=$1 - -# files get mode 0600 -umask 166 - -# show version info in log files
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
.