[SVN] r768 - in /branches/cyrus23/cyrus-imapd-2.3-2.3.13: ./ cmulocal/ com_err/ com_err/et/ contrib/ contrib/cyrus-graphtools.1.0/script/ debian/ debian/patches/ depot/ doc/ doc/internal/ doc/text/ et/ imap/ imtest/ installsieve/ lib/ lib/charset/ lib/test/ makedepend/ master/ netnews/ notifyd/ perl/ perl/imap/ perl/imap/IMAP/ perl/imap/examples/ perl/imap/t/ ptclient/ snmp/ syslog/ timsieved/ tools/

debian at incase.de debian at incase.de
Mon Feb 9 11:49:22 UTC 2009


Author: duncan
Date: Mon Feb  9 12:49:22 2009
New Revision: 768

URL: https://mail.incase.de/viewcvs?rev=768&root=cyrus22&view=rev
Log:
Large update to 2.3.13.  A few very conservative changes in debian files.

Added:
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.3
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.texinfo
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/compile_et.1
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/compile_et.sh
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/config_script
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/error_message.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/error_table.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_c.awk
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_h.awk
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_name.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/init_et.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/internal.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/mit-sipb-copyright.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test1.et
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test2.et
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test_et.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/texinfo.tex
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_synclog.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_virusscan.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/make_sha1.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message_guid.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message_guid.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/statuscache.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/statuscache_db.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1250.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1251.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1255.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_sql.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapopts.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapopts.h
Removed:
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/configure
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/et/
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/protocol.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/message_uuid.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/message_uuid.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/message_uuid_master.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/message_uuid_master.h
Modified:
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/COPYRIGHT
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/README.andrew
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/SMakefile
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/aclocal.m4
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/COPYING
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/berkdb.m4
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/c-attribute.m4
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/c-fpic.m4
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/sasl2.m4
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.guess
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.h.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.sub
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/configure.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/cyrus-graphtools.1.0/script/cyrus.pl
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/drac_auth.patch
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/fud-client.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/changelog
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/control
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/cyrus-common-2.3.cyrus2.3.init
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/cyrus-common-2.3.postrm
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/executable.files
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/00list
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/12-fix_timeout_handling.dpatch
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/13-master_process_handling.dpatch
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/17-fix_tail_syntax_in_xversion.h.dpatch
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/30-update_perlcalling.sh.dpatch
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/65-sieveshell-enhancements.dpatch
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/70-allow-larger-buffers.dpatch
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/72-faster-isdigit.dpatch
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/75-update-imapd.conf-documentation.dpatch
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/77-change-missing-sieve-notice.dpatch
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/rules
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/depot/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/depot/depot.conf
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/altnamespace.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/anoncvs.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/changes.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/cyrusv2.mc
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/faq.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/feedback.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-admin-mb.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-auth.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-configure.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-perf.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-prereq.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-replication.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-upgrade.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-virtdomains.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/database-formats.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/mailbox-format.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/replication_examples
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/replication_protocol
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/man.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/os.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/questions.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/readme.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/sieve-protocol.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/specs.html
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/text/Makefile
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/text/htmlstrip.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/Makefile.dist
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/annotate.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/annotate.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/append.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/append.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/arbitron.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/backend.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/backend.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/chk_cyrus.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cli_fatal.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/convert_code.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/convert_code.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_cyrusdb.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_deliver.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_mboxlist.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cvt_cyrusdb.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_dbtool.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_expire.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyrdump.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/deliver.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/delivered_prune.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/duplicate.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/duplicate.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/fetchnews.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/fud.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/global.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/global.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idle.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idle.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idled.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idled.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_err.et
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_proxy.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_proxy.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapd.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapd.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapparse.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/index.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/index.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ipurge.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtp_sieve.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtp_sieve.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpd.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpd.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpengine.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpengine.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpstats.snmp
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mailbox.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mailbox.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/make_md5.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbdump.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbdump.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbexamine.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxkey.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxkey.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxlist.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxlist.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxname.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxname.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbpath.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-client.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-client.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-slave.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate_err.et
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex_fake.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex_pthread.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/nntp_err.et
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/nntpd.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/notify.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/notify.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/pop3d.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proc.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/protocol.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proxy.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proxy.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/pushstats.snmp
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota_db.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/reconstruct.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslclient.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslclient.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslserver.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/search_engines.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/search_engines.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_bigdb.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_db.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_local.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/setproctitle.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/signals.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/signals.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smmapd.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smtpclient.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smtpclient.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/spool.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/spool.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_build.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_internal.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_internal.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squatter.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_client.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_commit.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_commit.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_log.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_log.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_reset.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_server.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_support.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_support.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/syncnews.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/telemetry.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/telemetry.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls_prune.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/unexpunge.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/user.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/user.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/version.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/version.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/xversion.sh
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imtest/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/imtest/imtest.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/codes.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/exitcodes.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/installscript.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/isieve.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/isieve.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/lex.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/lex.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/mystring.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/mystring.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/request.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/request.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl_afs.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/assert.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/assert.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_krb.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_krb5.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_pts.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_pts.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_unix.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/bsearch.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/bsearch.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/byteorder64.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/byteorder64.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/gb2312.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-2022-jp.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-2022-kr.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-1.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-15.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-2.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-3.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-4.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-5.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-6.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-7.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-8.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-9.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/koi8-r.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/unidata2.txt
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/unifix.txt
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/us-ascii.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1252.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1256.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/chartable.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_berkeley.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_flat.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_quotalegacy.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_skiplist.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/exitcodes.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/ftruncate.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gai.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getaddrinfo.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getdtablesize.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getnameinfo.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/glob.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/glob.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff_gmtime.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff_tm.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapoptions
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapurl.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapurl.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imclient.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imclient.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imparse.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imparse.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/iptostring.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/iptostring.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libconfig.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libconfig.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libcyr_cfg.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libcyr_cfg.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock_fcntl.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock_flock.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_nommap.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_shared.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_stupidshared.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/memmove.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkchartable.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkgmtime.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkgmtime.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mpool.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mpool.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock_fcntl.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock_ioctl.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/parseaddr.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/parseaddr.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/prot.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/prot.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/retry.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/retry.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/rfc822date.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/rfc822date.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strcasecmp.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strerror.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strhash.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strhash.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/sysexits.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/test/cyrusdb.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/test/rnddb.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/util.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/util.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/wildmat.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/wildmat.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xmalloc.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xmalloc.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcat.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcat.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcpy.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcpy.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/configure
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/cppsetup.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/def.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/ifparser.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/ifparser.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/include.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/install-sh
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/main.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/parse.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/pr.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/master.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/master.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/masterconf.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/masterconf.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service-thread.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/macros.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/readconfig.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/readconfig.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/remotepurge.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/exitcodes.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_log.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_log.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_mailto.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_mailto.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_null.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_null.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_zephyr.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_zephyr.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifyd.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifyd.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifytest.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/version.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP.pm
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP.xs
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP/Admin.pm
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP/Shell.pm
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/Makefile.PL
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/cyradm.sh
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/cyrperl.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/auditmbox.pl
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/imapcollate.pl
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/imapdu.pl
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/t/01-imclient.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/t/02-admin.t
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/xsutil.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/afskrb.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ldap.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptdump.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptexpire.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptextract.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptloader.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptloader.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/test.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/test2.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/snmp/snmpgen
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/logger.1
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/logger.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslog.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslogd.8
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslogd.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/Makefile.in
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/actions.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/actions.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/codes.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/exitcodes.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/lex.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/lex.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/mystring.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/parser.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/parser.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/scripttest.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/scripttest.h
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/timsieved.c
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/config2header
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/config2man
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/dohash
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/masssievec
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/migrate-metadata
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/mkimap
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/mknewsgroups
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/not-mkdep
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/rehash
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/translatesieve
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/undohash
    branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/upgradesieve

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/COPYRIGHT
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/COPYRIGHT?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/COPYRIGHT (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/COPYRIGHT Mon Feb  9 12:49:22 2009
@@ -1,8 +1,8 @@
-$Id: COPYRIGHT,v 1.7 2000/10/12 20:45:21 wcw Exp $
+$Id: COPYRIGHT,v 1.8 2008/03/24 18:43:42 murch Exp $
 
 ALL versions of the  Cyrus IMAP server are now covered by the following copyright: 
 
- * Copyright (c) 1994-2000 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -20,12 +20,13 @@
  *    endorse or promote products derived from this software without
  *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,7 +1,7 @@
 #
 # @configure_input@
 # 
-# Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -17,14 +17,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -39,6 +40,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 # 
+# $Id: Makefile.in,v 1.101 2008/10/14 14:40:50 murch Exp $
 
 SUBDIRS = man @PRE_SUBDIRS@ lib @SIEVE_SUBDIRS@ @SERVER_SUBDIRS@ \
 	imtest @SNMP_SUBDIRS@ @EXTRA_SUBDIRS@
@@ -62,7 +64,7 @@
 LEX = @LEX@
 COMPILE_ET = @COMPILE_ET@
 
-VERSION = 2.3.8
+VERSION = 2.3.13
 
 all:: 
 	@for d in  $(SUBDIRS); \
@@ -93,7 +95,7 @@
 	if [ \! -d dist ]; then mkdir dist ; fi
 	@echo "checking out the distribution"
 	@cd dist ; cvs -Q -d :pserver:anoncvs at cvs.andrew.cmu.edu:/cvs \
-		co -d cyrus-imapd-$(VERSION) cyrus
+		co -P -d cyrus-imapd-$(VERSION) cyrus
 	touch distcvs
 
 install::

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/README.andrew
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/README.andrew?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/README.andrew (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/README.andrew Mon Feb  9 12:49:22 2009
@@ -39,13 +39,16 @@
 
 - tag the CVS repository with cyrus-release-Major-Minor-Revision
 
+- upload tarball to /afs/andrew.cmu.edu/system/archive/cmu/anonftp/pub/cyrus
+
 - announce to:
     info-cyrus
     comp.mail.imap
     cyrus-announce
     freshmeat.net
 
-- update cyrusimap.web.cmu.edu links to new version
+- update cyrusimap.web.cmu.edu:/usr/www/htdocs/downloads.html
+  links to new version
 
 ---
 to bring up a new Andrew Cyrus server:

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/SMakefile
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/SMakefile?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/SMakefile (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/SMakefile Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -37,11 +38,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# This file is specific to Carnegie Mellon University's
-# software build process
-# 
-# $Id: SMakefile,v 1.98 2006/11/30 17:11:16 murch Exp $
-#
+# $Id: SMakefile,v 1.100 2008/03/24 18:43:44 murch Exp $
 
 NEW_AUTOTOOLS=yes
 export NEW_AUTOTOOLS
@@ -137,7 +134,7 @@
 SASL_CONFIG="--with-staticsasl=/usr/local --with-gssapi=/usr/local"
 #KRB_CONFIG="--enable-statickrb --with-krb=/usr/local"
 KRB_CONFIG="--with-krb=/usr/local"
-FEATURE_CONFIG="--enable-murder --enable-cmulocal --enable-nntp --enable-idled"
+FEATURE_CONFIG="--enable-murder --enable-cmulocal --enable-nntp --enable-idled --enable-replication"
 EXT_PACKAGE_CONFIG="--with-inn=/usr/news --with-ucdsnmp=/usr/local"
 
 MFCOMMAND="./configure $WITHAUTH $KRB_CONFIG $DB_CONFIG --enable-experiment --with-cyrus-group=staff $FEATURE_CONFIG $EXT_PACKAGE_CONFIG $SASL_CONFIG $DEBUG"

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/aclocal.m4
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/aclocal.m4?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/aclocal.m4 (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/aclocal.m4 Mon Feb  9 12:49:22 2009
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/COPYING
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/COPYING?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/COPYING (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/COPYING Mon Feb  9 12:49:22 2009
@@ -1,20 +1,39 @@
-        Copyright 1998 by Carnegie Mellon University
 
-                      All Rights Reserved
+Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
 
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Carnegie Mellon University
-not be used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
 
-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.
+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 legal
+   details, please contact
+     Carnegie Mellon University
+     Center for Technology Transfer and Enterprise Creation
+     4615 Forbes Avenue
+     Suite 302
+     Pittsburgh, PA  15213
+     (412) 268-7393, fax: (412) 268-7395
+     innovation at 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.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/berkdb.m4
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/berkdb.m4?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/berkdb.m4 (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/berkdb.m4 Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-dnl $Id: berkdb.m4,v 1.20 2005/04/26 19:14:07 shadow Exp $
+dnl $Id: berkdb.m4,v 1.22 2007/08/15 17:18:01 murch Exp $
 
 AC_DEFUN([CMU_DB_INC_WHERE1], [
 saved_CPPFLAGS=$CPPFLAGS
@@ -213,10 +213,11 @@
 	fi
 
 	saved_LIBS=$LIBS
-        for dbname in db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db
+        for dbname in ${with_bdb} db-4.6 db4.6 db46 db-4.5 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db
           do
 	    LIBS="$saved_LIBS -l$dbname"
-	    AC_TRY_LINK([#include <db.h>],
+	    AC_TRY_LINK([#include <stdio.h>
+#include <db.h>],
 	    [db_create(NULL, NULL, 0);],
 	    BDB_LIBADD="$BDB_LIBADD -l$dbname"; dblib="berkeley"; dbname=db,
             dblib="no")
@@ -224,7 +225,8 @@
           done
         if test "$dblib" = "no"; then
 	    LIBS="$saved_LIBS -ldb"
-	    AC_TRY_LINK([#include <db.h>],
+	    AC_TRY_LINK([#include <stdio.h>
+#include <db.h>],
 	    [db_open(NULL, 0, 0, 0, NULL, NULL, NULL);],
 	    BDB_LIBADD="$BDB_LIBADD -ldb"; dblib="berkeley"; dbname=db,
             dblib="no")

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/c-attribute.m4
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/c-attribute.m4?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/c-attribute.m4 (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/c-attribute.m4 Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: c-attribute.m4,v 1.3 2003/10/08 20:35:24 rjs3 Exp $
+dnl $Id: c-attribute.m4,v 1.4 2007/08/30 16:57:55 murch Exp $
 dnl
 
 dnl
@@ -11,8 +11,6 @@
 AC_CACHE_VAL(ac_cv___attribute__, [
 AC_TRY_COMPILE([
 #include <stdlib.h>
-],
-[
 static void foo(void) __attribute__ ((noreturn));
 
 static void
@@ -20,6 +18,8 @@
 {
   exit(1);
 }
+],
+[
 ],
 ac_cv___attribute__=yes,
 ac_cv___attribute__=no)])

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/c-fpic.m4
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/c-fpic.m4?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/c-fpic.m4 (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/c-fpic.m4 Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: c-fpic.m4,v 1.2 2003/10/08 20:35:24 rjs3 Exp $
+dnl $Id: c-fpic.m4,v 1.3 2007/08/30 16:57:55 murch Exp $
 dnl
 
 dnl
@@ -13,13 +13,13 @@
 CFLAGS="${CFLAGS} -fPIC"
 AC_TRY_COMPILE([
 #include <stdlib.h>
-],
-[
 static void
 foo(void)
 {
   exit(1);
 }
+],
+[
 ],
 ac_cv_fpic=yes,
 ac_cv_fpic=no)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/sasl2.m4
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/sasl2.m4?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/sasl2.m4 (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/cmulocal/sasl2.m4 Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 # sasl2.m4--sasl2 libraries and includes
 # Rob Siemborski
-# $Id: sasl2.m4,v 1.52 2006/05/18 19:25:00 murch Exp $
+# $Id: sasl2.m4,v 1.53 2008/03/03 22:06:34 wescraig Exp $
 
 # SASL2_CRYPT_CHK
 # ---------------
@@ -65,9 +65,7 @@
       fi
     fi
   fi
-  AC_CHECK_HEADER([gssapi.h],
-                  [AC_DEFINE(HAVE_GSSAPI_H,,
-                             [Define if you have the gssapi.h header file])],
+  AC_CHECK_HEADER([gssapi.h],,
                   [AC_CHECK_HEADER([gssapi/gssapi.h],,
                                    [AC_WARN([Disabling GSSAPI - no include files found]); gssapi=no])])
 
@@ -76,6 +74,10 @@
 fi
 
 if test "$gssapi" != no; then
+  if test "$ac_cv_header_gssapi_h" = "yes" -o "$ac_cv_header_gssapi_gssapi_h" = "yes"; then
+    AC_DEFINE(HAVE_GSSAPI_H,,[Define if you have the gssapi.h header file])
+  fi
+
   # We need to find out which gssapi implementation we are
   # using. Supported alternatives are: MIT Kerberos 5,
   # Heimdal Kerberos 5 (http://www.pdc.kth.se/heimdal),

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/Makefile.in?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/Makefile.in (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,0 +1,142 @@
+# Makefile for error-table routines
+#
+# @configure_input@
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: Makefile.in,v 1.2 2008/03/24 18:53:40 murch Exp $
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+CC = @CC@
+INSTALL = @INSTALL@
+RANLIB = @RANLIB@
+ARCHIVE = ar cr
+
+AWK = @AWK@
+SED = sed
+
+DEFS = @DEFS@
+CPPFLAGS = @CPPFLAGS@
+LIBS = @LIBS@
+
+CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
+
+SHELL = /bin/sh
+
+LIBOBJS= error_message.o et_name.o init_et.o com_err.o
+# for et_lex.lex.c include in error_table.y
+LOCALINCLUDE=-I. -I.. -I$(srcdir)
+
+all: compile_et libcom_err.a
+
+install:
+
+.c.o:
+	$(CC) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) -I$(srcdir)/../../lib -I. -I../.. $(CFLAGS) $<
+
+# solaris make loses on com_err.c but not on init_et.c, but this helps
+com_err.o: com_err.c
+
+#
+# real entries...
+#
+
+compile_et: $(srcdir)/compile_et.sh $(srcdir)/config_script
+	$(srcdir)/config_script $(srcdir)/compile_et.sh $(AWK) $(SED) > compile_et
+	chmod 755 compile_et	
+
+et_c.awk: $(srcdir)/et_c.awk
+	$(CP) $(srcdir)/et_c.awk et_c.awk
+
+et_h.awk: $(srcdir)/et_h.awk
+	$(CP) $(srcdir)/et_h.awk et_h.awk
+
+clean:
+	rm -f compile_et compile_et.o error_table.o 
+	rm -f libcom_err.a
+	rm -f $(LIBOBJS)
+
+distclean: clean
+	rm -f compile_et compile_et.o error_table.o 
+	rm -f libcom_err.a
+	rm -f $(LIBOBJS)
+	rm Makefile
+
+depend: compile_et 
+
+#install:: com_err.h 
+#	$(INSTALLFILE) $(srcdir)/com_err.h  $(DESTDIR)$(INCLDIR)/com_err.h
+#
+#install:: mit-sipb-copyright.h
+#	$(INSTALLFILE) $(srcdir)/mit-sipb-copyright.h $(DESTDIR)$(INCLDIR)/mit-sipb-copyright.h
+#
+#install:: com_err.3
+#	$(INSTALLFILE) $(srcdir)/com_err.3 $(DESTDIR)$(MANDIR)/man3/com_err.3
+#
+#install:: compile_et.1
+#	$(INSTALLFILE) $(srcdir)/compile_et.1 $(DESTDIR)$(MANDIR)/man1/compile_et.1
+
+
+## install_library_target(com_err,$(LIBOBJS),$(LINTFILES),)
+
+libcom_err.a: $(LIBOBJS)
+	rm -f libcom_err.a
+	$(ARCHIVE) $@ $(LIBOBJS)
+	$(RANLIB) $@
+
+#install::
+#	$(INSTALLLIB) libcom_err.a $(DESTDIR)$(LIBDIR)/libcom_err.a
+#	$(CHMOD) 644 $(DESTDIR)$(LIBDIR)/libcom_err.a
+#	$(RANLIB)    $(DESTDIR)$(LIBDIR)/libcom_err.a
+#	$(CHMOD) 444 $(DESTDIR)$(LIBDIR)/libcom_err.a
+## 
+
+libcom_err.o:	$(LIBOBJS)
+	ld -r -s -o libcom_err.o $(LIBOBJS)
+	chmod -x libcom_err.o
+
+TAGS:	et_name.c error_message.c compile_et.c error_table.c \
+		lex.yy.c init_et.c
+	etags et_name.c error_message.c compile_et.c \
+		error_table.c init_et.c
+

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.3
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.3?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.3 (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.3 Mon Feb  9 12:49:22 2009
@@ -1,0 +1,136 @@
+.\"
+.\" Copyright (c) 1994-2008 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 legal
+.\"    details, please contact
+.\"      Carnegie Mellon University
+.\"      Center for Technology Transfer and Enterprise Creation
+.\"      4615 Forbes Avenue
+.\"      Suite 302
+.\"      Pittsburgh, PA  15213
+.\"      (412) 268-7393, fax: (412) 268-7395
+.\"      innovation at 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.
+.\"
+.\" $Id: com_err.3,v 1.2 2008/03/24 18:53:40 murch Exp $
+.\"
+.\" Copyright (c) 1988 Massachusetts Institute of Technology,
+.\" Student Information Processing Board.  All rights reserved.
+.\"
+.TH COM_ERR 3 "22 Nov 1988" SIPB
+.SH NAME
+com_err \- common error display routine
+.SH SYNOPSIS
+.nf
+ #include "com_err.h"
+.PP
+void com_err (whoami, code, format, ...);
+	const char *whoami;
+	long code;
+	const char *format;
+.PP
+proc = set_com_err_hook (proc);
+.fi
+void (*
+.I proc
+) (const char *, long, const char *, va_list);
+.nf
+.PP
+proc = reset_com_err_hook ();
+.PP
+void initialize_XXXX_error_table ();
+.fi
+.SH DESCRIPTION
+.I Com_err
+displays an error message on the standard error stream
+.I stderr
+(see
+.IR stdio (3S))
+composed of the
+.I whoami
+string, which should specify the program name or some subportion of
+a program, followed by an error message generated from the
+.I code
+value (derived from
+.IR compile_et (1)),
+and a string produced using the
+.I format
+string and any following arguments, in the same style as
+.IR fprintf (3).
+
+The behavior of
+.I com_err
+can be modified using
+.I set_com_err_hook;
+this defines a procedure which is called with the arguments passed to
+.I com_err,
+instead of the default internal procedure which sends the formatted
+text to error output.  Thus the error messages from a program can all
+easily be diverted to another form of diagnostic logging, such as
+.IR syslog (3).
+.I Reset_com_err_hook
+may be used to restore the behavior of
+.I com_err
+to its default form.  Both procedures return the previous ``hook''
+value.  These ``hook'' procedures must have the declaration given for
+.I proc
+above in the synopsis.
+
+The
+.I initialize_XXXX_error_table
+routine is generated mechanically by
+.IR compile_et (1)
+from a source file containing names and associated strings.  Each
+table has a name of up to four characters, which is used in place of
+the
+.B XXXX
+in the name of the routine.  These routines should be called before
+any of the corresponding error codes are used, so that the
+.I com_err
+library will recognize error codes from these tables when they are
+used.
+
+The
+.B com_err.h
+header file should be included in any source file that uses routines
+from the
+.I com_err
+library; executable files must be linked using
+.I ``-lcom_err''
+in order to cause the
+.I com_err
+library to be included.
+
+.\" .IR for manual entries
+.\" .PP for paragraph breaks
+
+.SH "SEE ALSO"
+compile_et (1), syslog (3).
+
+Ken Raeburn, "A Common Error Description Library for UNIX".

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,188 @@
+/* 
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: com_err.c,v 1.2 2008/03/24 18:53:40 murch Exp $
+ *
+ * Copyright 1987, 1988 by MIT Student Information Processing Board.
+ *
+ * For copyright info, see mit-sipb-copyright.h.
+ */
+
+#define IN_COM_ERR
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+#include "mit-sipb-copyright.h"
+
+#if defined(HAVE_STDARG_H) || defined(_WINDOWS)
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#define VARARGS
+#endif
+
+#include "error_table.h"
+#include "internal.h"
+
+struct et_list * _et_list = (struct et_list *) NULL;
+
+#ifdef notdef
+/*
+ * Protect us from header version (externally visible) of com_err, so
+ * we can survive in a <varargs.h> environment.  I think.
+ */
+#define com_err com_err_external
+#include "com_err.h"
+#undef com_err
+#endif
+
+/* We have problems with varargs definitions if we include com_err.h */
+
+/*
+ * XXX for now, we define error_message by hand.  Ultimately, we
+ * should fix up com_err.h so that it's safe to #include here 
+ * directly.
+ */
+#if defined(__STDC__) || defined(_WINDOWS)
+extern char const * INTERFACE error_message (long);
+#else
+extern char * INTERFACE error_message ();
+#endif
+
+static void
+#if defined(__STDC__) || defined(_WINDOWS)
+    default_com_err_proc (const char *whoami, long code, const char *fmt, va_list args)
+#else
+    default_com_err_proc (whoami, code, fmt, args)
+    const char *whoami;
+    long code;
+    const char *fmt;
+    va_list args;
+#endif
+{
+    static char errbuf[1024];                   /* For those w/o stdio */
+
+    *errbuf = '\0';
+    if (whoami) {
+	strcat (errbuf, whoami);
+	strcat (errbuf, ": ");
+    }
+    if (code) {
+	strcat (errbuf, error_message(code));
+	strcat (errbuf, " ");
+    }
+    if (fmt) {
+        vsprintf (errbuf + strlen (errbuf), fmt, args);
+    }
+#ifdef _WINDOWS
+    MessageBox (NULL, errbuf, "Kerboros", MB_ICONEXCLAMATION);
+#else
+    fputs (errbuf, stderr);
+    /* should do this only on a tty in raw mode */
+    putc('\r', stderr);
+    putc('\n', stderr);
+    fflush(stderr);
+#endif
+}
+
+#if defined(__STDC__) || defined(_WINDOWS)
+typedef void (*errf) (const char *, long, const char *, va_list);
+#else
+typedef void (*errf) ();
+#endif
+
+errf com_err_hook = default_com_err_proc;
+
+void com_err_va (whoami, code, fmt, args)
+    const char *whoami;
+    long code;
+    const char *fmt;
+    va_list args;
+{
+    (*com_err_hook) (whoami, code, fmt, args);
+}
+
+#ifndef VARARGS
+void INTERFACE_C com_err (const char *whoami,
+	      long code,
+	      const char *fmt, ...)
+{
+#else
+void INTERFACE_C com_err (va_alist)
+    va_dcl
+{
+    const char *whoami, *fmt;
+    long code;
+#endif
+    va_list pvar;
+
+    if (!com_err_hook)
+	com_err_hook = default_com_err_proc;
+#ifdef VARARGS
+    va_start (pvar);
+    whoami = va_arg (pvar, const char *);
+    code = va_arg (pvar, long);
+    fmt = va_arg (pvar, const char *);
+#else
+    va_start(pvar, fmt);
+#endif
+    com_err_va (whoami, code, fmt, pvar);
+    va_end(pvar);
+}
+
+errf set_com_err_hook (new_proc)
+    errf new_proc;
+{
+    errf x = com_err_hook;
+
+    if (new_proc)
+	com_err_hook = new_proc;
+    else
+	com_err_hook = default_com_err_proc;
+
+    return x;
+}
+
+errf reset_com_err_hook () {
+    errf x = com_err_hook;
+    com_err_hook = default_com_err_proc;
+    return x;
+}

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.h?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.h (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.h Mon Feb  9 12:49:22 2009
@@ -1,0 +1,108 @@
+/* 
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: com_err.h,v 1.2 2008/03/24 18:53:40 murch Exp $
+ */
+
+/*
+ * Header file for common error description library.
+ *
+ * Copyright 1988, Student Information Processing Board of the
+ * Massachusetts Institute of Technology.
+ *
+ * Copyright 1995 by Cygnus Support.
+ *
+ * For copyright and distribution info, see the documentation supplied
+ * with this package.
+ */
+
+#ifndef __COM_ERR_H
+
+#ifndef HAVE_STDARG_H
+/* End-user programs may need this -- oh well */
+#if defined(__STDC__) || defined(_WINDOWS)
+#define HAVE_STDARG_H 1
+#endif
+#endif
+
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include "error_table.h"
+
+/* This should be part of k5-config.h but many application
+ * programs are not including that file. We probably want to
+ * come up with a better way of handling this problem.
+ */
+#ifndef INTERFACE
+#ifdef _WINDOWS
+#define INTERFACE   __far __export __pascal
+#define INTERFACE_C __far __export __cdecl
+#else
+#define INTERFACE
+#define INTERFACE_C
+#endif
+#endif
+#ifndef FAR
+#define FAR
+#endif
+
+#if defined(__STDC__) || defined(_WINDOWS)
+/* ANSI C -- use prototypes etc */
+extern void INTERFACE_C com_err (const char FAR *, long, const char FAR *, ...);
+extern char const FAR * INTERFACE error_message (long);
+extern void (*com_err_hook) (const char *, long, const char *, va_list);
+extern void (*set_com_err_hook (void (*) (const char *, long, const char *, va_list)))
+    (const char *, long, const char *, va_list);
+extern void (*reset_com_err_hook ()) (const char *, long, const char *, va_list);
+#else
+/* no prototypes */
+extern void INTERFACE_C com_err ();
+extern char * INTERFACE error_message ();
+extern void (*com_err_hook) ();
+extern void (*set_com_err_hook ()) ();
+extern void (*reset_com_err_hook ()) ();
+#endif
+
+#define __COM_ERR_H
+#endif /* ! defined(__COM_ERR_H) */

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.texinfo
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.texinfo?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.texinfo (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/com_err.texinfo Mon Feb  9 12:49:22 2009
@@ -1,0 +1,554 @@
+\input texinfo @c -*-texinfo-*-
+
+ at c $Header: /cvs/src/cyrus/com_err/et/com_err.texinfo,v 1.1 2007/10/17 20:06:32 murch Exp $
+ at c $Source: /cvs/src/cyrus/com_err/et/com_err.texinfo,v $
+ at c $Locker:  $
+
+ at c Note that although this source file is in texinfo format (more
+ at c or less), it is not yet suitable for turning into an ``info''
+ at c file.  Sorry, maybe next time.
+ at c
+ at c In order to produce hardcopy documentation from a texinfo file,
+ at c run ``tex com_err.texinfo'' which will load in texinfo.tex,
+ at c provided in this distribution.  (texinfo.tex is from the Free
+ at c Software Foundation, and is under different copyright restrictions
+ at c from the rest of this package.)
+
+ at ifinfo
+ at barfo
+ at end ifinfo
+
+ at iftex
+ at tolerance 10000
+
+ at c Mutate section headers...
+ at begingroup
+  @catcode#=6
+  @gdef at secheading#1#2#3{@secheadingi {#3 at enspace #1}}
+ at endgroup
+ at end iftex
+
+ at setfilename com_err
+ at settitle A Common Error Description Library for UNIX
+
+ at ifinfo
+This file documents the use of the Common Error Description library.
+
+Copyright (C) 1987, 1988 Student Information Processing Board of the
+Massachusetts Institute of Technology.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
+used in advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.  M.I.T. and the M.I.T. S.I.P.B.
+make no representations about the suitability of this software for any
+purpose.  It is provided "as is" without express or implied warranty.
+
+Note that the file texinfo.tex, provided with this distribution, is from
+the Free Software Foundation, and is under different copyright restrictions
+from the remainder of this package.
+
+ at end ifinfo
+
+ at ignore
+Permission is granted to process this file through Tex and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual).
+
+ at end ignore
+
+ at setchapternewpage odd
+
+ at titlepage
+ at center @titlefont{A Common Error Description}
+ at center @titlefont{Library for UNIX}
+ at sp 2
+ at center Ken Raeburn
+ at center Bill Sommerfeld
+ at sp 1
+ at center MIT Student Information Processing Board
+ at sp 3
+ at center last updated 1 January 1989
+ at center for version 1.2
+ at center ***DRAFT COPY ONLY***
+
+ at vskip 2in
+
+ at center @b{Abstract}
+
+UNIX has always had a clean and simple system call interface, with a
+standard set of error codes passed between the kernel and user
+programs.  Unfortunately, the same cannot be said of many of the
+libraries layered on top of the primitives provided by the kernel.
+Typically, each one has used a different style of indicating errors to
+their callers, leading to a total hodgepodge of error handling, and
+considerable amounts of work for the programmer.  This paper describes
+a library and associated utilities which allows a more uniform way for
+libraries to return errors to their callers, and for programs to
+describe errors and exceptional conditions to their users.
+
+ at page
+ at vskip 0pt plus 1filll
+
+Copyright @copyright{} 1987, 1988 by the Student Information Processing
+Board of the Massachusetts Institute of Technology.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
+used in advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.  M.I.T. and the M.I.T. S.I.P.B.
+make no representations about the suitability of this software for any
+purpose.  It is provided "as is" without express or implied warranty.
+
+Note that the file texinfo.tex, provided with this distribution, is from
+the Free Software Foundation, and is under different copyright restrictions
+from the remainder of this package.
+
+ at end titlepage
+
+ at ifinfo
+ at c should put a menu here someday....
+ at end ifinfo
+
+ at page
+
+ at section Why com_err?
+
+In building application software packages, a programmer often has to
+deal with a number of libraries, each of which can use a different
+error-reporting mechanism.  Sometimes one of two values is returned,
+indicating simply SUCCESS or FAILURE, with no description of errors
+encountered.  Sometimes it is an index into a table of text strings,
+where the name of the table used is dependent on the library being
+used when the error is generated; since each table starts numbering at
+0 or 1, additional information as to the source of the error code is
+needed to determine which table to look at.  Sometimes no text messages are
+supplied at all, and the programmer must supply them at any point at which
+he may wish to report error conditions.
+Often, a global variable is assigned some value describing the error, but
+the programmer has to know in each case whether to look at @code{errno},
+ at code{h_errno}, the return value from @code{hes_err()}, or whatever other
+variables or routines are specified.
+And what happens if something
+in the procedure of
+examining or reporting the error changes the same variable?
+
+The package we have developed is an attempt to present a common
+error-handling mechanism to manipulate the most common form of error code
+in a fashion that does not have the problems listed above.
+
+A list of up to 256 text messages is supplied to a translator we have
+written, along with the three- to four-character ``name'' of the error
+table.  The library using this error table need only call a routine
+generated from this error-table source to make the table ``known'' to the
+com_err library, and any error code the library generates can be converted
+to the corresponding error message.  There is also a default format for
+error codes accidentally returned before making the table known, which is
+of the form @samp{unknown code foo 32}, where @samp{foo} would be the name
+of the table.
+
+ at section Error codes
+
+Error codes themselves are 32 bit (signed) integers, of which the high
+order 24 bits are an identifier of which error table the error code is
+from, and the low order 8 bits are a sequential error number within
+the table.  An error code may thus be easily decomposed into its component
+parts.  Only the lowest 32 bits of an error code are considered significant
+on systems which support wider values.
+
+Error table 0 is defined to match the UNIX system call error table
+(@code{sys_errlist}); this allows @code{errno} values to be used directly
+in the library (assuming that @code{errno} is of a type with the same width
+as @t{long}).  Other error table numbers are formed by compacting together
+the first four characters of the error table name.  The mapping between
+characters in the name and numeric values in the error code are defined in
+a system-independent fashion, so that two systems that can pass integral
+values between them can reliably pass error codes without loss of meaning;
+this should work even if the character sets used are not the same.
+(However, if this is to be done, error table 0 should be avoided, since the
+local system call error tables may differ.)
+
+Any variable which is to contain an error code should be declared @t{long}.
+The draft proposed American National Standard for C (as of May, 1988)
+requires that @t{long} variables be at least 32 bits; any system which does
+not support 32-bit @t{long} values cannot make use of this package (nor
+much other software that assumes an ANSI-C environment base) without
+significant effort.
+
+ at section Error table source file
+
+The error table source file begins with the declaration of the table name,
+as
+
+ at example
+error_table @var{tablename}
+ at end example
+
+Individual error codes are
+specified with
+
+ at example
+error_code @var{ERROR_NAME}, @var{"text message"}
+ at end example
+
+where @samp{ec} can also be used as a short form of @samp{error_code}.  To
+indicate the end of the table, use @samp{end}.  Thus, a (short) sample
+error table might be:
+
+ at example
+
+        error_table     dsc
+
+        error_code      DSC_DUP_MTG_NAME,
+                        "Meeting already exists"
+
+        ec              DSC_BAD_PATH,
+                        "A bad meeting pathname was given"
+
+        ec              DSC_BAD_MODES,
+                        "Invalid mode for this access control list"
+
+        end
+
+ at end example
+
+ at section The error-table compiler
+
+The error table compiler is named @code{compile_et}.  It takes one
+argument, the pathname of a file (ending in @samp{.et}, e.g.,
+ at samp{dsc_err.et}) containing an error table source file.  It parses the
+error table, and generates two output files -- a C header file
+(@samp{discuss_err.h}) which contains definitions of the numerical values
+of the error codes defined in the error table, and a C source file which
+should be compiled and linked with the executable.  The header file must be
+included in the source of a module which wishes to reference the error
+codes defined; the object module generated from the C code may be linked in
+to a program which wishes to use the printed forms of the error codes.
+
+This translator accepts a @kbd{-language @var{lang}} argument, which
+determines for which language (or language variant) the output should be
+written.  At the moment, @var{lang} is currently limited to @kbd{ANSI-C}
+and @kbd{K&R-C}, and some abbreviated forms of each.  Eventually, this will
+be extended to include some support for C++.  The default is currently
+ at kbd{K&R-C}, though the generated sources will have ANSI-C code
+conditionalized on the symbol @t{__STDC__}.
+
+ at section Run-time support routines
+
+Any source file which uses the routines supplied with or produced by the
+com_err package should include the header file @file{<com_err.h>}.  It
+contains declarations and definitions which may be needed on some systems.
+(Some functions cannot be referenced properly without the return type
+declarations in this file.  Some functions may work properly on most
+architectures even without the header file, but relying on this is not
+recommended.)
+
+The run-time support routines and variables provided via this package
+include the following:
+
+ at example
+void initialize_ at var{xxxx}_error_table (void);
+ at end example
+
+One of these routines is built by the error compiler for each error table.
+It makes the @var{xxxx} error table ``known'' to the error reporting
+system.  By convention, this routine should be called in the initialization
+routine of the @var{xxxx} library.  If the library has no initialization
+routine, some combination of routines which form the core of the library
+should ensure that this routine is called.  It is not advised to leave it
+the caller to make this call.
+
+There is no harm in calling this routine more than once.
+
+ at example
+#define ERROR_TABLE_BASE_ at var{xxxx} @var{nnnnn}L
+ at end example
+
+This symbol contains the value of the first error code entry in the
+specified table.
+This rarely needs be used by the
+programmer.
+
+ at example
+const char *error_message (long code);
+ at end example
+
+This routine returns the character string error message associated
+with @code{code}; if this is associated with an unknown error table, or
+if the code is associated with a known error table but the code is not
+in the table, a string of the form @samp{Unknown code @var{xxxx nn}} is
+returned, where @var{xxxx} is the error table name produced by
+reversing the compaction performed on the error table number implied
+by that error code, and @var{nn} is the offset from that base value.
+
+Although this routine is available for use when needed, its use should be
+left to circumstances which render @code{com_err} (below) unusable.
+
+ at example
+void com_err (const char *whoami,  /* module reporting error */
+              long code,           /* error code */
+              const char *format,  /* format for additional detail */
+              ...);                /*  (extra parameters) */
+ at end example
+
+This routine provides an alternate way to print error messages to
+standard error; it allows the error message to be passed in as a
+parameter, rather than in an external variable.  @emph{Provide grammatical
+context for ``message.''}
+
+If @var{format} is @code{(char *)NULL}, the formatted message will not be
+printed.  @var{format} may not be omitted.
+
+ at example
+#include <stdarg.h>
+
+void com_err_va (const char *whoami,
+                 long code,
+                 const char *format,
+                 va_list args);
+ at end example
+
+This routine provides an interface, equivalent to @code{com_err} above,
+which may be used by higher-level variadic functions (functions which
+accept variable numbers of arguments).
+
+ at example
+#include <stdarg.h>
+
+void (*set_com_err_hook (void (*proc) ())) ();
+
+void (*@var{proc}) (const char *whoami, long code, va_list args);
+
+void reset_com_err_hook ();
+ at end example
+
+These two routines allow a routine to be dynamically substituted for
+ at samp{com_err}.  After @samp{set_com_err_hook} has been called,
+calls to @samp{com_err} will turn into calls to the new hook routine.
+ at samp{reset_com_err_hook} turns off this hook.  This may intended to
+be used in daemons (to use a routine which calls @var{syslog(3)}), or
+in a window system application (which could pop up a dialogue box).
+
+If a program is to be used in an environment in which simply printing
+messages to the @code{stderr} stream would be inappropriate (such as in a
+daemon program which runs without a terminal attached),
+ at code{set_com_err_hook} may be used to redirect output from @code{com_err}.
+The following is an example of an error handler which uses @var{syslog(3)}
+as supplied in BSD 4.3:
+
+ at example
+#include <stdio.h>
+#include <stdarg.h>
+#include <syslog.h>
+
+/* extern openlog (const char * name, int logopt, int facility); */
+/* extern syslog (int priority, char * message, ...); */
+
+void hook (const char * whoami, long code,
+           const char * format, va_list args)
+@{
+    char buffer[BUFSIZ];
+    static int initialized = 0;
+    if (!initialized) @{
+        openlog (whoami,
+                 LOG_NOWAIT|LOG_CONS|LOG_PID|LOG_NDELAY,
+                 LOG_DAEMON);
+        initialized = 1;
+    @}
+    vsprintf (buffer, format, args);
+    syslog (LOG_ERR, "%s %s", error_message (code), buffer);
+@}
+ at end example
+
+After making the call
+ at code{set_com_err_hook (hook);},
+any calls to @code{com_err} will result in messages being sent to the
+ at var{syslogd} daemon for logging.
+The name of the program, @samp{whoami}, is supplied to the
+ at samp{openlog()} call, and the message is formatted into a buffer and
+passed to @code{syslog}.
+
+Note that since the extra arguments to @code{com_err} are passed by
+reference via the @code{va_list} value @code{args}, the hook routine may
+place any form of interpretation on them, including ignoring them.  For
+consistency, @code{printf}-style interpretation is suggested, via
+ at code{vsprintf} (or @code{_doprnt} on BSD systems without full support for
+the ANSI C library).
+
+ at section Coding Conventions
+
+The following conventions are just some general stylistic conventions
+to follow when writing robust libraries and programs.  Conventions
+similar to this are generally followed inside the UNIX kernel and most
+routines in the Multics operating system.  In general, a routine
+either succeeds (returning a zero error code, and doing some side
+effects in the process), or it fails, doing minimal side effects; in
+any event, any invariant which the library assumes must be maintained.
+
+In general, it is not in the domain of non user-interface library
+routines to write error messages to the user's terminal, or halt the
+process.  Such forms of ``error handling'' should be reserved for
+failures of internal invariants and consistancy checks only, as it
+provides the user of the library no way to clean up for himself in the
+event of total failure.
+
+Library routines which can fail should be set up to return an error
+code.  This should usually be done as the return value of the
+function; if this is not acceptable, the routine should return a
+``null'' value, and put the error code into a parameter passed by
+reference.
+
+Routines which use the first style of interface can be used from
+user-interface levels of a program as follows:
+
+ at example
+@{
+    if ((code = initialize_world(getuid(), random())) != 0) @{
+        com_err("demo", code,
+                "when trying to initialize world");
+        exit(1);
+    @}
+    if ((database = open_database("my_secrets", &code))==NULL) @{
+        com_err("demo", code,
+                "while opening my_secrets");
+        exit(1);
+    @}
+@}
+ at end example
+
+A caller which fails to check the return status is in error.  It is
+possible to look for code which ignores error returns by using lint;
+look for error messages of the form ``foobar returns value which is
+sometimes ignored'' or ``foobar returns value which is always
+ignored.''
+
+Since libraries may be built out of other libraries, it is often necessary
+for the success of one routine to depend on another.  When a lower level
+routine returns an error code, the middle level routine has a few possible
+options.  It can simply return the error code to its caller after doing
+some form of cleanup, it can substitute one of its own, or it can take
+corrective action of its own and continue normally.  For instance, a
+library routine which makes a ``connect'' system call to make a network
+connection may reflect the system error code @code{ECONNREFUSED}
+(Connection refused) to its caller, or it may return a ``server not
+available, try again later,'' or it may try a different server.
+
+Cleanup which is typically necessary may include, but not be limited
+to, freeing allocated memory which will not be needed any more,
+unlocking concurrancy locks, dropping reference counts, closing file
+descriptors, or otherwise undoing anything which the procedure did up
+to this point.  When there are a lot of things which can go wrong, it
+is generally good to write one block of error-handling code which is
+branched to, using a goto, in the event of failure.  A common source
+of errors in UNIX programs is failing to close file descriptors on
+error returns; this leaves a number of ``zombied'' file descriptors
+open, which eventually causes the process to run out of file
+descriptors and fall over.
+
+ at example
+@{
+    FILE *f1=NULL, *f2=NULL, *f3=NULL;
+    int status = 0;
+
+    if ( (f1 = fopen(FILE1, "r")) == NULL) @{
+        status = errno;
+        goto error;
+    @}
+
+    /*
+     * Crunch for a while
+     */
+
+    if ( (f2 = fopen(FILE2, "w")) == NULL) @{
+        status = errno;
+        goto error;
+    @}
+
+    if ( (f3 = fopen(FILE3, "a+")) == NULL) @{
+        status = errno;
+            goto error;
+    @}
+
+    /*
+     * Do more processing.
+     */
+    fclose(f1);
+    fclose(f2);
+    fclose(f3);
+    return 0;
+
+error:
+    if (f1) fclose(f1);
+    if (f2) fclose(f2);
+    if (f3) fclose(f3);
+    return status;
+@}
+ at end example
+
+ at section Building and Installation
+
+The distribution of this package will probably be done as a compressed
+``tar''-format file available via anonymous FTP from SIPB.MIT.EDU.
+Retrieve @samp{pub/com_err.tar.Z} and extract the contents.  A subdirectory
+ at t{profiled} should be created to hold objects compiled for profiling.
+Running ``make all'' should then be sufficient to build the library and
+error-table compiler.  The files @samp{libcom_err.a},
+ at samp{libcom_err_p.a}, @samp{com_err.h}, and @samp{compile_et} should be
+installed for use; @samp{com_err.3} and @samp{compile_et.1} can also be
+installed as manual pages.
+
+Potential problems:
+
+ at itemize @bullet
+
+ at item Use of @code{strcasecmp}, a routine provided in BSD for
+case-insensitive string comparisons.  If an equivalent routine is
+available, you can modify @code{CFLAGS} in the makefile to define
+ at code{strcasecmp} to the name of that routine.
+
+ at item Compilers that defined @code{__STDC__} without providing the header
+file @code{<stdarg.h>}.  One such example is Metaware's High ``C''
+compiler, as provided at Project Athena on the IBM RT/PC workstation; if
+ at code{__HIGHC__} is defined, it is assumed that @code{<stdarg.h>} is not
+available, and therefore @code{<varargs.h>} must be used.  If the symbol
+ at code{VARARGS} is defined (e.g., in the makefile), @code{<varargs.h>} will
+be used.
+
+ at item If your linker rejects symbols that are simultaneously defined in two
+library files, edit @samp{Makefile} to remove @samp{perror.c} from the
+library.  This file contains a version of @var{perror(3)} which calls
+ at code{com_err} instead of calling @code{write} directly.
+
+ at end itemize
+
+As I do not have access to non-BSD systems, there are probably
+bugs present that may interfere with building or using this package on
+other systems.  If they are reported to me, they can probably be fixed for
+the next version.
+
+ at section Bug Reports
+
+Please send any comments or bug reports to the principal author: Ken
+Raeburn, @t{Raeburn@@Athena.MIT.EDU}.
+
+ at section Acknowledgements
+
+I would like to thank: Bill Sommerfeld, for his help with some of this
+documentation, and catching some of the bugs the first time around;
+Honeywell Information Systems, for not killing off the @emph{Multics}
+operating system before I had an opportunity to use it; Honeywell's
+customers, who persuaded them not to do so, for a while; Ted Anderson of
+CMU, for catching some problems before version 1.2 left the nest; Stan
+Zanarotti and several others of MIT's Student Information Processing Board,
+for getting us started with ``discuss,'' for which this package was
+originally written; and everyone I've talked into --- I mean, asked to read
+this document and the ``man'' pages.
+
+ at bye

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/compile_et.1
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/compile_et.1?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/compile_et.1 (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/compile_et.1 Mon Feb  9 12:49:22 2009
@@ -1,0 +1,119 @@
+.\"
+.\" Copyright (c) 1994-2008 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 legal
+.\"    details, please contact
+.\"      Carnegie Mellon University
+.\"      Center for Technology Transfer and Enterprise Creation
+.\"      4615 Forbes Avenue
+.\"      Suite 302
+.\"      Pittsburgh, PA  15213
+.\"      (412) 268-7393, fax: (412) 268-7395
+.\"      innovation at 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.
+.\"
+.\" $Id: compile_et.1,v 1.2 2008/03/24 18:53:40 murch Exp $
+.\" 
+.\" Copyright (c) 1988 Massachusetts Institute of Technology,
+.\" Student Information Processing Board.  All rights reserved.
+.\"
+.TH COMPILE_ET 1 "22 Nov 1988" SIPB
+.SH NAME
+compile_et \- error table compiler
+.SH SYNOPSIS
+.B compile_et
+file
+.SH DESCRIPTION
+.B Compile_et
+converts a table listing error-code names and associated messages into
+a C source file suitable for use with the
+.IR com_err (3)
+library.
+
+The source file name must end with a suffix of ``.et''; the file
+consists of a declaration supplying the name (up to four characters
+long) of the error-code table:
+
+.B error_table
+.I name
+
+followed by up to 256 entries of the form:
+
+.B error_code
+.I name,
+"
+.I string
+"
+
+and a final
+
+.B end
+
+to indicate the end of the table.
+
+The name of the table is used to construct the name of a subroutine
+.I initialize_XXXX_error_table
+which must be called in order for the
+.I com_err
+library to recognize the error table.
+
+The various error codes defined are assigned sequentially increasing
+numbers (starting with a large number computed as a hash function of
+the name of the table); thus for compatibility it is suggested that
+new codes be added only to the end of an existing table, and that no
+codes be removed from tables.
+
+The names defined in the table are placed into a C header file with
+preprocessor directives defining them as integer constants of up to
+32 bits in magnitude.
+
+A C source file is also generated which should be compiled and linked
+with the object files which reference these error codes; it contains
+the text of the messages and the initialization subroutine.  Both C
+files have names derived from that of the original source file, with
+the ``.et'' suffix replaced by ``.c'' and ``.h''.
+
+A ``#'' in the source file is treated as a comment character, and all
+remaining text to the end of the source line will be ignored.
+
+.SH BUGS
+
+Since
+.B compile_et
+uses a very simple parser based on
+.IR yacc (1),
+its error recovery leaves much to be desired.
+
+.\" .IR for manual entries
+.\" .PP for paragraph breaks
+
+.SH "SEE ALSO"
+com_err (3).
+
+Ken Raeburn, "A Common Error Description Library for UNIX".

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/compile_et.sh
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/compile_et.sh?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/compile_et.sh (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/compile_et.sh Mon Feb  9 12:49:22 2009
@@ -1,0 +1,51 @@
+#!/bin/sh
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: compile_et.sh,v 1.2 2008/03/24 18:53:40 murch Exp $
+
+AWK=@AWK@
+DIR=@DIR@
+
+ROOT=`echo $1 | sed -e s/.et$//`
+BASE=`echo $ROOT | sed -e 's;.*/;;'`
+
+$AWK -f ${DIR}/et_h.awk outfile=${BASE}.h $ROOT.et
+$AWK -f ${DIR}/et_c.awk outfile=${BASE}.c $ROOT.et

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/config_script
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/config_script?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/config_script (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/config_script Mon Feb  9 12:49:22 2009
@@ -1,0 +1,66 @@
+#!/bin/sh
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: config_script,v 1.3 2008/04/04 12:46:34 murch Exp $
+#
+# This program takes a shell script and configures for the following
+# variables:	@DIR@
+#		@AWK@
+#		@SED@
+#
+# Usage: config_script <filename> [<awk>] [<sed>]
+#
+
+FILE=$1
+AWK=$2
+SED=$3
+
+# Grr.... not all Unix's have the dirname command
+TMP=`echo  $1 | sed -e 's;[^/]*$;;' -e 's/^$/./'`
+DIR=`cd ${TMP}; pwd`
+
+if test "${AWK}x" = "x" ; then
+	AWK=awk
+fi
+if test "${SED}x" = "x" ; then
+	SED=sed
+fi
+sed -e "s;@DIR@;${DIR};" -e "s;@AWK@;${AWK};" -e "s;@SED@;${SED};" $FILE

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/error_message.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/error_message.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/error_message.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/error_message.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,118 @@
+/* error_message.c
+ *
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: error_message.c,v 1.2 2008/03/24 18:53:40 murch Exp $
+ *
+ * Copyright 1987 by the Student Information Processing Board
+ * of the Massachusetts Institute of Technology
+ *
+ * For copyright info, see "mit-sipb-copyright.h".
+ */
+
+#define IN_COM_ERR
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "error_table.h"
+#include "mit-sipb-copyright.h"
+#include "internal.h"
+
+static const char copyright[] =
+    "Copyright 1986, 1987, 1988 by the Student Information Processing Board\nand the department of Information Systems\nof the Massachusetts Institute of Technology";
+
+static char buffer[25];
+
+extern struct et_list * _et_list;
+
+const char * INTERFACE error_message (code)
+long code;
+{
+    int offset;
+    long l_offset;
+    struct et_list *et;
+    long table_num;
+    int started = 0;
+    char *cp;
+
+    l_offset = code & ((1<<ERRCODE_RANGE)-1);
+    offset = (int) l_offset;
+    table_num = code - l_offset;
+    if (!table_num) {
+#ifdef HAS_STRERROR
+	return strerror (offset);
+#else
+        if (offset < sys_nerr)
+	    return(sys_errlist[offset]);
+	else
+	    goto oops;
+#endif
+    }
+    for (et = _et_list; et; et = et->next) {
+	if (et->table->base == table_num) {
+	    /* This is the right table */
+	    if (et->table->n_msgs <= offset)
+		goto oops;
+	    return(et->table->msgs[offset]);
+	}
+    }
+oops:
+    strcpy (buffer, "Unknown code ");
+    if (table_num) {
+	strcat (buffer, error_table_name (table_num));
+	strcat (buffer, " ");
+    }
+    for (cp = buffer; *cp; cp++)
+	;
+    if (offset >= 100) {
+	*cp++ = '0' + offset / 100;
+	offset %= 100;
+	started++;
+    }
+    if (started || offset >= 10) {
+	*cp++ = '0' + offset / 10;
+	offset %= 10;
+    }
+    *cp++ = '0' + offset;
+    *cp = '\0';
+    return(buffer);
+}

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/error_table.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/error_table.h?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/error_table.h (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/error_table.h Mon Feb  9 12:49:22 2009
@@ -1,0 +1,90 @@
+/*
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: error_table.h,v 1.2 2008/03/24 18:53:40 murch Exp $
+ *
+ * Copyright 1988 by the Student Information Processing Board of the
+ * Massachusetts Institute of Technology.
+ *
+ * For copyright info, see mit-sipb-copyright.h.
+ */
+
+#ifndef _ET_H
+
+/* This directory doesn't really know about the krb5 world. The following
+   windows defines are usually hidden in k5-config.h. For now I'll just
+   place here what is needed from that file. Later we may decide to do
+   it differently.
+*/
+#ifdef _WINDOWS
+#define INTERFACE             __far __export __pascal
+#define INTERFACE_C           __far __export __cdecl
+#define sys_nerr              _sys_nerr
+#define sys_errlist           _sys_errlist
+int __far __pascal MessageBox (void __far *, const char __far*, const char __far*, unsigned int);
+#define MB_ICONEXCLAMATION    0x0030
+#else
+#define INTERFACE
+#define INTERFACE_C
+extern int errno;
+#endif
+
+struct error_table {
+    char const * const * msgs;
+    long base;
+    int n_msgs;
+};
+struct et_list {
+    struct et_list *next;
+    const struct error_table *table;
+};
+extern struct et_list * _et_list;
+
+#define	ERRCODE_RANGE	8	/* # of bits to shift table number */
+#define	BITS_PER_CHAR	6	/* # bits to shift per character in name */
+
+#if defined(__STDC__) || defined(KRB5_PROVIDE_PROTOTYPES) || defined(_WINDOWS)
+extern const char *error_table_name (long);
+#else 
+extern const char *error_table_name ();
+#endif
+
+#define _ET_H
+#endif

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_c.awk
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_c.awk?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_c.awk (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_c.awk Mon Feb  9 12:49:22 2009
@@ -1,0 +1,183 @@
+BEGIN { 
+char_shift=64
+## "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
+c2n["A"]=1
+c2n["B"]=2
+c2n["C"]=3
+c2n["D"]=4
+c2n["E"]=5
+c2n["F"]=6
+c2n["G"]=7
+c2n["H"]=8
+c2n["I"]=9
+c2n["J"]=10
+c2n["K"]=11
+c2n["L"]=12
+c2n["M"]=13
+c2n["N"]=14
+c2n["O"]=15
+c2n["P"]=16
+c2n["Q"]=17
+c2n["R"]=18
+c2n["S"]=19
+c2n["T"]=20
+c2n["U"]=21
+c2n["V"]=22
+c2n["W"]=23
+c2n["X"]=24
+c2n["Y"]=25
+c2n["Z"]=26
+c2n["a"]=27
+c2n["b"]=28
+c2n["c"]=29
+c2n["d"]=30
+c2n["e"]=31
+c2n["f"]=32
+c2n["g"]=33
+c2n["h"]=34
+c2n["i"]=35
+c2n["j"]=36
+c2n["k"]=37
+c2n["l"]=38
+c2n["m"]=39
+c2n["n"]=40
+c2n["o"]=41
+c2n["p"]=42
+c2n["q"]=43
+c2n["r"]=44
+c2n["s"]=45
+c2n["t"]=46
+c2n["u"]=47
+c2n["v"]=48
+c2n["w"]=49
+c2n["x"]=50
+c2n["y"]=51
+c2n["z"]=52
+c2n["0"]=53
+c2n["1"]=54
+c2n["2"]=55
+c2n["3"]=56
+c2n["4"]=57
+c2n["5"]=58
+c2n["6"]=59
+c2n["7"]=60
+c2n["8"]=61
+c2n["9"]=62
+c2n["_"]=63
+}
+/^#/ { next }
+/^[ \t]*(error_table|et)[ \t]+[a-zA-Z][a-zA-Z0-9_]+/ {
+	table_number = 0
+	table_name = $2
+	mod_base = 1000000
+	for(i=1; i<=length(table_name); i++) {
+	    table_number=(table_number*char_shift)+c2n[substr(table_name,i,1)]
+	}
+
+	# We start playing *_high, *low games here because the some
+	# awk programs do not have the necessary precision (sigh)
+	tab_base_low = table_number % mod_base
+	tab_base_high = int(table_number / mod_base)
+	tab_base_sign = 1;
+
+	# figure out: table_number_base=table_number*256
+	tab_base_low = tab_base_low * 256
+	tab_base_high = (tab_base_high * 256) + \
+			int(tab_base_low / mod_base)
+	tab_base_low = tab_base_low % mod_base
+
+	if (table_number > 128*256*256) {
+		# figure out:  table_number_base -= 256*256*256*256
+		# sub_high, sub_low is 256*256*256*256
+		sub_low = 256*256*256 % mod_base
+		sub_high = int(256*256*256 / mod_base)
+
+		sub_low = sub_low * 256
+		sub_high = (sub_high * 256) + int(sub_low / mod_base)
+		sub_low = sub_low % mod_base
+
+		tab_base_low = sub_low - tab_base_low;
+		tab_base_high = sub_high - tab_base_high;
+		tab_base_sign = -1;
+		if (tab_base_low < 0) {
+			tab_base_low = tab_base_low + mod_base
+			tab_base_high--
+		}
+	}
+	print "/*" > outfile
+	print " * " outfile ":" > outfile
+	print " * This file is automatically generated; please do not edit it." > outfile
+	print " */" > outfile
+
+	print "#if defined(__STDC__) || defined(_WINDOWS)" > outfile
+	print "#define NOARGS void" > outfile
+	print "#else" > outfile
+	print "#define NOARGS" > outfile
+	print "#define const" > outfile
+	print "#endif" > outfile
+	print "" > outfile
+	print "static const char * const text[] = {" > outfile
+	table_item_count = 0
+}
+
+/^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,[ \t]*$/ {
+	skipone=1
+	next
+}
+
+/^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,[ \t]*".*"[ \t]*$/ {
+	text=""
+	for (i=3; i<=NF; i++) { 
+	    text = text FS $i
+	}
+	text=substr(text,2,length(text)-1);
+	printf "\t%s,\n", text > outfile
+	table_item_count++
+}
+
+{ 
+	if (skipone) {
+	    printf "\t%s,\n", $0 > outfile
+	    table_item_count++
+	}
+	skipone=0
+}
+END {
+
+
+	print "    0" > outfile
+	print "};" > outfile
+	print "" > outfile
+	print "struct error_table {" > outfile
+	print "    char const * const * msgs;" > outfile
+	print "    long base;" > outfile
+	print "    int n_msgs;" > outfile
+	print "};" > outfile
+	print "struct et_list {" > outfile
+	print "    struct et_list *next;" > outfile
+	print "    const struct error_table * table;" > outfile
+	print "};" > outfile
+	print "extern struct et_list *_et_list;" > outfile
+	print "" > outfile
+	if (tab_base_high == 0) {
+	    print "static const struct error_table et = { text, " \
+		sprintf("%dL, %d };", tab_base_sign*tab_base_low, \
+		table_item_count) > outfile
+	} else {
+	    print "static const struct error_table et = { text, " \
+		sprintf("%d%06dL, %d };", tab_base_sign*tab_base_high, \
+		tab_base_low, table_item_count) > outfile
+	}
+	print "" > outfile
+	print "static struct et_list link = { 0, 0 };" > outfile
+	print "" > outfile
+	print "void initialize_" table_name "_error_table (NOARGS) {" > outfile
+	print "    if (!link.table) {" > outfile
+	print "        link.next = _et_list;" > outfile
+	print "        link.table = &et;" > outfile
+	print "        _et_list = &link;" > outfile
+	print "    }" > outfile
+	print "}" > outfile
+	
+
+}

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_h.awk
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_h.awk?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_h.awk (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_h.awk Mon Feb  9 12:49:22 2009
@@ -1,0 +1,150 @@
+BEGIN { 
+char_shift=64
+## "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
+c2n["A"]=1
+c2n["B"]=2
+c2n["C"]=3
+c2n["D"]=4
+c2n["E"]=5
+c2n["F"]=6
+c2n["G"]=7
+c2n["H"]=8
+c2n["I"]=9
+c2n["J"]=10
+c2n["K"]=11
+c2n["L"]=12
+c2n["M"]=13
+c2n["N"]=14
+c2n["O"]=15
+c2n["P"]=16
+c2n["Q"]=17
+c2n["R"]=18
+c2n["S"]=19
+c2n["T"]=20
+c2n["U"]=21
+c2n["V"]=22
+c2n["W"]=23
+c2n["X"]=24
+c2n["Y"]=25
+c2n["Z"]=26
+c2n["a"]=27
+c2n["b"]=28
+c2n["c"]=29
+c2n["d"]=30
+c2n["e"]=31
+c2n["f"]=32
+c2n["g"]=33
+c2n["h"]=34
+c2n["i"]=35
+c2n["j"]=36
+c2n["k"]=37
+c2n["l"]=38
+c2n["m"]=39
+c2n["n"]=40
+c2n["o"]=41
+c2n["p"]=42
+c2n["q"]=43
+c2n["r"]=44
+c2n["s"]=45
+c2n["t"]=46
+c2n["u"]=47
+c2n["v"]=48
+c2n["w"]=49
+c2n["x"]=50
+c2n["y"]=51
+c2n["z"]=52
+c2n["0"]=53
+c2n["1"]=54
+c2n["2"]=55
+c2n["3"]=56
+c2n["4"]=57
+c2n["5"]=58
+c2n["6"]=59
+c2n["7"]=60
+c2n["8"]=61
+c2n["9"]=62
+c2n["_"]=63
+}
+/^#/ { next }
+/^[ \t]*(error_table|et)[ \t]+[a-zA-Z][a-zA-Z0-9_]+/ {
+	table_number = 0
+	table_name = $2
+	mod_base = 1000000
+	for(i=1; i<=length(table_name); i++) {
+	    table_number=(table_number*char_shift)+c2n[substr(table_name,i,1)]
+	}
+	# We start playing *_high, *low games here because the some
+	# awk programs do not have the necessary precision (sigh)
+	tab_base_low = table_number % mod_base
+	tab_base_high = int(table_number / mod_base)
+	tab_base_sign = 1;
+
+	# figure out: table_number_base=table_number*256
+	tab_base_low = tab_base_low * 256
+	tab_base_high = (tab_base_high * 256) + \
+			int(tab_base_low / mod_base)
+	tab_base_low = tab_base_low % mod_base
+
+	if (table_number > 128*256*256) {
+		# figure out:  table_number_base -= 256*256*256*256
+		# sub_high, sub_low is 256*256*256*256
+		sub_low = 256*256*256 % mod_base
+		sub_high = int(256*256*256 / mod_base)
+
+		sub_low = sub_low * 256
+		sub_high = (sub_high * 256) + int(sub_low / mod_base)
+		sub_low = sub_low % mod_base
+
+		tab_base_low = sub_low - tab_base_low;
+		tab_base_high = sub_high - tab_base_high;
+		tab_base_sign = -1;
+		if (tab_base_low < 0) {
+			tab_base_low = tab_base_low + mod_base
+			tab_base_high--
+		}
+	}
+	curr_low = tab_base_low
+	curr_high = tab_base_high
+	curr_sign = tab_base_sign
+	print "/*" > outfile
+	print " * " outfile ":" > outfile
+	print " * This file is automatically generated; please do not edit it." > outfile
+	print " */" > outfile
+}
+
+/^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,/ {
+	tag=substr($2,1,length($2)-1)
+	if (curr_high == 0) {
+		printf "#define %-40s (%dL)\n", tag, \
+			curr_sign*curr_low > outfile
+	} else {
+		printf "#define %-40s (%d%06dL)\n", tag, curr_high*curr_sign, \
+			curr_low > outfile
+	}
+	curr_low += curr_sign;
+	if (curr_low >= mod_base) {
+		curr_low -= mod_base;
+		curr_high++
+	}
+	if (curr_low < 0) {
+		cur_low += mod_base
+		cur_high--
+	}
+}
+
+END {
+	print "extern void initialize_" table_name "_error_table ();" > outfile
+	if (tab_base_high == 0) {
+		print "#define ERROR_TABLE_BASE_" table_name " (" \
+			sprintf("%d", tab_base_sign*tab_base_low) \
+			"L)" > outfile
+	} else {
+		print "#define ERROR_TABLE_BASE_" table_name " (" \
+			sprintf("%d%06d", tab_base_sign*tab_base_high, \
+			tab_base_low) "L)" > outfile
+	}
+	print "" > outfile
+	print "/* for compatibility with older versions... */" > outfile
+	print "#define init_" table_name "_err_tbl initialize_" table_name "_error_table" > outfile
+	print "#define " table_name "_err_base ERROR_TABLE_BASE_" table_name > outfile
+}

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_name.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_name.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_name.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/et_name.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,82 @@
+/*
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: et_name.c,v 1.2 2008/03/24 18:53:40 murch Exp $
+ *
+ * Copyright 1987 by MIT Student Information Processing Board
+ *
+ * For copyright info, see mit-sipb-copyright.h.
+ */
+
+#include "error_table.h"
+#include "mit-sipb-copyright.h"
+#include "internal.h"
+
+#ifndef	lint
+static const char copyright[] =
+    "Copyright 1987,1988 by Student Information Processing Board, Massachusetts Institute of Technology";
+#endif
+
+static const char char_set[] =
+	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
+
+static char buf[6];
+
+const char * error_table_name (num)
+    long num;
+{
+    long ch;
+    int i;
+    char *p;
+
+    /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */
+    p = buf;
+    num >>= ERRCODE_RANGE;
+    /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */
+    num &= 077777777;
+    /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */
+    for (i = 4; i >= 0; i--) {
+	ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1);
+	if (ch != 0)
+	    *p++ = char_set[ch-1];
+    }
+    *p = '\0';
+    return(buf);
+}

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/init_et.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/init_et.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/init_et.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/init_et.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,83 @@
+/* init_et.c
+ *
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: init_et.c,v 1.2 2008/03/24 18:53:40 murch Exp $
+ *
+ * Copyright 1986, 1987, 1988 by MIT Information Systems and
+ *	the MIT Student Information Processing Board.
+ *
+ * For copyright info, see mit-sipb-copyright.h.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "error_table.h"
+#include "mit-sipb-copyright.h"
+
+struct foobar {
+    struct et_list etl;
+    struct error_table et;
+};
+
+extern struct et_list * _et_list;
+
+int init_error_table(msgs, base, count)
+    const char * const * msgs;
+    int base;
+    int count;
+{
+    struct foobar * new_et;
+
+    if (!base || !count || !msgs)
+	return 0;
+
+    new_et = (struct foobar *) malloc(sizeof(struct foobar));
+    if (!new_et)
+	return errno;	/* oops */
+    new_et->etl.table = &new_et->et;
+    new_et->et.msgs = msgs;
+    new_et->et.base = base;
+    new_et->et.n_msgs= count;
+
+    new_et->etl.next = _et_list;
+    _et_list = &new_et->etl;
+    return 0;
+}

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/internal.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/internal.h?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/internal.h (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/internal.h Mon Feb  9 12:49:22 2009
@@ -1,0 +1,56 @@
+/* internal include file for com_err package
+ *
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: internal.h,v 1.2 2008/03/24 18:53:40 murch Exp $
+ */
+
+#include "mit-sipb-copyright.h"
+
+#include <errno.h>
+
+#ifdef NEED_SYS_ERRLIST
+extern char const * const sys_errlist[];
+extern const int sys_nerr;
+#endif
+
+#if defined(__STDC__) && !defined(HDR_HAS_PERROR) && !defined(_WINDOWS)
+void perror (const char *);
+#endif

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/mit-sipb-copyright.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/mit-sipb-copyright.h?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/mit-sipb-copyright.h (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/mit-sipb-copyright.h Mon Feb  9 12:49:22 2009
@@ -1,0 +1,19 @@
+/*
+
+Copyright 1987, 1988 by the Student Information Processing Board
+	of the Massachusetts Institute of Technology
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is
+hereby granted, provided that the above copyright notice
+appear in all copies and that both that copyright notice and
+this permission notice appear in supporting documentation,
+and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
+used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+M.I.T. and the M.I.T. S.I.P.B. make no representations about
+the suitability of this software for any purpose.  It is
+provided "as is" without express or implied warranty.
+
+*/
+

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test1.et
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test1.et?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test1.et (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test1.et Mon Feb  9 12:49:22 2009
@@ -1,0 +1,69 @@
+	error_table	krb
+
+	error_code	KRB_MK_AP_TKFIL,
+			"Can't read ticket file"
+
+	ec		KRB_MK_AP_NOTKT,
+			"Can't find ticket or TGT"
+
+	ec		KRB_MK_AP_TGTEXP,
+			"TGT expired"
+
+	ec		KRB_RD_AP_UNDEC,
+			"Can't decode authenticator"
+
+	ec		KRB_RD_AP_EXP,
+			"Ticket expired"
+
+	ec		KRB_RD_AP_REPEAT,
+			"Repeated request"
+
+	ec		KRB_RD_AP_NOT_US,
+			"The ticket isn't for us"
+
+	ec		KRB_RD_AP_INCON,
+			"Request is inconsistent"
+
+	ec		KRB_RD_AP_TIME,
+			"Delta-T too big"
+
+	ec		KRB_RD_AP_BADD,
+			"Incorrect net address"
+
+	ec		KRB_RD_AP_VERSION,
+			"Protocol version mismatch"
+
+	ec		KRB_RD_AP_MSG_TYPE,
+			"Invalid message type"
+
+	ec		KRB_RD_AP_MODIFIED,
+			"Message stream modified"
+
+	ec		KRB_RD_AP_ORDER,
+			"Message out of order"
+
+	ec		KRB_RD_AP_UNAUTHOR,
+			"Unauthorized request"
+
+	ec		KRB_GT_PW_NULL,
+			"Current password is null"
+
+	ec		KRB_GT_PW_BADPW,
+			"Incorrect current password"
+
+	ec		KRB_GT_PW_PROT,
+			"Protocol error"
+
+	ec		KRB_GT_PW_KDCERR,
+			"Error returned by KDC"
+
+	ec		KRB_GT_PW_NULLTKT,
+			"Null ticket returned by KDC"
+
+	ec		KRB_SKDC_RETRY,
+			"Retry count exceeded"
+
+	ec		KRB_SKDC_CANT,
+			"Can't send request"
+
+	end

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test2.et
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test2.et?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test2.et (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test2.et Mon Feb  9 12:49:22 2009
@@ -1,0 +1,9 @@
+	error_table	quux
+
+	ec	FOO_ERR, "foo"
+
+	ec	BAR_ERR, "bar"
+
+	ec	BAZ_ERR, "meow"
+
+	end

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test_et.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test_et.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test_et.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/test_et.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,47 @@
+#include <stdio.h>
+#include <errno.h>
+#include "com_err.h"
+#include "test1.h"
+#include "test2.h"
+
+extern int sys_nerr, errno;
+
+main()
+{
+	printf("Before initiating error table:\n\n");
+	printf("Table name '%s'\n", error_table_name(KRB_MK_AP_TGTEXP));
+	printf("UNIX  name '%s'\n", error_table_name(EPERM));
+	printf("Msg TGT-expired is '%s'\n", error_message(KRB_MK_AP_TGTEXP));
+	printf("Msg EPERM is '%s'\n", error_message(EPERM));
+	printf("Msg FOO_ERR is '%s'\n", error_message(FOO_ERR));
+	printf("Msg {sys_nerr-1} is '%s'\n", error_message(sys_nerr-1));
+	printf("Msg {sys_nerr} is '%s'\n", error_message(sys_nerr));
+
+	printf("With 0: tgt-expired -> %s\n", error_message(KRB_MK_AP_TGTEXP));
+
+	initialize_krb_error_table();
+	printf("KRB error table initialized:  base %d (%s), name %s\n",
+	       ERROR_TABLE_BASE_krb, error_message(ERROR_TABLE_BASE_krb),
+	       error_table_name(ERROR_TABLE_BASE_krb));
+	initialize_krb_error_table();
+	printf("With krb: tgt-expired -> %s\n",
+	       error_message(KRB_MK_AP_TGTEXP));
+
+	initialize_quux_error_table();
+	printf("QUUX error table initialized: base %d (%s), name %s\n",
+	       ERROR_TABLE_BASE_quux, error_message(ERROR_TABLE_BASE_quux),
+	       error_table_name(ERROR_TABLE_BASE_quux));
+
+	printf("Msg for TGT-expired is '%s'\n",
+	       error_message(KRB_MK_AP_TGTEXP));
+	printf("Msg {sys_nerr-1} is '%s'\n", error_message(sys_nerr-1));
+	printf("Msg FOO_ERR is '%s'\n", error_message(FOO_ERR));
+	printf("Msg KRB_SKDC_CANT is '%s'\n",
+		    error_message(KRB_SKDC_CANT));
+	printf("Msg 1e6 (8B 64) is '%s'\n", error_message(1000000));
+	printf("\n\nCOM_ERR tests:\n");
+	com_err("whoami", FOO_ERR, (char *)NULL);
+	com_err("whoami", FOO_ERR, " -- message goes %s", "here");
+	com_err("whoami", 0, (char *)0);
+	com_err("whoami", 0, "error number %d\n", 0);
+}

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/texinfo.tex
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/texinfo.tex?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/texinfo.tex (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/com_err/et/texinfo.tex Mon Feb  9 12:49:22 2009
@@ -1,0 +1,2077 @@
+%% TeX macros to handle texinfo files
+
+%   Copyright (C) 1985, 1986, 1988 Richard M. Stallman
+
+%		       NO WARRANTY
+
+%  BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
+%NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
+%WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
+%RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
+%WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+%BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+%FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
+%AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
+%DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
+%CORRECTION.
+
+% IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
+%STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
+%WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
+%LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
+%OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+%USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
+%DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
+%A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
+%PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+%DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
+
+%		GENERAL PUBLIC LICENSE TO COPY
+
+%  1. You may copy and distribute verbatim copies of this source file
+%as you receive it, in any medium, provided that you conspicuously
+%and appropriately publish on each copy a valid copyright notice
+%"Copyright (C) 1986 Richard M. Stallman"; and include
+%following the copyright notice a verbatim copy of the above disclaimer
+%of warranty and of this License.
+
+%  2. You may modify your copy or copies of this source file or
+%any portion of it, and copy and distribute such modifications under
+%the terms of Paragraph 1 above, provided that you also do the following:
+
+%    a) cause the modified files to carry prominent notices stating
+%    that you changed the files and the date of any change; and
+
+%    b) cause the whole of any work that you distribute or publish,
+%    that in whole or in part contains or is a derivative of this
+%    program or any part thereof, to be licensed at no charge to all
+%    third parties on terms identical to those contained in this
+%    License Agreement (except that you may choose to grant more extensive
+%    warranty protection to some or all third parties, at your option).
+
+%    c) You may charge a distribution fee for the physical act of
+%    transferring a copy, and you may at your option offer warranty
+%    protection in exchange for a fee.
+
+%Mere aggregation of another unrelated program with this program (or its
+%derivative) on a volume of a storage or distribution medium does not bring
+%the other program under the scope of these terms.
+
+%  3. You may copy and distribute this program (or a portion or derivative
+%of it, under Paragraph 2) in object code or executable form under the terms
+%of Paragraphs 1 and 2 above provided that you also do one of the following:
+
+%    a) accompany it with the complete corresponding machine-readable
+%    source code, which must be distributed under the terms of
+%    Paragraphs 1 and 2 above; or,
+
+%    b) accompany it with a written offer, valid for at least three
+%    years, to give any third party free (except for a nominal
+%    shipping charge) a complete machine-readable copy of the
+%    corresponding source code, to be distributed under the terms of
+%    Paragraphs 1 and 2 above; or,
+
+%    c) accompany it with the information you received as to where the
+%    corresponding source code may be obtained.  (This alternative is
+%    allowed only for noncommercial distribution and only if you
+%    received the program in object code or executable form alone.)
+
+%For an executable file, complete source code means all the source code for
+%all modules it contains; but, as a special exception, it need not include
+%source code for modules which are standard libraries that accompany the
+%operating system on which the executable file runs.
+
+%  4. You may not copy, sublicense, distribute or transfer this program
+%except as expressly provided under this License Agreement.  Any attempt
+%otherwise to copy, sublicense, distribute or transfer this program is void and
+%your rights to use the program under this License agreement shall be
+%automatically terminated.  However, parties who have received computer
+%software programs from you with this License Agreement will not have
+%their licenses terminated so long as such parties remain in full compliance.
+
+%  5. If you wish to incorporate parts of this program into other free
+%programs whose distribution conditions are different, write to the Free
+%Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet
+%worked out a simple rule that can be stated here, but we will often permit
+%this.  We will be guided by the two goals of preserving the free status of
+%all derivatives of our free software and of promoting the sharing and reuse of
+%software.
+
+%In other words, you are welcome to use, share and improve this program.
+%You are forbidden to forbid anyone else to use, share and improve
+%what you give them.   Help stamp out software-hoarding!
+
+\def\texinfoversion{1.18}
+\message{Loading texinfo package [Version \texinfoversion]:}
+\message{}
+
+% Save some parts of plain tex whose names we will redefine.
+
+\let\ptexlbrace=\{
+\let\ptexrbrace=\}
+\let\ptexdot=\.
+\let\ptexstar=\*
+\let\ptexend=\end
+\let\ptexbullet=\bullet
+\let\ptexb=\b
+\let\ptexc=\c
+\let\ptexi=\i
+\let\ptext=\t
+\let\ptexl=\l
+\let\ptexL=\L
+
+\def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
+
+\message{Basics,}
+\chardef\other=12
+
+\hyphenation{ap-pen-dix}
+\hyphenation{mini-buf-fer mini-buf-fers}
+\hyphenation{eshell}
+
+% Margin to add to right of even pages, to left of odd pages.
+\newdimen \bindingoffset  \bindingoffset=0pt
+\newdimen \normaloffset   \normaloffset=\hoffset
+\newdimen\pagewidth \newdimen\pageheight
+\pagewidth=\hsize \pageheight=\vsize
+
+%---------------------Begin change-----------------------
+%
+% Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
+%
+\newdimen\cornerlong \newdimen\cornerthick
+\newdimen \topandbottommargin
+\newdimen \outerhsize \newdimen \outervsize
+\cornerlong=1pc\cornerthick=.3pt	% These set size of cropmarks
+\outerhsize=7in
+\outervsize=9.5in
+\topandbottommargin=.75in
+%
+%---------------------End change-----------------------
+
+% \onepageout takes a vbox as an argument.  Note that \pagecontents
+% does insertions itself, but you have to call it yourself.
+\chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
+\def\onepageout#1{\hoffset=\normaloffset
+\ifodd\pageno  \advance\hoffset by \bindingoffset
+\else \advance\hoffset by -\bindingoffset\fi
+\shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
+ {\let\hsize=\pagewidth \makefootline}}
+\advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
+
+
+% Here is a modification of the main output routine for Near East Publications
+% This provides right-angle cropmarks at all four corners.
+% The contents of the page are centerlined into the cropmarks,
+% and any desired binding offset is added as an \hskip on either
+% site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
+%
+\def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
+		 \shipout
+		 \vbox to \outervsize{\hsize=\outerhsize
+                 \vbox{\line{\ewtop\hfill\ewtop}}
+                 \nointerlineskip
+                 \line{\vbox{\moveleft\cornerthick\nstop}
+                       \hfill
+                       \vbox{\moveright\cornerthick\nstop}}
+                 \vskip \topandbottommargin
+                 \centerline{\ifodd\pageno\hskip\bindingoffset\fi
+			\vbox{
+			{\let\hsize=\pagewidth \makeheadline}
+			\pagebody{#1}
+			{\let\hsize=\pagewidth \makefootline}}
+			\ifodd\pageno\else\hskip\bindingoffset\fi}
+		 \vskip \topandbottommargin plus1fill minus1fill
+                 \boxmaxdepth\cornerthick
+                 \line{\vbox{\moveleft\cornerthick\nsbot}
+                       \hfill
+                       \vbox{\moveright\cornerthick\nsbot}}
+                 \nointerlineskip
+                 \vbox{\line{\ewbot\hfill\ewbot}}
+	}
+  \advancepageno 
+  \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
+%
+% Do @cropmarks to get crop marks
+\def\cropmarks{\let\onepageout=\croppageout }
+
+\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
+{\catcode`\@ =11
+\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
+\dimen@=\dp#1 \unvbox#1
+\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
+\ifr at ggedbottom \kern-\dimen@ \vfil \fi}
+}
+
+%
+% Here are the rules for the cropmarks.  Note that they are
+% offset so that the space between them is truly \outerhsize or \outervsize
+% (P. A. MacKay, 12 November, 1986)
+%
+\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
+\def\nstop{\vbox
+  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
+\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
+\def\nsbot{\vbox
+  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
+
+% Parse an argument, then pass it to #1.
+% The argument can be delimited with [...] or with "..." or braces
+% or it can be a whole line.
+% #1 should be a macro which expects
+% an ordinary undelimited TeX argument.
+
+\def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
+
+\def\parseargx{%
+\ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
+\aftergroup \parseargline %
+\fi \endgroup}
+
+{\obeyspaces %
+\gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
+
+\gdef\obeyedspace{\ }
+
+\def\parseargline{\begingroup \obeylines \parsearglinex}
+{\obeylines %
+\gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
+
+\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
+
+%% These are used to keep @begin/@end levels from running away
+%% Call \inENV within environments (after a \begingroup)
+\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
+\def\ENVcheck{%
+\ifENV\errmessage{Still within an environment.  Type Return to continue.}
+\endgroup\fi} % This is not perfect, but it should reduce lossage
+
+% @begin foo  is the same as @foo, for now.
+\newhelp\EMsimple{Type <Return> to continue}
+
+\outer\def\begin{\parsearg\beginxxx}
+
+\def\beginxxx #1{%
+\expandafter\ifx\csname #1\endcsname\relax
+{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
+\csname #1\endcsname\fi}
+
+%% @end foo executes the definition of \Efoo.
+%% foo can be delimited by doublequotes or brackets.
+
+\def\end{\parsearg\endxxx}
+
+\def\endxxx #1{%
+\expandafter\ifx\csname E#1\endcsname\relax
+\expandafter\ifx\csname #1\endcsname\relax
+\errmessage{Undefined command @end #1}\else
+\errorE{#1}\fi\fi
+\csname E#1\endcsname}
+\def\errorE#1{
+{\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
+
+% Single-spacing is done by various environments.
+
+\newskip\singlespaceskip \singlespaceskip = \baselineskip
+\def\singlespace{%
+{\advance \baselineskip by -\singlespaceskip
+\kern \baselineskip}%
+\baselineskip=\singlespaceskip
+}
+
+%% Simple single-character @ commands
+
+% @@ prints an @
+% Kludge this until the fonts are right (grr).
+\def\@{{\sf \char '100}}
+
+% Define @` and @' to be the same as ` and '
+% but suppressing ligatures.
+\def\`{{`}}
+\def\'{{'}}
+
+% Used to generate quoted braces.
+
+\def\mylbrace {{\tt \char '173}}
+\def\myrbrace {{\tt \char '175}}
+\let\{=\mylbrace
+\let\}=\myrbrace
+
+% @: forces normal size whitespace following.
+\def\:{\spacefactor=1000 }
+
+% @* forces a line break.
+\def\*{\hfil\break}
+
+% @. is an end-of-sentence period.
+\def\.{.\spacefactor=3000 }
+
+% @w prevents a word break
+\def\w #1{\hbox{#1}}
+
+% @group ... @end group  forces ... to be all on one page.
+
+\def\group{\begingroup% \inENV ???
+\def \Egroup{\egroup\endgroup}
+\vbox\bgroup}
+
+% @br   forces paragraph break
+
+\let\br = \par
+
+% @dots{}  output some dots
+
+\def\dots{$\ldots$}
+
+% @page    forces the start of a new page
+
+\def\page{\par\vfill\supereject}
+
+% @exdent text....
+% outputs text on separate line in roman font, starting at standard page margin
+
+\def\exdent{\errmessage{@exdent in filled text}}
+  % @lisp, etc, define \exdent locally from \internalexdent
+
+{\obeyspaces
+\gdef\internalexdent{\parsearg\exdentzzz}}
+
+\def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
+\advance \hsize by -\leftskip
+\advance \hsize by -\rightskip
+\leftline{{\rm#1}}}}
+
+% @include file    insert text of that file as input.
+
+\def\include{\parsearg\includezzz}
+\def\includezzz #1{{\def\thisfile{#1}\input #1
+}}
+
+\def\thisfile{}
+
+% @center line   outputs that line, centered
+
+\def\center{\parsearg\centerzzz}
+\def\centerzzz #1{{\advance\hsize by -\leftskip
+\advance\hsize by -\rightskip
+\centerline{#1}}}
+
+% @sp n   outputs n lines of vertical space
+
+\def\sp{\parsearg\spxxx}
+\def\spxxx #1{\par \vskip #1\baselineskip}
+
+% @comment ...line which is ignored...
+% @c is the same as @comment
+% @ignore ... @end ignore  is another way to write a comment
+
+\def\comment{\parsearg \commentxxx}
+
+\def\commentxxx #1{}
+
+\let\c=\comment
+
+\long\def\ignore #1\end ignore{}
+
+\outer\def\ifset{\parsearg\ifsetxxx}
+
+\def\ifsetxxx #1#2\end ifset{%
+\expandafter\ifx\csname IF#1\endcsname\relax \else #2\fi}
+
+\outer\def\ifclear{\parsearg\ifclearxxx}
+
+\def\ifclearxxx #1#2\end ifclear{%
+\expandafter\ifx\csname IF#1\endcsname\relax #2\fi}
+
+% Some texinfo constructs that are trivial in tex
+
+\def\iftex{}
+\def\Eiftex{}
+\long\def\ifinfo #1\end ifinfo{}
+\long\def\menu #1\end menu{}
+\def\asis#1{#1}
+
+\def\node{\parsearg\nodezzz}
+\def\nodezzz#1{\nodexxx [#1,]}
+\def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
+\let\lastnode=\relax
+
+\def\donoderef{\ifx\lastnode\relax\else
+\expandafter\expandafter\expandafter\setref{\lastnode}\fi
+\let\lastnode=\relax}
+
+\def\unnumbnoderef{\ifx\lastnode\relax\else
+\expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
+\let\lastnode=\relax}
+
+\let\refill=\relax
+
+\let\setfilename=\comment
+
+\def\inforef #1{\inforefzzz #1,,,,**}
+\def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}}, node `\losespace#1{}'}
+\def\losespace #1{#1}
+
+\message{fonts,}
+
+% Font-change commands.
+
+%% Try out Computer Modern fonts at \magstephalf
+\font\tenrm=cmr10 scaled \magstephalf
+\font\tentt=cmtt10 scaled \magstephalf
+% Instead of cmb10, you many want to use cmbx10.
+% cmbx10 is a prettier font on its own, but cmb10
+% looks better when embedded in a line with cmr10.
+\font\tenbf=cmb10 scaled \magstephalf 
+\font\tenit=cmti10 scaled \magstephalf
+\font\tensl=cmsl10 scaled \magstephalf
+\font\tensf=cmss10 scaled \magstephalf
+\def\li{\sf}
+\font\tensc=cmcsc10 scaled \magstephalf
+
+% Fonts for @defun, etc.
+\font\defbf=cmbx10 scaled \magstep1 %was 1314
+\let\deftt=\tentt
+\def\df{\let\tt=\deftt \defbf}
+
+% Font for title
+\font\titlerm = cmbx10 scaled \magstep5
+
+% Fonts for indices
+\font\indit=cmti9 \font\indrm=cmr9
+\def\indbf{\indrm} \def\indsl{\indit}
+\def\indexfonts{\let\it=\indit \let\sl=\indsl \let\bf=\indbf \let\rm=\indrm}
+
+% Fonts for headings
+\font\chaprm=cmbx10 scaled \magstep3
+\font\chapit=cmti10 scaled \magstep3
+\font\chapsl=cmsl10 scaled \magstep3
+\font\chaptt=cmtt10 scaled \magstep3
+\font\chapsf=cmss10 scaled \magstep3
+\let\chapbf=\chaprm
+
+\font\secrm=cmbx10 scaled \magstep2
+\font\secit=cmti10 scaled \magstep2
+\font\secsl=cmsl10 scaled \magstep2
+\font\sectt=cmtt10 scaled \magstep2
+\font\secsf=cmss10 scaled \magstep2
+\let\secbf=\secrm
+
+\font\ssecrm=cmbx10 scaled \magstep1
+\font\ssecit=cmti10 scaled \magstep1
+\font\ssecsl=cmsl10 scaled \magstep1
+\font\ssectt=cmtt10 scaled \magstep1
+\font\ssecsf=cmss10 scaled \magstep1
+\let\ssecbf=\ssecrm
+
+\def\textfonts{\let\rm=\tenrm\let\it=\tenit\let\sl=\tensl\let\bf=\tenbf%
+\let\sc=\tensc\let\sf=\tensf}
+\def\chapfonts{\let\rm=\chaprm\let\it=\chapit\let\sl=\chapsl\let\bf=\chapbf\let\tt=\chaptt\let\sf=\chapsf}
+\def\secfonts{\let\rm=\secrm\let\it=\secit\let\sl=\secsl\let\bf=\secbf\let\tt=\sectt\let\sf=\secsf}
+\def\subsecfonts{\let\rm=\ssecrm\let\it=\ssecit\let\sl=\ssecsl\let\bf=\ssecbf\let\tt=\ssectt\let\sf=\ssecsf}
+% Count depth in font-changes, for error checks
+\newcount\fontdepth \fontdepth=0
+
+%% Add scribe-like font environments, plus @l for inline lisp (usually sans
+%% serif) and @ii for TeX italic
+
+\def\i#1{{\sl #1}}
+\let\var=\i
+\let\dfn=\i
+\let\emph=\i
+\let\cite=\i
+
+\def\b#1{{\bf #1}}
+\let\strong=\b
+
+\def\t#1{{\tt \rawbackslash \frenchspacing #1}\null}
+\let\ttfont = \t
+\let\kbd=\t
+\let\code=\t
+\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
+\def\key #1{{\tt \uppercase{#1}}\null}
+\def\ctrl #1{{\tt \rawbackslash \hat}#1}
+
+\let\file=\samp
+
+\def\l#1{{\li #1}\null}
+
+\def\r#1{{\rm #1}}
+\def\s#1{{\sc #1}}
+\def\ii#1{{\it #1}}
+
+\def\titlefont#1{{\titlerm #1}}
+
+\def\titlepage{\begingroup \parindent=0pt \hbox{}%
+\let\oldpage=\page
+\def\page{\oldpage \hbox{}}}
+
+\def\Etitlepage{\endgroup\page\HEADINGSon}
+
+% Make altmode in file print out right
+
+\catcode `\^^[=\active \def^^[{$\diamondsuit$}
+
+\message{page headings,}
+
+%%% Set up page headings and footings.
+
+\let\thispage=\folio
+
+\newtoks \evenheadline    % Token sequence for heading line of even pages
+\newtoks \oddheadline     % Token sequence for heading line of odd pages
+\newtoks \evenfootline    % Token sequence for footing line of even pages
+\newtoks \oddfootline     % Token sequence for footing line of odd pages
+
+% Now make Tex use those variables
+\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}}
+\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}}
+
+% Commands to set those variables.
+% For example, this is what  @headings on  does
+% @evenheading @thistitle|@thispage|@thischapter
+% @oddheading @thischapter|@thispage|@thistitle
+% @evenfooting @thisfile||
+% @oddfooting ||@thisfile
+
+\def\evenheading{\parsearg\evenheadingxxx}
+\def\oddheading{\parsearg\oddheadingxxx}
+\def\everyheading{\parsearg\everyheadingxxx}
+
+\def\evenfooting{\parsearg\evenfootingxxx}
+\def\oddfooting{\parsearg\oddfootingxxx}
+\def\everyfooting{\parsearg\everyfootingxxx}
+
+{\catcode`\@=0 %
+
+\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
+\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
+\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
+\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
+\gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
+\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
+\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
+\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
+\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
+\gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
+\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
+\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+%
+}% unbind the catcode of @.
+
+% @headings on   turns them on.
+% @headings off  turns them off.
+% By default, they are off.
+
+\def\headings #1 {\csname HEADINGS#1\endcsname}
+
+\def\HEADINGSoff{
+\global\evenheadline={\hfil} \global\evenfootline={\hfil}
+\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
+\HEADINGSoff
+% When we turn headings on, set the page number to 1,
+% Put current file name in lower left corner,
+% Put chapter name on inside top of right hand pages, document
+% title on inside top of left hand pages, and page numbers on outside top
+% edge of all pages.
+\def\HEADINGSon{
+\pagealignmacro
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+}
+
+% Subroutines used in generating headings
+% Produces Day Month Year style of output.
+\def\today{\number\day\space
+\ifcase\month\or
+January\or February\or March\or April\or May\or June\or
+July\or August\or September\or October\or November\or December\fi
+\space\number\year}
+
+% Use this if you want the Month Day, Year style of output.
+%\def\today{\ifcase\month\or
+%January\or February\or March\or April\or May\or June\or
+%July\or August\or September\or October\or November\or December\fi
+%\space\number\day, \number\year}
+
+% @settitle line...  specifies the title of the document, for headings
+% It generates no output of its own
+
+\def\thistitle{No Title}
+\def\settitle{\parsearg\settitlezzz}
+\def\settitlezzz #1{\gdef\thistitle{#1}}
+
+\message{tables,}
+
+% Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
+
+% default indentation of table text
+\newdimen\tableindent \tableindent=.8in
+% default indentation of @itemize and @enumerate text
+\newdimen\itemindent  \itemindent=.3in
+% margin between end of table item and start of table text.
+\newdimen\itemmargin  \itemmargin=.1in
+
+% used internally for \itemindent minus \itemmargin
+\newdimen\itemmax
+
+% Note @table and @ftable define @item, @itemx, etc., with these defs.
+% They also define \itemindex
+% to index the item name in whatever manner is desired (perhaps none).
+
+\def\internalBitem{\smallbreak \parsearg\itemzzz}
+\def\internalBitemx{\par \parsearg\itemzzz}
+
+\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
+\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
+
+\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
+\def\internalBkitemx{\par \parsearg\kitemzzz}
+
+\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}\itemzzz {#1}}
+
+\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}\itemzzz {#1}}
+
+\def\itemzzz #1{\begingroup %
+\advance \hsize by -\rightskip %
+\advance \hsize by -\leftskip %
+\setbox0=\hbox{\itemfont{#1}}%
+\itemindex{#1}%
+\parskip=0in %
+\noindent %
+\ifdim \wd0>\itemmax %
+\vadjust{\penalty 10000}%
+\hbox to \hsize{\hskip -\tableindent\box0\hss}\ %
+\else %
+\hbox to 0pt{\hskip -\tableindent\box0\hss}%
+\fi %
+\endgroup %
+}
+
+\def\item{\errmessage{@item while not in a table}}
+\def\itemx{\errmessage{@itemx while not in a table}}
+\def\kitem{\errmessage{@kitem while not in a table}}
+\def\kitemx{\errmessage{@kitemx while not in a table}}
+\def\xitem{\errmessage{@xitem while not in a table}}
+\def\xitemx{\errmessage{@xitemx while not in a table}}
+
+%% Contains a kludge to get @end[description] to work
+\def\description{\tablez{\dontindex}{1}{}{}{}{}}
+
+\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
+{\obeylines\obeyspaces%
+\gdef\tablex #1^^M{%
+\tabley\dontindex#1        \endtabley}}
+
+\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
+{\obeylines\obeyspaces%
+\gdef\ftablex #1^^M{%
+\tabley\fnitemindex#1        \endtabley}}
+
+\def\dontindex #1{}
+\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
+
+{\obeyspaces %
+\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
+\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
+
+\def\tablez #1#2#3#4#5#6{%
+\aboveenvbreak %
+\begingroup %
+\def\Edescription{\Etable}% Neccessary kludge.
+\let\itemindex=#1%
+\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
+\ifnum 0#4>0 \tableindent=#4\mil \fi %
+\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
+\def\itemfont{#2}%
+\itemmax=\tableindent %
+\advance \itemmax by -\itemmargin %
+\advance \leftskip by \tableindent %
+\parindent = 0pt
+\parskip = \smallskipamount
+\ifdim \parskip=0pt \parskip=2pt \fi%
+\def\Etable{\endgraf\endgroup\afterenvbreak}%
+\let\item = \internalBitem %
+\let\itemx = \internalBitemx %
+\let\kitem = \internalBkitem %
+\let\kitemx = \internalBkitemx %
+\let\xitem = \internalBxitem %
+\let\xitemx = \internalBxitemx %
+}
+
+% This is the counter used by @enumerate, which is really @itemize
+
+\newcount \itemno
+
+\def\itemize{\parsearg\itemizezzz}
+
+\def\itemizezzz #1{\itemizey {#1}{\Eitemize}}
+
+\def\itemizey #1#2{%
+\aboveenvbreak %
+\begingroup %
+\itemno = 0 %
+\itemmax=\itemindent %
+\advance \itemmax by -\itemmargin %
+\advance \leftskip by \itemindent %
+\parindent = 0pt
+\parskip = \smallskipamount
+\ifdim \parskip=0pt \parskip=2pt \fi%
+\def#2{\endgraf\endgroup\afterenvbreak}%
+\def\itemcontents{#1}%
+\let\item=\itemizeitem}
+
+\def\bullet{$\ptexbullet$}
+\def\minus{$-$}
+
+\def\enumerate{\itemizey{\the\itemno.}\Eenumerate\flushcr}
+
+% Definition of @item while inside @itemize.
+
+\def\itemizeitem{%
+\advance\itemno by 1
+{\let\par=\endgraf \smallbreak}%
+\ifhmode \errmessage{\in hmode at itemizeitem}\fi
+{\parskip=0in \hskip 0pt
+\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
+\vadjust{\penalty 300}}%
+\flushcr}
+
+\message{indexing,}
+% Index generation facilities
+
+% Define \newwrite to be identical to plain tex's \newwrite
+% except not \outer, so it can be used within \newindex.
+{\catcode`\@=11
+\gdef\newwrite{\alloc at 7\write\chardef\sixt@@n}}
+
+% \newindex {foo} defines an index named foo.
+% It automatically defines \fooindex such that
+% \fooindex ...rest of line... puts an entry in the index foo.
+% It also defines \fooindfile to be the number of the output channel for
+% the file that	accumulates this index.  The file's extension is foo.
+% The name of an index should be no more than 2 characters long
+% for the sake of vms.
+
+\def\newindex #1{
+\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
+\openout \csname#1indfile\endcsname \jobname.#1	% Open the file
+\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
+\noexpand\doindex {#1}}
+}
+
+% @defindex foo  ==  \newindex{foo}
+
+\def\defindex{\parsearg\newindex}
+
+% Define @defcodeindex, like @defindex except put all entries in @code.
+
+\def\newcodeindex #1{
+\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
+\openout \csname#1indfile\endcsname \jobname.#1	% Open the file
+\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
+\noexpand\docodeindex {#1}}
+}
+
+\def\defcodeindex{\parsearg\newcodeindex}
+
+% @synindex foo bar    makes index foo feed into index bar.
+% Do this instead of @defindex foo if you don't want it as a separate index.
+\def\synindex #1 #2 {%
+\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
+\noexpand\doindex {#2}}%
+}
+
+% @syncodeindex foo bar   similar, but put all entries made for index foo
+% inside @code.
+\def\syncodeindex #1 #2 {%
+\expandafter\xdef\csname#1index\endcsname{%	% Define \xxxindex
+\noexpand\docodeindex {#2}}%
+}
+
+% Define \doindex, the driver for all \fooindex macros.
+% Argument #1 is generated by the calling \fooindex macro,
+%  and it is "foo", the name of the index.
+
+% \doindex just uses \parsearg; it calls \doind for the actual work.
+% This is because \doind is more useful to call from other macros.
+
+% There is also \dosubind {index}{topic}{subtopic}
+% which makes an entry in a two-level index such as the operation index.
+
+\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
+\def\singleindexer #1{\doind{\indexname}{#1}}
+
+% like the previous two, but they put @code around the argument.
+\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
+\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
+
+\def\indexdummies{%
+\def\bf{\realbackslash bf }%
+\def\rm{\realbackslash rm }%
+\def\sl{\realbackslash sl }%
+\def\dots{\realbackslash dots }%
+\def\copyright{\realbackslash copyright }%
+}
+
+% \indexnofonts no-ops all font-change commands.
+% This is used when outputting the strings to sort the index by.
+\def\indexdummyfont#1{#1}
+\def\indexnofonts{%
+\let\code=\indexdummyfont
+\let\samp=\indexdummyfont
+\let\kbd=\indexdummyfont
+\let\key=\indexdummyfont
+\let\var=\indexdummyfont
+}
+
+% To define \realbackslash, we must make \ not be an escape.
+% We must first make another character (@) an escape
+% so we do not become unable to do a definition.
+
+{\catcode`\@=0 \catcode`\\=\other
+ at gdef@realbackslash{\}}
+
+\let\indexbackslash=0  %overridden during \printindex.
+
+\def\doind #1#2{%
+{\indexdummies % Must do this here, since \bf, etc expand at this stage
+\count10=\lastpenalty %
+\escapechar=`\\%
+{\let\folio=0% Expand all macros now EXCEPT \folio
+\def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
+% so it will be output as is; and it will print as backslash in the indx.
+%
+% Now process the index-string once, with all font commands turned off,
+% to get the string to sort the index by.
+{\indexnofonts
+\xdef\temp1{#2}%
+}%
+% Now produce the complete index entry.  We process the index-string again,
+% this time with font commands expanded, to get what to print in the index.
+\edef\temp{%
+\write \csname#1indfile\endcsname{%
+\realbackslash entry {\temp1}{\folio}{#2}}}%
+\temp }%
+\penalty\count10}}
+
+\def\dosubind #1#2#3{%
+{\indexdummies % Must do this here, since \bf, etc expand at this stage
+\count10=\lastpenalty %
+\escapechar=`\\%
+{\let\folio=0%
+\def\rawbackslashxx{\indexbackslash}%
+%
+% Now process the index-string once, with all font commands turned off,
+% to get the string to sort the index by.
+{\indexnofonts
+\xdef\temp1{#2 #3}%
+}%
+% Now produce the complete index entry.  We process the index-string again,
+% this time with font commands expanded, to get what to print in the index.
+\edef\temp{%
+\write \csname#1indfile\endcsname{%
+\realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
+\temp }%
+\penalty\count10}}
+
+% The index entry written in the file actually looks like
+%  \entry {sortstring}{page}{topic}
+% or
+%  \entry {sortstring}{page}{topic}{subtopic}
+% The texindex program reads in these files and writes files
+% containing these kinds of lines:
+%  \initial {c}
+%     before the first topic whose initial is c
+%  \entry {topic}{pagelist}
+%     for a topic that is used without subtopics
+%  \primary {topic}
+%     for the beginning of a topic that is used with subtopics
+%  \secondary {subtopic}{pagelist}
+%     for each subtopic.
+
+% Define the user-accessible indexing commands 
+% @findex, @vindex, @kindex, @cindex.
+
+\def\findex {\fnindex}
+\def\kindex {\kyindex}
+\def\cindex {\cpindex}
+\def\vindex {\vrindex}
+\def\tindex {\tpindex}
+\def\pindex {\pgindex}
+
+\def\cindexsub {\begingroup\obeylines\cindexsub}
+{\obeylines %
+\gdef\cindexsub "#1" #2^^M{\endgroup %
+\dosubind{cp}{#2}{#1}}}
+
+% Define the macros used in formatting output of the sorted index material.
+
+% This is what you call to cause a particular index to get printed.
+% Write
+% @unnumbered Function Index
+% @printindex fn
+
+\def\printindex{\parsearg\doprintindex}
+
+\def\doprintindex#1{\tex %
+\catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
+\catcode`\$=\other\catcode`\_=\other
+\catcode`\~=\other
+\def\indexbackslash{\rawbackslashxx}
+\indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
+\begindoublecolumns
+\openin 1 \jobname.#1s
+\ifeof 1 \else \closein 1 \input \jobname.#1s
+\fi
+\enddoublecolumns
+\Etex}
+
+% These macros are used by the sorted index file itself.
+% Change them to control the appearance of the index.
+
+% Same as \bigskipamount except no shrink.
+% \balancecolumns gets confused if there is any shrink.
+\newskip\initialskipamount \initialskipamount 12pt plus4pt
+
+\outer\def\initial #1{%
+{\let\tentt=\sectt \let\sf=\sectt
+\ifdim\lastskip<\initialskipamount
+\removelastskip \penalty-200 \vskip \initialskipamount\fi
+\line{\secbf#1\hfill}\kern 2pt\penalty3000}}
+
+\outer\def\entry #1#2{
+{\parfillskip=0in \parskip=0in \parindent=0in
+\hangindent=1in \hangafter=1%
+\noindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll #2\par
+}}
+
+\def\primary #1{\line{#1\hfil}}
+
+\newskip\secondaryindent \secondaryindent=0.5cm
+
+\def\secondary #1#2{
+{\parfillskip=0in \parskip=0in
+\hangindent =1in \hangafter=1
+\noindent\hskip\secondaryindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll#2\par
+}}
+
+%% Define two-column mode, which is used in indexes.
+%% Adapted from the TeXBook, page 416
+\catcode `\@=11
+
+\newbox\partialpage
+
+\newdimen\doublecolumnhsize  \doublecolumnhsize = 3.11in
+\newdimen\doublecolumnvsize  \doublecolumnvsize = 19.1in
+
+\def\begindoublecolumns{\begingroup
+  \output={\global\setbox\partialpage=\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
+  \output={\doublecolumnout} \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
+\def\enddoublecolumns{\output={\balancecolumns}\eject
+  \endgroup \pagegoal=\vsize}
+
+\def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
+  \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
+  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
+  \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
+\def\pagesofar{\unvbox\partialpage %
+  \hsize=\doublecolumnhsize % have to restore this since output routine
+%	      changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986)
+  \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
+\def\balancecolumns{\setbox0=\vbox{\unvbox255} \dimen@=\ht0
+  \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
+  \divide\dimen@ by2 \splittopskip=\topskip
+  {\vbadness=10000 \loop \global\setbox3=\copy0
+    \global\setbox1=\vsplit3 to\dimen@
+    \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
+  \setbox0=\vbox to\dimen@{\unvbox1}  \setbox2=\vbox to\dimen@{\unvbox3}
+  \pagesofar}
+
+\catcode `\@=\other
+\message{sectioning,}
+% Define chapters, sections, etc.
+
+\newcount \chapno
+\newcount \secno
+\newcount \subsecno
+\newcount \subsubsecno
+
+% This counter is funny since it counts through charcodes of letters A, B, ...
+\newcount \appendixno  \appendixno = `\@
+\def\appendixletter{\char\the\appendixno}
+
+\newwrite \contentsfile
+\openout \contentsfile = \jobname.toc
+
+% Each @chapter defines this as the name of the chapter.
+% page headings and footings can use it.  @section does likewise
+
+\def\thischapter{} \def\thissection{}
+\def\seccheck#1{\if \pageno<0 %
+\errmessage{@#1 not allowed after generating table of contents}\fi
+%
+}
+
+\outer\def\chapter{\parsearg\chapterzzz}
+\def\chapterzzz #1{\seccheck{chapter}%
+\secno=0 \subsecno=0 \subsubsecno=0 \global\advance \chapno by 1 \message{Chapter \the\chapno}%
+\chapmacro {#1}{\the\chapno}%
+\gdef\thissection{#1}\gdef\thischapter{#1}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp  %
+\donoderef %
+}
+
+\outer\def\appendix{\parsearg\appendixzzz}
+\def\appendixzzz #1{\seccheck{appendix}%
+\secno=0 \subsecno=0 \subsubsecno=0 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
+\chapmacro {#1}{Appendix \appendixletter}%
+\gdef\thischapter{#1}\gdef\thissection{#1}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash chapentry {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp  %
+\unnumbnoderef %
+}
+
+\outer\def\unnumbered{\parsearg\unnumberedzzz}
+\def\unnumberedzzz #1{\seccheck{unnumbered}%
+\secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
+\unnumbchapmacro {#1}%
+\gdef\thischapter{#1}\gdef\thissection{#1}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp  %
+\unnumbnoderef %
+}
+
+\outer\def\section{\parsearg\sectionzzz}
+\def\sectionzzz #1{\seccheck{section}%
+\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
+\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash secentry %
+{#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\donoderef %
+\penalty 10000 %
+}
+
+\outer\def\appendixsection{\parsearg\appendixsectionzzz}
+\outer\def\appendixsec{\parsearg\appendixsectionzzz}
+\def\appendixsectionzzz #1{\seccheck{appendixsection}%
+\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
+\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash secentry %
+{#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\unnumbnoderef %
+\penalty 10000 %
+}
+
+\outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
+\def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
+\plainsecheading {#1}\gdef\thissection{#1}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\unnumbnoderef %
+\penalty 10000 %
+}
+
+\outer\def\subsection{\parsearg\subsectionzzz}
+\def\subsectionzzz #1{\seccheck{subsection}%
+\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
+\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash subsecentry %
+{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\donoderef %
+\penalty 10000 %
+}
+
+\outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
+\def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
+\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
+\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash subsecentry %
+{#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\unnumbnoderef %
+\penalty 10000 %
+}
+
+\outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
+\def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
+\plainsecheading {#1}\gdef\thissection{#1}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\unnumbnoderef %
+\penalty 10000 %
+}
+
+\outer\def\subsubsection{\parsearg\subsubsectionzzz}
+\def\subsubsectionzzz #1{\seccheck{subsubsection}%
+\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
+\subsubsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash subsubsecentry %
+{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
+\escapechar=`\\%
+\write \contentsfile \temp %
+\donoderef %
+\penalty 10000 %
+}
+
+\outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
+\def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
+\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
+\subsubsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash subsubsecentry{#1}%
+{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
+\escapechar=`\\%
+\write \contentsfile \temp %
+\unnumbnoderef %
+\penalty 10000 %
+}
+
+\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
+\def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
+\plainsecheading {#1}\gdef\thissection{#1}%
+\let\rawbackslash=\relax%
+\let\frenchspacing=\relax%
+\edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
+\escapechar=`\\%
+\write \contentsfile \temp %
+\unnumbnoderef %
+\penalty 10000 %
+}
+
+% Define @majorheading, @heading and @subheading
+
+\outer\def\majorheading #1{%
+{\advance\chapheadingskip by 10pt \chapbreak }%
+{\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 200}
+
+\outer\def\chapheading #1{\chapbreak %
+{\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 200}
+
+\let\heading=\secheadingi
+\let\subheading=\subsecheadingi
+\let\subsubheading=\subsubsecheadingi
+
+% These macros generate a chapter, section, etc. heading only
+% (including whitespace, linebreaking, etc. around it),
+% given all the information in convenient, parsed form.
+
+%%% Args are the skip and penalty (usually negative)
+\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
+
+\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
+
+%%% Define plain chapter starts, and page on/off switching for it
+% Parameter controlling skip before chapter headings (if needed)
+
+\newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
+
+\def\chapbreak{\dobreak \chapheadingskip {-4000}}
+\def\chappager{\par\vfill\supereject}
+\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
+
+\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
+
+\def\CHAPPAGoff{
+\global\let\pchapsepmacro=\chapbreak
+\global\let\pagealignmacro=\chappager}
+
+\def\CHAPPAGon{
+\global\let\pchapsepmacro=\chappager
+\global\let\pagealignmacro=\chappager}
+
+\def\CHAPPAGodd{
+\global\let\pchapsepmacro=\chapoddpage
+\global\let\pagealignmacro=\chapoddpage}
+
+\CHAPPAGon
+
+\def\CHAPFplain{
+\global\let\chapmacro=\chfplain
+\global\let\unnumbchapmacro=\unnchfplain}
+
+\def\chfplain #1#2{%
+\pchapsepmacro %
+{\chapfonts \line{\chaprm #2.\enspace #1\hfill}}\bigskip \par\penalty 5000 %
+}
+
+\def\unnchfplain #1{%
+\pchapsepmacro %
+{\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 10000 %
+}
+\CHAPFplain % The default
+
+\def\unnchfopen #1{%
+\chapoddpage {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 10000 %
+}
+
+\def\chfopen #1#2{\chapoddpage {\chapfonts
+\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
+\par\penalty 5000 %
+}
+
+\def\CHAPFopen{
+\global\let\chapmacro=\chfopen
+\global\let\unnumbchapmacro=\unnchfopen}
+
+% Parameter controlling skip before section headings.
+
+\newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
+\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
+
+\newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
+\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
+
+\def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
+\def\plainsecheading #1{\secheadingi {#1}}
+\def\secheadingi #1{{\advance \secheadingskip by \parskip %
+\secheadingbreak}%
+{\secfonts \line{\secrm #1\hfill}}%
+\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
+
+\def\subsecheading #1#2#3#4{{\advance \subsecheadingskip by \parskip %
+\subsecheadingbreak}%
+{\secfonts \line{\secrm#2.#3.#4\enspace #1\hfill}}%
+\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
+
+\def\subsubsecfonts{\subsecfonts} % Maybe this should change
+
+\def\subsubsecheading #1#2#3#4#5{{\advance \subsecheadingskip by \parskip %
+\subsecheadingbreak}%
+{\secfonts \line{\secrm#2.#3.#4.#5\enspace #1\hfill}}%
+\ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
+
+\message{toc printing,}
+
+\def\Dotsbox{\hbox to 1em{\hss.\hss}} % Used by index macros
+
+\def\finishcontents{%
+\ifnum\pageno>0 %
+\pagealignmacro %
+\immediate\closeout \contentsfile%
+\pageno=-1		% Request roman numbered pages
+\fi}
+
+\outer\def\contents{%
+\finishcontents %
+\unnumbchapmacro{Table of Contents}
+\def\thischapter{Table of Contents}
+{\catcode`\\=0
+\catcode`\{=1		% Set up to handle contents files properly
+\catcode`\}=2
+\catcode`\@=11
+\input \jobname.toc
+}
+\vfill \eject}
+
+\outer\def\summarycontents{%
+\finishcontents %
+\unnumbchapmacro{Summary Table of Contents}
+\def\thischapter{Summary Table of Contents}
+{\catcode`\\=0
+\catcode`\{=1		% Set up to handle contents files properly
+\catcode`\}=2
+\catcode`\@=11
+\def\smallbreak{}
+\def\secentry ##1##2##3##4{}
+\def\subsecentry ##1##2##3##4##5{}
+\def\subsubsecentry ##1##2##3##4##5##6{}
+\def\unnumbsecentry ##1##2{}
+\def\unnumbsubsecentry ##1##2{}
+\def\unnumbsubsubsecentry ##1##2{}
+\let\medbreak=\smallbreak
+\input \jobname.toc
+}
+\vfill \eject}
+
+\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
+
+% These macros generate individual entries in the table of contents
+% The first argument is the chapter or section name.
+% The last argument is the page number.
+% The arguments in between are the chapter number, section number, ...
+
+\def\chapentry #1#2#3{%
+\medbreak
+\line{#2.\space#1\leaders\hbox to 1em{\hss.\hss}\hfill #3}
+}
+
+\def\unnumbchapentry #1#2{%
+\medbreak
+\line{#1\leaders\Dotsbox\hfill #2}
+}
+
+\def\secentry #1#2#3#4{%
+\line{\enspace\enspace#2.#3\space#1\leaders\Dotsbox\hfill#4}
+}
+
+\def\unnumbsecentry #1#2{%
+\line{\enspace\enspace#1\leaders\Dotsbox\hfill #2}
+}
+
+\def\subsecentry #1#2#3#4#5{%
+\line{\enspace\enspace\enspace\enspace
+#2.#3.#4\space#1\leaders\Dotsbox\hfill #5}
+}
+
+\def\unnumbsubsecentry #1#2{%
+\line{\enspace\enspace\enspace\enspace#1\leaders\Dotsbox\hfill #2}
+}
+
+\def\subsubsecentry #1#2#3#4#5#6{%
+\line{\enspace\enspace\enspace\enspace\enspace\enspace
+#2.#3.#4.#5\space#1\leaders\Dotsbox\hfill #6}
+}
+
+\def\unnumbsubsubsecentry #1#2{%
+\line{\enspace\enspace\enspace\enspace\enspace\enspace#1\leaders\Dotsbox\hfill #2}
+}
+
+\message{environments,}
+
+% @tex ... @end tex    escapes into raw Tex temporarily.
+% One exception: @ is still an escape character, so that @end tex works.
+% But \@ or @@ will get a plain tex @ character.
+
+\def\tex{\begingroup
+\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
+\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
+\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
+\catcode `\%=14
+\catcode`\"=12
+\catcode`\|=12
+\catcode`\<=12
+\catcode`\>=12
+\escapechar=`\\
+%
+\let\{=\ptexlbrace
+\let\}=\ptexrbrace
+\let\.=\ptexdot
+\let\*=\ptexstar
+\def\@={@}%
+\let\bullet=\ptexbullet
+\let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
+\let\L=\ptexL
+%
+\let\Etex=\endgroup}
+
+% Define @lisp ... @endlisp.
+% @lisp does a \begingroup so it can rebind things,
+% including the definition of @endlisp (which normally is erroneous).
+
+% Amount to narrow the margins by for @lisp.
+\newskip\lispnarrowing \lispnarrowing=0.4in
+
+% This is the definition that ^M gets inside @lisp
+% phr: changed space to \null, to avoid overfull hbox problems.
+{\obeyspaces%
+\gdef\lisppar{\null\endgraf}}
+
+% Cause \obeyspaces to make each Space cause a word-separation
+% rather than the default which is that it acts punctuation.
+% This is because space in tt font looks funny.
+{\obeyspaces %
+\gdef\sepspaces{\def {\ }}}
+
+\newskip\aboveenvskipamount \aboveenvskipamount= 0pt
+\def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip
+\endgraf \ifdim\lastskip<\aboveenvskipamount
+\removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}}
+
+\def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount
+\removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}
+
+\def\lisp{\aboveenvbreak\begingroup\inENV %This group ends at the end of the @lisp body
+\hfuzz=12truept % Don't be fussy
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+% Single space lines
+\singlespace %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+\let\par=\lisppar
+\def\Elisp{\endgroup\afterenvbreak}%
+\parskip=0pt \advance \rightskip by \lispnarrowing 
+\advance \leftskip by \lispnarrowing
+\parindent=0pt
+\let\exdent=\internalexdent
+\obeyspaces \obeylines \tt \rawbackslash
+\def\next##1{}\next}
+
+
+\let\example=\lisp
+\def\Eexample{\Elisp}
+
+\let\smallexample=\lisp
+\def\Esmallexample{\Elisp}
+
+% Macro for 9 pt. examples, necessary to print with 5" lines.
+% From Pavel at xerox.  This is not really used unless the
+% @smallbook command is given.
+
+\def\smalllispx{\aboveenvbreak\begingroup\inENV
+%			This group ends at the end of the @lisp body
+\hfuzz=12truept % Don't be fussy
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+% Single space lines
+\singlespace %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+\let\par=\lisppar
+\def\Esmalllisp{\endgroup\afterenvbreak}%
+\parskip=0pt \advance \rightskip by \lispnarrowing 
+\advance \leftskip by \lispnarrowing
+\parindent=0pt
+\let\exdent=\internalexdent
+\obeyspaces \obeylines \ninett \rawbackslash
+\def\next##1{}\next}
+
+% This is @display; same as @lisp except use roman font.
+
+\def\display{\begingroup\inENV %This group ends at the end of the @display body
+\aboveenvbreak
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+% Single space lines
+\singlespace %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+\let\par=\lisppar
+\def\Edisplay{\endgroup\afterenvbreak}%
+\parskip=0pt \advance \rightskip by \lispnarrowing 
+\advance \leftskip by \lispnarrowing
+\parindent=0pt
+\let\exdent=\internalexdent
+\obeyspaces \obeylines
+\def\next##1{}\next}
+
+% This is @format; same as @lisp except use roman font and don't narrow margins
+
+\def\format{\begingroup\inENV %This group ends at the end of the @format body
+\aboveenvbreak
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+\singlespace %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+\let\par=\lisppar
+\def\Eformat{\endgroup\afterenvbreak}
+\parskip=0pt \parindent=0pt
+\obeyspaces \obeylines
+\def\next##1{}\next}
+
+% @flushleft and @flushright
+
+\def\flushleft{\begingroup\inENV %This group ends at the end of the @format body
+\aboveenvbreak
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+% This also causes @ to work when the directive name
+% is terminated by end of line.
+\let\par=\lisppar
+\def\Eflushleft{\endgroup\afterenvbreak}%
+\parskip=0pt \parindent=0pt
+\obeyspaces \obeylines
+\def\next##1{}\next}
+
+\def\flushright{\begingroup\inENV %This group ends at the end of the @format body
+\aboveenvbreak
+% Make spaces be word-separators rather than space tokens.
+\sepspaces %
+% The following causes blank lines not to be ignored
+% by adding a space to the end of each line.
+% This also causes @ to work when the directive name
+% is terminated by end of line.
+\let\par=\lisppar
+\def\Eflushright{\endgroup\afterenvbreak}%
+\parskip=0pt \parindent=0pt
+\advance \leftskip by 0pt plus 1fill
+\obeyspaces \obeylines
+\def\next##1{}\next}
+
+% @quotation - narrow the margins.
+
+\def\quotation{\begingroup\inENV %This group ends at the end of the @quotation body
+{\parskip=0pt  % because we will skip by \parskip too, later
+\aboveenvbreak}%
+\singlespace
+\parindent=0pt
+\def\Equotation{\par\endgroup\afterenvbreak}%
+\advance \rightskip by \lispnarrowing 
+\advance \leftskip by \lispnarrowing}
+
+\message{defuns,}
+% Define formatter for defuns
+% First, allow user to change definition object font (\df) internally
+\def\setdeffont #1 {\csname DEF#1\endcsname}
+
+\newskip\defbodyindent \defbodyindent=36pt
+\newskip\defargsindent \defargsindent=50pt
+\newskip\deftypemargin \deftypemargin=12pt
+\newskip\deflastargmargin \deflastargmargin=18pt
+
+\newcount\parencount
+% define \functionparens, which makes ( and ) and & do special things.
+% \functionparens affects the group it is contained in.
+\def\activeparens{%
+\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
+\catcode`\[=\active \catcode`\]=\active}
+{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
+\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
+\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
+
+% Definitions of (, ) and & used in args for functions.
+% This is the definition of ( outside of all parentheses.
+\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
+\global\advance\parencount by 1 }
+%
+% This is the definition of ( when already inside a level of parens.
+\gdef\opnested{\char`\(\global\advance\parencount by 1 }
+%
+\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
+% also in that case restore the outer-level definition of (.
+\ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
+\global\advance \parencount by -1 }
+% If we encounter &foo, then turn on ()-hacking afterwards
+\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
+%
+\gdef\normalparens{\boldbrax\let&=\ampnr}
+} % End of definition inside \activeparens
+%% These parens (in \boldbrax) actually are a little bolder than the
+%% contained text.  This is especially needed for [ and ]
+\def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
+\def\lbrb{{\tt\char`\[}} \def\rbrb{{\tt\char`\]}}
+
+% First, defname, which formats the header line itself.
+% #1 should be the function name.
+% #2 should be the type of definition, such as "Function".
+
+\def\defname #1#2{%
+\leftskip = 0in  %
+\noindent        %
+\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
+\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
+\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
+\parshape 2 0in \dimen0 \defargsindent \dimen1     %
+% Now output arg 2 ("Function" or some such)
+% ending at \deftypemargin from the right margin,
+% but stuck inside a box of width 0 so it does not interfere with linebreaking
+\rlap{\rightline{{\rm #2}\hskip \deftypemargin}}%
+\tolerance=10000 \hbadness=10000    % Make all lines underfull and no complaints
+{\df #1}\enskip        % Generate function name
+}
+
+% Actually process the body of a definition
+% #1 should be the terminating control sequence, such as \Edefun.
+% #2 should be the "another name" control sequence, such as \defunx.
+% #3 should be the control sequence that actually processes the header,
+%    such as \defunheader.
+
+\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
+\parindent=0in \leftskip=\defbodyindent %
+\begingroup\obeylines\activeparens\spacesplit#3}
+
+\def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
+\medbreak %
+% Define the end token that this defining construct specifies
+% so that it will exit this group.
+\def#1{\endgraf\endgroup\medbreak}%
+\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
+\parindent=0in \leftskip=\defbodyindent %
+\begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
+
+% Split up #2 at the first space token.
+% call #1 with two arguments:
+%  the first is all of #2 before the space token,
+%  the second is all of #2 after that space token.
+% If #2 contains no space token, all of it is passed as the first arg
+% and the second is passed as empty.
+
+{\obeylines
+\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
+\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
+\ifx\relax #3%
+#1{#2}{}\else #1{#2}{#3#4}\fi}}
+
+% So much for the things common to all kinds of definitions.
+
+% Define @defun.
+
+% First, define the processing that is wanted for arguments of \defun
+% Use this to expand the args and terminate the paragraph they make up
+
+\def\defunargs #1{\functionparens \sl #1%
+\ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
+\interlinepenalty=10000
+\endgraf\vskip -\parskip \penalty 10000}
+
+% Do complete processing of one @defun or @defunx line already parsed.
+
+% @deffn Command forward-char nchars
+
+\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
+
+\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
+\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup}
+
+% @defun == @deffn Function
+
+\def\defun{\defparsebody\Edefun\defunx\defunheader}
+
+\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{Function}%
+\defunargs {#2}\endgroup %
+}
+
+% @defmac == @deffn Macro
+
+\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
+
+\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{Macro}%
+\defunargs {#2}\endgroup %
+}
+
+% @defspec == @deffn Special Form
+
+\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
+
+\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{Special form}%
+\defunargs {#2}\endgroup %
+}
+
+% This definition is run if you use @defunx
+% anywhere other than immediately after a @defun or @defunx.
+
+\def\deffnx #1 {\errmessage{@deffnx in invalid context}}
+\def\defunx #1 {\errmessage{@defunx in invalid context}}
+\def\defmacx #1 {\errmessage{@defmacx in invalid context}}
+\def\defspecx #1 {\errmessage{@defspecx in invalid context}}
+
+% @defmethod, and so on
+
+% @defop {Funny Method} foo-class frobnicate argument
+
+\def\defop #1 {\def\defoptype{#1}%
+\defmethparsebody\Edefop\defopx\defopheader}
+
+\def\defopheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
+\begingroup\defname {#2}{\defoptype{} on #1}%
+\defunargs {#3}\endgroup %
+}
+
+% @defmethod == @defop Method
+
+\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
+
+\def\defmethodheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% entry in function index
+\begingroup\defname {#2}{Operation on #1}%
+\defunargs {#3}\endgroup %
+}
+
+% @defcv {Class Option} foo-class foo-flag
+
+\def\defcv #1 {\def\defcvtype{#1}%
+\defmethparsebody\Edefcv\defcvx\defcvheader}
+
+\def\defcvarheader #1#2#3{%
+\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
+\begingroup\defname {#2}{\defcvtype of #1}%
+\defvarargs {#3}\endgroup %
+}
+
+% @defivar == @defcv {Instance Variable}
+
+\def\defivar{\defmethparsebody\Edefivar\defivarx\defivarheader}
+
+\def\defivarheader #1#2#3{%
+\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
+\begingroup\defname {#2}{Instance variable of #1}%
+\defvarargs {#3}\endgroup %
+}
+
+% These definitions are run if you use @defmethodx, etc.,
+% anywhere other than immediately after a @defmethod, etc.
+
+\def\defopx #1 {\errmessage{@defopx in invalid context}}
+\def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
+\def\defcvx #1 {\errmessage{@defcvx in invalid context}}
+\def\defivarx #1 {\errmessage{@defivarx in invalid context}}
+
+% Now @defvar
+
+% First, define the processing that is wanted for arguments of @defvar.
+% This is actually simple: just print them in roman.
+% This must expand the args and terminate the paragraph they make up
+\def\defvarargs #1{\normalparens #1%
+\interlinepenalty=10000
+\endgraf\vskip -\parskip \penalty 10000}
+
+% @defvr Counter foo-count
+
+\def\defvr{\defmethparsebody\Edefvr\defvrx\defvrheader}
+
+\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
+\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
+
+% @defvar == @defvr Variable
+
+\def\defvar{\defparsebody\Edefvar\defvarx\defvarheader}
+
+\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
+\begingroup\defname {#1}{Variable}%
+\defvarargs {#2}\endgroup %
+}
+
+% @defopt == @defvr {User Option}
+
+\def\defopt{\defparsebody\Edefopt\defoptx\defoptheader}
+
+\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
+\begingroup\defname {#1}{User Option}%
+\defvarargs {#2}\endgroup %
+}
+
+% This definition is run if you use @defvarx
+% anywhere other than immediately after a @defvar or @defvarx.
+
+\def\defvrx #1 {\errmessage{@defvrx in invalid context}}
+\def\defvarx #1 {\errmessage{@defvarx in invalid context}}
+\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
+
+% Now define @deftp
+% Args are printed in bold, a slight difference from @defvar.
+
+\def\deftpargs #1{\bf \defvarargs{#1}}
+
+% @deftp Class window height width ...
+
+\def\deftp{\defmethparsebody\Edeftp\deftpx\deftpheader}
+
+\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
+\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
+
+% This definition is run if you use @deftpx, etc
+% anywhere other than immediately after a @deftp, etc.
+
+\def\deftpx #1 {\errmessage{@deftpx in invalid context}}
+
+\message{cross reference,}
+% Define cross-reference macros
+\newwrite \auxfile
+
+% \setref{foo} defines a cross-reference point named foo.
+
+\def\setref#1{%
+\dosetq{#1-pg}{Ypagenumber}%
+\dosetq{#1-snt}{Ysectionnumberandtype}}
+
+\def\unnumbsetref#1{%
+\dosetq{#1-pg}{Ypagenumber}%
+\dosetq{#1-snt}{Ynothing}}
+
+% \xref and \pxref generate cross references to specified points.
+
+\def\pxref #1{see \xrefX [#1,,,,,,,]}
+\def\xref #1{See \xrefX [#1,,,,,,,]}
+\def\xrefX [#1,#2,#3,#4,#5,#6]{%
+\setbox1=\hbox{\i{\losespace#5{}}}%
+\setbox0=\hbox{\losespace#3{}}%
+\ifdim \wd0 =0pt \setbox0=\hbox{\losespace#1{}}\fi%
+\ifdim \wd1 >0pt%
+section \unhbox0{} in \unhbox1%
+\else%
+\refx{#1-snt} [\unhbox0], page\tie \refx{#1-pg}%
+\fi }
+
+% \dosetq is the interface for calls from other macros
+
+\def\dosetq #1#2{{\let\folio=0%
+\edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
+\next}}
+
+% \internalsetq {foo}{page} expands into CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
+% When the aux file is read, ' is the escape character
+
+\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
+
+% Things to be expanded by \internalsetq
+
+\def\Ypagenumber{\folio}
+
+\def\Ynothing{}
+
+\def\Ysectionnumberandtype{%
+\ifnum\secno=0 chapter\xreftie\the\chapno %
+\else \ifnum \subsecno=0 section\xreftie\the\chapno.\the\secno %
+\else \ifnum \subsubsecno=0 %
+section\xreftie\the\chapno.\the\secno.\the\subsecno %
+\else %
+section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
+\fi \fi \fi }
+
+\gdef\xreftie{'tie}
+
+% Define @refx to reference a specific cross-reference string.
+
+\def\refx#1{%
+{%
+\expandafter\ifx\csname X#1\endcsname\relax
+% If not defined, say something at least.
+\expandafter\gdef\csname X#1\endcsname {$<$undefined$>$}%
+\message {WARNING: Cross-reference "#1" used but not yet defined}%
+\message {}%
+\fi %
+\csname X#1\endcsname %It's defined, so just use it.
+}}
+
+% Read the last existing aux file, if any.  No error if none exists.
+
+% This is the macro invoked by entries in the aux file.
+\def\xrdef #1#2{
+{\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
+
+{
+\catcode `\^^@=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\^^C=\other
+\catcode `\^^D=\other
+\catcode `\^^E=\other
+\catcode `\^^F=\other
+\catcode `\^^G=\other
+\catcode `\^^H=\other
+\catcode `\=\other
+\catcode `\^^L=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\=\other
+\catcode `\^^[=\other
+\catcode `\^^\=\other
+\catcode `\^^]=\other
+\catcode `\^^^=\other
+\catcode `\^^_=\other
+\catcode `\@=\other
+\catcode `\^=\other
+\catcode `\~=\other
+\catcode `\[=\other
+\catcode `\]=\other
+\catcode`\"=\other
+\catcode`\_=\other
+\catcode`\|=\other
+\catcode`\<=\other
+\catcode`\>=\other
+\catcode `\$=\other
+\catcode `\#=\other
+\catcode `\&=\other
+
+% the aux file uses ' as the escape.
+% Turn off \ as an escape so we do not lose on
+% entries which were dumped with control sequences in their names.
+% For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
+% Reference to such entries still does not work the way one would wish,
+% but at least they do not bomb out when the aux file is read in.
+
+\catcode `\{=1 \catcode `\}=2
+\catcode `\%=\other
+\catcode `\'=0
+\catcode `\\=\other
+
+'openin 1 'jobname.aux
+'ifeof 1 'else 'closein 1 'input 'jobname.aux
+'fi
+}
+
+% Open the new aux file.  Tex will close it automatically at exit.
+
+\openout \auxfile=\jobname.aux
+
+% Footnotes.
+
+\newcount \footnoteno
+
+\def\supereject{\par\penalty -20000\footnoteno =0 }
+
+\let\ptexfootnote=\footnote
+
+{\catcode `\@=11
+\gdef\footnote{\global\advance \footnoteno by \@ne
+\edef\thisfootno{$^{\the\footnoteno}$}%
+\let\@sf\empty
+\ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
+\thisfootno\@sf\parsearg\footnotezzz}
+
+\gdef\footnotezzz #1{\insert\footins{
+\interlinepenalty\interfootnotelinepenalty
+\splittopskip\ht\strutbox % top baseline for broken footnotes
+\splitmaxdepth\dp\strutbox \floatingpenalty\@MM
+\leftskip\z at skip \rightskip\z at skip \spaceskip\z at skip \xspaceskip\z at skip
+\footstrut\hang\textindent{\thisfootno}#1\strut}}
+
+}%end \catcode `\@=11
+
+% End of control word definitions.
+
+\message{and turning on texinfo input format.}
+
+\newindex{cp}
+\newcodeindex{fn}
+\newcodeindex{vr}
+\newcodeindex{tp}
+\newcodeindex{ky}
+\newcodeindex{pg}
+
+% Set some numeric style parameters, for 8.5 x 11 format.
+
+\hsize = 6.5in
+\parindent 15pt
+\parskip 18pt plus 1pt
+\baselineskip 15pt
+\advance\topskip by 1.2cm
+
+% Prevent underfull vbox error messages.
+\vbadness=10000
+
+% Use @smallbook to reset parameters for 7x9.5 format
+\def\smallbook{
+\global\lispnarrowing = 0.3in
+\global\baselineskip 12pt
+\global\parskip 3pt plus 1pt
+\global\hsize = 5in
+\global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in
+\global\vsize=7.5in
+\global\tolerance=700
+\global\hfuzz=1pt
+
+\global\pagewidth=\hsize
+\global\pageheight=\vsize
+\global\font\ninett=cmtt9
+
+\global\let\smalllisp=\smalllispx
+\global\let\smallexample=\smalllispx
+\global\def\Esmallexample{\Esmalllisp}
+}
+
+%% For a final copy, take out the rectangles
+%% that mark overfull boxes (in case you have decided
+%% that the text looks ok even though it passes the margin).
+\def\finalout{\overfullrule=0pt}
+
+% Turn off all special characters except @
+% (and those which the user can use as if they were ordinary)
+% Define certain chars to be always in tt font.
+
+\catcode`\"=\active
+\def\activedoublequote{{\tt \char '042}}
+\let"=\activedoublequote
+\catcode`\~=\active
+\def~{{\tt \char '176}}
+\chardef\hat=`\^
+\catcode`\^=\active
+\def^{{\tt \hat}}
+\catcode`\_=\active
+\def_{{\tt \char '137}}
+\catcode`\|=\active
+\def|{{\tt \char '174}}
+\chardef \less=`\<
+\catcode`\<=\active
+\def<{{\tt \less}}
+\chardef \gtr=`\>
+\catcode`\>=\active
+\def>{{\tt \gtr}}
+
+\catcode`\@=0
+
+% \rawbackslashxx output one backslash character in current font
+{\catcode`\\=\other
+ at gdef@rawbackslashxx{\}}
+
+% \rawbackslash redefines \ as input to do \rawbackslashxx.
+{\catcode`\\=\active
+ at gdef@rawbackslash{@let\=@rawbackslashxx }}
+
+% \normalbackslash outputs one backslash in fixed width font.
+\def\normalbackslash{{\tt\rawbackslashxx}}
+
+% Say @foo, not \foo, in error messages.
+\escapechar=`\@
+
+%% These look ok in all fonts, so just make them not special.  The @rm below
+%% makes sure that the current font starts out as the newly loaded cmr10
+\catcode`\$=\other \catcode`\%=\other \catcode`\&=\other \catcode`\#=\other
+
+\catcode 17=0   @c Define control-q
+\catcode`\\=\active
+ at let\=@normalbackslash
+
+ at textfonts
+ at rm

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.guess
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.guess?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.guess (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.guess Mon Feb  9 12:49:22 2009
@@ -1,8 +1,11 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 #   Free Software Foundation, Inc.
-#
+
+timestamp='2008-01-23'
+
 # This file 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
@@ -15,44 +18,118 @@
 #
 # 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.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-# Written by Per Bothner <bothner at cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
-# Please send patches to <autoconf-patches at gnu.org>.
+
+# Originally written by Per Bothner <per at bothner.com>.
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
 # The plan is that this can be called by configure scripts if you
-# don't specify an explicit system type (host/target name).
-#
-# Only a few systems have been added to this list; please add others
-# (but try to keep the structure clean).
-#
-
-# Use $HOST_CC if defined. $CC may point to a cross-compiler
-if test x"$CC_FOR_BUILD" = x; then
-  if test x"$HOST_CC" != x; then
-    CC_FOR_BUILD="$HOST_CC"
-  else
-    if test x"$CC" != x; then
-      CC_FOR_BUILD="$CC"
-    else
-      CC_FOR_BUILD=cc
-    fi
-  fi
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
 fi
 
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi at noc.rutgers.edu 8/24/94.)
+# (ghazi at noc.rutgers.edu 1994-08-24)
 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
 	PATH=$PATH:/.attbin ; export PATH
 fi
@@ -62,112 +139,173 @@
 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
-
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+	fi
+				;;
+	    *)
+	        os=netbsd
+				;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+				;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+				;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
     alpha:OSF1:*:*)
-	if test $UNAME_RELEASE = "V4.0"; then
+	case $UNAME_RELEASE in
+	*4.0)
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-	fi
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+				;;
+		esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	cat <<EOF >$dummy.s
-	.globl main
-	.ent main
-main:
-	.frame \$30,0,\$26,0
-	.prologue 0
-	.long 0x47e03d80 # implver $0
-	lda \$2,259
-	.long 0x47e20c21 # amask $2,$1
-	srl \$1,8,\$2
-	sll \$2,2,\$2
-	sll \$0,3,\$0
-	addl \$1,\$0,\$0
-	addl \$2,\$0,\$0
-	ret \$31,(\$26),1
-	.end main
-EOF
-	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
-	if test "$?" = 0 ; then
-		./$dummy
-		case "$?" in
-			7)
-				UNAME_MACHINE="alpha"
-				;;
-			15)
-				UNAME_MACHINE="alphaev5"
-				;;
-			14)
-				UNAME_MACHINE="alphaev56"
-				;;
-			10)
-				UNAME_MACHINE="alphapca56"
-				;;
-			16)
-				UNAME_MACHINE="alphaev6"
-				;;
-		esac
-	fi
-	rm -f $dummy.s $dummy
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit 0 ;;
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
 	# of the specific Alpha model?
 	echo alpha-pc-interix
-	exit 0 ;;
+	exit ;;
     21064:Windows_NT:50:3)
 	echo alpha-dec-winnt3.5
-	exit 0 ;;
+	exit ;;
     Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-cbm-sysv4
-	exit 0;;
-    amiga:NetBSD:*:*)
-      echo m68k-cbm-netbsd${UNAME_RELEASE}
-      exit 0 ;;
-    amiga:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
+	echo m68k-unknown-sysv4
+	exit ;;
     *:[Aa]miga[Oo][Ss]:*:*)
 	echo ${UNAME_MACHINE}-unknown-amigaos
-	exit 0 ;;
-    arc64:OpenBSD:*:*)
-	echo mips64el-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    arc:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    hkmips:OpenBSD:*:*)
-	echo mips-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    pmax:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    sgi:OpenBSD:*:*)
-	echo mips-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    wgrisc:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
     *:OS/390:*:*)
 	echo i370-ibm-openedition
-	exit 0 ;;
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
-	exit 0;;
-    arm32:NetBSD:*:*)
-	echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-	exit 0 ;;
-    SR2?01:HI-UX/MPP:*:*)
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
 	echo hppa1.1-hitachi-hiuxmpp
-	exit 0;;
+	exit ;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
 	if test "`(/bin/universe) 2>/dev/null`" = att ; then
@@ -175,25 +313,32 @@
 	else
 		echo pyramid-pyramid-bsd
 	fi
-	exit 0 ;;
+	exit ;;
     NILE*:*:*:dcosx)
 	echo pyramid-pyramid-svr4
-	exit 0 ;;
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
     sun4H:SunOS:5.*:*)
 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
+	exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
-    i86pc:SunOS:5.*:*)
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
+	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
 	# it's likely to be more like Solaris than SunOS4.
 	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
+	exit ;;
     sun4*:SunOS:*:*)
 	case "`/usr/bin/arch -k`" in
 	    Series*|S4*)
@@ -202,12 +347,12 @@
 	esac
 	# Japanese Language versions have a version number like `4.1.3-JL'.
 	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-	exit 0 ;;
+	exit ;;
     sun3*:SunOS:*:*)
 	echo m68k-sun-sunos${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     sun*:*:4.2BSD:*)
-	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
 	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
@@ -217,16 +362,10 @@
 		echo sparc-sun-sunos${UNAME_RELEASE}
 		;;
 	esac
-	exit 0 ;;
+	exit ;;
     aushp:SunOS:*:*)
 	echo sparc-auspex-sunos${UNAME_RELEASE}
-	exit 0 ;;
-    atari*:NetBSD:*:*)
-	echo m68k-atari-netbsd${UNAME_RELEASE}
-	exit 0 ;;
-    atari*:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
     # "atarist" or "atariste" at least should have a processor 
@@ -237,61 +376,45 @@
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
         echo m68k-atari-mint${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
 	echo m68k-atari-mint${UNAME_RELEASE}
-        exit 0 ;;
+        exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
         echo m68k-atari-mint${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
         echo m68k-milan-mint${UNAME_RELEASE}
-        exit 0 ;;
+        exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
         echo m68k-hades-mint${UNAME_RELEASE}
-        exit 0 ;;
+        exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
         echo m68k-unknown-mint${UNAME_RELEASE}
-        exit 0 ;;
-    sun3*:NetBSD:*:*)
-	echo m68k-sun-netbsd${UNAME_RELEASE}
-	exit 0 ;;
-    sun3*:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mac68k:NetBSD:*:*)
-	echo m68k-apple-netbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mac68k:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvme68k:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvme88k:OpenBSD:*:*)
-	echo m88k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
     powerpc:machten:*:*)
 	echo powerpc-apple-machten${UNAME_RELEASE}
-	exit 0 ;;
-    macppc:NetBSD:*:*)
-        echo powerpc-apple-netbsd${UNAME_RELEASE}
-        exit 0 ;;
+	exit ;;
     RISC*:Mach:*:*)
 	echo mips-dec-mach_bsd4.3
-	exit 0 ;;
+	exit ;;
     RISC*:ULTRIX:*:*)
 	echo mips-dec-ultrix${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     VAX*:ULTRIX*:*:*)
 	echo vax-dec-ultrix${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
 	echo clipper-intergraph-clix${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 #ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
 	int main (int argc, char *argv[]) {
 #else
 	int main (argc, argv) int argc; char *argv[]; {
@@ -310,28 +433,37 @@
 	  exit (-1);
 	}
 EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy \
-	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-	  && rm $dummy.c $dummy && exit 0
-	rm -f $dummy.c $dummy
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
 	echo mips-mips-riscos${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
     Night_Hawk:Power_UNIX:*:*)
 	echo powerpc-harris-powerunix
-	exit 0 ;;
+	exit ;;
     m88k:CX/UX:7*:*)
 	echo m88k-harris-cxux7
-	exit 0 ;;
+	exit ;;
     m88k:*:4*:R4*)
 	echo m88k-motorola-sysv4
-	exit 0 ;;
+	exit ;;
     m88k:*:3*:R3*)
 	echo m88k-motorola-sysv3
-	exit 0 ;;
+	exit ;;
     AViiON:dgux:*:*)
         # DG/UX returns AViiON for all architectures
         UNAME_PROCESSOR=`/usr/bin/uname -p`
-	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110]
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
 	then
 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
 	       [ ${TARGET_BINARY_INTERFACE}x = x ]
@@ -343,31 +475,40 @@
 	else
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
- 	exit 0 ;;
+ 	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
-	exit 0 ;;
+	exit ;;
     M88*:*:R3*:*)
 	# Delta 88k system running SVR3
 	echo m88k-motorola-sysv3
-	exit 0 ;;
+	exit ;;
     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
 	echo m88k-tektronix-sysv3
-	exit 0 ;;
+	exit ;;
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
 	echo m68k-tektronix-bsd
-	exit 0 ;;
+	exit ;;
     *:IRIX*:*:*)
 	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-	exit 0 ;;
+	exit ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
 	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
-	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
-    i?86:AIX:*:*)
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
 	echo i386-ibm-aix
-	exit 0 ;;
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
 		sed 's/^		//' << EOF >$dummy.c
 		#include <sys/systemcfg.h>
 
@@ -379,18 +520,21 @@
 			exit(0);
 			}
 EOF
-		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
-		rm -f $dummy.c $dummy
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
 		echo rs6000-ibm-aix3.2.5
+		fi
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
 		echo rs6000-ibm-aix3.2.4
 	else
 		echo rs6000-ibm-aix3.2
 	fi
-	exit 0 ;;
-    *:AIX:*:4)
-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
+	exit ;;
+    *:AIX:*:[456])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
 		IBM_ARCH=powerpc
@@ -398,37 +542,56 @@
 	if [ -x /usr/bin/oslevel ] ; then
 		IBM_REV=`/usr/bin/oslevel`
 	else
-		IBM_REV=4.${UNAME_RELEASE}
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
 	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-	exit 0 ;;
+	exit ;;
     *:AIX:*:*)
 	echo rs6000-ibm-aix
-	exit 0 ;;
+	exit ;;
     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
 	echo romp-ibm-bsd4.4
-	exit 0 ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
 	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-	exit 0 ;;                           # report: romp-ibm BSD 4.3
+	exit ;;                             # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
 	echo rs6000-bull-bosx
-	exit 0 ;;
+	exit ;;
     DPX/2?00:B.O.S.:*:*)
 	echo m68k-bull-sysv3
-	exit 0 ;;
+	exit ;;
     9000/[34]??:4.3bsd:1.*:*)
 	echo m68k-hp-bsd
-	exit 0 ;;
+	exit ;;
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
 	echo m68k-hp-bsd4.4
-	exit 0 ;;
+	exit ;;
     9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
 	case "${UNAME_MACHINE}" in
 	    9000/31? )            HP_ARCH=m68000 ;;
 	    9000/[34]?? )         HP_ARCH=m68k ;;
 	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
               sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
               #include <stdlib.h>
               #include <unistd.h>
 
@@ -459,13 +622,39 @@
                   exit (0);
               }
 EOF
-	(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=
3D`./$dummy`
-	rm -f $dummy.c $dummy
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
 	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
 	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-	exit 0 ;;
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
     3050*:HI-UX:*:*)
+	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 	#include <unistd.h>
 	int
@@ -491,434 +680,491 @@
 	  exit (0);
 	}
 EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
-	rm -f $dummy.c $dummy
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
 	echo unknown-hitachi-hiuxwe2
-	exit 0 ;;
+	exit ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
 	echo hppa1.1-hp-bsd
-	exit 0 ;;
+	exit ;;
     9000/8??:4.3bsd:*:*)
 	echo hppa1.0-hp-bsd
-	exit 0 ;;
-    *9??*:MPE/iX:*:*)
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
 	echo hppa1.0-hp-mpeix
-	exit 0 ;;
+	exit ;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
 	echo hppa1.1-hp-osf
-	exit 0 ;;
+	exit ;;
     hp8??:OSF1:*:*)
 	echo hppa1.0-hp-osf
-	exit 0 ;;
-    i?86:OSF1:*:*)
+	exit ;;
+    i*86:OSF1:*:*)
 	if [ -x /usr/sbin/sysversion ] ; then
 	    echo ${UNAME_MACHINE}-unknown-osf1mk
 	else
 	    echo ${UNAME_MACHINE}-unknown-osf1
 	fi
-	exit 0 ;;
+	exit ;;
     parisc*:Lites*:*:*)
 	echo hppa1.1-hp-lites
-	exit 0 ;;
-    hppa*:OpenBSD:*:*)
-	echo hppa-unknown-openbsd
-	exit 0 ;;
+	exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
-        exit 0 ;;
+        exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-        exit 0 ;;
+        exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
-        exit 0 ;;
+        exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
-        exit 0 ;;
+        exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
-        exit 0 ;;
-    CRAY*X-MP:*:*:*)
-	echo xmp-cray-unicos
-        exit 0 ;;
+        exit ;;
     CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos${UNAME_RELEASE}
-	exit 0 ;;
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
     CRAY*[A-Z]90:*:*:*)
 	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
-	exit 0 ;;
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
     CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE}
-	exit 0 ;;
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
     CRAY*T3E:*:*:*)
-	echo alpha-cray-unicosmk${UNAME_RELEASE}
-	exit 0 ;;
-    CRAY-2:*:*:*)
-	echo cray2-cray-unicos
-        exit 0 ;;
-    F300:UNIX_System_V:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit 0 ;;
-    F301:UNIX_System_V:*:*)
-       echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
-       exit 0 ;;
-    hp3[0-9][05]:NetBSD:*:*)
-	echo m68k-hp-netbsd${UNAME_RELEASE}
-	exit 0 ;;
-    hp300:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     sparc*:BSD/OS:*:*)
 	echo sparc-unknown-bsdi${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     *:BSD/OS:*:*)
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     *:FreeBSD:*:*)
-	if test -x /usr/bin/objformat; then
-	    if test "elf" = "`/usr/bin/objformat`"; then
-		echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
-		exit 0
-	    fi
-	fi
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-	exit 0 ;;
-    *:NetBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
-	exit 0 ;;
-    *:OpenBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-	exit 0 ;;
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
-	exit 0 ;;
-    i*:MINGW*:*)
+	exit ;;
+    *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
-	exit 0 ;;
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:[3456]*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    EM64T | authenticamd)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
 	# UNAME_MACHINE based on the output of uname instead of i386?
-	echo i386-pc-interix
-	exit 0 ;;
+	echo i586-pc-interix
+	exit ;;
     i*:UWIN*:*)
 	echo ${UNAME_MACHINE}-pc-uwin
-	exit 0 ;;
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
     p*:CYGWIN*:*)
 	echo powerpcle-unknown-cygwin
-	exit 0 ;;
+	exit ;;
     prep*:SunOS:5.*:*)
 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit 0 ;;
+	exit ;;
     *:GNU:*:*)
+	# the GNU system
 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-	exit 0 ;;
-    *:Linux:*:*)
-
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
 	# The BFD linker knows what the default object file format is, so
 	# first see if it will tell us. cd to the root directory to prevent
 	# problems with other programs or directories called `ld' in the path.
-	ld_help_string=`cd /; ld --help 2>&1`
-	ld_supported_emulations=`echo $ld_help_string \
-			 | sed -ne '/supported emulations:/!d
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
 				    s/[ 	][ 	]*/ /g
-				    s/.*supported emulations: *//
+				    s/.*supported targets: *//
 				    s/ .*//
 				    p'`
-        case "$ld_supported_emulations" in
-	  *ia64)
-		echo "${UNAME_MACHINE}-unknown-linux"
-		exit 0
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
 		;;
-	  i?86linux)
+	  a.out-i386-linux)
 		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit 0
-		;;
-	  i?86coff)
+		exit ;;
+	  coff-i386)
 		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit 0
-		;;
-	  sparclinux)
-		echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
-		exit 0
-		;;
-	  armlinux)
-		echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
-		exit 0
-		;;
-	  elf32arm*)
-		echo "${UNAME_MACHINE}-unknown-linux-gnu"
-		exit 0
-		;;
-	  armelf_linux*)
-		echo "${UNAME_MACHINE}-unknown-linux-gnu"
-		exit 0
-		;;
-	  m68klinux)
-		echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
-		exit 0
-		;;
-	  elf32ppc)
-		# Determine Lib Version
-		cat >$dummy.c <<EOF
-#include <features.h>
-#if defined(__GLIBC__)
-extern char __libc_version[];
-extern char __libc_release[];
-#endif
-main(argc, argv)
-     int argc;
-     char *argv[];
-{
-#if defined(__GLIBC__)
-  printf("%s %s\n", __libc_version, __libc_release);
-#else
-  printf("unkown\n");
-#endif
-  return 0;
-}
-EOF
-		LIBC=""
-		$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
-		if test "$?" = 0 ; then
-			./$dummy | grep 1\.99 > /dev/null
-			if test "$?" = 0 ; then
-				LIBC="libc1"
-			fi
-		fi	
-		rm -f $dummy.c $dummy
-		echo powerpc-unknown-linux-gnu${LIBC}
-		exit 0
-		;;
-	esac
-
-	if test "${UNAME_MACHINE}" = "alpha" ; then
-		sed 's/^	//'  <<EOF >$dummy.s
-		.globl main
-		.ent main
-	main:
-		.frame \$30,0,\$26,0
-		.prologue 0
-		.long 0x47e03d80 # implver $0
-		lda \$2,259
-		.long 0x47e20c21 # amask $2,$1
-		srl \$1,8,\$2
-		sll \$2,2,\$2
-		sll \$0,3,\$0
-		addl \$1,\$0,\$0
-		addl \$2,\$0,\$0
-		ret \$31,(\$26),1
-		.end main
-EOF
-		LIBC=""
-		$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
-		if test "$?" = 0 ; then
-			./$dummy
-			case "$?" in
-			7)
-				UNAME_MACHINE="alpha"
-				;;
-			15)
-				UNAME_MACHINE="alphaev5"
-				;;
-			14)
-				UNAME_MACHINE="alphaev56"
-				;;
-			10)
-				UNAME_MACHINE="alphapca56"
-				;;
-			16)
-				UNAME_MACHINE="alphaev6"
-				;;
-			esac
-
-			objdump --private-headers $dummy | \
-			  grep ld.so.1 > /dev/null
-			if test "$?" = 0 ; then
-				LIBC="libc1"
-			fi
-		fi
-		rm -f $dummy.s $dummy
-		echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
-	elif test "${UNAME_MACHINE}" = "mips" ; then
-	  cat >$dummy.c <<EOF
-#ifdef __cplusplus
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __MIPSEB__
-  printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
-  printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
-  return 0;
-}
-EOF
-	  $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
-	  rm -f $dummy.c $dummy
-	else
-	  # Either a pre-BFD a.out linker (linux-gnuoldld)
-	  # or one that does not give us useful --help.
-	  # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
-	  # If ld does not provide *any* "supported emulations:"
-	  # that means it is gnuoldld.
-	  echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
-	  test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
-
-	  case "${UNAME_MACHINE}" in
-	  i?86)
-	    VENDOR=pc;
-	    ;;
-	  *)
-	    VENDOR=unknown;
-	    ;;
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
 	  esac
 	  # Determine whether the default compiler is a.out or elf
-	  cat >$dummy.c <<EOF
-#include <features.h>
-#ifdef __cplusplus
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __ELF__
-# ifdef __GLIBC__
-#  if __GLIBC__ >= 2
-    printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
-#  else
-    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-#  endif
-# else
-   printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-#else
-  printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
-#endif
-  return 0;
-}
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
 EOF
-	  $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
-	  rm -f $dummy.c $dummy
-	fi ;;
-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
-# are messed up and put the nodename in both sysname and nodename.
-    i?86:DYNIX/ptx:4*:*)
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
 	echo i386-sequent-sysv4
-	exit 0 ;;
-    i?86:UNIX_SV:4.2MP:2.*)
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
         # Unixware is an offshoot of SVR4, but it has its own version
         # number series starting with 2...
         # I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
         # Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-	exit 0 ;;
-    i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
 	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
 		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
 	else
 		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
 	fi
-	exit 0 ;;
-    i?86:*:5:7*)
-        # Fixed at (any) Pentium or better
-        UNAME_MACHINE=i586
-        if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
-	    echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
-	else
-	    echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
-	fi
-	exit 0 ;;
-    i?86:*:3.2:*)
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
 		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
-		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
-		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
-		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
 			&& UNAME_MACHINE=i586
-		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
 			&& UNAME_MACHINE=i686
-		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
 			&& UNAME_MACHINE=i686
 		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
 	else
 		echo ${UNAME_MACHINE}-pc-sysv32
 	fi
-	exit 0 ;;
+	exit ;;
     pc:*:*:*)
+	# Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
         # the processor, so we play safe by assuming i386.
 	echo i386-pc-msdosdjgpp
-        exit 0 ;;
+        exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
-	exit 0 ;;
+	exit ;;
     paragon:*:*:*)
 	echo i860-intel-osf1
-	exit 0 ;;
+	exit ;;
     i860:*:4.*:*) # i860-SVR4
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
 	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
 	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
 	fi
-	exit 0 ;;
+	exit ;;
     mini*:CTIX:SYS*5:*)
 	# "miniframe"
 	echo m68010-convergent-sysv
-	exit 0 ;;
-    M68*:*:R3V[567]*:*)
-	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && echo i486-ncr-sysv4 && exit 0 ;;
-    m68*:LynxOS:2.*:*)
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
 	echo m68k-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
-	exit 0 ;;
-    i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     TSUNAMI:LynxOS:2.*:*)
 	echo sparc-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
-    rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+	exit ;;
+    rs6000:LynxOS:2.*:*)
 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
     SM[BE]S:UNIX_SV:*:*)
 	echo mips-dde-sysv${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     RM*:ReliantUNIX-*:*:*)
 	echo mips-sni-sysv4
-	exit 0 ;;
+	exit ;;
     RM*:SINIX-*:*:*)
 	echo mips-sni-sysv4
-	exit 0 ;;
+	exit ;;
     *:SINIX-*:*:*)
 	if uname -p 2>/dev/null >/dev/null ; then
 		UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -926,62 +1172,164 @@
 	else
 		echo ns32k-sni-sysv
 	fi
-	exit 0 ;;
-    PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
                            # says <Richard.M.Bartel at ccMail.Census.GOV>
         echo i586-unisys-sysv4
-        exit 0 ;;
+        exit ;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes at openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
 	echo hppa1.1-stratus-sysv4
-	exit 0 ;;
+	exit ;;
     *:*:*:FTX*)
 	# From seanf at swdc.stratus.com.
 	echo i860-stratus-sysv4
-	exit 0 ;;
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
     mc68*:A/UX:*:*)
 	echo m68k-apple-aux${UNAME_RELEASE}
-	exit 0 ;;
-    news*:NEWS-OS:*:6*)
+	exit ;;
+    news*:NEWS-OS:6*:*)
 	echo mips-sony-newsos6
-	exit 0 ;;
+	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
 	        echo mips-nec-sysv${UNAME_RELEASE}
 	else
 	        echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
-        exit 0 ;;
+        exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
-	exit 0 ;;
+	exit ;;
     BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
 	echo powerpc-apple-beos
-	exit 0 ;;
+	exit ;;
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
 	echo i586-pc-beos
-	exit 0 ;;
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     SX-5:SUPER-UX:*:*)
 	echo sx5-nec-superux${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
     *:Rhapsody:*:*)
 	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-	exit 0 ;;
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
     *:QNX:*:4*)
-	echo i386-qnx-qnx${UNAME_VERSION}
-	exit 0 ;;
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
 
+eval $set_cc_for_build
 cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
 # include <sys/types.h>
@@ -1007,7 +1355,7 @@
 #endif
 
 #if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix"); exit (0);
+  printf ("arm-acorn-riscix\n"); exit (0);
 #endif
 
 #if defined (hp300) && !defined (hpux)
@@ -1068,11 +1416,24 @@
 #endif
 
 #if defined (vax)
-#if !defined (ultrix)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
   printf ("vax-dec-bsd\n"); exit (0);
-#else
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
   printf ("vax-dec-ultrix\n"); exit (0);
-#endif
+# endif
 #endif
 
 #if defined (alliant) && defined (i860)
@@ -1083,12 +1444,12 @@
 }
 EOF
 
-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
-rm -f $dummy.c $dummy
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
 
 # Apollos put the system type in the environment.
 
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
 
 # Convex versions that predate uname can use getsysinfo(1)
 
@@ -1097,25 +1458,69 @@
     case `getsysinfo -f cpu_type` in
     c1*)
 	echo c1-convex-bsd
-	exit 0 ;;
+	exit ;;
     c2*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-	exit 0 ;;
+	exit ;;
     c34*)
 	echo c34-convex-bsd
-	exit 0 ;;
+	exit ;;
     c38*)
 	echo c38-convex-bsd
-	exit 0 ;;
+	exit ;;
     c4*)
 	echo c4-convex-bsd
-	exit 0 ;;
+	exit ;;
     esac
 fi
 
-#echo '(Unable to guess system type)' 1>&2
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
 
 exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.h.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.h.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.h.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.h.in Mon Feb  9 12:49:22 2009
@@ -1,9 +1,8 @@
 /* config.h.in.  Generated from configure.in by autoheader.  */
 
 
-/* $Id: configure.in,v 1.297 2006/11/30 17:11:16 murch Exp $ */
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,6 +40,8 @@
  * 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.
+ *
+ * $Id: configure.in,v 1.308 2008/10/08 23:28:58 murch Exp $
  */
 
 #ifndef _CYRUS_IMAPD_CONFIG_H_
@@ -61,7 +63,7 @@
 /* Enable the LISTEXT extension? */
 #undef ENABLE_LISTEXT
 
-/* Do we have a decent regex library? */
+/* Do we have a regex library? */
 #undef ENABLE_REGEX
 
 /* Enable Netscape Menu Option Hack? */
@@ -84,6 +86,10 @@
 
 /* Define to 1 if you have the `daemon' function. */
 #undef HAVE_DAEMON
+
+/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
+   */
+#undef HAVE_DECL_TZNAME
 
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */
@@ -113,6 +119,9 @@
 /* Define to 1 if you have the `getdtablesize' function. */
 #undef HAVE_GETDTABLESIZE
 
+/* Define to 1 if you have the `getgrouplist' function. */
+#undef HAVE_GETGROUPLIST
+
 /* Do we have a getnameinfo? */
 #undef HAVE_GETNAMEINFO
 
@@ -165,17 +174,26 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Do we have MySQL support? */
+#undef HAVE_MYSQL
+
 /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
 #undef HAVE_NDIR_H
 
 /* Do we have Net-SNMP support? */
 #undef HAVE_NETSNMP
 
+/* Define to 1 if you have the <pcreposix.h> header file. */
+#undef HAVE_PCREPOSIX_H
+
+/* Do we have Postgres support? */
+#undef HAVE_PGSQL
+
 /* Do we have an rlim_t? */
 #undef HAVE_RLIM_T
 
-/* Do we have rxposix.h? */
-#undef HAVE_RX
+/* Define to 1 if you have the <rxposix.h> header file. */
+#undef HAVE_RXPOSIX_H
 
 /* Define to 1 if you have the `setrlimit' function. */
 #undef HAVE_SETRLIMIT
@@ -191,6 +209,9 @@
 
 /* Do we have a socklen_t? */
 #undef HAVE_SOCKLEN_T
+
+/* Do we have SQLite support? */
+#undef HAVE_SQLITE
 
 /* Build with SSL support? */
 #undef HAVE_SSL
@@ -316,13 +337,22 @@
 /* Directiory to use for service binaries */
 #undef SERVICE_PATH
 
-/* The size of a `long', as computed by sizeof. */
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
 #undef SIZEOF_LONG
 
-/* The size of a `long long int', as computed by sizeof. */
+/* The size of `long long int', as computed by sizeof. */
 #undef SIZEOF_LONG_LONG_INT
 
-/* The size of a `unsigned long long int', as computed by sizeof. */
+/* The size of `off_t', as computed by sizeof. */
+#undef SIZEOF_OFF_T
+
+/* The size of `size_t', as computed by sizeof. */
+#undef SIZEOF_SIZE_T
+
+/* The size of `unsigned long long int', as computed by sizeof. */
 #undef SIZEOF_UNSIGNED_LONG_LONG_INT
 
 /* Do we already have setproctitle? */
@@ -482,6 +512,27 @@
 #define shutdown(fd, mode) 0
 #endif
 
+/* *printf() macros */
+#if (SIZEOF_SIZE_T == SIZEOF_INT)
+#define SIZE_T_FMT "%u"
+#elif (SIZEOF_SIZE_T == SIZEOF_LONG)
+#define SIZE_T_FMT "%lu"
+#elif (SIZEOF_SIZE_T == SIZEOF_LONG_LONG_INT)
+#define SIZE_T_FMT "%llu"
+#else
+#error dont know what to use for SIZE_T_FMT
+#endif
+
+#if (SIZEOF_OFF_T == SIZEOF_LONG)
+#define OFF_T_FMT "%ld"
+#define strtoofft(nptr, endptr, base) strtol(nptr, endptr, base)
+#elif (SIZEOF_OFF_T == SIZEOF_LONG_LONG_INT)
+#define OFF_T_FMT "%lld"
+#define strtoofft(nptr, endptr, base) strtoll(nptr, endptr, base)
+#else
+#error dont know what to use for OFF_T_FMT
+#endif
+
 /* compile time options; think carefully before modifying */
 enum {
     /* should we send an UNAVAILABLE message to master when

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.sub
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.sub?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.sub (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/config.sub Mon Feb  9 12:49:22 2009
@@ -1,6 +1,11 @@
 #! /bin/sh
-# Configuration validation subroutine script, version 1.1.
-#   Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc.
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
+
+timestamp='2008-01-16'
+
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
 # can handle that machine.  It does not imply ALL GNU software can.
@@ -17,14 +22,18 @@
 #
 # 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.
-
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
+
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
@@ -45,30 +54,75 @@
 #	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 # It is wrong to echo any other type of specification.
 
-if [ x$1 = x ]
-then
-	echo Configuration name missing. 1>&2
-	echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
-	echo "or     $0 ALIAS" 1>&2
-	echo where ALIAS is a recognized configuration type. 1>&2
-	exit 1
-fi
-
-# First pass through any local machine types.
-case $1 in
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
 	*local*)
+       # First pass through any local machine types.
 		echo $1
-		exit 0
-		;;
-	*)
-	;;
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
 esac
 
 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  linux-gnu*)
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -94,7 +148,7 @@
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple)
+	-apple | -axis | -knuth | -cray)
 		os=
 		basic_machine=$1
 		;;
@@ -108,8 +162,20 @@
 		os=-vxworks
 		basic_machine=$1
 		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
 	-hiux*)
 		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco5)
 		os=-sco3.2v5
@@ -124,6 +190,10 @@
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
 	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
 		# Don't forget version if it is 3.2v4 or newer.
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
@@ -166,27 +236,74 @@
 case $basic_machine in
 	# Recognize the basic CPU types without company name.
 	# Some are omitted here because they have special meanings below.
-	tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
-		| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
-		| 580 | i960 | h8300 \
-		| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
-		| alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
-		| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
-		| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
-		| mips64orion | mips64orionel | mipstx39 | mipstx39el \
-		| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
-		| mips64vr5000 | miprs64vr5000el | mcore \
-		| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
-		| thumb | d10v | fr30)
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
 		basic_machine=$basic_machine-unknown
 		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
 		;;
 
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
-	i[34567]86)
+	i*86 | x86_64)
 	  basic_machine=$basic_machine-pc
 	  ;;
 	# Object if more than one company name word.
@@ -195,24 +312,70 @@
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
-	# FIXME: clean up the formatting here.
-	vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
-	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
-	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
-	      | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
-	      | xmp-* | ymp-* \
-	      | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
-	      | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \
-	      | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
-	      | clipper-* | orion-* \
-	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
-	      | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
-	      | mips64el-* | mips64orion-* | mips64orionel-* \
-	      | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
-	      | mipstx39-* | mipstx39el-* | mcore-* \
-	      | f301-* | armv*-* | t3e-* \
-	      | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
-	      | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* )
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
@@ -230,6 +393,9 @@
 		basic_machine=a29k-amd
 		os=-udi
 		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
 	adobe68k)
 		basic_machine=m68010-adobe
 		os=-scout
@@ -244,19 +410,25 @@
 		basic_machine=a29k-none
 		os=-bsd
 		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	amdahl)
 		basic_machine=580-amdahl
 		os=-sysv
 		;;
 	amiga | amiga-*)
-		basic_machine=m68k-cbm
+		basic_machine=m68k-unknown
 		;;
 	amigaos | amigados)
-		basic_machine=m68k-cbm
+		basic_machine=m68k-unknown
 		os=-amigaos
 		;;
 	amigaunix | amix)
-		basic_machine=m68k-cbm
+		basic_machine=m68k-unknown
 		os=-sysv4
 		;;
 	apollo68)
@@ -275,6 +447,18 @@
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
 	convex-c1)
 		basic_machine=c1-convex
 		os=-bsd
@@ -295,26 +479,44 @@
 		basic_machine=c38-convex
 		os=-bsd
 		;;
-	cray | ymp)
-		basic_machine=ymp-cray
+	cray | j90)
+		basic_machine=j90-cray
 		os=-unicos
 		;;
-	cray2)
-		basic_machine=cray2-cray
-		os=-unicos
-		;;
-	[ctj]90-cray)
-		basic_machine=c90-cray
-		os=-unicos
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16)
+		basic_machine=cr16-unknown
+		os=-elf
 		;;
 	crds | unos)
 		basic_machine=m68k-crds
 		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
 	da30 | da30-*)
 		basic_machine=m68k-da30
 		;;
 	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
 		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
 		;;
 	delta | 3300 | motorola-3300 | motorola-delta \
 	      | 3300-motorola | delta-motorola)
@@ -324,6 +526,10 @@
 		basic_machine=m88k-motorola
 		os=-sysv3
 		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
 	dpx20 | dpx20-*)
 		basic_machine=rs6000-bull
 		os=-bosx
@@ -357,6 +563,10 @@
 		basic_machine=tron-gmicro
 		os=-sysv
 		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
 	h3050r* | hiux*)
 		basic_machine=hppa1.1-hitachi
 		os=-hiuxwe2
@@ -432,19 +642,19 @@
 		basic_machine=i370-ibm
 		;;
 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-	i[34567]86v32)
+	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
 		;;
-	i[34567]86v4*)
+	i*86v4*)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv4
 		;;
-	i[34567]86v)
+	i*86v)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv
 		;;
-	i[34567]86sol2)
+	i*86sol2)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-solaris2
 		;;
@@ -455,17 +665,6 @@
 	i386-vsta | vsta)
 		basic_machine=i386-unknown
 		os=-vsta
-		;;
-	i386-go32 | go32)
-		basic_machine=i386-unknown
-		os=-go32
-		;;
-	i386-mingw32 | mingw32)
-		basic_machine=i386-unknown
-		os=-mingw32
-		;;
-	i386-qnx | qnx)
-		basic_machine=i386-qnx
 		;;
 	iris | iris4d)
 		basic_machine=mips-sgi
@@ -481,6 +680,14 @@
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	m88k-omron*)
 		basic_machine=m88k-omron
 		;;
@@ -492,6 +699,14 @@
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
@@ -499,14 +714,6 @@
 		basic_machine=m68k-atari
 		os=-mint
 		;;
-	mipsel*-linux*)
-		basic_machine=mipsel-unknown
-		os=-linux-gnu
-		;;
-	mips*-linux*)
-		basic_machine=mips-unknown
-		os=-linux-gnu
-		;;
 	mips3*-*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
 		;;
@@ -517,9 +724,16 @@
 		basic_machine=m68k-rom68k
 		os=-coff
 		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
 	msdos)
-		basic_machine=i386-unknown
+		basic_machine=i386-pc
 		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
 	mvs)
 		basic_machine=i370-ibm
@@ -582,13 +796,27 @@
 		basic_machine=i960-intel
 		os=-mon960
 		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
 	np1)
 		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
 		;;
 	op50n-* | op60c-*)
 		basic_machine=hppa1.1-oki
 		os=-proelf
 		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
 	OSE68000 | ose68000)
 		basic_machine=m68000-ericsson
 		os=-ose
@@ -605,6 +833,14 @@
 		basic_machine=i860-intel
 		os=-osf
 		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	pbd)
 		basic_machine=sparc-tti
 		;;
@@ -614,28 +850,40 @@
         pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
-	pentium | p5 | k5 | k6 | nexen)
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
 		;;
-	pentiumpro | p6 | 6x86)
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
 		basic_machine=i686-pc
 		;;
-	pentiumii | pentium2)
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
 		basic_machine=i786-pc
 		;;
-	pentium-* | p5-* | k5-* | k6-* | nexen-*)
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumpro-* | p6-* | 6x86-*)
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumii-* | pentium2-*)
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
 		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pn)
 		basic_machine=pn-gould
 		;;
-	power)	basic_machine=rs6000-ibm
+	power)	basic_machine=power-ibm
 		;;
 	ppc)	basic_machine=powerpc-unknown
 	        ;;
@@ -647,8 +895,26 @@
 	ppcle-* | powerpclittle-*)
 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	ps2)
 		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
 		;;
 	rom68k)
 		basic_machine=m68k-rom68k
@@ -660,10 +926,30 @@
 	rtpc | rtpc-*)
 		basic_machine=romp-ibm
 		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
 	sa29200)
 		basic_machine=a29k-amd
 		os=-udi
 		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
 	sequent)
 		basic_machine=i386-sequent
 		;;
@@ -671,7 +957,13 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
-	sparclite-wrs)
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
 		basic_machine=sparclite-wrs
 		os=-vxworks
 		;;
@@ -729,13 +1021,37 @@
 	sun386 | sun386i | roadrunner)
 		basic_machine=i386-sun
 		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
 	symmetry)
 		basic_machine=i386-sequent
 		os=-dynix
 		;;
 	t3e)
-		basic_machine=t3e-cray
+		basic_machine=alphaev5-cray
 		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
 		;;
 	tx39)
 		basic_machine=mipstx39-unknown
@@ -743,8 +1059,16 @@
 	tx39el)
 		basic_machine=mipstx39el-unknown
 		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
 	tower | tower-32)
 		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
 		;;
 	udi29k)
 		basic_machine=a29k-amd
@@ -789,12 +1113,16 @@
 		basic_machine=hppa1.1-winbond
 		os=-proelf
 		;;
-	xmp)
-		basic_machine=xmp-cray
-		os=-unicos
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
 		;;
         xps | xps100)
 		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
 		;;
 	z8k-*-coff)
 		basic_machine=z8k-unknown
@@ -816,29 +1144,32 @@
 	op60c)
 		basic_machine=hppa1.1-oki
 		;;
-	mips)
-		if [ x$os = x-linux-gnu ]; then
-			basic_machine=mips-unknown
-		else
-			basic_machine=mips-mips
-		fi
-		;;
 	romp)
 		basic_machine=romp-ibm
 		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
 	rs6000)
 		basic_machine=rs6000-ibm
 		;;
 	vax)
 		basic_machine=vax-dec
 		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
 	pdp11)
 		basic_machine=pdp11-dec
 		;;
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sparc | sparcv9)
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
 		basic_machine=sparc-sun
 		;;
         cydra)
@@ -856,9 +1187,8 @@
 	pmac | pmac-mpw)
 		basic_machine=powerpc-apple
 		;;
-	c4x*)
-		basic_machine=c4x-none
-		os=-coff
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
 		;;
 	*)
 		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
@@ -912,22 +1242,49 @@
 	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
-	      | -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*)
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
-	      | -macos* | -mpw* | -magic* | -mon960* | -lnews*)
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
 		;;
 	-mac*)
 		os=`echo $os | sed -e 's|mac|macos|'`
 		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
 	-linux*)
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
@@ -940,6 +1297,12 @@
 	-opened*)
 		os=-openedition
 		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
 	-osfrose*)
 		os=-osfrose
 		;;
@@ -955,14 +1318,26 @@
 	-acis*)
 		os=-aos
 		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
 	-386bsd)
 		os=-bsd
 		;;
 	-ctix* | -uts*)
 		os=-sysv
 		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
 	-ns2 )
 	        os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
 		;;
 	# Preserve the version number of sinix5.
 	-sinix5.*)
@@ -971,15 +1346,15 @@
 	-sinix*)
 		os=-sysv4
 		;;
+        -tpf*)
+		os=-tpf
+		;;
 	-triton*)
 		os=-sysv3
 		;;
 	-oss*)
 		os=-sysv3
 		;;
-        -qnx)
-		os=-qnx4
-		;;
 	-svr4)
 		os=-sysv4
 		;;
@@ -1001,8 +1376,17 @@
 	-xenix)
 		os=-xenix
 		;;
-        -*mint | -*MiNT)
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
 	        os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
 		;;
 	-none)
 		;;
@@ -1026,6 +1410,12 @@
 # system, and we'll never get to this point.
 
 case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
 	*-acorn)
 		os=-riscix1.2
 		;;
@@ -1034,6 +1424,13 @@
 		;;
 	arm*-semi)
 		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
 		;;
         pdp11-*)
 		os=-none
@@ -1056,12 +1453,18 @@
 	m68*-cisco)
 		os=-aout
 		;;
+        mep-*)
+		os=-elf
+		;;
 	mips*-cisco)
 		os=-elf
 		;;
 	mips*-*)
 		os=-elf
 		;;
+	or32-*)
+		os=-coff
+		;;
 	*-tti)	# must be before sparc entry or we get the wrong os.
 		os=-sysv3
 		;;
@@ -1071,9 +1474,15 @@
 	*-be)
 		os=-beos
 		;;
+	*-haiku)
+		os=-haiku
+		;;
 	*-ibm)
 		os=-aix
 		;;
+    	*-knuth)
+		os=-mmixware
+		;;
 	*-wec)
 		os=-proelf
 		;;
@@ -1143,7 +1552,7 @@
 	*-masscomp)
 		os=-rtu
 		;;
-	f301-fujitsu)
+	f30[01]-fujitsu | f700-fujitsu)
 		os=-uxpv
 		;;
 	*-rom68k)
@@ -1206,10 +1615,16 @@
 			-mvs* | -opened*)
 				vendor=ibm
 				;;
+			-os400*)
+				vendor=ibm
+				;;
 			-ptx*)
 				vendor=sequent
 				;;
-			-vxsim* | -vxworks*)
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
 				vendor=wrs
 				;;
 			-aux*)
@@ -1221,8 +1636,11 @@
 			-mpw* | -macos*)
 				vendor=apple
 				;;
-			-*mint | -*MiNT)
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
 				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
 				;;
 		esac
 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
@@ -1230,3 +1648,11 @@
 esac
 
 echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/configure.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/configure.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/configure.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/configure.in Mon Feb  9 12:49:22 2009
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
 dnl
-dnl Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+dnl Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
 dnl
 dnl Redistribution and use in source and binary forms, with or without
 dnl modification, are permitted provided that the following conditions
@@ -17,19 +17,20 @@
 dnl
 dnl 3. The name "Carnegie Mellon University" must not be used to
 dnl    endorse or promote products derived from this software without
-dnl    prior written permission. For permission or any other legal
+dnl    prior written permission. For permission or any legal
 dnl    details, please contact  
-dnl      Office of Technology Transfer
 dnl      Carnegie Mellon University
-dnl      5000 Forbes Avenue
-dnl      Pittsburgh, PA  15213-3890
-dnl      (412) 268-4387, fax: (412) 268-7395
-dnl      tech-transfer at andrew.cmu.edu
+dnl      Center for Technology Transfer and Enterprise Creation
+dnl      4615 Forbes Avenue
+dnl      Suite 302
+dnl      Pittsburgh, PA  15213
+dnl      (412) 268-7393, fax: (412) 268-7395
+dnl      innovation at andrew.cmu.edu
 dnl
 dnl 4. Redistributions of any form whatsoever must retain the following
 dnl    acknowledgment:
-dnl    \"This product includes software developed by Computing Services
-dnl     at Carnegie Mellon University (http://www.cmu.edu/computing/).\"
+dnl    "This product includes software developed by Computing Services
+dnl     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
 dnl
 dnl CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
 dnl THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
@@ -39,10 +40,9 @@
 dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 dnl OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 dnl
-
+dnl $Id: configure.in,v 1.308 2008/10/08 23:28:58 murch Exp $
 dnl
 dnl configure.in for the Cyrus imapd
-dnl $Id: configure.in,v 1.297 2006/11/30 17:11:16 murch Exp $
 dnl
 
 
@@ -100,7 +100,11 @@
 fi
 AC_C_INLINE
 
+dnl Check the size of various types
+AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(size_t)
+AC_CHECK_SIZEOF(off_t)
 
 dnl Check if `long long int' is available
 AC_CHECK_SIZEOF(long long int)
@@ -119,7 +123,7 @@
 
 AC_CHECK_HEADERS(unistd.h sys/select.h sys/param.h stdarg.h)
 AC_REPLACE_FUNCS(memmove strcasecmp ftruncate strerror)
-AC_CHECK_FUNCS(strlcat strlcpy)
+AC_CHECK_FUNCS(strlcat strlcpy getgrouplist)
 AC_HEADER_DIRENT
 
 dnl do this before Berkeley DB/IPv6 detection
@@ -219,6 +223,204 @@
 
 dnl End Berkeley DB Detection
 
+
+dnl SQL DB Detection
+
+HAVE_SQL=0
+
+dnl MySQL
+AC_ARG_WITH(mysql,  [  --with-mysql=PATH       use MySQL from PATH [[no]] ],
+  with_mysql=$withval, with_mysql=no)
+
+# find location of library 
+# presuming if one given then correct
+if test "${with_mysql}" = "yes"; then
+  with_mysql=notfound
+  for mysqlloc in lib/mysql lib mysql/lib
+  do
+    if test -f ${prefix}/${mysqlloc}/libmysqlclient.a; then
+      with_mysql="${prefix}"
+      break
+    elif test -f /usr/local/${mysqlloc}/libmysqlclient.a; then
+      with_mysql="/usr/local"
+      break
+    elif test -f /usr/${mysqlloc}/libmysqlclient.a; then
+      with_mysql="/usr"
+      break
+    fi
+  done
+fi
+
+LIB_MYSQL_DIR=""
+
+case "$with_mysql" in
+    no) true;;
+    notfound) AC_WARN([MySQL Library not found]); true;;
+    *)
+     if test -d ${with_mysql}/lib/mysql; then
+	CMU_ADD_LIBPATH_TO(${with_mysql}/lib/mysql, LIB_MYSQL_DIR)
+     elif test -d ${with_mysql}/mysql/lib; then
+	CMU_ADD_LIBPATH_TO(${with_mysql}/mysql/lib, LIB_MYSQL_DIR)
+     elif test -d ${with_mysql}/lib; then
+	CMU_ADD_LIBPATH_TO(${with_mysql}/lib, LIB_MYSQL_DIR)
+     else
+	CMU_ADD_LIBPATH_TO(${with_mysql}, LIB_MYSQL_DIR)
+     fi
+
+     if test -d ${with_mysql}/include/mysql; then
+         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include/mysql"
+     elif test -d ${with_mysql}/mysql/include; then
+         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/mysql/include"
+     elif test -d ${with_mysql}/include; then
+         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include"
+     else
+         CPPFLAGS="${CPPFLAGS} -I${with_mysql}"
+     fi
+
+     save_mysql_LDFLAGS=$LDFLAGS
+     LDFLAGS="$LDFLAGS $LIB_MYSQL_DIR"
+     AC_CHECK_LIB(mysqlclient, mysql_select_db,
+         AC_DEFINE(HAVE_MYSQL, [], [Do we have MySQL support?]),
+         [AC_WARN([MySQL library mysqlclient does not work])
+	 with_mysql=no])
+     LDFLAGS=$save_mysql_LDFLAGS
+         
+     if test "${with_mysql}" != "no"; then
+         LDFLAGS="$LDFLAGS $LIB_MYSQL_DIR"
+         LIBS="$LIBS -lmysqlclient"
+	 HAVE_SQL=1
+     fi
+     ;;
+esac
+
+dnl PgSQL
+AC_ARG_WITH(pgsql,  [  --with-pgsql=PATH       use PostgreSQL from PATH [[no]] ],
+  with_pgsql=$withval, with_pgsql=no)
+
+# find location of library 
+# presuming if one given then correct
+if test "${with_pgsql}" = "yes"; then
+  with_pgsql=notfound
+  for pgsqlloc in lib/pgsql lib pgsql/lib
+  do
+    if test -f ${prefix}/${pgsqlloc}/libpq.a -o -f ${prefix}/${pgsqlloc}/libpq.so; then
+      with_pgsql="${prefix}"
+      break
+    elif test -f /usr/local/${pgsqlloc}/libpq.a -o -f /usr/local/${pgsqlloc}/libpq.so; then
+      with_pgsql="/usr/local"
+      break
+    elif test -f /usr/${pgsqlloc}/libpq.a -o -f /usr/${pgsqlloc}/libpq.so; then
+      with_pgsql="/usr"
+      break
+    fi
+  done
+fi
+
+LIB_PGSQL_DIR=""
+
+case "$with_pgsql" in
+    no) true;;
+    notfound) AC_WARN([PostgreSQL Library not found]); true;;
+    *)
+     if test -d ${with_pgsql}/lib/pgsql; then
+	CMU_ADD_LIBPATH_TO(${with_pgsql}/lib/pgsql, LIB_PGSQL_DIR)
+     elif test -d ${with_pgsql}/pgsql/lib; then
+	CMU_ADD_LIBPATH_TO(${with_pgsql}/pgsql/lib, LIB_PGSQL_DIR)
+     elif test -d ${with_pgsql}/lib; then
+	CMU_ADD_LIBPATH_TO(${with_pgsql}/lib, LIB_PGSQL_DIR)
+     else
+	CMU_ADD_LIBPATH_TO(${with_pgsql}, LIB_PGSQL_DIR)
+     fi
+
+     if test -d ${with_pgsql}/include/pgsql; then
+         CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/include/pgsql"
+     elif test -d ${with_pgsql}/pgsql/include; then
+         CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/pgsql/include"
+     elif test -d ${with_pgsql}/include; then
+         CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/include"
+     else
+         CPPFLAGS="${CPPFLAGS} -I${with_pgsql}"
+     fi
+
+     save_pgsql_LDFLAGS=$LDFLAGS
+     LDFLAGS="$LDFLAGS $LIB_PGSQL_DIR"
+     AC_CHECK_LIB(pq, PQsetdbLogin,
+         AC_DEFINE(HAVE_PGSQL, [], [Do we have Postgres support?]),
+         [AC_WARN([PostgreSQL Library pq does not work])
+	 with_pgsql=no])
+     LDFLAGS=$save_pgsql_LDFLAGS
+
+     if test "${with_pgsql}" != "no"; then
+         LDFLAGS="$LDFLAGS $LIB_PGSQL_DIR"
+         LIBS="$LIBS -lpq"
+	 HAVE_SQL=1
+     fi
+     ;;
+esac
+
+dnl SQLite
+AC_ARG_WITH(sqlite,  [  --with-sqlite=PATH      use SQLite from PATH [[no]] ],
+  with_sqlite=$withval, with_sqlite=no)
+
+# find location of library 
+# presuming if one given then correct
+if test "${with_sqlite}" = "yes"; then
+  with_sqlite=notfound
+  for sqliteloc in lib
+  do
+    if test -f ${prefix}/${sqliteloc}/libsqlite3.a -o -f ${prefix}/${sqliteloc}/libsqlite3.so; then
+      with_sqlite="${prefix}"
+      break
+    elif test -f /usr/local/${sqliteloc}/libsqlite3.a -o -f /usr/local/${sqliteloc}/libsqlite3.so; then
+      with_sqlite="/usr/local"
+      break
+    elif test -f /usr/${sqliteloc}/libsqlite3.a -o -f /usr/${sqliteloc}/libsqlite3.so; then
+      with_sqlite="/usr"
+      break
+    fi
+  done
+fi
+
+LIB_SQLITE_DIR=""
+
+case "$with_sqlite" in
+    no) true;;
+    notfound) AC_WARN([SQLite Library not found]); true;;
+    *)
+     if test -d ${with_sqlite}/lib; then
+         CMU_ADD_LIBPATH_TO(${with_sqlite}/lib, LIB_SQLITE_DIR)
+     else
+         CMU_ADD_LIBPATH_TO(${with_sqlite}, LIB_SQLITE_DIR)
+     fi
+
+     if test -d ${with_sqlite}/include; then
+         CPPFLAGS="${CPPFLAGS} -I${with_sqlite}/include"
+     else
+         CPPFLAGS="${CPPFLAGS} -I${with_sqlite}"
+     fi
+
+     save_sqlite_LDFLAGS=$LDFLAGS
+     LDFLAGS="$LDFLAGS $LIB_SQLITE_DIR"
+     AC_CHECK_LIB(sqlite3, sqlite3_open,
+         AC_DEFINE(HAVE_SQLITE, [], [Do we have SQLite support?]),
+         [AC_WARN([SQLite library sqlite does not work])
+	 with_sqlite=no])
+     LDFLAGS=$save_sqlite_LDFLAGS
+
+     if test "${with_sqlite}" != "no"; then
+         LDFLAGS="$LDFLAGS $LIB_SQLITE_DIR"
+         LIBS="$LIBS -lsqlite3"
+	 HAVE_SQL=1
+     fi
+     ;;
+esac
+
+if test $HAVE_SQL = 1; then
+  CYRUSDB_OBJS="${CYRUSDB_OBJS} cyrusdb_sql.o"
+fi
+
+dnl End SQL DB Detection
+
 AC_SUBST(CYRUSDB_OBJS)
 
 SIEVE_SUBDIRS=""
@@ -243,10 +445,21 @@
 	AC_PROG_LEX
 	AC_CHECK_LIB(fl,main)
 
- 	AC_SEARCH_LIBS(regcomp, rx regex, [
- 			AC_DEFINE(ENABLE_REGEX,[],[Do we have a decent regex library?])
-		 	AC_CHECK_HEADER(rxposix.h, AC_DEFINE(HAVE_RX,[],[Do we have rxposix.h?]))])
-  		
+	AC_CHECK_HEADERS(pcreposix.h rxposix.h)
+	if test "$ac_cv_header_pcreposix_h" == "yes"; then
+		LIBS="$LIBS -lpcre -lpcreposix";
+		AC_DEFINE(ENABLE_REGEX, [], [Do we have a regex library?])
+	else 
+		if test "$ac_cv_header_rxposix_h" == "yes"; then
+			LIBS="$LIBS -lrx"
+			AC_DEFINE(ENABLE_REGEX, [],
+				  [Do we have a regex library?])
+		else
+			AC_SEARCH_LIBS(regcomp, regex,
+					AC_DEFINE(ENABLE_REGEX, [],
+					[Do we have a regex library?]), [])
+		fi
+	fi
 
 	SIEVE_SUBDIRS="${SIEVE_SUBDIRS} $sievedir"
 	EXTRA_OUTPUT="${EXTRA_OUTPUT} $sievedir/Makefile"
@@ -811,6 +1024,9 @@
 	ENABLE_REPLICATION=$enableval
         if test "$ENABLE_REPLICATION" != no; then
 	  IMAP_PROGS="$IMAP_PROGS sync_client sync_server sync_reset make_md5"
+	  if test "$with_openssl" != "no"; then
+	     IMAP_PROGS="$IMAP_PROGS make_sha1"
+	  fi
         fi) 
 
 AC_SUBST(IMAP_PROGS)
@@ -861,12 +1077,12 @@
 case "$with_com_err" in
   # built-in et
   yes) # use the com_err we're gonna build
-	  COM_ERR_LIBS="../et/libcom_err.a"
-	  COMPILE_ET="../et/compile_et"
+	  COM_ERR_LIBS="../com_err/et/libcom_err.a"
+	  COMPILE_ET="../com_err/et/compile_et"
 	  COM_ERR_LDFLAGS=""
-	  COM_ERR_CPPFLAGS="-I\${top_srcdir}/et"
-	  PRE_SUBDIRS="et ${PRE_SUBDIRS}"
-	  EXTRA_OUTPUT="${EXTRA_OUTPUT} et/Makefile"
+	  COM_ERR_CPPFLAGS="-I\${top_srcdir}/com_err/et"
+	  PRE_SUBDIRS="com_err/et ${PRE_SUBDIRS}"
+	  EXTRA_OUTPUT="${EXTRA_OUTPUT} com_err/et/Makefile"
 	  ;;
   "")   # no problem, we already have it in the paths
 	# we do nothing to pick it up
@@ -1037,7 +1253,7 @@
 done
 
 IMAP_COM_ERR_LIBS="${COM_ERR_LIBS}"
-IMAP_LIBS="${LIB_SASL} ${LIBS}"
+IMAP_LIBS="${LIB_SASL} ${LIBS} ${SQL_LIBS}"
 
 AC_SUBST(LIB_RT)
 AC_SUBST(IMAP_COM_ERR_LIBS)
@@ -1054,9 +1270,8 @@
 AC_SUBST(PERL)
 
 AH_TOP([
-/* $Id: configure.in,v 1.297 2006/11/30 17:11:16 murch Exp $ */
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -1072,14 +1287,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -1093,6 +1309,8 @@
  * 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.
+ *
+ * $Id: configure.in,v 1.308 2008/10/08 23:28:58 murch Exp $
  */
 
 #ifndef _CYRUS_IMAPD_CONFIG_H_
@@ -1208,6 +1426,27 @@
 #define shutdown(fd, mode) 0
 #endif
 
+/* *printf() macros */
+#if (SIZEOF_SIZE_T == SIZEOF_INT)
+#define SIZE_T_FMT "%u"
+#elif (SIZEOF_SIZE_T == SIZEOF_LONG)
+#define SIZE_T_FMT "%lu"
+#elif (SIZEOF_SIZE_T == SIZEOF_LONG_LONG_INT)
+#define SIZE_T_FMT "%llu"
+#else
+#error dont know what to use for SIZE_T_FMT
+#endif
+
+#if (SIZEOF_OFF_T == SIZEOF_LONG)
+#define OFF_T_FMT "%ld"
+#define strtoofft(nptr, endptr, base) strtol(nptr, endptr, base)
+#elif (SIZEOF_OFF_T == SIZEOF_LONG_LONG_INT)
+#define OFF_T_FMT "%lld"
+#define strtoofft(nptr, endptr, base) strtoll(nptr, endptr, base)
+#else
+#error dont know what to use for OFF_T_FMT
+#endif
+
 /* compile time options; think carefully before modifying */
 enum {
     /* should we send an UNAVAILABLE message to master when

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/cyrus-graphtools.1.0/script/cyrus.pl
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/cyrus-graphtools.1.0/script/cyrus.pl?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/cyrus-graphtools.1.0/script/cyrus.pl (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/cyrus-graphtools.1.0/script/cyrus.pl Mon Feb  9 12:49:22 2009
@@ -1,35 +1,50 @@
 #!/usr/local/bin/perl5 
 
-################################################################################
-## This will read information from the cyrus MIB for all devices specified
-## in cyrusrc 
-##
-##           Copyright 2001 by Carnegie Mellon University
-## 
-##                       All Rights Reserved
-## 
-## Permission to use, copy, modify, and distribute this software and its
-## documentation for any purpose and without fee is hereby granted,
-## provided that the above copyright notice appear in all copies and that
-## both that copyright notice and this permission notice appear in
-## supporting documentation, and that the name of CMU not be
-## used in advertising or publicity pertaining to distribution of the
-## software without specific, written prior permission.
-## 
-## CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-## CMU 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.
-##
-## Author: Alison Greenwald <alison at andrew.cmu.edu>
-## $Id: cyrus.pl,v 1.1 2001/01/28 22:43:02 wcw Exp $
-##
-################################################################################
+# This will read information from the cyrus MIB for all devices specified
+# in cyrusrc 
 #
-
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: cyrus.pl,v 1.2 2008/03/24 20:28:40 murch Exp $
+#
+# Author: Alison Greenwald <alison at andrew.cmu.edu>
 
 use RRDs;
 use SNMP 1.8;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/drac_auth.patch
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/drac_auth.patch?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/drac_auth.patch (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/drac_auth.patch Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-$Id: drac_auth.patch,v 1.20 2007/02/06 15:39:09 murch Exp $
+$Id: drac_auth.patch,v 1.27 2008/09/25 11:24:48 murch Exp $
 
 Patch to add support for Dynamic Relay Authorization Control
 
@@ -67,11 +67,11 @@
 Index: configure.in
 ===============3D====================================================
 RCS file: /afs/andrew/system/cvs/src/cyrus/configure.in,v
-retrieving revision 1.297
-diff -u -r1.297 configure.in
---- configure.in	30 Nov 2006 17:11:16 -0000	1.297
-+++ configure.in	6 Feb 2007 15:34:18 -0000
-@@ -1003,6 +1003,19 @@
+retrieving revision 1.306
+diff -u -r1.306 configure.in
+--- configure.in	30 Jul 2008 16:03:36 -0000	1.306
++++ configure.in	25 Sep 2008 11:15:28 -0000
+@@ -1215,6 +1215,19 @@
  SNMP_SUBDIRS=""
  AC_SUBST(SNMP_SUBDIRS)
  
@@ -94,10 +94,10 @@
 Index: imap/Makefile.in
 ===============3D====================================================
 RCS file: /afs/andrew/system/cvs/src/cyrus/imap/Makefile.in,v
-retrieving revision 1.186
-diff -u -r1.186 Makefile.in
---- imap/Makefile.in	9 Jan 2007 17:41:35 -0000	1.186
-+++ imap/Makefile.in	6 Feb 2007 15:34:18 -0000
+retrieving revision 1.196
+diff -u -r1.196 Makefile.in
+--- imap/Makefile.in	23 Sep 2008 16:17:09 -0000	1.196
++++ imap/Makefile.in	25 Sep 2008 11:15:28 -0000
 @@ -66,6 +66,7 @@
  SIEVE_LIBS = @SIEVE_LIBS@
  IMAP_COM_ERR_LIBS = @IMAP_COM_ERR_LIBS@
@@ -107,7 +107,7 @@
  DEPLIBS = ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@
  
 @@ -202,17 +203,17 @@
- imapd: xversion $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE)
+ imapd: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE)
  	$(CC) $(LDFLAGS) -o imapd \
  	 $(SERVICE) $(IMAPDOBJS) mutex_fake.o \
 -	libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP)
@@ -123,7 +123,7 @@
  	$(QUANTIFY) $(QUANTOPT) $(CC) $(LDFLAGS) -o imapd.quant \
  	 $(SERVICE) $(IMAPDOBJS) mutex_fake.o libimap.a \
 -	$(DEPLIBS) $(LIBS) $(LIB_WRAP)
-+	$(DEPLIBS) $(LIBS) $(LIB_WRAP) $(DRAC_LIBS) $(DRAC_LIBS)
++	$(DEPLIBS) $(LIBS) $(LIB_WRAP) $(DRAC_LIBS)
  
  mupdate: mupdate.o mupdate-slave.o mupdate-client.o mutex_pthread.o tls.o \
  	libimap.a $(DEPLIBS)
@@ -139,11 +139,11 @@
 Index: imap/imapd.c
 ===============3D====================================================
 RCS file: /afs/andrew/system/cvs/src/cyrus/imap/imapd.c,v
-retrieving revision 1.509
-diff -u -r1.509 imapd.c
---- imap/imapd.c	5 Feb 2007 18:49:55 -0000	1.509
-+++ imap/imapd.c	6 Feb 2007 15:34:18 -0000
-@@ -183,6 +183,18 @@
+retrieving revision 1.551
+diff -u -r1.551 imapd.c
+--- imap/imapd.c	5 Sep 2008 15:56:21 -0000	1.551
++++ imap/imapd.c	25 Sep 2008 11:15:29 -0000
+@@ -188,6 +188,18 @@
      1, 1, &imapd_authstate, &imapd_userisadmin, &imapd_userisproxyadmin
  };
  
@@ -162,7 +162,7 @@
  /* current sub-user state */
  static struct mailbox mboxstruct;
  static struct mailbox *imapd_mailbox;
-@@ -653,6 +665,23 @@
+@@ -659,6 +671,23 @@
      /* setup for sending IMAP IDLE notifications */
      idle_enabled();
  
@@ -186,7 +186,7 @@
      /* create connection to the SNMP listener, if available. */
      snmp_connect(); /* ignore return code */
      snmp_set_str(SERVER_NAME_VERSION,CYRUS_VERSION);
-@@ -757,6 +786,15 @@
+@@ -767,6 +796,15 @@
  		imapd_haveaddr = 1;
  	    }
  	}
@@ -202,7 +202,7 @@
      }
  
      /* create the SASL connection */
-@@ -799,6 +837,11 @@
+@@ -809,6 +847,11 @@
      prot_flush(imapd_out);
      snmp_increment(ACTIVE_CONNECTIONS, -1);
  
@@ -214,7 +214,7 @@
      /* cleanup */
      imapd_reset();
  
-@@ -892,6 +935,10 @@
+@@ -907,6 +950,10 @@
  
      cyrus_done();
  
@@ -225,7 +225,7 @@
      exit(code);
  }
  
-@@ -952,6 +999,35 @@
+@@ -967,6 +1014,36 @@
      }
  }
  
@@ -235,7 +235,8 @@
 + * to let it know that we are still connected
 + */
 +struct prot_waitevent *drac_ping(struct protstream *s,
-+				 struct prot_waitevent *ev, void *rock)
++				 struct prot_waitevent *ev,
++				 void *rock __attribute__((unused)))
 +{
 +    char *err;
 +    static int nfailure = 0;
@@ -261,25 +262,25 @@
  /*
   * Top-level command loop parsing
   */
-@@ -2058,6 +2134,11 @@
+@@ -2132,6 +2209,11 @@
      capa_response(CAPA_PREAUTH|CAPA_POSTAUTH);
      prot_printf(imapd_out, "] %s\r\n", reply);
  
 +#ifdef DRAC_AUTH
-+    if (drac.interval && drac.clientaddr)
++    if (!imapd_userisproxyadmin && drac.interval && drac.clientaddr)
 +	drac.event = prot_addwaitevent(imapd_in, 0 /* now */, drac_ping, NULL);
 +#endif /* DRAC_AUTH */
 +
      /* Create telemetry log */
      imapd_logfd = telemetry_log(imapd_userid, imapd_in, imapd_out, 0);
  
-@@ -2214,6 +2295,11 @@
+@@ -2289,6 +2371,11 @@
  
      prot_setsasl(imapd_in,  imapd_saslconn);
      prot_setsasl(imapd_out, imapd_saslconn);
 +
 +#ifdef DRAC_AUTH
-+    if (drac.interval && drac.clientaddr)
++    if (!imapd_userisproxyadmin && drac.interval && drac.clientaddr)
 +	drac.event = prot_addwaitevent(imapd_in, 0 /* now */, drac_ping, NULL);
 +#endif /* DRAC_AUTH */
  
@@ -288,10 +289,10 @@
 Index: imap/pop3d.c
 ===============3D====================================================
 RCS file: /afs/andrew/system/cvs/src/cyrus/imap/pop3d.c,v
-retrieving revision 1.171
-diff -u -r1.171 pop3d.c
---- imap/pop3d.c	5 Feb 2007 18:41:48 -0000	1.171
-+++ imap/pop3d.c	6 Feb 2007 15:34:19 -0000
+retrieving revision 1.189
+diff -u -r1.189 pop3d.c
+--- imap/pop3d.c	22 Apr 2008 13:11:18 -0000	1.189
++++ imap/pop3d.c	25 Sep 2008 11:15:29 -0000
 @@ -105,6 +105,10 @@
  extern int opterr;
  
@@ -303,8 +304,33 @@
  
  #ifdef HAVE_SSL
  static SSL *tls_conn;
-@@ -522,6 +526,10 @@
-     prot_settimeout(popd_in, timeout*60);
+@@ -116,6 +120,7 @@
+ char *popd_userid = 0, *popd_subfolder = 0;
+ struct mailbox *popd_mailbox = 0;
+ struct auth_state *popd_authstate = 0;
++static int popd_userisproxyadmin = 0;
+ int config_popuseacl;
+ struct sockaddr_storage popd_localaddr, popd_remoteaddr;
+ int popd_haveaddr = 0;
+@@ -141,7 +146,7 @@
+ 
+ /* the sasl proxy policy context */
+ static struct proxy_context popd_proxyctx = {
+-    0, 1, &popd_authstate, NULL, NULL
++    0, 1, &popd_authstate, NULL, &popd_userisproxyadmin
+ };
+ 
+ /* signal to config.c */
+@@ -368,6 +373,7 @@
+ 	auth_freestate(popd_authstate);
+ 	popd_authstate = NULL;
+     }
++    popd_userisproxyadmin = 0;
+     if (popd_saslconn) {
+ 	sasl_dispose(&popd_saslconn);
+ 	popd_saslconn = NULL;
+@@ -536,6 +542,10 @@
+     prot_settimeout(popd_in, popd_timeout);
      prot_setflushonread(popd_in, popd_out);
  
 +#ifdef DRAC_AUTH
@@ -314,13 +340,13 @@
      if (kflag) kpop();
  
      /* we were connected on pop3s port so we should do 
-@@ -1653,6 +1661,21 @@
- 	popd_mailbox = &mboxstruct;
+@@ -1702,6 +1712,21 @@
  	proc_register("pop3d", popd_clienthost, popd_userid,
  		      popd_mailbox->name);
-+
-+#ifdef DRAC_AUTH
-+	if (drac_enabled &&
+     }
++
++#ifdef DRAC_AUTH
++    if (!popd_userisproxyadmin && drac_enabled &&
 +	    ((struct sockaddr *)&popd_remoteaddr)->sa_family == AF_INET) {
 +	    char *err;
 +
@@ -333,17 +359,17 @@
 +	    }
 +	}
 +#endif /* DRAC_AUTH */
-     }
  
      /* Create telemetry log */
+     popd_logfd = telemetry_log(popd_userid, popd_in, popd_out, 0);
 Index: imap/version.c
 ===============3D====================================================
 RCS file: /afs/andrew/system/cvs/src/cyrus/imap/version.c,v
-retrieving revision 1.20
-diff -u -r1.20 version.c
---- imap/version.c	30 Nov 2006 17:11:20 -0000	1.20
-+++ imap/version.c	6 Feb 2007 15:34:19 -0000
-@@ -151,6 +151,10 @@
+retrieving revision 1.22
+diff -u -r1.22 version.c
+--- imap/version.c	24 Mar 2008 17:09:20 -0000	1.22
++++ imap/version.c	25 Sep 2008 11:15:29 -0000
+@@ -153,6 +153,10 @@
      snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
  	     "; %s", SIEVE_VERSION);
  #endif
@@ -357,11 +383,11 @@
 Index: lib/imapoptions
 ===============3D====================================================
 RCS file: /afs/andrew/system/cvs/src/cyrus/lib/imapoptions,v
-retrieving revision 1.41
-diff -u -r1.41 imapoptions
---- lib/imapoptions	9 Jan 2007 17:29:31 -0000	1.41
-+++ lib/imapoptions	6 Feb 2007 15:34:19 -0000
-@@ -203,6 +203,14 @@
+retrieving revision 1.57
+diff -u -r1.57 imapoptions
+--- lib/imapoptions	24 Sep 2008 11:56:41 -0000	1.57
++++ lib/imapoptions	25 Sep 2008 11:15:29 -0000
+@@ -236,6 +236,14 @@
     grant the user the ability to delete a mailbox.  If a user has this
     right, they will automatically be given the new 'x' right. */
  
@@ -373,6 +399,6 @@
 +{ "drachost", "localhost", STRING }
 +/* Hostname of the RPC dracd server. */
 +
- { "duplicate_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist")}
+ { "duplicate_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql")}
  /* The cyrusdb backend to use for the duplicate delivery suppression
     and sieve. */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/fud-client.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/fud-client.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/fud-client.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/contrib/fud-client.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: fud-client.c,v 1.6 2008/03/24 20:28:40 murch Exp $
  */
-
-/* $Id: fud-client.c,v 1.5 2003/02/13 20:15:18 rjs3 Exp $ */
 
 /*  This is an example client for the experimental fud service. 
     For this to work, the mailbox must have the local ACL bit 0 enabled

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/changelog
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/changelog?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/changelog (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/changelog Mon Feb  9 12:49:22 2009
@@ -1,3 +1,13 @@
+cyrus-imapd-2.3 (2.3.13-1) experimental; urgency=low
+
+  * New upstream release (via conservative branch from Sirius in-house).
+  * Make debian/rules call autoconf and autoheader.
+  * Auto-detect BDB version from whichever -dev package is installed
+    at build time, rather than hardcoding in debian/control.
+  * Tweak the init script to support epoch in PACKAGE_VERSION.
+ 
+ -- Duncan Gibb <Duncan.Gibb at siriusit.co.uk>  Fri, 06 Feb 2009 15:41:07 +0000
+
 cyrus-imapd-2.3 (2.3.8-2) UNRELEASED; urgency=low
 
   * Fix a problem in cyrus-common-2.3.postrm (Closes: #439217)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/control
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/control?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/control (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/control Mon Feb  9 12:49:22 2009
@@ -4,14 +4,14 @@
 Maintainer: Debian Cyrus Team <pkg-cyrus-imapd-debian-devel at lists.alioth.debian.org>
 Uploaders: Henrique de Moraes Holschuh <hmh at debian.org>, Sven Mueller <sven at debian.org>, Benjamin Seidenberg <benjamin at debian.org>, OndÃ…=C2™ej Surý <ondrej at debian.org>
 Standards-Version: 3.7.2
-Build-Depends: debhelper (>= 4.1.68), tcl8.3-dev, libwrap0-dev, libpam0g-dev, libdb4.5-dev, libssl-dev, libzephyr-dev, libsasl2-dev (>= 2.1.9), comerr-dev, libsnmp9-dev | libsnmp5-dev, perl (>= 5.6.0-16), xutils, flex, bison, autotools-dev, po-debconf, dpatch, transfig, gs, groff, libkvm-dev [kfreebsd-i386], libkvm-dev [kfreebsd-amd64]
+Build-Depends: debhelper (>= 4.1.68), tcl8.3-dev, libwrap0-dev, libpam0g-dev, libdb4.4-dev | libdb4.5-dev | libdb4.6-dev, libssl-dev, libzephyr-dev, libsasl2-dev (>= 2.1.9), comerr-dev, libsnmp9-dev | libsnmp5-dev, perl (>= 5.6.0-16), xutils, flex, bison, autotools-dev, po-debconf, dpatch, transfig, gs, groff, libkvm-dev [kfreebsd-i386], libkvm-dev [kfreebsd-amd64]
 Xs-Vcs-Browser: https://mail.incase.de/viewcvs/branches/cyrus23/?root=cyrus22
 Xs-Vcs-Svn: https://mail.incase.de/svn/cyrus22/branches/cyrus23
 
 Package: cyrus-common-2.3
 Architecture: any
 Section: mail
-Depends: postfix | mail-transport-agent, adduser (>= 3.34), dpkg (>> 1.9.0), netbase (>= 4.07), gawk, ${shlibs:Depends}, ${perl:Depends}, ${misc:Depends}
+Depends: ssmtp | mail-transport-agent, adduser (>= 3.34), dpkg (>> 1.9.0), netbase (>= 4.07), gawk, ${shlibs:Depends}, ${perl:Depends}, ${misc:Depends}
 Recommends: cyrus-imapd-2.3 | cyrus-pop3d-2.3 | cyrus-murder-2.3 | cyrus-nntpd-2.3 | cyrus-admin-2.3
 Suggests: cyrus-clients-2.3, cyrus-admin-2.3, cyrus-imapd-2.3, cyrus-pop3d-2.3, cyrus-murder-2.3, cyrus-replication-2.3, cyrus-nntpd-2.3, cyrus-doc-2.3, sasl2-bin, apt-listchanges (>= 2.35)
 Conflicts: suidmanager (<< 0.50), cyrus-common, cyrus21-common, cyrus22-common, cyrus-common-2.2
@@ -38,8 +38,8 @@
  own MH-like format.
  .
  This package contains the common files needed by the other Cyrus
- components. The cyrus-imapd-2.2 and/or cyrus-pop3d-2.2 packages are needed
- to enable IMAP and POP3 support respectively. cyrus-murder-2.2 can be
+ components. The cyrus-imapd-2.3 and/or cyrus-pop3d-2.3 packages are needed
+ to enable IMAP and POP3 support respectively. cyrus-murder-2.3 can be
  used to enable IMAP, POP3 and LMTP proxying. cyrus-replication-2.3
  can be used to provide server replication between two imap servers.
  .

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/cyrus-common-2.3.cyrus2.3.init
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/cyrus-common-2.3.cyrus2.3.init?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/cyrus-common-2.3.cyrus2.3.init (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/cyrus-common-2.3.cyrus2.3.init Mon Feb  9 12:49:22 2009
@@ -48,7 +48,7 @@
 
 # Check if Cyrus 2.3 is installed
 test -x ${DAEMON} || exit 0
-grep -qE '^PACKAGE_VERSION[[:blank:]]+2[.]3' \
+grep -qE '^PACKAGE_VERSION[[:blank:]]+([0-9]+:|)2[.]3' \
 	/usr/lib/cyrus/cyrus-hardwired-config.txt >/dev/null 2>&1 || exit 0
 
 set -e

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/cyrus-common-2.3.postrm
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/cyrus-common-2.3.postrm?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/cyrus-common-2.3.postrm (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/cyrus-common-2.3.postrm Mon Feb  9 12:49:22 2009
@@ -55,8 +55,8 @@
 
 			db_get cyrus-common-2.3/removespools
 			[ "${RET}" = "true" ] && {
-				for i in /var/spool/cyrus /var/lib/cyrus \
-					/var/spool/sieve /etc/sieve ; do
+					for i in /var/spool/cyrus /var/lib/cyrus \
+					 /var/spool/sieve /etc/sieve ; do
 					find "$i" -type f -exec rm -f '{}' \; || true
 					find "$i" -type d -depth -not -name 'lost+found' -exec rmdir '{}' \; || true
 				done

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/executable.files
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/executable.files?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/executable.files (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/executable.files Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 ./autogen.sh
-./configure
+./com_err/et/compile_et.sh
+./com_err/et/config_script
 ./contrib/cyrus-graphtools.1.0/cgi-bin/cyrus_master.pl
 ./contrib/cyrus-graphtools.1.0/cgi-bin/graph_cyrus_db-sum.pl
 ./contrib/cyrus-graphtools.1.0/cgi-bin/graph_cyrus_db.pl
@@ -16,8 +17,6 @@
 ./debian/examples/mboxtocyrus
 ./debian/rules
 ./doc/internal/internationalization.html
-./et/compile_et.sh
-./et/config_script
 ./imap/xversion.sh
 ./install-sh
 ./lib/test/run

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/00list
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/00list?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/00list (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/00list Mon Feb  9 12:49:22 2009
@@ -15,7 +15,6 @@
 16-fix_mib.dpatch
 17-fix_tail_syntax_in_xversion.h.dpatch
 19-fix_tls_ssl.dpatch
-20-fix-bdb-for-4.5.dpatch
 21-fix_config-parsing.dpatch
 25-update_install-sh.dpatch
 30-update_perlcalling.sh.dpatch
@@ -26,4 +25,3 @@
 72-faster-isdigit.dpatch
 75-update-imapd.conf-documentation.dpatch
 80-kbsd-no-psstrings.dpatch
-99-update-autoconf.dpatch

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/12-fix_timeout_handling.dpatch
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/12-fix_timeout_handling.dpatch?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/12-fix_timeout_handling.dpatch (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/12-fix_timeout_handling.dpatch Mon Feb  9 12:49:22 2009
@@ -5,18 +5,6 @@
 ## DP: fixes timeout handling
 
 @DPATCH@
-diff -urNad complete.dpatch/imap/signals.c /tmp/dpep.9pxAsS/complete.dpatch/imap/signals.c
---- complete.dpatch/imap/signals.c	2005-02-14 17:26:50.000000000 +0100
-+++ /tmp/dpep.9pxAsS/complete.dpatch/imap/signals.c	2005-11-11 14:10:07.056723830 +0100
-@@ -50,7 +50,7 @@
- #include "xmalloc.h"
- #include "exitcodes.h"
- 
--static int gotsignal = 0;
-+static volatile int gotsignal = 0;
- 
- static void sighandler(int sig)
- {
 diff -urNad complete.dpatch/lib/lock.h /tmp/dpep.9pxAsS/complete.dpatch/lib/lock.h
 --- complete.dpatch/lib/lock.h	2003-02-13 21:15:40.000000000 +0100
 +++ /tmp/dpep.9pxAsS/complete.dpatch/lib/lock.h	2005-11-11 14:10:07.056723830 +0100

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/13-master_process_handling.dpatch
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/13-master_process_handling.dpatch?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/13-master_process_handling.dpatch (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/13-master_process_handling.dpatch Mon Feb  9 12:49:22 2009
@@ -17,18 +17,6 @@
  static int janitor_frequency = 1;	/* Janitor sweeps per second */
  static int janitor_position;		/* Entry to begin at in next sweep */
  static struct timeval janitor_mark;	/* Last time janitor did a sweep */
-@@ -193,9 +195,9 @@
- int become_cyrus(void)
- {
-     struct passwd *p;
--    int newuid, newgid;
-+    uid_t newuid, newgid;
-     int result;
--    static int uid = 0;
-+    static uid_t uid = 0;
- 
-     if (uid) return setuid(uid);
- 
 @@ -947,7 +949,7 @@
  		}
  	    }
@@ -231,3 +219,17 @@
  
  /*
   * Description of multiple address family support from
+diff -urNad cyrus-imapd-2.3-2.3.13~/lib/util.c cyrus-imapd-2.3-2.3.13/lib/util.c
+--- cyrus-imapd-2.3-2.3.13~/lib/util.c		2008-10-29 13:50:04.000000000 +0000
++++ cyrus-imapd-2.3-2.3.13/lib/util.c		2008-10-29 13:50:34.000000000 +0000
+@@ -365,9 +365,9 @@
+ int become_cyrus(void)
+ {
+     struct passwd *p;
+-    int newuid, newgid;
++    uid_t newuid, newgid;
+     int result;
+-    static int uid = 0;
++    static uid_t uid = 0;
+
+     if (uid) return setuid(uid);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/17-fix_tail_syntax_in_xversion.h.dpatch
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/17-fix_tail_syntax_in_xversion.h.dpatch?rev=768&root=
3Dcyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/17-fix_tail_syntax_in_xversion.h.dpatch (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/17-fix_tail_syntax_in_xversion.h.dpatch Mon Feb  9 12:49:22 2009
@@ -1,16 +1,20 @@
 #! /bin/sh /usr/share/dpatch/dpatch-run
 ## 17-fix_tail_syntax_in_xversion.h.dpatch by Sven Mueller <debian at incase.de>
+## Updated to 2.3.13 by Duncan Gibb <duncan.gibb at siriusit.co.uk>
 ##
 ## All lines beginning with `## DP:' are a description of the patch.
 ## DP: fix tail syntax in xversion.h (use "tail -n 1" instead of "tail -1")
 
 @DPATCH@
-diff -urNad complete.dpatch/imap/xversion.sh /tmp/dpep.gLdzBq/complete.dpatch/imap/xversion.sh
---- complete.dpatch/imap/xversion.sh	2003-10-22 20:03:00.000000000 +0200
-+++ /tmp/dpep.gLdzBq/complete.dpatch/imap/xversion.sh	2005-11-10 17:14:52.208238481 +0100
-@@ -22,4 +22,4 @@
+diff -aurNad cyrus-imapd-2.3-2.3.13~/imap/xversion.sh cyrus-imapd-2.3-2.3.13/imap/xversion.sh
+--- cyrus-imapd-2.3-2.3.13~/imap/xversion.sh		2008-10-29 13:58:52.000000000 +0000
++++ cyrus-imapd-2.3-2.3.13/imap/xversion.sh		2008-10-29 13:59:08.000000000 +0000
+@@ -62,7 +62,7 @@
  	match ($0, pattern) {
  	    printf "\"%s\"\n", substr($0, RSTART, RLENGTH)
  	}' pattern="$DATEPAT $TIMEPAT" | \
--	sort | tail -1 >> xversion.h
-+	sort | tail -n 1 >> xversion.h
+-	sort | tail -1 >> $TMPF
++	sort | tail -n 1 >> $TMPF
+ 
+ if [ -f xversion.h ] && cmp -s $TMPF xversion.h
+ then

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/30-update_perlcalling.sh.dpatch
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/30-update_perlcalling.sh.dpatch?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/30-update_perlcalling.sh.dpatch (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/30-update_perlcalling.sh.dpatch Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 #! /bin/sh /usr/share/dpatch/dpatch-run
 ## 30_update_perlcalling.sh.dpatch by Sven Mueller <debian at incase.de>
+## Updated to 2.3.13 by Duncan Gibb <duncan.gibb at siriusit.co.uk>
 ##
 ## All lines beginning with `## DP:' are a description of the patch.
 ## DP: updates calling of the perl interpreter to what we expect in Debian.
@@ -104,22 +105,21 @@
  # Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
  #
 diff -urNad cyrus-imapd-2.3-2.3.8/snmp/snmpgen /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/snmp/snmpgen
---- cyrus-imapd-2.3-2.3.8/snmp/snmpgen	2007-02-27 03:54:56.000000000 +0100
-+++ /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/snmp/snmpgen	2007-02-27 03:57:28.886495687 +0100
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/usr/bin/perl -w
- # 
- # Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
- #
-@@ -38,25 +38,8 @@
- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- #
--exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
--#!perl -w
- # $Id: snmpgen,v 1.19 2006/11/30 17:11:25 murch Exp $
- 
+--- cyrus-imapd-2.3-2.3.13/snmp/snmpgen 2008-10-29 14:53:34.000000000 +0000
++++ cyrus-imapd-2.3-2.3.13/snmp/snmpgen.sirius  2008-10-29 14:57:28.000000000 +0000
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/usr/bin/perl -w
+ # 
+ # Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
+ #
+@@ -41,24 +41,6 @@
+ #
+ # $Id: snmpgen,v 1.20 2008/03/24 20:10:50 murch Exp $
+
+-exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
+-#!perl -w
+-
 -if ($] !~ /^5\..*/) {
 -  # uh-oh. this isn't perl 5.
 -  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
@@ -136,7 +136,7 @@
 -
 -__END__
  require 5;
- 
+
  #Tim Martin
 diff -urNad cyrus-imapd-2.3-2.3.8/tools/arbitronsort.pl /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/arbitronsort.pl
 --- cyrus-imapd-2.3-2.3.8/tools/arbitronsort.pl	2007-02-27 03:54:56.000000000 +0100
@@ -148,188 +148,184 @@
  #
  # This script takes the output of arbitron (run without the -o option)
 diff -urNad cyrus-imapd-2.3-2.3.8/tools/config2header /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/config2header
---- cyrus-imapd-2.3-2.3.8/tools/config2header	2007-02-27 03:54:56.000000000 +0100
-+++ /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/config2header	2007-02-27 03:59:28.766571652 +0100
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/usr/bin/perl -w
- # $Id: config2header,v 1.13 2006/11/30 17:11:25 murch Exp $
- #
- # Copyright (c) 2001 Carnegie Mellon University.  All rights reserved.
-@@ -39,24 +39,6 @@
- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- #
--exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
--#!perl -w
--
--if ($] !~ /^5\..*/) {
--  # uh-oh. this isn't perl 5.
--  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
--    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
--  }
--  # we failed. bail.
--  die "Your perl is too old; I need perl 5.\n";
--}
--
--# load the real script. this is isolated in an 'eval' so perl4 won't
--# choke on the perl5-isms.
--eval join("\n", <DATA>);
--if ($@) { die "$@"; }
--
--__END__
- require 5;
- 
+--- cyrus-imapd-2.3-2.3.13/tools/config2header  2008-10-29 14:53:34.000000000 +0000
++++ cyrus-imapd-2.3-2.3.13/tools/config2header.sirius   2008-10-29 14:55:46.000000000 +0000
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/usr/bin/perl -w
+ #
+ # Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
+ #
+@@ -41,24 +41,6 @@
+ #
+ # $Id: config2header,v 1.15 2008/03/24 20:25:22 murch Exp $
+
+-exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
+-#!perl -w
+-
+-if ($] !~ /^5\..*/) {
+-  # uh-oh. this isn't perl 5.
+-  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
+-    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
+-  }
+-  # we failed. bail.
+-  die "Your perl is too old; I need perl 5.\n";
+-}
+-
+-# load the real script. this is isolated in an 'eval' so perl4 won't
+-# choke on the perl5-isms.
+-eval join("\n", <DATA>);
+-if ($@) { die "$@"; }
+-
+-__END__
+ require 5;
+
  use strict;
-diff -urNad cyrus-imapd-2.3-2.3.8/tools/config2man /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/config2man
---- cyrus-imapd-2.3-2.3.8/tools/config2man	2007-02-27 03:54:56.000000000 +0100
-+++ /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/config2man	2007-02-27 03:58:59.045529126 +0100
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/usr/bin/perl -w
- # $Id: config2man,v 1.4 2006/11/30 17:11:25 murch Exp $
- #
- # Copyright (c) 2001 Carnegie Mellon University.  All rights reserved.
-@@ -39,24 +39,6 @@
- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- #
--exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
--#!perl -w
--
--if ($] !~ /^5\..*/) {
--  # uh-oh. this isn't perl 5.
--  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
--    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
--  }
--  # we failed. bail.
--  die "Your perl is too old; I need perl 5.\n";
--}
--
--# load the real script. this is isolated in an 'eval' so perl4 won't
--# choke on the perl5-isms.
--eval join("\n", <DATA>);
--if ($@) { die "$@"; }
--
--__END__
- require 5;
- 
+diff -urNad cyrus-imapd-2.3-2.3.13/tools/config2man cyrus-imapd-2.3-2.3.13/tools/config2man.sirius
+--- cyrus-imapd-2.3-2.3.13/tools/config2man     2008-10-29 14:10:46.000000000 +0000
++++ cyrus-imapd-2.3-2.3.13/tools/config2man.sirius      2008-10-29 14:29:13.000000000 +0000
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/usr/bin/perl -w
+ #
+ # Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
+ #
+@@ -41,24 +41,6 @@
+ #
+ # $Id: config2man,v 1.5 2008/03/24 20:25:22 murch Exp $
+
+-exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
+-#!perl -w
+-
+-if ($] !~ /^5\..*/) {
+-  # uh-oh. this isn't perl 5.
+-  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
+-    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
+-  }
+-  # we failed. bail.
+-  die "Your perl is too old; I need perl 5.\n";
+-}
+-
+-# load the real script. this is isolated in an 'eval' so perl4 won't
+-# choke on the perl5-isms.
+-eval join("\n", <DATA>);
+-if ($@) { die "$@"; }
+-
+-__END__
+ require 5;
+
  use strict;
-diff -urNad cyrus-imapd-2.3-2.3.8/tools/dohash /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/dohash
---- cyrus-imapd-2.3-2.3.8/tools/dohash	2007-02-27 03:54:56.000000000 +0100
-+++ /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/dohash	2007-02-27 03:58:39.706453594 +0100
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/usr/bin/perl -w
- # 
- # Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
- #
-@@ -38,27 +38,10 @@
- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- #
+diff -urNad cyrus-imapd-2.3-2.3.13/tools/dohash cyrus-imapd-2.3-2.3.13/tools/dohash.sirius
+--- cyrus-imapd-2.3-2.3.13/tools/dohash 2008-10-29 14:10:46.000000000 +0000
++++ cyrus-imapd-2.3-2.3.13/tools/dohash.sirius  2008-10-29 14:30:50.000000000 +0000
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/usr/bin/perl -w
+ # 
+ # Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
+ #
+@@ -41,26 +41,9 @@
+ #
+ # $Id: dohash,v 1.13 2008/03/24 20:25:22 murch Exp $
+
 -exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 -#!perl -w
  # script to upgrade from versions of imapd previous to 1.6.2
  # make sure you run it as the cyrus user
- # $Id: dohash,v 1.12 2006/11/30 17:11:25 murch Exp $
- 
--if ($] !~ /^5\..*/) {
--  # uh-oh. this isn't perl 5.
--  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
--    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
--  }
--  # we failed. bail.
--  die "Your perl is too old; I need perl 5.\n";
--}
--
--# load the real script. this is isolated in an 'eval' so perl4 won't
--# choke on the perl5-isms.
--eval join("\n", <DATA>);
--if ($@) { die "$@"; }
--
--__END__
- require 5;
- 
+
+-if ($] !~ /^5\..*/) {
+-  # uh-oh. this isn't perl 5.
+-  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
+-    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
+-  }
+-  # we failed. bail.
+-  die "Your perl is too old; I need perl 5.\n";
+-}
+-
+-# load the real script. this is isolated in an 'eval' so perl4 won't
+-# choke on the perl5-isms.
+-eval join("\n", <DATA>);
+-if ($@) { die "$@"; }
+-
+-__END__
+ require 5;
+
  $| = 1;
 diff -urNad cyrus-imapd-2.3-2.3.8/tools/masssievec /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/masssievec
---- cyrus-imapd-2.3-2.3.8/tools/masssievec	2007-02-27 03:54:56.000000000 +0100
-+++ /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/masssievec	2007-02-27 03:58:22.326183189 +0100
+--- cyrus-imapd-2.3-2.3.13/tools/masssievec     2008-10-29 14:10:46.000000000 +0000
++++ cyrus-imapd-2.3-2.3.13/tools/masssievec.sirius      2008-10-29 14:34:13.000000000 +0000
 @@ -1,4 +1,6 @@
 -#!/bin/sh
 +#!/usr/bin/perl -w
-+# 
++#
 +# Script for mass compilation of sieve scripts.
  # 
- # Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
- #
-@@ -38,28 +40,11 @@
- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- #
--exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
--#!perl -w
- #
- # Script for mass compilation of sieve scripts.
- #
- # $Id: masssievec,v 1.6 2006/11/30 17:11:25 murch Exp $
- 
--if ($] !~ /^5\..*/) {
--  # uh-oh. this isn't perl 5.
--  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
--    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
--  }
--  # we failed. bail.
--  die "Your perl is too old; I need perl 5.\n";
--}
--
--# load the real script. this is isolated in an 'eval' so perl4 won't
--# choke on the perl5-isms.
--eval join("\n", <DATA>);
--if ($@) { die "$@"; }
--
--__END__
- require 5;
- 
+ # Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
+ #
+@@ -41,26 +43,6 @@
+ #
+ # $Id: masssievec,v 1.7 2008/03/24 20:25:22 murch Exp $
+
+-exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
+-#!perl -w
+-#
+-# Script for mass compilation of sieve scripts.
+-
+-if ($] !~ /^5\..*/) {
+-  # uh-oh. this isn't perl 5.
+-  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
+-    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
+-  }
+-  # we failed. bail.
+-  die "Your perl is too old; I need perl 5.\n";
+-}
+-
+-# load the real script. this is isolated in an 'eval' so perl4 won't
+-# choke on the perl5-isms.
+-eval join("\n", <DATA>);
+-if ($@) { die "$@"; }
+-
+-__END__
+ require 5;
+
  $| = 1;
 diff -urNad cyrus-imapd-2.3-2.3.8/tools/mkimap /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/mkimap
---- cyrus-imapd-2.3-2.3.8/tools/mkimap	2007-02-27 03:54:56.000000000 +0100
-+++ /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/mkimap	2007-02-27 03:57:49.725426588 +0100
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/usr/bin/perl
- # 
- # Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
- #
-@@ -38,25 +38,8 @@
- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- #
--exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
--#!perl -w
- # $Id: mkimap,v 1.18 2006/11/30 17:11:25 murch Exp $
- 
--if ($] !~ /^5\..*/) {
--  # uh-oh. this isn't perl 5.
--  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
--    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
--  }
--  # we failed. bail.
--  die "Your perl is too old; I need perl 5.\n";
--}
--
--# load the real script. this is isolated in an 'eval' so perl4 won't
--# choke on the perl5-isms.
--eval join("\n", <DATA>);
--if ($@) { die "$@"; }
--
--__END__
- require 5;
- 
+--- cyrus-imapd-2.3-2.3.13/tools/mkimap 2008-10-29 14:10:46.000000000 +0000
++++ cyrus-imapd-2.3-2.3.13/tools/mkimap.sirius  2008-10-29 14:44:01.000000000 +0000
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/usr/bin/perl -w
+ # 
+ # Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
+ #
+@@ -41,24 +41,6 @@
+ #
+ # $Id: mkimap,v 1.19 2008/03/24 20:25:22 murch Exp $
+
+-exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
+-#!perl -w
+-
+-if ($] !~ /^5\..*/) {
+-  # uh-oh. this isn't perl 5.
+-  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
+-    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
+-  }
+-  # we failed. bail.
+-  die "Your perl is too old; I need perl 5.\n";
+-}
+-
+-# load the real script. this is isolated in an 'eval' so perl4 won't
+-# choke on the perl5-isms.
+-eval join("\n", <DATA>);
+-if ($@) { die "$@"; }
+-
+-__END__
+ require 5;
+
  sub read_conf {
 diff -urNad cyrus-imapd-2.3-2.3.8/tools/mknewsgroups /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/mknewsgroups
---- cyrus-imapd-2.3-2.3.8/tools/mknewsgroups	2007-02-27 03:54:56.000000000 +0100
-+++ /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/mknewsgroups	2007-02-27 03:54:57.955483105 +0100
+--- cyrus-imapd-2.3-2.3.13/tools/mknewsgroups   2008-10-29 14:10:46.000000000 +0000
++++ cyrus-imapd-2.3-2.3.13/tools/mknewsgroups.sirius    2008-10-29 14:46:12.000000000 +0000
 @@ -1,5 +1,8 @@
 -#!/bin/sh
 +#!/usr/bin/perl -w
@@ -337,82 +333,79 @@
 +# Create newsgroups on imap server
 +# Based on the make_fromactive.pl script by Tim Martin
 +#
- # Copyright (c) 2003 Carnegie Mellon University.  All rights reserved.
+ # Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
  #
  # Redistribution and use in source and binary forms, with or without
-@@ -38,29 +41,6 @@
- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- #
+@@ -41,27 +44,6 @@
+ #
+ # $Id: mknewsgroups,v 1.3 2008/03/24 20:25:22 murch Exp $
+
 -exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 -#!perl -w
 -#
 -# Create newsgroups on imap server
 -# Based on the make_fromactive.pl script by Tim Martin
--#
--# $Id: mknewsgroups,v 1.2 2003/10/22 18:03:47 rjs3 Exp $
--
--if ($] !~ /^5\..*/) {
--  # uh-oh. this isn't perl 5.
--  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
--    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
--  }
--  # we failed. bail.
--  die "Your perl is too old; I need perl 5.\n";
--}
--
--# load the real script. this is isolated in an 'eval' so perl4 won't
--# choke on the perl5-isms.
--eval join("\n", <DATA>);
--if ($@) { die "$@"; }
--
--__END__
- require 5;
- 
+-
+-if ($] !~ /^5\..*/) {
+-  # uh-oh. this isn't perl 5.
+-  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
+-    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
+-  }
+-  # we failed. bail.
+-  die "Your perl is too old; I need perl 5.\n";
+-}
+-
+-# load the real script. this is isolated in an 'eval' so perl4 won't
+-# choke on the perl5-isms.
+-eval join("\n", <DATA>);
+-if ($@) { die "$@"; }
+-
+-__END__
+ require 5;
+
  use Getopt::Long;
 diff -urNad cyrus-imapd-2.3-2.3.8/tools/rehash /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/rehash
---- cyrus-imapd-2.3-2.3.8/tools/rehash	2007-02-27 03:54:56.000000000 +0100
-+++ /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/rehash	2007-02-27 03:54:57.956483006 +0100
-@@ -1,4 +1,8 @@
--#!/bin/sh
-+#!/usr/bin/perl
+--- cyrus-imapd-2.3-2.3.13/tools/rehash 2008-10-29 14:10:46.000000000 +0000
++++ cyrus-imapd-2.3-2.3.13/tools/rehash.sirius  2008-10-29 14:48:07.000000000 +0000
+@@ -1,4 +1,9 @@
+-#!/bin/sh
++#!/usr/bin/perl -w
++#
 +# script to upgrade from simple hashing scheme to full hashing scheme
 +# make sure you run it as the cyrus user
-+# 
++#
 +# Written by Gary Mills <mills at cc.UManitoba.CA>
  # 
- # Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
- #
-@@ -38,8 +42,6 @@
- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- #
--exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
--#!perl -w
- # script to upgrade from simple hashing scheme to full hashing scheme
- # make sure you run it as the cyrus user
- #
-@@ -47,21 +49,6 @@
- #
- # $Id: rehash,v 1.9 2006/11/30 17:11:25 murch Exp $
- 
--if ($] !~ /^5\..*/) {
--  # uh-oh. this isn't perl 5.
--  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
--    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
--  }
--  # we failed. bail.
--  die "Your perl is too old; I need perl 5.\n";
--}
--
--# load the real script. this is isolated in an 'eval' so perl4 won't
--# choke on the perl5-isms.
--eval join("\n", <DATA>);
--if ($@) { die "$@"; }
--
--__END__
- require 5;
- 
+ # Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
+ #
+@@ -41,28 +46,6 @@
+ #
+ # $Id: rehash,v 1.10 2008/03/24 20:25:22 murch Exp $
+
+-exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
+-#!perl -w
+-# script to upgrade from simple hashing scheme to full hashing scheme
+-# make sure you run it as the cyrus user
+-#
+-# Written by Gary Mills <mills at cc.UManitoba.CA>
+-
+-if ($] !~ /^5\..*/) {
+-  # uh-oh. this isn't perl 5.
+-  foreach (split(/:/, $ENV{PATH})) { # try to find "perl5".
+-    exec("$_/perl5", "-x", "-S", $0, @ARGV) if (-x "$_/perl5");
+-  }
+-  # we failed. bail.
+-  die "Your perl is too old; I need perl 5.\n";
+-}
+-
+-# load the real script. this is isolated in an 'eval' so perl4 won't
+-# choke on the perl5-isms.
+-eval join("\n", <DATA>);
+-if ($@) { die "$@"; }
+-
+-__END__
+ require 5;
+
  $| = 1;
 diff -urNad cyrus-imapd-2.3-2.3.8/tools/translatesieve /tmp/dpep.uetA0X/cyrus-imapd-2.3-2.3.8/tools/translatesieve
 --- cyrus-imapd-2.3-2.3.8/tools/translatesieve	2007-02-27 03:54:56.000000000 +0100

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/65-sieveshell-enhancements.dpatch
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/65-sieveshell-enhancements.dpatch?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/65-sieveshell-enhancements.dpatch (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/65-sieveshell-enhancements.dpatch Mon Feb  9 12:49:22 2009
@@ -1,19 +1,20 @@
 #! /bin/sh /usr/share/dpatch/dpatch-run
 ## 65-sieveshell-enhancements.dpatch by Sven Mueller <debian at incase.de>
+## Hacked up to 2.3.13 by Duncan Gibb <duncan.gibb at siriusit.co.uk>
 ##
 ## All lines beginning with `## DP:' are a description of the patch.
 ## DP: Adds some enhancements to sieveshell and fixes some paths.
 
 @DPATCH@
 diff -urNad cyrus-imapd-2.3.7~/perl/imap/IMAP/Shell.pm cyrus-imapd-2.3.7/perl/imap/IMAP/Shell.pm
---- cyrus-imapd-2.3.7~/perl/imap/IMAP/Shell.pm	2006-03-31 21:22:35.000000000 +0200
-+++ cyrus-imapd-2.3.7/perl/imap/IMAP/Shell.pm	2006-08-11 12:29:13.000000000 +0200
+--- cyrus-imapd-2.3.13~/perl/imap/IMAP/Shell.pm	2008-10-29 01:22:35.000000000 +0200
++++ cyrus-imapd-2.3.13/perl/imap/IMAP/Shell.pm	2008-10-29 12:29:13.000000000 +0200
 @@ -126,7 +126,7 @@
  		  [\&_sc_info, '[mailbox]',
  		   'display mailbox/server metadata'],
  		mboxcfg =>
--		  [\&_sc_mboxcfg, 'mailbox [comment|condstore|news2mail|expire|sieve|squat] value',
-+		  [\&_sc_mboxcfg, 'mailbox [comment|condstore|news2mail|expire|sieve|squat|/<explicit annotation>] value',
+-		  [\&_sc_mboxcfg, 'mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value',
++		  [\&_sc_mboxcfg, 'mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat|/<explicit annotation>] value',
  		   'configure mailbox'],
  		mboxconfig => 'mboxcfg',
  		reconstruct =>
@@ -35,21 +36,21 @@
    }
    my $fstk = [*STDIN, *STDOUT, *STDERR];
    if ($dorc && $systemrc ne '' && -f $systemrc) {
-@@ -1424,7 +1424,7 @@
+@@ -1437,7 +1437,7 @@
    while (defined ($opt = shift(@argv))) {
      last if $opt eq '--';
      if ($opt =~ /^-/) {
--      die "usage: mboxconfig mailbox [comment|condstore|news2mail|expire|sieve|squat] value\n";
-+      die "usage: mboxconfig mailbox [comment|condstore|news2mail|expire|sieve|squat|/<explicit annotation>] value\n";
+-      die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value\n";
++      die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat|/<explicit annotation>] value\n";
      }
      else {
        push(@nargv, $opt);
-@@ -1433,7 +1433,7 @@
+@@ -1445,7 +1445,7 @@
    }
    push(@nargv, @argv);
    if (@nargv < 2) {
--    die "usage: mboxconfig mailbox [comment|condstore|news2mail|expire|sieve|squat] value\n";
-+    die "usage: mboxconfig mailbox [comment|condstore|news2mail|expire|sieve|squat|/<explicit annotation>] value\n";
+-    die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value\n";
++    die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat|/<explicit annotation>] value\n";
    }
    if (!$cyrref || !$$cyrref) {
      die "mboxconfig: no connection to server\n";

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/70-allow-larger-buffers.dpatch
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/70-allow-larger-buffers.dpatch?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/70-allow-larger-buffers.dpatch (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/70-allow-larger-buffers.dpatch Mon Feb  9 12:49:22 2009
@@ -1,24 +1,23 @@
 #! /bin/sh /usr/share/dpatch/dpatch-run
 ## allow-larger-buffers-dpatch by Sven Mueller <debian at incase.de>
+## updated to 2.3.13 by Duncan Gibb <duncan.gibb at siriusit.co.uk>
 ##
 ## All lines beginning with `## DP:' are a description of the patch.
 ## DP: Patch to allow larger buffers (especially for list of UIDs).
 ## DP: Patch taken and "backported" to 2.2 from:
 ## DP: http://cyrus.brong.fastmail.fm/patches/cyrus-longwords-2.3.3.diff
+## DP: Simplified for 2.3.13 since maxquoted and maxword became run-time
+## DP: options.  Now just doubles MAXLITERAL.
 
 @DPATCH@
 diff -urNad cyrus-imapd-2.2.13/imap/imapparse.c /tmp/dpep.G4uvjC/cyrus-imapd-2.2.13/imap/imapparse.c
 --- cyrus-imapd-2.2.13/imap/imapparse.c	2007-02-25 21:39:04.000000000 +0100
 +++ /tmp/dpep.G4uvjC/cyrus-imapd-2.2.13/imap/imapparse.c	2007-02-25 21:40:19.830078835 +0100
-@@ -52,9 +52,9 @@
+@@ -52,7 +52,7 @@
  #include "exitcodes.h"
  
  enum {
--    MAXQUOTED = 32768,
--    MAXWORD = 32768,
 -    MAXLITERAL = INT_MAX / 20
-+    MAXQUOTED = 524288,
-+    MAXWORD = 524288,
 +    MAXLITERAL = INT_MAX / 10
  };
  

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/72-faster-isdigit.dpatch
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/72-faster-isdigit.dpatch?rev=768&root=cyrus22&r1=
3D767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/72-faster-isdigit.dpatch (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/72-faster-isdigit.dpatch Mon Feb  9 12:49:22 2009
@@ -5,12 +5,13 @@
 ## DP: Use a smaller (but less intelligent) isdigit() implementation,
 ## DP: a simple range-check. Patch backported from:
 ## DP: http://cyrus.brong.fastmail.fm/patches/cyrus-isdigit-2.3.3.diff
+## DP: Seems to be partially present in 2.3.13 mainline.
 
 @DPATCH@
-diff -urNad cyrus-imapd-2.3-2.3.8/imap/index.c /tmp/dpep.mjLm85/cyrus-imapd-2.3-2.3.8/imap/index.c
---- cyrus-imapd-2.3-2.3.8/imap/index.c	2007-02-27 04:00:28.000000000 +0100
-+++ /tmp/dpep.mjLm85/cyrus-imapd-2.3-2.3.8/imap/index.c	2007-02-27 04:00:29.789499834 +0100
-@@ -518,8 +518,8 @@
+diff -urNad cyrus-imapd-2.3-2.3.8/imap/index.c cyrus-imapd-2.3-2.3.8/imap/index.c.sirius
+--- cyrus-imapd-2.3-2.3.13/imap/index.c		2008-10-29 15:21:21.000000000 +0000
++++ /cyrus-imapd-2.3-2.3.13/imap/index.c.sirius	2008-10-29 15:27:08.000000000 +0000
+@@ -571,8 +571,8 @@
       */
      old = seenuids;
      new = newseenuids;
@@ -21,16 +22,16 @@
  
      for (msgno = 1; msgno <= imapd_exists; msgno++) {
  	uid = UID(msgno);
-@@ -533,7 +533,7 @@
- 		oldnext = 0;
- 		if (!*old) oldnext = mailbox->last_uid+1;
+@@ -595,7 +595,7 @@
+ 		    }
+ 		}
  		else old++;
 -		while (isdigit((int) *old)) {
 +		while (cyrus_isdigit((int) *old)) {
  		    oldnext = oldnext * 10 + *old++ - '0';
  		}
  		oldnext += oldseen;
-@@ -552,7 +552,7 @@
+@@ -621,7 +621,7 @@
  		    neweof++;
  		}
  		else new++;
@@ -39,7 +40,7 @@
  		    newnext = newnext * 10 + *new++ - '0';
  		}
  		newnext += newseen;
-@@ -684,7 +684,7 @@
+@@ -753,7 +753,7 @@
  		neweof++;
  	    }
  	    else new++;
@@ -48,7 +49,7 @@
  	    newnext += newseen;
  	}
      }
-@@ -702,7 +702,7 @@
+@@ -771,7 +771,7 @@
  		/* There's a ":M" after the ",N".  Parse/include that too. */
  		new++;
  		newnext = 0;
@@ -57,43 +58,7 @@
  	    }
  	    uid = newnext;
  	    newseen++;		/* Forget we parsed ",N" */
-@@ -1691,7 +1691,7 @@
-     }
- 
-     for (;;) {
--	if (isdigit((int) *sequence)) {
-+	if (cyrus_isdigit((int) *sequence)) {
- 	    start = start*10 + *sequence - '0';
- 	}
- 	else if (*sequence == '*') {
-@@ -1700,7 +1700,7 @@
- 	else if (*sequence == ':') {
- 	    end = 0;
- 	    sequence++;
--	    while (isdigit((int) *sequence)) {
-+	    while (cyrus_isdigit((int) *sequence)) {
- 		end = end*10 + *sequence++ - '0';
- 	    }
- 	    if (*sequence == '*') {
-@@ -1758,7 +1758,7 @@
-     unsigned i, start = 0, end;
- 
-     for (;;) {
--	if (isdigit((int) *sequence)) {
-+	if (cyrus_isdigit((int) *sequence)) {
- 	    start = start*10 + *sequence - '0';
- 	}
- 	else if (*sequence == '*') {
-@@ -1768,7 +1768,7 @@
- 	else if (*sequence == ':') {
- 	    end = 0;
- 	    sequence++;
--	    while (isdigit((int) *sequence)) {
-+	    while (cyrus_isdigit((int) *sequence)) {
- 		end = end*10 + *sequence++ - '0';
- 	    }
- 	    if (*sequence == '*') {
-@@ -1899,7 +1899,7 @@
+@@ -1913,7 +1913,7 @@
      while (*p != ']' && *p != 'M') {
  	/* Generate the actual part number */
  	skip = 0;
@@ -102,7 +67,7 @@
              skip = skip * 10 + *p++ - '0';
              /* xxx overflow */
          }
-@@ -2028,7 +2028,7 @@
+@@ -2043,7 +2043,7 @@
  
      while (*p != 'H') {
  	skip = 0;
@@ -111,7 +76,7 @@
              skip = skip * 10 + *p++ - '0';
              /* xxx overflow */
          }
-@@ -3766,7 +3766,7 @@
+@@ -3783,7 +3783,7 @@
  	case '{':			/* literal */
  	    c++;			/* skip open brace */
  	    len = 0;			/* determine length of literal */
@@ -120,7 +85,7 @@
  		len = len*10 + *c - '0';
  		c++;
  	    }
-@@ -3920,7 +3920,7 @@
+@@ -3937,7 +3937,7 @@
  			break;
  		    			/* if we have a digit, and we're still
  					   counting, keep building the count */
@@ -129,17 +94,3 @@
  			count = count * 10 + *x - '0';
                          if (count < 0) {                /* overflow */
                              count = -1; /* abort counting */
-diff -urNad cyrus-imapd-2.3-2.3.8/lib/util.h /tmp/dpep.mjLm85/cyrus-imapd-2.3-2.3.8/lib/util.h
---- cyrus-imapd-2.3-2.3.8/lib/util.h	2007-02-27 04:00:26.000000000 +0100
-+++ /tmp/dpep.mjLm85/cyrus-imapd-2.3-2.3.8/lib/util.h	2007-02-27 04:00:29.790499734 +0100
-@@ -113,4 +113,10 @@
- 
- #define cyrus_isdigit(x) ((x) >= '0' && (x) <= '9')
- 
-+/* Some systems have very inefficient implementations of isdigit,
-+ * and we use it in a lot of inner loops
-+ */
-+
-+#define cyrus_isdigit(x) ((x) >= '0' && (x) <= '9')
-+
- #endif /* INCLUDED_UTIL_H */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/75-update-imapd.conf-documentation.dpatch
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/75-update-imapd.conf-documentation.dpatch?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/75-update-imapd.conf-documentation.dpatch (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/75-update-imapd.conf-documentation.dpatch Mon Feb  9 12:49:22 2009
@@ -1,5 +1,8 @@
 #! /bin/sh /usr/share/dpatch/dpatch-run
 ## 75-update-imapd.conf-documentation.dpatch by Sven Mueller <sven at debian.org>
+## Updated to 2.3.13 by Duncan Gibb <duncan.gibb at siriusit.co.uk>
+## Note that the default for allowplaintext is "no" since release 2.3.9
+## (Ken changed it on 30 March 2007)
 ##
 ## All lines beginning with `## DP:' are a description of the patch.
 ## DP: update imapd.conf option descriptions to be a bit more verbose about
@@ -9,7 +12,7 @@
 diff -urNad cyrus-imapd-2.3.7~/lib/imapoptions cyrus-imapd-2.3.7/lib/imapoptions
 --- cyrus-imapd-2.3.7~/lib/imapoptions	2006-08-11 12:31:09.000000000 +0200
 +++ cyrus-imapd-2.3.7/lib/imapoptions	2006-08-11 12:31:10.000000000 +0200
-@@ -69,7 +69,10 @@
+@@ -90,7 +90,10 @@
  \fB/etc/imapd.conf\fR file, and show each option's default value.
  Some options have no default value, these are listed with
  ``<no default>''.  Some options default to the empty string, these
@@ -21,15 +24,15 @@
  */
  
  # OPTIONS
-@@ -122,7 +125,17 @@
+@@ -146,7 +146,17 @@
    enabled when absolutely necessary. */
  
- { "allowplaintext", 1, SWITCH }
+ { "allowplaintext", 0, SWITCH }
 -/* Allow the use of cleartext passwords on the wire. */
 +/* Allow the use of cleartext passwords on the wire.
 +.PP
-+  To disallow the use of plaintext passwords for authentication, you can
-+  set ``allowplaintext: no'' in imapd.conf. This will still allow PLAIN
++  To allow the use of plaintext passwords for authentication, you can
++  set ``allowplaintext: yes'' in imapd.conf. This will still allow PLAIN
 +  under TLS, but IMAP LOGIN commands will now fail.
 +.PP
 +  If you only list plaintext authentication mechanisms in ``sasl_mech_list''

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/77-change-missing-sieve-notice.dpatch
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/77-change-missing-sieve-notice.dpatch?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/77-change-missing-sieve-notice.dpatch (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/patches/77-change-missing-sieve-notice.dpatch Mon Feb  9 12:49:22 2009
@@ -15,9 +15,9 @@
  #include <assert.h>
 +#include <errno.h>
  
- #include "xmalloc.h"
- 
-@@ -418,7 +419,11 @@
+ #include "charset.h"
+ #include "hash.h"
+@@ -508,7 +509,11 @@
      if (!fname || !ret) return SIEVE_FAIL;
      
      if (stat(fname, &sbuf) == -1) {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/rules
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/rules?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/rules (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/debian/rules Mon Feb  9 12:49:22 2009
@@ -19,6 +19,8 @@
 export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
+export BDB_VERSION ?= $(shell dpkg-query -l 'libdb4.[2-6]-dev' | grep ^ii | sed -e 's|.*\s\libdb\(4\.[0-9]\)-dev\s.*|\1|')
+
 # enable dpatch usage
 #include /usr/share/dpatch/dpatch.make
 # -*- Makefile -*-, you silly Emacs!
@@ -62,10 +64,10 @@
 
 # Extra version information to add to Cyrus IMAPd ID
 DEBVERSION:=$(shell LCALL=C dpkg-parsechangelog | sed -ne 's/^Version: \(.*-\)/\1/p')
-EXTRA_IDENT:="Debian-$(DEBVERSION)"
+EXTRA_IDENT:="Sirius-$(DEBVERSION)"
 
 # DB engine version
-DBENGINE=BerkeleyDB4.5
+DBENGINE=BerkeleyDB$(BDB_VERSION)
 
 DEBUGFLAGS=-g
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
@@ -92,7 +94,7 @@
 # This is done to make sure the build daemon's source tree is the 
 # same as the one I am using to produce the i386 debs. 
 clean: clean-patched unpatch
-clean-patched: configure
+clean-patched:	configure
 	dh_testdir
 	dh_testroot
 	-xargs -t -r chmod +x < debian/executable.files
@@ -116,13 +118,13 @@
 
 configure-stamp: patch
 	dh_testdir
+	autoheader
+	autoconf
 	# -rm -f config.sub config.guess
 	# cp /usr/share/misc/config.sub config.sub
 	# cp /usr/share/misc/config.guess config.guess
 	touch configure.in && touch aclocal.m4 && touch configure
 
-	# IF YOU CHANGE BERKELEY DB VERSION, MAKE SURE TO UPDATE
-	# DBENGINE AT THE TOP OF THIS MAKEFILE!
 	./configure CFLAGS="-fno-strict-aliasing -fPIC -Wall -pipe $(DEBUGFLAGS)" $(CONFFLAGS) \
 	 --with-extraident=$(EXTRA_IDENT) \
 	 --prefix=/usr/share --exec-prefix=/usr --libexecdir=/usr/sbin \
@@ -136,6 +138,8 @@
 	 --with-cyrus-prefix=/usr/lib/cyrus --with-lock=fcntl \
 	 --with-perl=/usr/bin/perl \
 	 --with-openssl=/usr --with-auth=unix \
+	 --with-bdb=db-$(BDB_VERSION) \
+	 --with-bdb-libdir=/usr/lib --with-bdb-incdir=/usr/include \
 	 --enable-murder --enable-nntp --enable-replication \
 	 --disable-listext --enable-annotatemore --with-sasl=/usr \
 	 --enable-idled --with-drac=/usr \

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/depot/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/depot/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/depot/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/depot/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,7 +1,8 @@
 # Makefile for CMU local support
 # 
 # @configure_input@
-# Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+#
+# Copyright (c) 1994-2008 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
@@ -17,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -39,6 +41,8 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 # 
+# $Id: Makefile.in,v 1.8 2008/03/24 20:26:12 murch Exp $
+
 srcdir = @srcdir@
 VPATH = @srcdir@
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/depot/depot.conf
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/depot/depot.conf?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/depot/depot.conf (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/depot/depot.conf Mon Feb  9 12:49:22 2009
@@ -6,3 +6,4 @@
 ~delete lib/perl5/5.8.6/i686-linux/perllocal.pod
 ~delete lib/perl5/5.8.6/sparc-solaris-thread-multi-64int-ld/perllocal.pod
 ~delete lib/perl5/5.8.6/sparc-solaris/perllocal.pod
+~delete lib/perl5/5.8.6/sun4-solaris/perllocal.pod

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/altnamespace.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/altnamespace.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/altnamespace.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/altnamespace.html Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 <HTML><HEAD>
 <title>Cyrus IMAP Server:  Altername Namespace</title>
-<!-- $Id: altnamespace.html,v 1.2 2001/10/23 20:15:18 leg Exp $ -->
+<!-- $Id: altnamespace.html,v 1.3 2008/01/07 17:56:04 murch Exp $ -->
 </HEAD><BODY>
 <H1>              Cyrus IMAP Server:  Alternate Namespace</H1>
 
@@ -59,7 +59,7 @@
 <p>To use the alternate namespace, turn on the <tt>altnamespace</tt>
 option in <tt>/etc/imapd.conf</tt>.  The prefixes used for shared
 folders and other users folders can be changed from the defaults by
-setting the <tt>sharedrefix</tt> and <tt>userprefix</tt> options
+setting the <tt>sharedprefix</tt> and <tt>userprefix</tt> options
 respectively.
 
 <H2><a name="unixhiersep">UNIX Hierarchy Convention</a></H2>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/anoncvs.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/anoncvs.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/anoncvs.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/anoncvs.html Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 <html>
   <title> Cyrus IMAP: Anonymous CVS Access </title>
-  <!-- $Id: anoncvs.html,v 1.3 2002/05/25 19:57:43 leg Exp $ -->
+  <!-- $Id: anoncvs.html,v 1.5 2007/10/19 14:33:13 murch Exp $ -->
   
   <body>
     <h1>Cyrus IMAP: Anonymous CVS Access</h1>
@@ -39,9 +39,18 @@
       collection).  The password is "anonymous".
       
     <p>
-      You will need autoconf (v2.12) to build CVS from the repository because
-      we don't keep the configure script in the repository, along with the
-      usual tools to build Cyrus (a compiler, a Unix box, a network.)
+      You will need autoconf, yacc (bison) and lex (flex) to build CVS
+      from the repository because we don't keep generated files in the
+      repository, along with the usual tools to build Cyrus (a
+      compiler, a Unix box, a network.)  To create the configure
+      script, do the following:
+
+      <p><pre><kbd>
+      aclocal -I cmulocal
+      autoheader
+      autoconf
+      </kbd></pre>
+      
       
     <p>
       Read access to the repository is availible to anyone via
@@ -76,7 +85,7 @@
 
 
 <P><HR>
-last modified: $Date: 2002/05/25 19:57:43 $
+last modified: $Date: 2007/10/19 14:33:13 $
 <br>
 <A HREF="index.html">Return</A> to the Cyrus IMAP Server Home Page
 </BODY></HTML>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/changes.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/changes.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/changes.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/changes.html Mon Feb  9 12:49:22 2009
@@ -1,12 +1,181 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- $Id: changes.html,v 1.107 2007/02/06 15:32:43 murch Exp $ -->
+<!-- $Id: changes.html,v 1.164 2008/10/09 14:40:20 murch Exp $ -->
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta name="generator" content="HTML Tidy, see www.w3.org" />
 <title>Changes to the Cyrus IMAP Server</title>
 </head>
 <body>
+
+<h1>Changes to the Cyrus IMAP Server since 2.3.12</h1>
+<ul>
+<li>Added an experimental "sql" backend for cyrusdb.  Currently MySQL,
+PostgreSQL, and SQLite are supported.  See the new <tt>sql_*</tt>
+options for details.</li>
+<li>Added support for IMAP [CAPABILITY] response code to client-side
+of Murder proxies.</li>
+<li>Added support for ManageSieve auto-capability response after
+STARTTLS and after AUTH with a SASL security layer.</li>
+<li>Made <tt>MAXWORD</tt> and <tt>MAXQUOTED</tt> sizes configurable
+  via <tt>imapd.conf</tt> <i>-- courtesy of Fastmail.fm</i>.</li>
+<li>Rewrote <tt>cyrusdb_quotalegacy.c</tt> to use <tt>readir()</tt>
+  rather than <tt>glob.c</tt>.  This avoids a potential crash due to
+  conflicts between glibc and Heimdal implementations of <tt>glob()</tt>.</li>
+<li>Added support for <tt>fulldirhash</tt> to <tt>ctl_mboxlist -v</tt>.</li>
+<li>More skiplist transaction fixes <i>-- courtesy of Fastmail.fm</i>.</li>
+<li><tt>cyr_expire</tt> no longer has a default of 0 (zero)
+  for <tt>-X</tt> and <tt>-D</tt>.  These options must be used
+  explicitly in order to have the desired effect.</li>
+<li>Added <tt>sieve_utf8fileinto</tt> option.</li>
+<li>Added <tt>sieve_sasl_send_unsolicited_capability</tt>
+  and <tt>sieve_sasl_expect_unsolicited_capability</tt> options.</li>
+<li>Several 32/64-bit compatibility fixes.</li>
+<li>Fixed miscellaneous bugs and build issues.</li>
+</ul>
+
+<h1>Changes to the Cyrus IMAP Server since 2.3.11</h1>
+<ul>
+<li>Added <tt>statuscache.db</tt> to cache IMAP STATUS data which
+significantly reduces the amount of I/O necessary when neither the
+mailbox nor \Seen state has changed
+<i>-- courtesy of Fastmail.fm</i>.</li>
+<li>Added option to <tt>unexpunge</tt> to restore messages by time
+interval
+<i>-- courtesy of David Carter</i>.</li>
+<li>Implemented undocumented IMAP SCAN extension, which allows
+Pine/Alpine to do cross-mailbox searches
+<i>-- based on work of David Carter</i>.</li>
+<li>Implemented incremental squat updates (see <tt>squatter.8</tt>)
+<i>-- courtesy of David Carter</i>.</li>
+<li>Fixed major bugs in <tt>reconstruct -k</tt> implementation 
+<i>-- courtesy of David Carter</i>.</li>
+<li>Added code to promote transaction safety and to track the lock
+status of skiplist databases <i>-- courtesy of Fastmail.fm</i>.</li>
+<li>Added option to <tt>mbexamine</tt> to compare quota usage in
+cyrus.index to the actual message file sizes.</li>
+<li>Allow long lines in <tt>imapd.conf</tt> to be split across
+multiple lines by using backslash as a continuation character.</li>
+<li>The Sieve compiler now translates UTF-8 mailbox names used in
+<tt>fileinto</tt> to modified UTF-7 so that messages will be
+successfully inserted into the mailbox.</li>
+<li>Use a more appropriate argument with LHLO command.</li>
+<li>Added <tt>serverinfo</tt> option to control the information
+displayed in banner greetings and capability responses.</li>
+<li>Fixed miscellaneous bugs and build issues.</li>
+</ul>
+
+<h1>Changes to the Cyrus IMAP Server since 2.3.10</h1>
+<ul>
+<li>Fixed several skiplist bugs <i>-- courtesy of Fastmail.fm</i>.</li>
+<li>Add robustness to skiplist recovery <i>-- courtesy of
+Fastmail.fm</i>.</li>
+<li>Added support for modification sequences to replication protocol
+(for CONDSTORE) <i>-- courtesy of David Carter</i>.</li>
+<li>Fixed delayed delete replication <i>-- courtesy of Fastmail.fm</i>.</li>
+<li>Allow [un]deleting of user INBOXes (renaming to/from deleted
+hierarchy) to work when using delayed delete
+<i>-- courtesy of Simon Matter</i>.</li>
+<li>Fixed interaction with removal of rights and
+<tt>implicitownerrights</tt>.</li>
+<li>Fixed parsing of single FETCH item when using FETCH
+modifiers.</li>
+<li>Prevented SSL_accept() from blocking indefinitely when using
+TLS/SSL.  This should eliminate a lot of hung SSL-wrapped processes.</li>
+<li>Allow STARTTLS to be used to externally preauth'd LMTP
+connections.</li>
+<li>Allow a TLS client certificate to be sufficient authentication for
+LMTP.</li>
+<li><tt>timsieved</tt> now automatically sends CAPABILITY response
+after STARTTLS.  This code was reintroduced after being mistakenly
+removed as part of bug #1338.</li>
+<li>Fixed miscellaneous bugs and build issues.</li>
+</ul>
+
+<h1>Changes to the Cyrus IMAP Server since 2.3.9</h1>
+<ul>
+<li>Added support for "delayed" delete, in which mailboxes are renamed
+to a special admin-only "deleted" hierarchy at the time of the DELETE
+(hiding them from the client), rather than immediately removing them
+from the filesystem.  This allows messages/mailboxes to be recovered
+by the admin in case of user error.  The mailboxes and messages can be
+removed at a later time by <tt>cyr_expire</tt>.  The new
+<tt>delete_mode</tt> and <tt>deletedprefix</tt> options in
+<tt>imapd.conf</tt> controls whether deletes are "immediate" or
+"delayed" and the mailbox hierarchy for "delayed" deletes. 
+<i>-- courtesy of David Carter and FastMail.fm</i>.</li>
+<li>Fixed the special case of RENAMEing an Inbox, so that it doesn't
+keep the same mailbox uniqueid, thus allowing it to replicate
+properly (seen state is still preserved).</li>
+<li>Disabled <a
+href="http://en.wikipedia.org/wiki/Nagle's_algorithm">Nagle's
+algorithm</a> in <tt>sync_client</tt> and <tt>sync_server</tt> to
+increase the throughput of the replication protocol.
+<i>-- courtesy of Wes Craig</i>.</li>
+<li>Added support for a shared \Seen flag on messages (must be
+enabled on a per-mailbox basis with the
+<tt>/vendor/cmu/cyrus-imapd/sharedseen</tt> mailbox annotation.</li>
+<li>Added <tt>-g</tt> and <tt>-G</tt> options to <tt>reconstruct</tt>
+<i>-- courtesy of David Carter</i>.</li>
+<li>Added <tt>SETUIDVALIDITY</tt> command to the replication protocol
+<i>-- courtesy of David Carter</i>.</li>
+<li>Finally fixed (again?) alignment issues on 64-bit SPARC.</li>
+<li>Changed message GUIDs used by replication to be the SHA1 hash of
+the messages <i>-- based on work of David Carter and Fastmail.fm</i>.</li>
+<li>Improve the performance of commands that operate on
+sequence-sets.  The sequence-set is now parsed only once, and the
+commands operate on a sorted list of seq-ranges.</li>
+<li>Added new <tt>cyr_synclog</tt> utility for adding events to the
+replication log <i>-- courtesy of Fastmail.fm</i>.</li>
+<li>Added support for PCRE library <i>-- courtesy of Fastmail.fm</i>.</li>
+<li>Added support for disabling duplicate delivery suppression
+on a per-folder basis with the
+<tt>/vendor/cmu/cyrus-imapd/duplicatedeliver</tt> mailbox annotation
+<i>-- courtesy of Fastmail.fm</i>.</li>
+<li>Fixed miscellaneous bugs and build issues.</li>
+</ul>
+
+<h1>Changes to the Cyrus IMAP Server since 2.3.8</h1>
+<ul>
+<li>Added support for BDB 4.5 and 4.6.</li>
+<li>Fixed bug in frontend handling of CREATE for both proxying and
+referring. <i>-- courtesy of Gary Mills</i></li>
+<li>Fixed local deletion during XFER from a unified server. <i>-- courtesy
+of Gary Mills</i></li>
+<li>Fixed XFER bug which prevented sieve scripts from being
+migrated. <i>-- courtesy of Gary Mills</i></li>
+<li>Allow utilities to be run as root (acquiring 'cyrus' uid
+on-the-fly).</li>
+<li>Changed the default value of the <tt>allowplaintext</tt> option to
+disabled (0).</li>
+<li>Finally fixed 64-bit alignment problem with HIGHESTMODSEQ.</li>
+<li>Fixed initialization of UUID subsystem for replication. <i>-- courtesy
+of Fastmail.fm</i></li>
+<li>Added <tt>-a</tt> option to <tt>cyr_expire</tt> to ignore to skip
+annotation check. <i>-- courtesy of Fastmail.fm</i></li>
+<li>Set the mtime of synchronized message files to INTERNALDATE (makes
+reconstruction a little friendlier). <i>-- courtesy of Fastmail.fm</i></li>
+<li>Fixed a bug in <tt>sync_client</tt> which caused it to bail when a
+message was deleted out from under it.</li>
+<li>Allow <tt>sync_server</tt> to accept unauthenticated connections
+from <tt>sync_client</tt> on a UNIX socket.</li>
+<li>Drastically reduced the amount of time it takes for a
+<tt>mupdate</tt> slave to synchronize with a master.</li>
+<li>Added URI contained in the <tt>Content-Location</tt> header to the
+<tt>BODYSTRUCTURE</tt> response (per RFC 3501). <i>-- inspired by
+Fastmail.fm</i></li>
+<li>Fixed <tt>flushseenstate</tt> bug which was causing unsolicited
+EXPUNGE responses during FETCH/STORE. <i>-- courtesy of David 
+Carter</i></li>
+<li>Added option to <tt>ctl_mboxlist</tt> to verify the consistency of
+the mailbox list database and the spool  partition(s).  See
+<tt>ctl_mboxlist.8</tt> for details.</li>
+<li>RENAME now copies <tt>cyrus.expunge</tt> index file as well as
+expunged message files.</li>
+<li>Fixed replication of 64-bit quotas.  <i>-- courtesy of David 
+Carter</i></li>
+<li>Fixed miscellaneous bugs, memory leaks, and build issues.</li>
+</ul>
 
 <h1>Changes to the Cyrus IMAP Server since 2.3.7</h1>
 <ul>
@@ -2192,7 +2361,7 @@
 </ul>
 
 <hr />
-last modified: $Date: 2007/02/06 15:32:43 $ <br />
+last modified: $Date: 2008/10/09 14:40:20 $ <br />
 <a href="index.html">Return</a> to the Cyrus IMAP Server Home Page
 </body>
 </html>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/cyrusv2.mc
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/cyrusv2.mc?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/cyrusv2.mc (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/cyrusv2.mc Mon Feb  9 12:49:22 2009
@@ -1,11 +1,50 @@
 # divert(-1)
 #
-#	(C) Copyright 2000 by Carnegie Mellon University
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: cyrusv2.mc,v 1.5 2008/04/04 12:46:34 murch Exp $
+
 #
 #	This sample mc file is for a site that uses the Cyrus IMAP server
 #	exclusively for local mail. This requires Sendmail 8.10 or later.
 #
-# $Id: cyrusv2.mc,v 1.4 2001/08/23 23:26:56 leg Exp $
 
 divert(0)dnl
 VERSIONID(`cyrus v2 sample configuartion')

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/faq.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/faq.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/faq.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/faq.html Mon Feb  9 12:49:22 2009
@@ -4,15 +4,12 @@
 <head>
 <meta name="generator" content="HTML Tidy, see www.w3.org" />
 <title>Cyrus IMAP Server FAQ</title>
-<!-- $Id: faq.html,v 1.37 2006/11/30 17:11:16 murch Exp $ -->
+<!-- $Id: faq.html,v 1.40 2008/08/27 08:28:45 selsky Exp $ -->
 </head>
 <body>
 <h1>Cyrus IMAP Server FAQ</h1>
 
 <ul>
-<li><b>Using PAM</b> Under Linux when using PAM and shadow
-passwords, /etc/shadow needs to be readable by the Cyrus user.</li>
-
 <li><b>POP-Before-SMTP</b> It is not included in the default distribution
 because there is already a standard way of doing this with SMTP AUTH.
 Any good MTA and/or MUA should support SMTP AUTH, so we shouldn't have
@@ -48,7 +45,7 @@
 convention</a>.</li>
 
 <li><b>renaming users</b> - Supported, but try to make sure that the
-user is not, and can not login when doing the rename.  Otherwise
+user is not, and cannot login when doing the rename.  Otherwise
 user-meta may get corrupted and/or out of sync.</li>
 
 <li><b>plus addressing</b> - Plus addressing allows direct delivery
@@ -75,9 +72,70 @@
 href="install-perf.html">the performance guide</a>.</li>
 </ul>
 
+<h2>General Questions</h2>
+
+<dl compact="compact">
+<dt><b>Q:</b> What are the advantages of LMTP?</dt>
+
+<dd>
+<p><b>A:</b> LMTP protocol differs from SMTP in that it causes the
+   Cyrus to return, after the final "." of the DATA command, one
+   reply for each recipient.  If, for example, a server is given a
+   transaction for two recipients, delivery to the first succeeds, and
+   delivery to the second encounters a temporary failure condition,
+   the MTA will get a separate response for each recipient and
+   will only have to reattempt to deliver it to the second recipient.
+   If using SMTP, only a single temporary failure response would be
+   returned, and the entire transaction would have to be reattempted.
+<p>Furthermore, LMTP is superior to invoking command-line delivery
+agents from the MTA in that most ESMTP extensions are supported by
+LMTP, without having to extend any interfaces.
+<p>Lastly, because LMTP can be run over TCP, it allows you to run SMTP
+(and spam/virus scanning) and mailbox access on separate servers, thus
+allowing better scalability.
+</dd>
+
+<dt><b>Q:</b> How do I configure my MTA?</dt>
+
+<dd>
+<p><b>A:</b> See <a href="install-configure.html#mta">Configuring the
+Mail Transfer Agent</a>
+</dd>
+
+<dt><b>Q:</b> How should I configure partitions to deal
+with a large number of users?</dt>
+
+<dd>
+<p><b>A:</b> The key is not to over-subscribe any partitions. Avoid
+putting too many users on any one partition, such that read/write
+performance becomes unacceptable. Good RAID performance (plenty of
+read/write cache, and perhaps RAID 10 instead of RAID 5) will improve
+the number of users a partition can serve.  To benefit from multiple
+partitions, each should be on its own set of disks, served by an
+unsaturated interface (FC, SCSI, SAS, SATA, etc) to the host running
+Cyrus.
+<p>See <a href="install-perf.html">the performance guide</a> or general
+performance guidelines.  Also see <tt>metapartition_files</tt> and
+<tt>metapartition-name</tt> in <tt>imapd.conf.5</tt> for additional
+configuration options which can help with performance, especially if
+you have access to high-speed storage (faster than disks).
+</dd>
+</dl>
+
 <h2>Troubleshooting</h2>
 
 <dl compact="compact">
+<dt><b>Q:</b> Why doesn't <tt>imapd/pop3d/nntpd/lmtpd/timsieved</tt>
+advertise PLAIN or plaintext login commands?</dt>
+
+<dd>
+<p><b>A:</b> Unless otherwise configured, Cyrus services only advertise
+PLAIN or plaintext login commands on encrypted connections
+(SSL-wrapped connections or after a successful STARTTLS command).
+This behavior can be changed with the use of the
+<tt>allowplaintext</tt> option in <tt>imapd.conf.5</tt>.
+</dd>
+
 <dt><b>Q:</b> I'm getting syslog'd messages from the master process
 saying processes are "signaled to death by 10". What's up?</dt>
 
@@ -202,12 +260,12 @@
 
 <dd>
 <p><b>A:</b> Nothing is wrong. These messages are logged whenever
-Berkeley db encounters lock contention, but isn't necessarily a
-problem by themselves. This is especially likely when you have an
+Berkeley DB encounters lock contention, but aren't necessarily
+problems. This is especially likely when you have an
 empty or small duplicate delivery database and are receiving a large
 volume of e-mail.</p>
 
-<p>Berkeley db 4.0 has a bug where the number of lockers isn't
+<p>Berkeley DB 4.0 has a bug where the number of lockers isn't
 decremented properly, causing this number to be unreliable.</p>
 </dd>
 
@@ -216,13 +274,13 @@
 
 <dd>
 <p><b>A:</b> 8-bit characters are illegal in message headers.  Following
-the principal of &quot;be liberal in what you accept, and strict in what you
-send&quot; cyrus converts them to Xs.  (Without a character set, having
+the principle of &quot;be liberal in what you accept, and strict in what you
+send&quot;, Cyrus converts them to Xs.  (Without a character set, having
 the 8-bit characters replaced with Xs is just as good as having them be any
 other 8-bit character, especially for sorting and searching).
 Alternatively, you can set &quot;reject8bit: t&quot; in <tt>imapd.conf</tt> to
 reject the messages outright.  It might
-also be reasonable for cyrus to support the use of a default character set,
+also be reasonable for Cyrus to support the use of a default character set,
 however thus far no one has done the work to do so (it would also involve
 QP-encoding the corrupted headers).
 </p>
@@ -233,7 +291,7 @@
 
 <dd>
 <p><b>A:</b>
-Trash folders, as they are commonly implemented (as an actual IMAP mailbox),
+Trash folders, as they are commonly implemented (as actual IMAP mailboxes),
 do not fit the IMAP delete/expunge model very well.  In fact, naive
 client implementations will get stuck in a situation where they cannot
 delete a message from a mailbox because they try to COPY it to the trash
@@ -272,7 +330,7 @@
 </dl>
 
 <hr />
-last modified: $Date: 2006/11/30 17:11:16 $ <br />
+last modified: $Date: 2008/08/27 08:28:45 $ <br />
 <a href="index.html">Return</a> to the Cyrus IMAP Server Home Page
 </body>
 </html>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/feedback.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/feedback.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/feedback.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/feedback.html Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-<!-- $Id: feedback.html,v 1.6 2003/08/15 17:37:04 rjs3 Exp $ -->
+<!-- $Id: feedback.html,v 1.8 2008/08/27 08:28:45 selsky Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Sending Feedback on the Cyrus IMAP Server</TITLE>
@@ -10,7 +10,7 @@
 <P>Feedback on and fixes for the software or on the document may be
 sent to <a
 href="mailto:cyrus-bugs+ at andrew.cmu.edu"><tt>cyrus-bugs+ at andrew.cmu.edu</tt></a>.
-Unfortunately, we can not guarantee a response but we'll try the best
+Unfortunately, we cannot guarantee a response but we'll try the best
 we can. As usual, a high quality and complete message helps us
 tremendously.
 
@@ -25,7 +25,7 @@
 	    <li> the version of imapd 
 	    <li> the version of libsasl
 	    <li> your system type (<tt>uname -a</tt> often provides
-	    the right information.
+	    the right information).
 </ul>
 You should also include:
 <ul>
@@ -37,7 +37,7 @@
 
 <p><b>NOTE: </b>If you are able to connect to the imap server, all of this
 information can be gathered by using the <tt>version</tt> 
-command in <tt>cyradm</tt>.  If you can not use <tt>cyradm</tt>
+command in <tt>cyradm</tt>.  If you cannot use <tt>cyradm</tt>
 because you are having perl problems, you can connect using
 <tt>imtest</tt> and then run the following IMAP command:
 <ul>
@@ -52,7 +52,7 @@
 list instead of to cyrus-bugs, as there are more readers here.
 
 <P><HR>
-last modified: $Date: 2003/08/15 17:37:04 $
+last modified: $Date: 2008/08/27 08:28:45 $
 <br>
 <A HREF="index.html">Return</A> to the Cyrus IMAP Server Home Page
 </BODY></HTML>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-admin-mb.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-admin-mb.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-admin-mb.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-admin-mb.html Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-<!-- $Id: install-admin-mb.html,v 1.5 2006/11/30 17:11:16 murch Exp $ -->
+<!-- $Id: install-admin-mb.html,v 1.6 2008/01/07 17:56:08 murch Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Administering Mailboxes
@@ -35,10 +35,14 @@
 
 <p><b>Note:</b>If you run "<tt>cyradm</tt>" on a system not using
 Kerberos for authentication, you will be prompted for your user name
-and password before you can issue any "<tt>cyradm</tt>" commands.  Use
-the "<tt>-u</tt>" option to specify a particular user.
+and password before you can issue any "<tt>cyradm</tt>" commands.  By
+default, you will be prompted for the password of the user ID of the
+current shell.  If you want to authenticate as a different user, use
+the "<tt>-a</tt>" option.  If the user that you authenticate as is a
+Cyrus admin, you can proxy as a particular user by also using the
+"<tt>-u</tt>" option.
 
-<p>The mailbox naming convention requires that the primary mailbox (inbox)
+<p>The mailbox naming convention requires that the primary mailbox (INBOX)
 for anyone must be named "<tt>user.<var>&lt;userid&gt;</var></tt>".
 To create a mailbox, type:
 
@@ -58,7 +62,7 @@
 <kbd>   setquota user.smith 10000
 </kbd></pre>
 
-Once the inbox is created, users can create their own additional mailboxes 
+Once the INBOX is created, users can create their own additional mailboxes 
 from a mail program.  If Smith created a work mailbox and a play mailbox, 
 the full names of the mailboxes would be:
 
@@ -83,7 +87,5 @@
 IMAP server.
 
 <P><HR>
-last modified: $Date: 2006/11/30 17:11:16 $
+last modified: $Date: 2008/01/07 17:56:08 $
 </BODY></HTML>
-
-

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-auth.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-auth.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-auth.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-auth.html Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-<!-- $Id: install-auth.html,v 1.12 2003/07/28 02:47:09 rjs3 Exp $ -->
+<!-- $Id: install-auth.html,v 1.13 2008/08/27 08:28:45 selsky Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Authenticating Users
@@ -77,7 +77,7 @@
 system can take advantage of it -- for example, login, xlock, etc. 
 
 <p>Keep in mind that when you use PLAIN or LOGIN you should encrypt
-the stream so a user's password can not be trivially sniffed off of
+the stream so a user's password cannot be trivially sniffed off of
 the network.
 </ul>
 
@@ -197,5 +197,5 @@
 </ol>
 
 <HR>
-last modified: $Date: 2003/07/28 02:47:09 $
+last modified: $Date: 2008/08/27 08:28:45 $
 </BODY></HTML>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-configure.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-configure.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-configure.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-configure.html Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-<!-- $Id: install-configure.html,v 1.34 2006/11/30 17:11:16 murch Exp $ -->
+<!-- $Id: install-configure.html,v 1.35 2008/01/07 17:56:09 murch Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Installing and configuring the IMAP Server
@@ -227,11 +227,11 @@
 </kbd></pre>
 
 <p>Optionally, you can edit <tt>/etc/cyrus.conf</tt> to disable or
-enabling certain services, or to tune the number of preforked copies.
+enable certain services, or to tune the number of preforked copies.
 Be sure not to remove the entries that are labeled required.
 
 <p><li>Arrange to start "<tt>/usr/cyrus/bin/master</tt>" as root when
-the system starts.  It will bind some ports and then give up it's root
+the system starts.  It will bind some ports and then give up its root
 privileges.  Until your system reboots, you can start the master
 process by hand:
 
@@ -247,7 +247,7 @@
 <a name="mta"><h3>Configuring the Mail Transfer Agent</h3></a>
 
 <p>In order to deliver mail to the Cyrus system, you'll have to
-configure your MTA (Sendmail, Postfix, Exim, etc) to use LMTP.
+configure your MTA (Sendmail, Postfix, Exim, etc.) to use LMTP.
 
 <h4>Configuring <a href="http://www.sendmail.org/">Sendmail</a></h4>
 
@@ -435,13 +435,13 @@
 <li><p>OpenSSL requires the certificate and key in PEM format.  You can
 create the server's private key and certificate yourself using
 OpenSSL.  Here, we create a self-signed  key for the machine
-"<tt> foobar.andrew.cmu.edu</tt>" and put both the certificate and key
+"<tt>foobar.andrew.cmu.edu</tt>" and put both the certificate and key 
 in the file "<tt>/var/imap/server.pem</tt>".</p>
 
 <p>Please do not blindly enter in the information to OpenSSL
 below. Instead, enter the appropriate information for your
-organization (i.e. NOT Carnegie Mellon University for the Organization
-name, etc.).</p>
+organization (i.e., NOT Carnegie Mellon University for the Organization
+Name, etc.).</p>
 
 <pre>
 <kbd>openssl req -new -x509 -nodes -out /var/imap/server.pem -keyout /var/imap/server.pem -days 365</kbd>
@@ -471,7 +471,7 @@
 example: <kbd>chown cyrus /var/imap/server.pem</kbd>
 
 <li>Add the following to <tt>/etc/imapd.conf</tt> to tell the server
-where to find the certificate and key file (used for ALL services):
+where to find the certificate and key files (used for ALL services):
 
 <pre>tls_cert_file: /var/imap/server.pem
 tls_key_file: /var/imap/server.pem
@@ -485,10 +485,10 @@
 </pre>
 
 &quot;servicename&quot; here refers to the name of the service as specified
-in cyrus.conf.  It is <i>not</i> necessaraly the name of the binary.
+in <tt>cyrus.conf</tt>.  It is <i>not</i> necessarily the name of the binary.
 
 <p>This is useful if you want to use different hostnames for each service
-(e.g. via virtual host interfaces or DNS CNAMEs). In the absence of
+(e.g., via virtual host interfaces or DNS CNAMEs). In the absence of
 any of the service specific options, the value of the global option is
 used. A value of <b>disabled</b> for the certificate or key file for
 a particular service will disable SSL/TLS for that service.
@@ -537,5 +537,5 @@
 href=altnamespace.html#altnameconfig>altnamespace.html</a>.
 
 <P><HR>
-last modified: $Date: 2006/11/30 17:11:16 $
+last modified: $Date: 2008/01/07 17:56:09 $
 </BODY></HTML>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-perf.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-perf.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-perf.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-perf.html Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<!-- $Id: install-perf.html,v 1.10 2003/01/02 19:23:11 rjs3 Exp $ -->
+<!-- $Id: install-perf.html,v 1.11 2008/01/09 19:51:07 murch Exp $ -->
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta name="generator" content="HTML Tidy, see www.w3.org" />
@@ -9,7 +9,7 @@
 <body>
 <h1>Performance Notes</h1>
 
-Performance issues for you to consider. If you never expect to have
+Cyrus presents various performance issues for you to consider. If you never expect to have
 more than 100 simultaneous users, chances are any hardware you have
 will be fine. If you plan on having thousands or more users, please
 be sure to review this section. 
@@ -19,24 +19,24 @@
 
 <ul>
 <li><tt><b>/var/imap/proc</b></tt> - After a successful login, the
-imapd creates a file in <tt>/var/imap/proc</tt> that is its unix
-process id. It also contains the name of any <tt>SELECT</tt>'d
+<tt>imapd</tt> creates a file in <tt>var/imap/proc</tt> that is its unix
+process id. It also contains the name of any <tt>SELECT</tt>ed
 mailbox. The file is deleted when the user logs out. 
 
 <p>Given the potential load, this is a good candidate to move
 elsewhere. This can be done by symlink'ing the directory to another
-partition. We symlink it to a directory on a memory/viritual memory
-filesystem (specifically Solaris' tmpfs). If you use a tmpfs type
+partition. We symlink it to a directory on a memory/virtual memory
+filesystem (specifically Solaris' <tt>tmpfs</tt>). If you use a <tt>tmpfs</tt> type
 filesystem, make sure that you have sufficient memory/swap to do
 this.</p>
 
-<p>Some people don't care about this information and just #ifdef
+<p>Some people don't care about this information and just <tt>#ifdef</tt>
 out the code. We probably should add a <tt>configure</tt> option to
 do this.</p>
 </li>
 
 <li><tt><b>/var/imap/mailboxes.db</b></tt> - The mailboxes list is often
-the ultimate source of contention between imap processes, especially if
+the ultimate source of contention between <tt>imapd</tt> processes, especially if
 clients are inefficient about their use of the LIST command.  For this reason
 it is often better to use the skiplist backend which is optimized for
 enumeration of the database, as opposed to the default, Berkeley DB
@@ -46,16 +46,16 @@
 you can also tweak the Berkeley backend if you want to or have to stick
 with it. Cyrus doesn't do anything to increase the BDB cache size, and the
 default (256 kB) is way too small for any reasonably large site. With some
-50000 mailboxes and random operations, I found the hit rate for default
-BDB cache to be 70-80%. After growing the cache size to 2M, hit rate
+50000 mailboxes and random operations, I found the hit rate for the default
+BDB cache to be 70-80%. After growing the cache size to 2M, the hit rate
 approached 99% and disk traffic was greatly reduced since most of the
 operations are reads anyway. Therefore processes could complete their work
 and release their locks much more quickly, and the dreaded "DBERROR: xxx
 lockers" messages stayed at a comfortable level. You can modify the source
 (<tt>/lib/cyrusdb_db3.c</tt>, the setting is commented out) or you can put
 a <tt>DB_CONFIG</tt> file under <tt>/var/imap/db</tt> with the appropriate
-setting. Read more about this in the Berkeley docs before trying it, typos
-and incorrect settings can cause havoc.</p>
+setting. Read more about this in the Berkeley docs before trying it - typos
+and incorrect settings can wreak havoc.</p>
 
 <li><tt><b>/var/imap/deliverdb</b></tt> - Unless you disable
 duplicate delivery suppression, each time a mail message is
@@ -73,20 +73,20 @@
 separate machine.</li>
 
 <li>Unused SASL mechanisms - If you just build the SASL library and
-copied all the mechanisms into /usr/lib/sasl2, the <tt>imapd</tt>
-will try to use them and allocate some amount of memory. In
+copy all the mechanisms into <tt>/usr/lib/sasl2</tt>, the <tt>imapd</tt>
+will try to use them and allocate some amount of memory for each. In
 general, the operating system will swap out those pages but you may
-be allocating more swap space than you need. So, look in
-/usr/lib/sasl2 and if you don't plan on using those mechanisms,
+be allocating more swap space than you need. So look in
+<tt>usr/lib/sasl2</tt> and if you don't plan on using those mechanisms,
 don't leave them there.</li>
 
 <li>You may want to increase the listen queue value when starting
 up the master process. For example, you may want to do this if you
-see the Listen queue drop counter increasing quickly. For example,
-under Solaris, look at the variable tcpListenDrop (from <tt>netstat
+see the listen queue drop counter increasing quickly.
+Under Solaris, look at the variable <tt>tcpListenDrop</tt> (from <tt>netstat
 -sP tcp</tt>).</li>
 
-<li><b>Database recovery.</b> If restarting the server takes a long
+<li>Database recovery. If restarting the server takes a long
 time due to the <tt>cyrusdb</tt> database recovery procedure (this is
 usually true if you have a large number of deliveries) you should look
 into shortening the interval between checkpoints, controlled by the
@@ -102,12 +102,12 @@
 generate thousands of syslog messages.  On Linux, syslog
 performance can be greatly improved by disabling synchronous
 logging (disabling fsync() after each message).  Prepending
-filenames in /etc/syslog.conf with a "-", e.g., "/var/log/maillog"
-becomes "-/var/log/maillog", disables syslog's fsync() call after
+filenames in <tt>etc/syslog.conf</tt> with a "-", e.g., "<code>/var/log/maillog</code>"
+becomes "<tt>-/var/log/maillog</tt>", disables syslog's fsync() call after
 each log message.  If you log many messages those fsync()s will
 kill your I/O throughput.  Note that if you do not need the detail provided
 by the LOG_DEBUG level, then not logging these messages can significantly
-reduces the amount of log entries that cyrus makes.</li>
+reduces the number of log entries that Cyrus makes.</li>
 </ul>
 
 <p>In general, there's no magic bullet for performance. It depends
@@ -115,12 +115,12 @@
 system. In general, an <tt>imapd</tt> process takes up anywhere
 from 256 Kbytes of memory to 512 Kbytes when it is first fired up.
 CPU has not been a big deal, but it may become more important as
-the imap sessions are encrypted and now that searching may be more
+the IMAP sessions are encrypted and now that searching may be more
 frequent. Disk I/O is probably the most important and having a
-hardware RAID subsystem with an amount of write-back cache would be
+hardware RAID subsystem with a decent amount of write-back cache would be
 a good thing.</p>
 
-<p>Finally, if you are talking about less than 100 interactive
+<p>Again, if you are talking about less than 100 interactive
 users it is likely that any relatively modern hardware can support
 it. If you are talking about having more than 1000 interactive
 users, you should know how to predict your utilization, go
@@ -132,7 +132,6 @@
 look for his name.</p>
 
 <hr />
-last modified: $Date: 2003/01/02 19:23:11 $
+last modified: $Date: 2008/01/09 19:51:07 $
 </body>
 </html>
-

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-prereq.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-prereq.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-prereq.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-prereq.html Mon Feb  9 12:49:22 2009
@@ -1,19 +1,19 @@
-<!-- $Id: install-prereq.html,v 1.12 2003/10/22 18:50:04 rjs3 Exp $ -->
+<!-- $Id: install-prereq.html,v 1.13 2008/01/07 17:56:11 murch Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Prerequisites and other notes
 </title>
 </head>
-<h1>Prerequisites and other notes
-</h1>
 <body>
+
+<h1>Prerequisites and other notes</h1>
 
 <P>The following programs and/or packages are <b>required</b>.
 
 <ul>
-<LI> <b>libsasl</b>, version 2.1.7 or higher.  To obtain libsasl, ftp
+<LI> <b>libsasl</b>, version 2.1.7 or higher.  To obtain <tt>libsasl</tt>, <tt>ftp</tt>
 it from <a
-href="ftp://ftp.andrew.cmu.edu/pub/cyrus-mail"><TT>ftp.andrew.cmu.edu</TT></a>.
+href="ftp://ftp.andrew.cmu.edu/pub/cyrus-mail">ftp.andrew.cmu.edu</a>.
 Earlier versions of SASL will not work; please get the latest one.
 Configure SASL so that it supports whatever authentication method your
 site uses.  Please pay careful attention to the SASL
@@ -21,7 +21,7 @@
 
 <li> <b>Berkeley DB</b>, version 3.0.55 or higher. Berkeley DB can be
 obtained from <a href="http://www.sleepycat.com">Sleepycat</a>.  It is
-strongly recommended that libsasl be compiled with Berkeley DB
+strongly recommended that <tt>libsasl</tt> be compiled with Berkeley DB
 support, using the same version of Berkeley DB.  (If you have a
 Berkeley DB version mismatch, somewhat perplexing crashes result.)
 
@@ -40,14 +40,14 @@
 <ul>
 <LI> <b>makedepend</b>.  A version is included in the
 <TT>makedepend</TT> subdirectory of the distribution.  Try and install
-it before installing the Cyrus IMAPd.  If it fails, the configure
-script will use a dummy shell script instead of makedepend, and you
+it before installing the Cyrus IMAPd.  If it fails, the <tt>configure</tt>
+script will use a dummy shell script instead of <code>makedepend</code>, and you
 should be sure to always give the command "<TT>make clean</TT>" before
 "<TT>make all</TT>". If you don't mind builds taking longer, this
-isn't a big deal and you can ignore any makedepend errors.
+isn't a big deal and you can ignore any <code>makedepend</code> errors.
 
-<LI> <b>Perl</b>, version 5.  To obtain Perl, see <a
-href="http://www.cpan.org/">the comprehensive Perl archive</a>.  This
+<LI> <b>Perl</b>, version 5.  To obtain Perl, see the <a
+href="http://www.cpan.org/">Comprehensive Perl Archive</a>.  This
 is required for <tt>cyradm</tt> (written by Brandon Allbery).  It is
 also used for some installation scripts: you don't need it but it may
 make your life easier.  We recommend at least version 5.00502.
@@ -85,14 +85,12 @@
 <ul>
 <li><a href="ftp://ftp.gnu.org/non-gnu/flex">flex</a> - libsieve has
 two different lexical analyzers, and that's hard to do with
-traditional lex.  
+traditional <tt>lex</tt>.
 
-<li><a href="ftp://ftp.gnu.org/gnu/gcc">gcc</a> - we build using gcc
+<li><a href="ftp://ftp.gnu.org/gnu/gcc">gcc</a> - we build using <code>gcc</code>
 	  and the compiler options <tt>-O2 -g</tt>.
 </ul>
 
 <P><HR>
-last modified: $Date: 2003/10/22 18:50:04 $
+last modified: $Date: 2008/01/07 17:56:11 $
 </BODY></HTML>
-
-

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-replication.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-replication.html?rev=768&root=cyrus22&r1=767&r2=
3D768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-replication.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-replication.html Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-<!-- $Id: install-replication.html,v 1.3 2007/02/06 18:49:19 murch Exp $ -->
+<!-- $Id: install-replication.html,v 1.8 2007/11/26 20:35:59 murch Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Cyrus replication
@@ -13,15 +13,17 @@
 at your own risk.  The core of the replication code has been used
 successfully in production at <a
 href="http://www-uxsup.csx.cam.ac.uk/~dpc22/cyrus/replication.html">Cambridge 
-University</a> for about a year, but it has been rewritten extensively
+University</a> since the summer of 2003, but it has been rewritten extensively
 as part of the integration into the mainstream Cyrus codebase.
-</i></b><br><br>
-<b><i>Also note that the replication protocol currently does not have
-the facility to support the IMAP CONDSTORE extension (modification
-sequences).  It is recommended that you do not try to use both
-CONDSTORE and replication at this time.  The deficiencies in the
-replication protocol will be fixed in version 2.3.9.
-</i></b><br>
+The replication code as integrated into Cyrus 2.3 has been running in
+production at Fastmail.fm and Columbia.edu since early 2006 and will
+be put into production at CMU in winter 2007.
+</i></b>
+
+<p><i>The Cyrus team owes a debt of gratitude to the kind folks at
+Cambridge, Columbia, and Fastmail for their considerable effort in
+helping to identify and correct the bugs the in Cyrus 2.3 replication
+code.</i>
 
 <h3>Introduction &amp; Assumptions</h3>
 <p>The Cyrus replication engine is designed to replicate the mailstore on
@@ -52,10 +54,12 @@
 
 <h3>Configuring the "replica" server</h3>
 
-The "replica" server is a standalone server which listens for
+The "replica" server is a <i>standalone</i> server which listens for
 and processes synchronization messages from a "master" server.  The
 "replica" server needs to be configured to accept these synchonization
-messages.<p>
+messages.  The "replica" server <b>MUST NOT</b> be configured to be
+part of a Murder (it should only be configured into the Murder at the
+point at which it replaces a failed backend "master").<p>
 
 <ol>
 <p><li>Configure a standalone server as described in the rest
@@ -115,32 +119,16 @@
 
 </ol>
 
-<h4>Universally Unique Identifiers (UUIDs)</h4>
+<h4>Globally Unique IDentifiers (GUIDs)</h4>
 
-An optional, but recommended step is to enable UUIDs for messages.
-Use of UUIDs improves efficiency by eliminating the synchronization
+An optional, but recommended step is to enable GUIDs for messages.
+Use of GUIDs improves efficiency by eliminating the synchronization
 of messages which the "replica" has already received from the
-"master".  Note that UUIDs can be safely enabled and disabled at any
+"master".  Note that GUIDs can be safely enabled and disabled at any
 time.
 
 <ol>
-<p><li>
-Define the <tt>sync_machineid</tt> option in imapd.conf.  This option
-specifies the numeric identifier (1 - 255) of the "master" machine
-which is used in constructing the UUID for each message on the server.
-This identifier MUST be unique across all active "backend" servers in
-a Murder.  Example:<p>
-
-<pre>
-sync_machineid: 1
-</pre>
-
-<p><li>For each IMAP, NNTP and LMTP service in cyrus.conf, enable the
-<tt>provide_uuid</tt> argument.  Example:<p>
-
-<pre>
-imap	cmd="imapd" listen="imap" prefork=5 provide_uuid=1
-</pre>
+<p><li>Set the <tt>guid_mode</tt> option in imapd.conf to <tt>sha1</tt>.
 </ol>
 
 <h4>"Rolling" replication</h4>
@@ -180,7 +168,7 @@
 <h3>Failover</h3>
 
 <P><HR>
-last modified: $Date: 2007/02/06 18:49:19 $
+last modified: $Date: 2007/11/26 20:35:59 $
 </BODY></HTML>
 
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-upgrade.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-upgrade.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-upgrade.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-upgrade.html Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-<!-- $Id: install-upgrade.html,v 1.36 2007/02/07 18:58:07 murch Exp $ -->
+<!-- $Id: install-upgrade.html,v 1.41 2008/10/03 14:40:43 murch Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Upgrading From Previous Versions
@@ -7,6 +7,51 @@
 <body>
 
 <h1>Upgrading From Previous Versions</h1>
+
+<h2>Upgrading from 2.3.12</h2>
+<ul>
+<li>Sieve has reverted back to expecting modified UTF7 folder names in
+  fileinto actions by default.  If your scripts are using UTF8 folder
+  names, you <b>MUST</b> enable the <tt>sieve_utf8fileinto</tt>
+  in <tt>imapd.conf</tt>.</li>
+</ol>
+</ul>
+
+<h2>Upgrading from 2.3.10</h2>
+<ul>
+<li>STARTTLS is now allowed for externally preauth'd LMTP connections.
+If you don't want STARTTLS to be advertised and used by preauth'd
+clients, you can set <tt>&lt;service_name&gt;_tls_cert_file:
+disabled</tt> in imapd.conf.</li>
+</ol>
+</ul>
+
+<h2>Upgrading from 2.3.9</h2>
+<ul>
+<li>The method used for generating Globally Unique IDentifiers used
+for replication has been changed to be the SHA1 hash of the messages.
+If you wish to upgrade the existing GUIDs in particular mailbox(es) or
+the entire server, perform the following steps in the listed order.
+Note that is is NOT REQUIRED that existing GUIDs be upgraded.
+<ol>
+<li>Zero GUIDs on the replica (<tt>reconstruct -g</tt>)</li>
+<li>Regenerate GUIDs on the master (<tt>reconstruct -G</tt>)</li>
+<li>Regenerate GUIDs on the replica (<tt>reconstruct -G</tt>)</li>
+</ol>
+</ul>
+
+<h2>Upgrading from 2.3.8</h2>
+<ul>
+<li> You must install and configure Cyrus SASL version 2.1.17 or later
+to use Cyrus IMAP 2.3.9 and later.  You can download SASL at <a
+href="http://cyrusimap.web.cmu.edu/downloads.html#sasl">
+http://cyrusimap.web.cmu.edu/downloads.html#sasl</a>.</li>
+
+<li>The default value of the <tt>allowplaintext</tt> option has been
+changed to disabled (0).  If you need to allow cleartext passwords on
+the wire, then you will have to explicitly enable the
+<tt>allowplaintext</tt> option in <tt>imapd.conf</tt>.</li>
+</ul>
 
 <h2>Upgrading from 2.3.3 or later (64-bit machines)</h2>
 <ul>
@@ -462,7 +507,7 @@
 </ul>
 
 <HR><P>
-last modified: $Date: 2007/02/07 18:58:07 $
+last modified: $Date: 2008/10/03 14:40:43 $
 </BODY></HTML>
 
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-virtdomains.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-virtdomains.html?rev=768&root=cyrus22&r1=767&r2=
3D768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-virtdomains.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/install-virtdomains.html Mon Feb  9 12:49:22 2009
@@ -1,18 +1,18 @@
-<!-- $Id: install-virtdomains.html,v 1.4 2006/11/30 17:11:16 murch Exp $ -->
+<!-- $Id: install-virtdomains.html,v 1.5 2008/01/07 17:56:12 murch Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Configuring Virtual Domains
 </title>
 </head>
-<h1>Configuring Virtual Domains
-</h1>
 <body>
+
+<h1>Configuring Virtual Domains</h1>
 
 <h2>Introduction</h2>
 
 <p>Virtual domains is the practice of hosting a service for more than one
 domain on one server.  Cyrus IMAP has the ability to host IMAP/POP
-mailboxes for multiple domains (e.g. <tt>test at example.com</tt> and
+mailboxes for multiple domains (e.g., <tt>test at example.com</tt> and
 <tt>test at example.net</tt>) on a single server or Murder.</p>
 
 <p>In order to accomplish this, Cyrus needs to know which domain to look
@@ -21,7 +21,7 @@
 
 <ul>
 <li>Fully qualified userid - the client logs in with a userid
-containing the domain in which the user belongs (e.g
+containing the domain in which the user belongs (e.g.,
 <tt>test at example.com</tt> or <tt>test%example.net</tt>)</li>
 <li>IP address - the server looks up the domain based on the IP
 address of the receiving interface (useful for servers with multiple
@@ -44,7 +44,7 @@
 as existing inside a domain.  Unqualified users are technically inside the
 <tt>defaultdomain</tt>.</li>
 <li><b>Names can be qualified</b> - Global admins can reference
-mailboxes and ids by qualified names.  That is, for any given mailbox
+mailboxes and IDs by qualified names.  That is, for any given mailbox
 command, you can add <tt>@domain</tt> to the end of the mailbox name.
 Here are some examples:
  <ul>
@@ -69,9 +69,9 @@
     implementation supports per-domain administrators as well as
     global (inter-domain) administrators.  Domain-specific
     administrators are specified with a fully qualified userid in the
-    <tt>admins</tt> option (e.g. <tt>admin at example.net</tt>) and only
+    <tt>admins</tt> option (e.g., <tt>admin at example.net</tt>) and only
     have access to mailboxes in the associated domain.  Global
-    administrators are specified with an unqualified userid.
+    administrators are specified with unqualified userids.
 </ul>
 
 <h2>Quick Start</h2>
@@ -133,7 +133,7 @@
 </kbd></pre>
 
 <p>Once the server obtains the fully qualified hostname of the
-interface, it removes the localpart (ie, 'mail') and uses the
+interface, it removes the localpart (i.e., 'mail') and uses the
 remainder as the domain for any user that logs in.</p>
 
 <p>This address to hostname mapping would usually be done via DNS,
@@ -149,7 +149,7 @@
 <h4>Configuring Sendmail</h4>
 
 <p>In general, follow the basic <a href=install-configure.html>configuration
-instructions</a>.  Here are a few caveots:</p>
+instructions</a>.  Here are a few caveats:</p>
 
 <ul>
 <li> It is easiest to use the mailertable to route mail to Cyrus,
@@ -163,7 +163,7 @@
 
 <li> You'll have to use the Cyrus mailer in LMTP mode, and you'll have
 to change the mailer flags so that it provides the full domain while
-communicating LMTP.  Specifically these changes:
+communicating via LMTP.  Specifically these changes:
 
 <pre>
 S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP
@@ -171,12 +171,12 @@
 </ul>
 
 <h3>Mail Clients</h3>
-<p>The only changes you'll need to make to the mail client is to change the
-username to the fully qualified domain name, ie <tt>user at example.com</tt>.
+<p>The only changes you'll need to make to mail clients is to change
+usernames to the fully qualified domain names, i.e., <tt>user at example.com</tt>.
 Note that to support some mail clients, the <tt>user%example.com</tt>
 form of userid is also supported.  Users in the default domain will not
-need to reconfigur their clients (as unqualified userids are assumed to
-be in the default domain)</p>
+need to reconfigure their clients (as unqualified userids are assumed to
+be in the default domain).</p>
 
 <a name="admins"><h3>Administration</h3></a>
 
@@ -184,20 +184,20 @@
 administrators as well as "global" (inter-domain) administrators.
 Domain-specific administrators are specified with a
 fully qualified userid in the <tt>admins</tt> option
-(e.g. <tt>admin at example.net</tt>) and only have access to mailboxes in
+(e.g., <tt>admin at example.net</tt>) and only have access to mailboxes in
 the associated domain.  Mailbox names should be specified in the same
 fashion as on a single domain configuration.</p>
 
 <p>Global administrators are specified with an unqualified userid in the
 <tt>admins</tt> option and have access to <i>any</i> mailbox on the
 server.  Because global admins use unqualified userids, they belong
-to the <tt>defaultdomain</tt>.  As a result, you can NOT have a global
+to the <tt>defaultdomain</tt>.  As a result, you CANNOT have a global
 admin without specifying a <tt>defaultdomain</tt>.  Note that when
-trying to login as a global admin to a multi-homed server from remote
+trying to login as a global admin to a multi-homed server from a remote
 machine, it might be necessary to fully qualify the userid with the
 <tt>defaultdomain</tt>.</p>
 
-<p>Global admins must use a <tt>mailbox at domain</tt> syntax when
+<p>Global admins must use <tt>mailbox at domain</tt> syntax when
 specifying mailboxes outside of the <tt>defaultdomain</tt>.  Examples
 (using <tt>cyradm</tt>):</p>
 
@@ -220,5 +220,5 @@
 </kbd></pre>
 
 <P><HR>
-last modified: $Date: 2006/11/30 17:11:16 $
+last modified: $Date: 2008/01/07 17:56:12 $
 </BODY></HTML>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/database-formats.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/database-formats.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/database-formats.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/database-formats.html Mon Feb  9 12:49:22 2009
@@ -4,7 +4,7 @@
 
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="revision" content="$Id: database-formats.html,v 1.3 2006/11/30 17:11:16 murch Exp $" />
+<meta name="revision" content="$Id: database-formats.html,v 1.4 2008/01/18 19:17:07 murch Exp $" />
 <meta name="author" content="Ken Murchison" />
 
 <title>Database Formats</title>
@@ -123,6 +123,25 @@
 Data: &lt;Auth State (multi-byte)&gt;
 </pre>
 
+<h2>STATUS cache (statuscache.db)</h2>
+
+<p>This database caches IMAP STATUS information resulting in less I/O
+when the STATUS information hasn't changed (mailbox and \Seen state
+unchanged).  The database is indexed by mailbox name + userid and each
+data record contains the database version number, a bitmask of the
+stored status items, the mtime, inode, and size of the cyrus.index
+file at the time the record was written, the total number of messages
+in the mailbox, the number of recent messages, the next UID value, the
+mailbox UID validity value, the number of unseen messages, and the highest
+modification sequence in the mailbox.  The format of each record is as
+follows:</p>
+
+<pre>
+Key: &lt;Mailbox Name&gt;\0&lt;Userid&gt;\0
+
+Data: &lt;Version&gt;SP&lt;Bitmask of Items&gt;SP&lt;Mtime of Index&gt;SP&lt;Inode of Index&gt;SP&lt;Size of Index&gt;SP&lt;# of Messages&gt;SP&lt;# of Recent Messages&gt;SP&lt;Next UID&gt;SP&lt;UID Validity&gt;SP&lt;# of Unseen Messages&gt;SP&lt;Highest Mod Sequence&gt;
+</pre>
+
 <h2>Seen State (&lt;userid&gt;.seen)</h2>
 
 This database is a per-user database and maintains the list of

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/mailbox-format.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/mailbox-format.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/mailbox-format.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/mailbox-format.html Mon Feb  9 12:49:22 2009
@@ -4,7 +4,7 @@
 
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="revision" content="$Id: mailbox-format.html,v 1.5 2006/11/30 17:11:16 murch Exp $" />
+<meta name="revision" content="$Id: mailbox-format.html,v 1.8 2007/10/12 12:54:23 murch Exp $" />
 <meta name="author" content="Rob Siemborski" />
 
 <title>mailbox format</title>
@@ -184,6 +184,16 @@
 
 <dd> Flag signalling that we're supporting the IMAP CONDSTORE
 extension on the mailbox.</dd>
+
+<dt>IMAP_SHAREDSEEN</dt>
+
+<dd> Flag signalling that we're supporting a shared \Seen flag
+on the mailbox.</dd>
+
+<dt>IMAP_DUPDELIVER</dt>
+
+<dd> Flag signalling that we're allowing duplicate delivery of
+messages to the mailbox, overriding system-wide duplicate suppression.</dd>
 </dl>
 </dd>
 
@@ -245,8 +255,9 @@
 <dd>Indicates the version number of the cache record for the message
 (determines which headers are cached).</dd>
 
-<dt>UUID (MESSAGE_UUID_SIZE bytes)</dt>
-<dd>Universal UID of the message (used by replication code).</dd>
+<dt>GUID (MESSAGE_GUID_SIZE bytes)</dt>
+<dd>Globally Unique IDentifier of the message (used by replication
+engine).</dd>
 
 <dt>MODSEQ (8 bytes)</dt>
 <dd>Modification Sequence of the message (CONDSTORE).</dd>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/replication_examples
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/replication_examples?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/replication_examples (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/replication_examples Mon Feb  9 12:49:22 2009
@@ -36,7 +36,7 @@
 #      Folder UniqueID, Name, ACL, UIDlast, timestamp for last seen update.
 #
 #   "*" response for each mail message in folder:
-#      UID, UUID, flags (other than \Seen state)
+#      UID, GUID, flags (other than \Seen state)
 
 C: user_some dpc22 user.dpc22
 S: ** 6b98205c796c6c61 user.dpc22 \
@@ -59,7 +59,7 @@
 S: OK 6b98205c796c6c61 4151 1062945305
 
 # Remove message with UID "1" from folder list (message which has been
-# sitting in my inbox since January, has no UUID defined)
+# sitting in my inbox since January, has no GUID defined)
 
 C: expunge 1
 S: OK Expunge Complete
@@ -130,7 +130,7 @@
 
 S:   USER_SOME dpc22 ...
 
-Reserve message with given UUID in user.dpc22 so that it can be moved
+Reserve message with given GUID in user.dpc22 so that it can be moved
 
 S:   RESERVE user.dpc22 ...
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/replication_protocol
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/replication_protocol?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/replication_protocol (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/internal/replication_protocol Mon Feb  9 12:49:22 2009
@@ -249,18 +249,18 @@
 
 RESERVE
   mailbox :: astring
-  uuid0 :: ulong
+  guid0 :: ulong
      . . .
-  uuidn :: ulong
-
-Reserves collection of messages matching list of UUIDs in given mailbox.
+  guidn :: ulong
+
+Reserves collection of messages matching list of GUIDs in given mailbox.
 Message data is linked into /var/spool/imap/sync. staging directory
 so that we can later link the messages into other folders even if the
 original has been expunged. Multiline response of the form:
 
-  * [UUID :: astring]
+  * [GUID :: astring]
     . . .
-  * [UUID :: astring]
+  * [GUID :: astring]
   OK Reserve complete
 
 so that client knows which reserve operations have been complete and which
@@ -289,9 +289,9 @@
 
 Return complete status of currently selected mailbox. Multiline response:
 
-  * [uid :: ulong] [uuid :: astring] [flags :: flag_list]
+  * [uid :: ulong] [guid :: astring] [flags :: flag_list]
     . . .
-  * [uid :: ulong] [uuid :: astring] [flags :: flag_list]
+  * [uid :: ulong] [guid :: astring] [flags :: flag_list]
   OK [last_uid :: ulong]
 
 Believe that this command has been obsoleted by USER_ALL and USER_SOME.
@@ -359,8 +359,8 @@
   Arbitrary list of messages on single logical line , with three forms:
 
    SIMPLE                          # Unparsed message that we need to parse
-     UUID          :: astring
-     UID           :: ulong        # "NIL" => Use UUID 0.
+     GUID          :: astring
+     UID           :: ulong        # "NIL" => Use GUID 0.
      internaldate  :: time_t
      sentdate      :: time_t
      last_updated  :: time_t
@@ -368,7 +368,7 @@
      message_text  :: literal+
 
    PARSED                          # Message plus pre-parsed cyrus.cache entry
-     UUID          :: astring
+     GUID          :: astring
      UID           :: ulong
      internaldate  :: time_t
      sentdate      :: time_t
@@ -378,7 +378,7 @@
      message_text  :: literal+
 
    COPY                           # Copy of message which has already
-     UUID          :: astring     # been UPLOADED or RESERVED
+     GUID          :: astring     # been UPLOADED or RESERVED
      UID           :: ulong       # Message body and cache available
      internaldate  :: time_t      # from staging directory
      sentdate      :: time_t
@@ -388,7 +388,7 @@
 Will normally only add messages to the end of the mailfolder in current use
 (and the code has special optimised path for that case).  However if
 message list contains UIDs which belong in the middle of a mailbox, or a
-given UID exists on both client and server but the UUID values don't match
+given UID exists on both client and server but the GUID values don't match
 (which normally indicates the two ends have lost sync with each other),
 the the UPLOAD command will merge in new and replacement messages.
 
@@ -453,7 +453,7 @@
   same as that generated by STATUS command:
 
   * [uid :: ulong]
-    [uuid :: astring]
+    [guid :: astring]
     [flags :: flag_list_t]
 
 Final line of successful response is used to report QUOTA information

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/man.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/man.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/man.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/man.html Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-<!-- $Id: man.html,v 1.18 2006/11/30 17:11:16 murch Exp $ -->
+<!-- $Id: man.html,v 1.19 2007/02/09 13:23:27 murch Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Cyrus IMAP Server Man Pages</TITLE>
@@ -39,6 +39,7 @@
 <LI><A HREF="man/ctl_cyrusdb.8.html"><TT>ctl_cyrusdb</TT>(8)</A>
 <LI><A HREF="man/ctl_deliver.8.html"><TT>ctl_deliver</TT>(8)</A>
 <LI><A HREF="man/ctl_mboxlist.8.html"><TT>ctl_mboxlist</TT>(8)</A>
+<LI><A HREF="man/cyr_dbtool.8.html"><TT>cyr_dbtool</TT>(8)</A>
 <LI><A HREF="man/cyr_expire.8.html"><TT>cyr_expire</TT>(8)</A>
 <LI><A HREF="man/deliver.8.html"><TT>deliver</TT>(8)</A>
 <LI><A HREF="man/fetchnews.8.html"><TT>fetchnews</TT>(8)</A>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/os.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/os.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/os.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/os.html Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-<!-- $Id: os.html,v 1.4 2001/11/18 19:50:43 leg Exp $ -->
+<!-- $Id: os.html,v 1.5 2008/01/07 17:56:13 murch Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Operating System Notes
@@ -47,9 +47,9 @@
 <h2>Linux</h2>
 
 <ol>
-<li> synchronous fs updates.
+<li> synchronous FS updates.
 <br>By turning on synchronous updates for ext2fs, all updates (instead of
-just meta-data) become synchronous. This is good for reliability. Bad
+just meta-data) become synchronous. This is good for reliability, but bad
 for performance.
 
 <p> The big problem used to be with the <tt>mailboxes</tt> file. The
@@ -59,13 +59,11 @@
 <p>Note this is for ext2fs. If you are using a newer filesystem (such
 as xfs, jfs, or reiserfs) the synchronous metadata issue shouldn't
 come up.  Then again, we haven't really looked at other filesystems
-for linux yet.  (It appears that the different filesystems support
+for Linux yet.  (It appears that the different filesystems support
 slightly different semantics, and it's not always clear what the right
 thing for the application to do is.)
 </ol>
 
 <P><HR>
-last modified: $Date: 2001/11/18 19:50:43 $
+last modified: $Date: 2008/01/07 17:56:13 $
 </BODY></HTML>
-
-

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/questions.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/questions.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/questions.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/questions.html Mon Feb  9 12:49:22 2009
@@ -1,30 +1,15 @@
 <html>
 <head>
-<title>outstanding questions in cyrus documentation</title>
-<!-- $Id: questions.html,v 1.3 2003/10/16 15:33:31 rjs3 Exp $ -->
-</head><body>
+<title>Outstanding Questions in Cyrus Documentation</title>
+<!-- $Id: questions.html,v 1.5 2008/01/09 22:04:52 murch Exp $ -->
+</head>
+<body>
 
-questions we really should answer.  if you feel like doing us a favor,
-sit down and answer one.
+<p>Questions we really should answer.  If you feel like doing us a favor,
+sit down and answer one.</p>
 
 <ul>
-<li> why is it so hard to get <tt>imapd</tt> working with redhat's
-shadow password implementation?
-
-<li> When does <tt>imapd</tt> advertise PLAIN?  when does it accept
-plaintext logins?
-
-<li> What are the advantages of LMTP?  
-
-<li> How do I configure Sendmail to use LMTP?
-
-<li> How do I configure Postfix to work with Cyrus?  To use LMTP?
-
-<li> How can I run LMTP over TCP?  Why should I want to?
-
-<li> What are the performance implications of single-instance store?
-(in effect as of 1.6.22)  How should I configure partitions to deal
-with a large number of users?
+<li> What are the performance implications of single-instance store (as of 1.6.22)?
 
 </ul>
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/readme.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/readme.html?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/readme.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/readme.html Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 <HTML><HEAD>
     <TITLE>Cyrus IMAP Server Release Information</TITLE>
-    <!-- $Id: readme.html,v 1.22 2007/02/06 18:51:29 murch Exp $ -->
+    <!-- $Id: readme.html,v 1.23 2008/04/04 12:46:34 murch Exp $ -->
   </HEAD><BODY>
       <H1>                Cyrus IMAP Server Release Information</H1>
       
@@ -107,7 +107,7 @@
 The following copyright applies to the code:
 
 <pre>
- * Copyright (c) 1994-2000 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -125,12 +125,13 @@
  *    endorse or promote products derived from this software without
  *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/sieve-protocol.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/sieve-protocol.html?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/sieve-protocol.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/sieve-protocol.html Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-<!-- $Id: sieve-protocol.html,v 1.3 2003/05/02 17:01:57 rjs3 Exp $ -->
+<!-- $Id: sieve-protocol.html,v 1.4 2008/01/07 17:56:14 murch Exp $ -->
 
 <HTML><HEAD>
 <TITLE>Protocol for Sieve script exchange</TITLE>
@@ -6,7 +6,7 @@
 <H1>Protocol for Sieve script exchange</H1>
 
 <i>Please note that this document is not authoritative and may well be out
-of date, you should look at <a href=specs.html>specs.html</a> for the
+of date; you should look at <a href=specs.html>specs.html</a> for the
 current authoritative document for the MANAGESIEVE protocol.</i>
 
 Note: This is <b>not</b> a standards track protocol. If you decide to base
@@ -31,9 +31,9 @@
 
 <h3>Types</h3>
 
-This a line oriented protocol much like [IMAP] or [ACAP]. There
-are two types: ATOMS and strings. Strings may be quoted or
-literal. See [ACAP] for detailed descriptions.
+This is a line-oriented protocol much like [IMAP] or [ACAP]. There
+are two types: ATOMS and strings, all space ('SP') separated. Strings
+may be quoted or literal. See [ACAP] for detailed descriptions.
 <br>
 
 <i>sievename</i> is a string where only certain characters are
@@ -46,44 +46,45 @@
 <DD>
 SASL authentication; the parameters are the mechanism and optionally
 the initial data. Initial data is base64 encoded. The server
-replies with a OK or NO response, or a string base64 encoded followed
-by an EOL. Client then replies with a string base64 encoded followed
-by an EOL and the procedure is repeated.
+replies with an OK or NO response, or a base64 string followed
+by an EOL. Client then replies with a base64 string followed
+by an EOL, and the procedure is repeated.
 
 <DT><tt>NOOP EOL</tt>
 <DD>
-No side affects. OK, NO replies
+No side effects. Valid replies: OK or NO.
 
 <DT><tt>LOGOUT EOL</tt>
 <DD>
-Logout, terminates connection. OK, NO replies.
+Logout: terminates connection. Valid replies: OK or NO.
 
 <DT><tt>GETSCRIPT SP <i>sievename</i> EOL</tt>
 <DD>
 
 The parameter is the name of the requested script.
 Returns: <tt>string EOL</tt> containing the script data.
-Get the script with name <i>sievename</i> from the server. OK, NO replies
+Get the script with name <i>sievename</i> from the server. Valid
+replies: OK or NO.
 
 <DT><tt>PUTSCRIPT SP <i>sievename</i> SP <i>string</i> </tt> EOL
 <DD>
 Puts <i>sievename</i> with data <i>data</i> onto the server if
-possible. OK, NO replies.
+possible. Valid replies: OK or NO.
 
 <DT><tt> SETACTIVE SP <i>sievename</i> </tt>EOL
 <DD>
 Set the script with the name <i>sievename</i> as the active
-script. Any other script that was active is no longer. OK, NO replies
+script. Any other script that was active is no longer. Valid replies: OK or NO.
 
 <DT><TT>DELETESCRIPT SP <i>sievename</i> </tt>EOL
 <DD>
-Delete the script with <i>sievename</i>. OK or NO replies.
+Delete the script with <i>sievename</i>. Valid replies: OK or NO.
 
 <DT><TT>LISTSCRIPTS EOL</TT>
 <DD>
-returns zero or more: <i>sievename</i> EOL.
-where the active script has a '*' at the end of it's name
-OK or NO replies
+Returns zero or more: <i>sievename</i> EOL.
+Where the active script has a '*' at the end of its name.
+Valid replies: OK or NO.
 
 </dl>
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/specs.html
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/specs.html?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/specs.html (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/specs.html Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-<!-- $Id: specs.html,v 1.66 2006/11/30 17:11:16 murch Exp $ -->
+<!-- $Id: specs.html,v 1.68 2007/10/04 01:24:50 murch Exp $ -->
 <HTML>
 <HEAD>
 <TITLE>Cyrus IMAP Server Protocol Specifications</TITLE>
@@ -25,7 +25,7 @@
 <TD>IMAP4 IDLE command</TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2192.txt">RFC 2192</A></TD>
 <TD>IMAP URL Scheme
-<BR><I>being updated by</I> <A HREF="http://www.ietf.org/internet-drafts/draft-ietf-lemonade-rfc2192bis-02.txt">draft-ietf-lemonade-rfc2192bis</A></TD></TR>
+<BR><I>being updated by</I> <A HREF="http://www.ietf.org/internet-drafts/draft-ietf-lemonade-rfc2192bis-09.txt">draft-ietf-lemonade-rfc2192bis</A></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2193.txt">RFC 2193</A></TD>
 <TD>IMAP4 Mailbox Referrals</TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2342.txt">RFC 2342</A></TD>
@@ -51,31 +51,30 @@
 Profile</TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc4551.txt">RFC 4551</A></TD>
 <TD>IMAP Extension for Conditional STORE operation</TD></TR>
-<TR><TD><A HREF="http://www.ietf.org/internet-drafts/draft-ietf-imapext-sort-17.txt">
+<TR><TD><A HREF="http://www.ietf.org/rfc/rfc4959.txt">RFC 4959</A></TD>
+<TD>IMAP Extension for Simple Authentication and Security Layer (SASL)
+Initial Client Response</TD></TR>
+<TR><TD><A HREF="http://www.ietf.org/internet-drafts/draft-ietf-imapext-sort-19.txt">
 draft-ietf-imapext-sort</A></TD>
 <TD>IMAP SORT and THREAD Extension</TD></TR>
-<TR><TD><A HREF="http://www.ietf.org/internet-drafts/draft-ietf-imapext-list-extensions-13.txt">
+<TR><TD><A HREF="http://www.ietf.org/internet-drafts/draft-ietf-imapext-list-extensions-18.txt">
 draft-ietf-imapext-list-extensions</A></TD>
 <TD>IMAP4 LIST Command Extensions</TD></TR>
-<TR><TD><A HREF="http://www.ietf.org/internet-drafts/draft-daboo-imap-annotatemore-09.txt">
+<TR><TD><A HREF="http://www.ietf.org/internet-drafts/draft-daboo-imap-annotatemore-11.txt">
 draft-daboo-imap-annotatemore</A></TD>
 <TD>IMAP ANNOTATEMORE Extension</TD></TR>
-<TR><TD><A HREF="http://www.ietf.org/internet-drafts/draft-siemborski-imap-sasl-initial-response-04.txt">
-draft-siemborski-imap-sasl-initial-response</A></TD>
-<TD>IMAP Extension for SASL Initial Client Response</TD></TR>
 
 
 <TR><TD COLSPAN=2><br><h2>POP</h2></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc1939.txt">RFC 1939</A></TD>
 <TD>Post Office Protocol - Version 3 (POP3)</TD></TR>
-<TR><TD><A HREF="http://www.ietf.org/rfc/rfc1734.txt">RFC 1734</A></TD>
-<TD>POP3 AUTHentication command
-<BR><I>being updated by</I> <A HREF="http://www.ietf.org/internet-drafts/draft-siemborski-rfc1734bis-04.txt">
-draft-siemborski-rfc1734bis</A></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2449.txt">RFC 2449</A></TD>
 <TD>POP3 Extension Mechanism</TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2595.txt">RFC 2595</A></TD>
 <TD>Using TLS with IMAP, POP3 and ACAP</TD></TR>
+<TR><TD><A HREF="http://www.ietf.org/rfc/rfc5034.txt">RFC 5034</A></TD>
+<TD>The Post Office Protocol (POP3) Simple Authentication and Security
+Layer (SASL) Authentication Mechanism</TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc3206.txt">
 RFC 3206</A></TD><TD>The SYS and AUTH POP Response Codes</TD></TR>
 
@@ -102,14 +101,12 @@
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2195.txt">RFC 2195</A></TD>
 <TD>IMAP/POP AUTHorize Extension for Simple Challenge/Response
 <BR><I>being revised by</I>
-<A HREF="http://www.ietf.org/internet-drafts/draft-ietf-sasl-crammd5-07.txt">
+<A HREF="http://www.ietf.org/internet-drafts/draft-ietf-sasl-crammd5-09.txt">
 draft-ietf-sasl-crammd5</A></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2444.txt">RFC 2444</A></TD>
 <TD>The One-Time-Password SASL Mechanism</TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2831.txt">RFC 2831</A></TD>
-<TD>Using Digest Authentication as a SASL Mechanism
-<BR><I>being revised by</I> <A HREF="http://www.ietf.org/internet-drafts/draft-ietf-sasl-rfc2831bis-10.txt">
-draft-ietf-sasl-rfc2831bis</a></TD></TR>
+<TD>Using Digest Authentication as a SASL Mechanism</TD></TR>
 
 <TR><TD COLSPAN=2><br><h2>TLS/SSL</h2></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc4346.txt">RFC 4346</A></TD>
@@ -140,15 +137,14 @@
 <TD>Enhanced Mail System Status Codes</TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc3207.txt">RFC 3207</A></TD>
 <TD>SMTP Service Extension for Secure SMTP over TLS</TD></TR>
-<TR><TD><A HREF="http://www.ietf.org/rfc/rfc2554.txt">RFC 2554</A></TD>
-<TD>SMTP Service Extension for Authentication
-<BR><I>being updated by</I> <A HREF="http://www.ietf.org/internet-drafts/draft-siemborski-rfc2554bis-04.txt">
-draft-siemborski-rfc2554bis</A></TD></TR>
+<TR><TD><A HREF="http://www.ietf.org/rfc/rfc4954.txt">RFC 4954</A></TD>
+<TD>SMTP Service Extension for Authentication</TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2920.txt">RFC 2920</A></TD>
 <TD>SMTP Service Extension for Command Pipelining</TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc3848.txt">RFC 3848</A></TD>
 <TD>ESMTP and LMTP Transmission Types Registration</TD></TR>
-<TR><TD><A HREF="http://www.oceana.com/ftp/drafts/draft-murchison-lmtp-ignorequota-02.txt">
+<TR><TD><A
+HREF="http://www.oceana.com/ftp/drafts/draft-murchison-lmtp-ignorequota-02.txt">
 draft-murchison-lmtp-ignorequota</A></TD>
 <TD>LMTP Service Extension for Ignoring Recipient Quotas</TD></TR>
 
@@ -156,49 +152,64 @@
 <TR><TD COLSPAN=2><br><h2>Sieve</h2></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc3028.txt">RFC 3028</A></TD>
 <TD>Sieve: A Mail Filtering Language
-<BR><I>being updated by</I> <A HREF="http://ietf.org/internet-drafts/draft-ietf-sieve-3028bis-06.txt">
+<BR><I>being updated by</I> <A
+HREF="http://ietf.org/internet-drafts/draft-ietf-sieve-3028bis-12.txt">
 draft-ietf-sieve-3028bis</A></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc3431.txt">RFC 3431</A></TD>
-<TD>Sieve Extension: Relational Tests</TD></TR>
+<TD>Sieve Extension: Relational Tests
+<BR><I>being updated by</I> <A
+HREF="http://www.ietf.org/internet-drafts/draft-ietf-sieve-3431bis-04.txt">
+draft-ietf-sieve-rfc3431bis</A></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc3598.txt">RFC 3598</A></TD>
 <TD>Sieve Email Filtering -- Subaddress Extension
-<BR><I>being updated by</I> <A HREF="http://www.ietf.org/internet-drafts/draft-ietf-sieve-rfc3598bis-04.txt">
+<BR><I>being updated by</I> <A
+HREF="http://www.ietf.org/internet-drafts/draft-ietf-sieve-rfc3598bis-05.txt">
 draft-ietf-sieve-rfc3598bis</A></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc3894.txt">RFC 3894</A></TD>
 <TD>Sieve Extension: Copying Without Side Effects</TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2298.txt">RFC 2298</A></TD>
 <TD>Extensible Message Format for Message Disposition Notifications (MDNs)</TD></TR>
-<TR><TD><A HREF="http://www.ietf.org/internet-drafts/draft-ietf-sieve-vacation-06.txt">
+<TR><TD><A
+HREF="http://www.ietf.org/internet-drafts/draft-ietf-sieve-vacation-07.txt">
 draft-ietf-sieve-vacation</A></TD>
 <TD>Sieve Email Filtering:  Vacation Extension</TD></TR>
-<TR><TD><A HREF="http://www.ietf.org/internet-drafts/draft-ietf-sieve-body-03.txt">
+<TR><TD><A
+HREF="http://www.ietf.org/internet-drafts/draft-ietf-sieve-body-06.txt">
 draft-ietf-sieve-body</A></TD>
 <TD>Sieve Mail Filtering Language: Body Extension</TD></TR>
-<TR><TD><A HREF="http://www.ietf.org/internet-drafts/draft-ietf-sieve-regex-00.txt">
+<TR><TD><A
+HREF="http://www.ietf.org/internet-drafts/draft-ietf-sieve-regex-00.txt">
 draft-ietf-sieve-regex</A></TD>
 <TD>Sieve -- Regular Expression Extension</TD></TR>
-<TR><TD><A HREF="http://www.oceana.com/ftp/drafts/draft-daboo-sieve-include-01.txt">
+<TR><TD><A
+HREF="http://www.oceana.com/ftp/drafts/draft-daboo-sieve-include-01.txt">
 draft-daboo-sieve-include</A></TD>
 <TD>SIEVE Include Extension</TD></TR>
-<TR><TD><A HREF="http://www.oceana.com/ftp/drafts/draft-melnikov-sieve-imapflags-03.txt">
+<TR><TD><A
+HREF="http://www.oceana.com/ftp/drafts/draft-melnikov-sieve-imapflags-03.txt">
 draft-melnikov-sieve-imapflags</A></TD>
 <TD>Sieve -- IMAP flag Extension</TD></TR>
-<TR><TD><A HREF="http://www.oceana.com/ftp/drafts/draft-martin-sieve-notify-01.txt">
+<TR><TD><A
+HREF="http://www.oceana.com/ftp/drafts/draft-martin-sieve-notify-01.txt">
 draft-martin-sieve-notify</A></TD>
 <TD>Sieve -- An extension for providing instant notifications</TD></TR>
-<TR><TD><A HREF="http://www.oceana.com/ftp/drafts/draft-martin-managesieve-04.txt">
+<TR><TD><A
+HREF="http://www.ietf.org/internet-drafts/draft-martin-managesieve-08.txt">
 draft-martin-managesieve</A></TD>
-<TD>Protocol for Remotely Managing Sieve Scripts</TD></TR>
+<TD>A Protocol for Remotely Managing Sieve Scripts</TD></TR>
 
 <TR><TD COLSPAN=2><br><h2>Other</h2></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc2822.txt">RFC 2822</A></TD>
-<TD>Internet Message Format</TD></TR>
+<TD>Internet Message Format
+<BR><I>being updated by</I> <A
+HREF="http://www.ietf.org/internet-drafts/draft-resnick-2822upd-03.txt">
+draft-resnick-2822upd</A></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc1036.txt">RFC 1036</A></TD>
 <TD>Standard for Interchange of USENET Messages
 <BR><I>being updated by</I>
-<A HREF="http://www.ietf.org/internet-drafts/draft-ietf-usefor-usefor-10.txt">
+<A HREF="http://www.ietf.org/internet-drafts/draft-ietf-usefor-usefor-12.txt">
 draft-ietf-usefor-usefor</A> <I>and</I>
-<A HREF="http://www.ietf.org/internet-drafts/draft-ietf-usefor-usepro-05.txt">
+<A HREF="http://www.ietf.org/internet-drafts/draft-ietf-usefor-usepro-08.txt">
 draft-ietf-usefor-usepro</A></TD></TR>
 <TR><TD><A HREF="http://www.ietf.org/rfc/rfc3656.txt">RFC 3656</a></TD>
 <TD>MUPDATE Protocol (For Cyrus Murder)</TD></TR>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/text/Makefile
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/text/Makefile?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/text/Makefile (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/text/Makefile Mon Feb  9 12:49:22 2009
@@ -1,30 +1,45 @@
 # Makefile for cyrus documentation directory
 # 
-# Copyright 1998 Carnegie Mellon University
+# Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
 # 
-# No warranties, either expressed or implied, are made regarding the
-# operation, use, or results of the software.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
 #
-# Permission to use, copy, modify and distribute this software and its
-# documentation is hereby granted for non-commercial purposes only
-# provided that this copyright notice appears in all copies and in
-# supporting documentation.
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
 #
-# Permission is also granted to Internet Service Providers and others
-# entities to use the software for internal purposes.
+# 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.
 #
-# The distribution, modification or sale of a product which uses or is
-# based on the software, in whole or in part, for commercial purposes or
-# benefits requires specific, additional permission from:
+# 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 legal
+#    details, please contact
+#  Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
-#  Office of Technology Transfer
-#  Carnegie Mellon University
-#  5000 Forbes Avenue
-#  Pittsburgh, PA  15213-3890
-#  (412) 268-4387, fax: (412) 268-7395
-#  tech-transfer at 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.
 # 
-# $Id: Makefile,v 1.4 2002/11/14 15:27:35 rjs3 Exp $
+# $Id: Makefile,v 1.5 2008/04/04 12:46:35 murch Exp $
 
 all: htmlstrip docs clean
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/text/htmlstrip.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/text/htmlstrip.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/text/htmlstrip.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/doc/text/htmlstrip.c Mon Feb  9 12:49:22 2009
@@ -1,22 +1,51 @@
 /* htmlstrip.c -- HTML to text converter
  *
- * Copyright 1998-2003, Carnegie Mellon University.  All Rights Reserved.
+ * Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
  * 
- * This software is made available for academic and research
- * purposes only.  No commercial license is hereby granted.
- * Copying and other reproduction is authorized only for research,
- * education, and other non-commercial purposes.  No warranties,
- * either expressed or implied, are made regarding the operation,
- * use, or results of the software.  Such a release does not permit
- * use of the code for commercial purposes or benefits by anyone
- * without specific, additional permission by the owner of the code.
- *
+ * 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: htmlstrip.c,v 1.11 2008/04/04 12:46:35 murch Exp $
  */
-  
-/* $Id: htmlstrip.c,v 1.9 2003/10/22 18:50:06 rjs3 Exp $ */
   
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #define MODE_PRE 1		/* Preformatted */
 #define MODE_IGNORETXT 2	/* Discard text */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/Makefile.dist
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/Makefile.dist?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/Makefile.dist (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/Makefile.dist Mon Feb  9 12:49:22 2009
@@ -1,4 +1,4 @@
-# $Id: Makefile.dist,v 1.9 2006/11/30 17:11:17 murch Exp $
+# $Id: Makefile.dist,v 1.10 2007/10/17 20:05:57 murch Exp $
 # it would be nice to figure out how to make "Makefile" do an
 # 'include' of this file.
 # we'd have to make this use srcdir and only define COMPILE_ET if it wasn't
@@ -6,22 +6,10 @@
 
 SNMPGEN = ../snmp/snmpgen
 
-BUILT_SOURCES = imap_err.h imap_err.c \
-	nntp_err.h nntp_err.c \
-	mupdate_err.h mupdate_err.c \
-	lmtpstats.c lmtpstats.h \
+BUILT_SOURCES = lmtpstats.c lmtpstats.h \
 	pushstats.c pushstats.h
 
 dist: $(BUILT_SOURCES)
-
-imap_err.h imap_err.c: imap_err.et
-	$(COMPILE_ET) imap_err.et
-
-nntp_err.h nntp_err.c: nntp_err.et
-	$(COMPILE_ET) nntp_err.et
-
-mupdate_err.h mupdate_err.c: mupdate_err.et
-	$(COMPILE_ET) mupdate_err.et
 
 pushstats.c pushstats.h: pushstats.snmp
 	$(SNMPGEN) pushstats.snmp

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,9 +1,6 @@
 # Makefile for cyrus imap server and associated programs
-# $Id: Makefile.in,v 1.186 2007/01/09 17:41:35 murch Exp $
 # 
-# @configure_input@
-# 
-# Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -19,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -41,6 +39,8 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 # 
+# $Id: Makefile.in,v 1.196 2008/09/23 16:17:09 murch Exp $
+
 DEFINES=-DSETPROCTITLE
 
 # \Seen state database.  Either 'db' (berkeley db) or 
@@ -100,8 +100,9 @@
 	global.o imap_err.o mupdate_err.o proc.o setproctitle.o \
 	convert_code.o duplicate.o saslclient.o saslserver.o signals.o \
 	annotate.o search_engines.o squat.o squat_internal.o mbdump.o \
-	imapparse.o telemetry.o user.o notify.o protocol.o idle.o quota_db.o \
-	sync_log.o $(SEEN) mboxkey.o backend.o tls.o
+	imapparse.o telemetry.o user.o notify.o idle.o quota_db.o \
+	sync_log.o $(SEEN) mboxkey.o backend.o tls.o message_guid.o \
+	statuscache_db.o
 
 IMAPDOBJS=pushstats.o imapd.o proxy.o imap_proxy.o index.o version.o
 
@@ -114,7 +115,7 @@
 SERVICETHREAD=../master/service-thread.o
 
 PROGS = imapd lmtpd pop3d \
-	fud smmapd reconstruct quota mbpath ipurge cyr_dbtool \
+	fud smmapd reconstruct quota mbpath ipurge cyr_dbtool cyr_synclog \
 	cyrdump chk_cyrus cvt_cyrusdb deliver ctl_mboxlist \
 	ctl_deliver ctl_cyrusdb squatter mbexamine cyr_expire arbitron \
 	unexpunge @IMAP_PROGS@
@@ -123,7 +124,7 @@
 	lmtpstats.c lmtpstats.h xversion.h mupdate_err.c mupdate_err.h \
 	nntp_err.c nntp_err.h
 
-all: $(BUILTSOURCES) $(PROGS) $(SUIDPROGS)
+all: xversion $(BUILTSOURCES) $(PROGS) $(SUIDPROGS)
 
 pure: imapd.pure lmtpd.pure mupdate.pure
 
@@ -151,11 +152,10 @@
 
 ### Built Source Files
 
-xversion:
-	rm -f version.o
+xversion xversion.h:
 	AWK=$(AWK) $(srcdir)/xversion.sh
 
-xversion.h: xversion
+version.o: xversion.h
 
 pushstats.c: pushstats.snmp $(srcdir)/../snmp/snmpgen
 	$(srcdir)/../snmp/snmpgen $(srcdir)/pushstats.snmp
@@ -199,7 +199,7 @@
 	 $(SERVICE) lmtpd.o proxy.o $(LMTPOBJS) $(SIEVE_OBJS) \
 	 mutex_fake.o libimap.a $(SIEVE_LIBS) $(DEPLIBS) $(LIBS) $(LIB_WRAP)
 
-imapd: xversion $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE)
+imapd: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE)
 	$(CC) $(LDFLAGS) -o imapd \
 	 $(SERVICE) $(IMAPDOBJS) mutex_fake.o \
 	libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP)
@@ -262,6 +262,10 @@
 	$(CC) $(LDFLAGS) -o cyr_dbtool cyr_dbtool.o $(CLIOBJS) \
 	libimap.a $(DEPLIBS) $(LIBS)
 
+cyr_synclog: cyr_synclog.o mutex_fake.o libimap.a $(DEPLIBS)
+	$(CC) $(LDFLAGS) -o cyr_synclog cyr_synclog.o $(CLIOBJS) \
+	libimap.a $(DEPLIBS) $(LIBS)
+
 cvt_cyrusdb: cvt_cyrusdb.o mutex_fake.o libimap.a $(DEPLIBS)
 	$(CC) $(LDFLAGS) -o cvt_cyrusdb cvt_cyrusdb.o $(CLIOBJS) \
 	libimap.a $(DEPLIBS) $(LIBS)
@@ -306,6 +310,10 @@
 	$(CC) $(LDFLAGS) -o ipurge ipurge.o $(CLIOBJS) \
 	libimap.a $(DEPLIBS) $(LIBS)
 
+cyr_virusscan: cyr_virusscan.o index.o $(CLIOBJS) libimap.a $(DEPLIBS)
+	$(CC) $(LDFLAGS) -o cyr_virusscan cyr_virusscan.o index.o $(CLIOBJS) \
+	libimap.a $(DEPLIBS) $(LIBS) -lclamav
+
 cyrdump: cyrdump.o index.o $(CLIOBJS) libimap.a $(DEPLIBS)
 	$(CC) $(LDFLAGS) -o cyrdump cyrdump.o index.o $(CLIOBJS) \
 	libimap.a $(DEPLIBS) $(LIBS)
@@ -333,6 +341,9 @@
 make_md5: make_md5.o libimap.a mutex_fake.o $(DEPLIBS)
 	$(CC) $(LDFLAGS) -o make_md5 make_md5.o libimap.a mutex_fake.o $(DEPLIBS) $(LIBS)
 
+make_sha1: make_sha1.o libimap.a mutex_fake.o $(DEPLIBS)
+	$(CC) $(LDFLAGS) -o make_sha1 make_sha1.o libimap.a mutex_fake.o $(DEPLIBS) $(LIBS)
+
 sync_client: sync_client.o sync_support.o \
 	backend.o tls.o imapparse.o libimap.a mutex_fake.o $(DEPLIBS)
 	$(CC) $(LDFLAGS) -o \
@@ -349,7 +360,7 @@
 
 clean:
 	rm -f *.o *.a Makefile.bak makedepend.log \
-	$(BUILTSOURCES) $(PROGS) $(SUIDPROGS)
+	$(BUILTSOURCES) $(PROGS) $(SUIDPROGS) cyr_virusscan
 
 distclean: clean
 	rm -f Makefile

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/annotate.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/annotate.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/annotate.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/annotate.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* annotate.c -- Annotation manipulation routines
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: annotate.c,v 1.35 2007/02/05 18:41:45 jeaton Exp $
+ * $Id: annotate.c,v 1.42 2008/10/08 15:47:06 murch Exp $
  */
 
 #include <config.h>
@@ -253,7 +252,7 @@
 	strcat(fname, FNAME_ANNOTATIONS);
     }
 
-    ret = DB->open(fname, CYRUSDB_CREATE, &anndb);
+    ret = (DB->open)(fname, CYRUSDB_CREATE, &anndb);
     if (ret != 0) {
 	syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
 	       cyrusdb_strerror(ret));
@@ -270,7 +269,7 @@
     int r;
 
     if (annotate_dbopen) {
-	r = DB->close(anndb);
+	r = (DB->close)(anndb);
 	if (r) {
 	    syslog(LOG_ERR, "DBERROR: error closing annotations: %s",
 		   cyrusdb_strerror(r));
@@ -306,11 +305,12 @@
 static int split_attribs(const char *data, int datalen __attribute__((unused)),
 			 struct annotation_data *attrib)
 {
-    unsigned long tmp;
+    unsigned long tmp; /* for alignment */
 
     /* xxx use datalen? */
     /* xxx sanity check the data? */
-    attrib->size = (size_t) ntohl(*(unsigned long *) data);
+    memcpy(&tmp, data, sizeof(unsigned long));
+    attrib->size = (size_t) ntohl(tmp);
     data += sizeof(unsigned long); /* skip to value */
 
     attrib->value = data;
@@ -563,7 +563,7 @@
 	/* Base the return of the size attribute on whether or not there is
 	 * an attribute, not whether size is nonzero. */
 	if ((fdata->attribs & ATTRIB_SIZE_SHARED) && attrib->value) {
-	    snprintf(buf, sizeof(buf), "%u", attrib->size);
+	    snprintf(buf, sizeof(buf), SIZE_T_FMT, attrib->size);
 	    appendattvalue(&attvalues, "size.shared", buf);
 	}
 
@@ -589,7 +589,7 @@
 	/* Base the return of the size attribute on whether or not there is
 	 * an attribute, not whether size is nonzero. */
 	if ((fdata->attribs & ATTRIB_SIZE_PRIV) && attrib->value) {
-	    snprintf(buf, sizeof(buf), "%u", attrib->size);
+	    snprintf(buf, sizeof(buf), SIZE_T_FMT, attrib->size);
 	    appendattvalue(&attvalues, "size.priv", buf);
 	}
 
@@ -712,7 +712,8 @@
 {
     struct mailbox mailbox;
     struct index_record record;
-    int r = 0, msg;
+    int r = 0;
+    unsigned msg;
 #ifdef HAVE_LONG_LONG_INT
     unsigned long long totsize = 0;
 # define SIZE_FMT "%llu"
@@ -869,7 +870,7 @@
     output_entryatt(ext_mboxname, entry, "", &attrib, fdata);
 }
 
-static void annotation_get_condstore(const char *int_mboxname,
+static void annotation_get_mailboxopt(const char *int_mboxname,
 				     const char *ext_mboxname,
 				     const char *entry,
 				     struct fetchdata *fdata,
@@ -877,12 +878,12 @@
 				     void *rock __attribute__((unused)))
 { 
     struct mailbox mailbox;
-    int r = 0;
+    int flag, r = 0;
     char value[40];
     struct annotation_data attrib;
   
-    if(!int_mboxname || !ext_mboxname || !fdata || !mbrock)
-      fatal("annotation_get_condstore called with bad parameters",
+    if(!int_mboxname || !ext_mboxname || !entry || !fdata || !mbrock)
+      fatal("annotation_get_mailboxopt called with bad parameters",
               EC_TEMPFAIL);
 
     get_mb_data(int_mboxname, mbrock);
@@ -890,6 +891,17 @@
     /* Make sure its a local mailbox */
     if (mbrock->server) return;
 
+    /* Check entry */
+    if (!strcmp(entry, "/vendor/cmu/cyrus-imapd/condstore")) {
+	flag = OPT_IMAP_CONDSTORE;
+    } else if (!strcmp(entry, "/vendor/cmu/cyrus-imapd/sharedseen")) {
+	flag = OPT_IMAP_SHAREDSEEN;
+    } else if (!strcmp(entry, "/vendor/cmu/cyrus-imapd/duplicatedeliver")) {
+	flag = OPT_IMAP_DUPDELIVER;
+    } else {
+	return;
+    }
+  
     /* Check ACL */
     if(!fdata->isadmin &&
        (!mbrock->acl ||
@@ -906,7 +918,7 @@
     }
 
     if (!r) {
-      if (mailbox.options & OPT_IMAP_CONDSTORE) {
+      if (mailbox.options & flag) {
           strcpy(value, "true");
       } else {
           strcpy(value, "false");
@@ -1017,7 +1029,11 @@
     { "/vendor/cmu/cyrus-imapd/lastpop", BACKEND_ONLY,
       annotation_get_lastpop, NULL },
     { "/vendor/cmu/cyrus-imapd/condstore", BACKEND_ONLY,
-      annotation_get_condstore, NULL },
+      annotation_get_mailboxopt, NULL },
+    { "/vendor/cmu/cyrus-imapd/sharedseen", BACKEND_ONLY,
+      annotation_get_mailboxopt, NULL },
+    { "/vendor/cmu/cyrus-imapd/duplicatedeliver", BACKEND_ONLY,
+      annotation_get_mailboxopt, NULL },
     { NULL, ANNOTATION_PROXY_T_INVALID, NULL, NULL }
 };
 
@@ -1694,14 +1710,27 @@
     return r;
 }
 
-static int annotation_set_condstore(const char *int_mboxname,
+static int annotation_set_mailboxopt(const char *int_mboxname,
 				    struct annotate_st_entry_list *entry,
 				    struct storedata *sdata,
 				    struct mailbox_annotation_rock *mbrock,
 				    void *rock __attribute__((unused)))
 {
     struct mailbox mailbox;
-    int r = 0;
+    int flag, r = 0;
+
+    /* Check entry */
+    if (!strcmp(entry->entry->name, "/vendor/cmu/cyrus-imapd/condstore")) {
+	flag = OPT_IMAP_CONDSTORE;
+    } else if (!strcmp(entry->entry->name,
+		       "/vendor/cmu/cyrus-imapd/sharedseen")) {
+	flag = OPT_IMAP_SHAREDSEEN;
+    } else if (!strcmp(entry->entry->name,
+		       "/vendor/cmu/cyrus-imapd/duplicatedeliver")) {
+	flag = OPT_IMAP_DUPDELIVER;
+    } else {
+	return IMAP_PERMISSION_DENIED;
+    }
   
     /* Check ACL */
     if(!sdata->isadmin &&
@@ -1717,9 +1746,9 @@
 
     if (!r) {
 	if (!strcmp(entry->shared.value, "true")) {
-	    mailbox.options |= OPT_IMAP_CONDSTORE;
+	    mailbox.options |= flag;
 	} else {
-	    mailbox.options &= ~OPT_IMAP_CONDSTORE;
+	    mailbox.options &= ~flag;
 	}
 
 	r = mailbox_write_index_header(&mailbox);
@@ -1793,7 +1822,13 @@
       ACL_ADMIN, annotation_set_todb, NULL },
     { "/vendor/cmu/cyrus-imapd/condstore", ATTRIB_TYPE_BOOLEAN, BACKEND_ONLY,
       ATTRIB_VALUE_SHARED | ATTRIB_CONTENTTYPE_SHARED,
-      ACL_ADMIN, annotation_set_condstore, NULL },
+      ACL_ADMIN, annotation_set_mailboxopt, NULL },
+    { "/vendor/cmu/cyrus-imapd/sharedseen", ATTRIB_TYPE_BOOLEAN, BACKEND_ONLY,
+      ATTRIB_VALUE_SHARED | ATTRIB_CONTENTTYPE_SHARED,
+      ACL_ADMIN, annotation_set_mailboxopt, NULL },
+    { "/vendor/cmu/cyrus-imapd/duplicatedeliver", ATTRIB_TYPE_BOOLEAN, BACKEND_ONLY,
+      ATTRIB_VALUE_SHARED | ATTRIB_CONTENTTYPE_SHARED,
+      ACL_ADMIN, annotation_set_mailboxopt, NULL },
     { NULL, 0, ANNOTATION_PROXY_T_INVALID, 0, 0, NULL, NULL }
 };
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/annotate.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/annotate.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/annotate.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/annotate.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
- /* 
- * annotate.h -- Annotation manipulation routines
+/* annotate.h -- Annotation manipulation routines
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: annotate.h,v 1.10 2006/11/30 17:11:17 murch Exp $
+ * $Id: annotate.h,v 1.11 2008/03/24 17:09:16 murch Exp $
  */
 
 #ifndef ANNOTATE_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/append.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/append.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/append.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/append.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* append.c -- Routines for appending messages to a mailbox
- * $Id: append.c,v 1.110 2007/02/05 18:41:45 jeaton Exp $
- *
- * Copyright (c)1998, 2000 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: append.c,v 1.115 2008/09/23 16:19:42 murch Exp $
  */
 
 #include <config.h>
@@ -68,7 +70,7 @@
 #include "retry.h"
 #include "quota.h"
 
-#include "message_uuid.h"
+#include "message_guid.h"
 
 struct stagemsg {
     char fname[1024];
@@ -83,7 +85,7 @@
     */
     char *parts; /* buffer of current stage parts */
     char *partend; /* end of buffer */
-    struct message_uuid uuid;
+    struct message_guid guid;
 };
 
 static int append_addseen(struct mailbox *mailbox, const char *userid,
@@ -416,9 +418,6 @@
     stage->parts = xzmalloc(5 * (MAX_MAILBOX_PATH+1) * sizeof(char));
     stage->partend = stage->parts + 5 * (MAX_MAILBOX_PATH+1) * sizeof(char);
 
-    /* Assign new, shared MessageID */
-    message_uuid_assign(&stage->uuid);
-
     snprintf(stage->fname, sizeof(stage->fname), "%d-%d-%d",
 	     (int) getpid(), (int) internaldate, msgnum);
 
@@ -432,6 +431,7 @@
     strlcat(stagefile, stage->fname, sizeof(stagefile));
 
     /* create this file and put it into stage->parts[0] */
+    unlink(stagefile);
     f = fopen(stagefile, "w+");
     if (!f) {
 	if (mkdir(stagedir, 0755) != 0) {
@@ -576,7 +576,8 @@
 	/* ok, we've successfully created the file */
 	if (!*body || (as->nummsg - 1))
 	    r = message_parse_file(destfile, NULL, NULL, body);
-	if (!r) r = message_create_record(mailbox, &message_index, *body);
+	if (!r) r = message_create_record(mailbox->name, mailbox->cache_fd,
+					  &message_index, *body);
     }
     if (destfile) {
 	/* this will hopefully ensure that the link() actually happened
@@ -640,9 +641,6 @@
 	    }
 	}
     }
-    /* Copy Message UUID from stage */
-    message_uuid_copy(&message_index.uuid, &stage->uuid);
-
     /* Write out index file entry */
     r = mailbox_append_index(mailbox, &message_index, 
 			     mailbox->exists + as->nummsg - 1, 1, 0);
@@ -741,7 +739,8 @@
     if (!r) {
 	if (!*body || (as->nummsg - 1))
 	    r = message_parse_file(destfile, NULL, NULL, body);
-	if (!r) r = message_create_record(mailbox, &message_index, *body);
+	if (!r) r = message_create_record(mailbox->name, mailbox->cache_fd,
+					  &message_index, *body);
     }
     fclose(destfile);
     if (r) {
@@ -800,9 +799,6 @@
 	    }
 	}
     }
-
-    /* Assign new Message-UUID */
-    message_uuid_assign(&message_index.uuid);
 
     /* Write out index file entry; if we abort later, it's not
        important */
@@ -950,7 +946,8 @@
 				  &src_base, &src_size);
 
 	    if (!r) r = message_parse_file(destfile, NULL, NULL, &body);
-	    if (!r) r = message_create_record(append_mailbox,
+	    if (!r) r = message_create_record(append_mailbox->name,
+					      append_mailbox->cache_fd,
 					      &message_index[msg], body);
 	    if (body) message_free_body(body);
 	    fclose(destfile);
@@ -1004,8 +1001,8 @@
 		  message_index[msg].uid);
 	}
 
-	/* Assign messageID for this message */
-	message_uuid_copy(&message_index[msg].uuid, &copymsg[msg].uuid);
+	/* Message is copy of existing GUID */
+	message_guid_copy(&message_index[msg].guid, &copymsg[msg].guid);
     }
 
     if (body) free(body);
@@ -1091,7 +1088,9 @@
     /* what's the first uid in our new list? */
     start = atoi(msgrange);
 
-    r = seen_open(mailbox, userid, SEEN_CREATE, &seendb);
+    r = seen_open(mailbox,
+		  (mailbox->options & OPT_IMAP_SHAREDSEEN) ? "anyone" : userid,
+		  SEEN_CREATE, &seendb);
     if (r) return r;
     
     r = seen_lockread(seendb, &last_read, &last_uid, &last_change, &seenuids);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/append.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/append.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/append.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/append.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* append.h -- Description of messages to be copied 
- * $Id: append.h,v 1.28 2006/11/30 17:11:17 murch Exp $ 
  *
- * Copyright (c) 1998, 2000 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: append.h,v 1.30 2008/03/24 17:09:16 murch Exp $
  */
 
 #ifndef INCLUDED_APPEND_H
@@ -60,7 +60,7 @@
     const char *cache_begin;
     int cache_len;		/* 0 if need to copy & parse message */
     int seen;
-    struct message_uuid uuid;
+    struct message_guid guid;
     bit32 system_flags;
     char *flag[MAX_USER_FLAGS+1];
 };

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/arbitron.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/arbitron.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/arbitron.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/arbitron.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* arbitron.c -- program to report readership statistics
  *
- * Copyright (c) 1998, 2000 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: arbitron.c,v 1.46 2008/03/24 17:09:16 murch Exp $
  */
-
-/* $Id: arbitron.c,v 1.42 2007/02/05 18:49:55 jeaton Exp $ */
 
 #include <config.h>
 
@@ -67,6 +68,7 @@
 #include "mboxlist.h"
 #include "convert_code.h"
 #include "seen.h"
+#include "util.h"
 #include "xmalloc.h"
 #include "xstrlcpy.h"
 #include "xstrlcat.h"
@@ -125,7 +127,9 @@
 
     strcpy(pattern, "*");
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     report_end_time = now;
 
@@ -417,14 +421,14 @@
     int r;    
     struct db *tmp = NULL;
 
-    r = DB->open(path, 0, &tmp);
+    r = (DB->open)(path, 0, &tmp);
     if(r) goto done;
     
     DB->foreach(tmp, "", 0, process_user_p, process_user_cb,
 		(void *) user, NULL);
 
  done:
-    if(tmp) DB->close(tmp);
+    if(tmp) (DB->close)(tmp);
 }
 
 static int process_subs_cb(void *rockp __attribute__((unused)),
@@ -473,14 +477,14 @@
     int r;    
     struct db *tmp = NULL;
 
-    r = SUBDB->open(path, 0, &tmp);
+    r = (SUBDB->open)(path, 0, &tmp);
     if(r) goto done;
     
     SUBDB->foreach(tmp, "", 0, process_subs_p, process_subs_cb,
 		   (void *) user, NULL);
 
  done:
-    if(tmp) SUBDB->close(tmp);
+    if(tmp) (SUBDB->close)(tmp);
 }
 
 void report_users(struct user_list *u)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/backend.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/backend.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/backend.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/backend.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* backend.c -- IMAP server proxy for Cyrus Murder
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: backend.c,v 1.57 2008/10/08 13:12:41 wescraig Exp $
  */
-
-/* $Id: backend.c,v 1.44 2007/02/05 18:41:46 jeaton Exp $ */
 
 #include <config.h>
 
@@ -59,13 +60,13 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <assert.h>
 #include <ctype.h>
 #include <errno.h>
 
 #include <sasl/sasl.h>
 #include <sasl/saslutil.h>
 
+#include "assert.h"
 #include "prot.h"
 #include "backend.h"
 #include "global.h"
@@ -75,26 +76,35 @@
 #include "iptostring.h"
 #include "util.h"
 
+enum {
+    AUTO_BANNER = -1,
+    AUTO_NO = 0,
+    AUTO_YES = 1
+};
+
 static char *ask_capability(struct protstream *pout, struct protstream *pin,
 			    struct protocol_t *prot, unsigned long *capa,
-			    int banner)
+			    int automatic)
 {
     char str[4096];
     char *ret = NULL, *tmp;
     struct capa_t *c;
+    const char *resp;
 
     *capa = 0;
     
-    if (!banner && prot->capa_cmd.cmd) {
+    resp = (automatic == AUTO_BANNER) ? prot->banner.resp : prot->capa_cmd.resp;
+
+    if (!automatic && prot->capa_cmd.cmd) {
 	/* request capabilities of server */
-	prot_printf(pout, "%s\r\n", prot->capa_cmd.cmd);
+	prot_printf(pout, "%s", prot->capa_cmd.cmd);
+	if (prot->capa_cmd.arg) prot_printf(pout, " %s", prot->capa_cmd.arg);
+	prot_printf(pout, "\r\n");
 	prot_flush(pout);
     }
 
     do {
-	if (prot_fgets(str, sizeof(str), pin) == NULL) {
-	    return NULL;
-	}
+	if (prot_fgets(str, sizeof(str), pin) == NULL) break;
 
 	/* look for capabilities in the string */
 	for (c = prot->capa_cmd.capa; c->str; c++) {
@@ -109,9 +119,15 @@
 		}
 	    }
 	}
+	if (!resp) {
+	    /* multiline response with no distinct end (IMAP banner) */
+	    prot_NONBLOCK(pin);
+	}
+
 	/* look for the end of the capabilities */
-    } while (strncasecmp(str, prot->capa_cmd.resp, strlen(prot->capa_cmd.resp)));
-    
+    } while (!resp || strncasecmp(str, resp, strlen(resp)));
+    
+    prot_BLOCK(pin);
     return ret;
 }
 
@@ -148,6 +164,7 @@
     if (r != SASL_OK) return -1;
 
     r = sasl_setprop(s->saslconn, SASL_AUTH_EXTERNAL, auth_id);
+    if (auth_id) free(auth_id);
     if (r != SASL_OK) return -1;
 
     prot_settls(s->in,  s->tlsconn);
@@ -162,7 +179,8 @@
 				sasl_callback_t *cb, const char **status)
 {
     int r;
-    sasl_security_properties_t *secprops = NULL;
+    sasl_security_properties_t secprops =
+	{ 0, 0xFF, PROT_BUFSIZE, 0, NULL, NULL }; /* default secprops */
     struct sockaddr_storage saddr_l, saddr_r;
     char remoteip[60], localip[60];
     socklen_t addrsize;
@@ -206,8 +224,7 @@
 	return r;
     }
 
-    secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
-    r = sasl_setprop(s->saslconn, SASL_SEC_PROPS, secprops);
+    r = sasl_setprop(s->saslconn, SASL_SEC_PROPS, &secprops);
     if (r != SASL_OK) {
 	return r;
     }
@@ -245,21 +262,31 @@
 	/* If we don't have a usable mech, do TLS and try again */
     } while (r == SASL_NOMECH && CAPA(s, CAPA_STARTTLS) &&
 	     do_starttls(s, &prot->tls_cmd) != -1 &&
-	     (*mechlist = ask_capability(s->out, s->in, prot, &s->capability, 0)));
+	     (*mechlist = ask_capability(s->out, s->in, prot,
+					 &s->capability,
+					 prot->tls_cmd.auto_capa)));
 
     /* xxx unclear that this is correct */
     if (local_cb) free_callbacks(cb);
 
     if (r == SASL_OK) {
+	const void *ssf;
+
 	prot_setsasl(s->in, s->saslconn);
 	prot_setsasl(s->out, s->saslconn);
+
+	sasl_getprop(s->saslconn, SASL_SSF, &ssf);
+	if (*((sasl_ssf_t *) ssf) && prot->sasl_cmd.auto_capa) {
+	    free(*mechlist);
+	    *mechlist = ask_capability(s->out, s->in, prot, &s->capability, 1);
+	}
     }
 
     /* r == SASL_OK on success */
     return r;
 }
 
-static int timedout = 0;
+static volatile sig_atomic_t timedout = 0;
 
 static void timed_out(int sig) 
 {
@@ -278,6 +305,7 @@
     int sock = -1;
     int r;
     int err = -1;
+    int ask = 1; /* should we explicitly ask for capabilities? */
     struct addrinfo hints, *res0 = NULL, *res;
     struct sockaddr_un sunsock;
     char buf[2048], *mechlist = NULL;
@@ -285,8 +313,7 @@
     struct backend *ret;
 
     if (!ret_backend) {
-	ret = xmalloc(sizeof(struct backend));
-	memset(ret, 0, sizeof(struct backend));
+	ret = xzmalloc(sizeof(struct backend));
 	strlcpy(ret->hostname, server, sizeof(ret->hostname));
 	ret->timeout = NULL;
     }
@@ -370,7 +397,16 @@
     prot_setflushonread(ret->in, ret->out);
     ret->prot = prot;
     
-    if (!prot->banner.is_capa) {
+    if (prot->banner.is_capa) {
+	/* try to get the capabilities from the banner */
+	mechlist = ask_capability(ret->out, ret->in, prot,
+				  &ret->capability, AUTO_BANNER);
+	if (mechlist || ret->capability) {
+	    /* found capabilities in banner -> don't ask */
+	    ask = 0;
+	}
+    }
+    else {
 	do { /* read the initial greeting */
 	    if (!prot_fgets(buf, sizeof(buf), ret->in)) {
 		syslog(LOG_ERR,
@@ -384,13 +420,17 @@
 			     strlen(prot->banner.resp)));
     }
 
+    if (ask) {
     /* get the capabilities */
-    mechlist = ask_capability(ret->out, ret->in, prot, &ret->capability,
-			      prot->banner.is_capa);
+	mechlist = ask_capability(ret->out, ret->in, prot,
+				  &ret->capability, AUTO_NO);
+    }
 
     /* now need to authenticate to backend server,
-       unless we're doing LMTP on a UNIX socket (deliver) */
-    if ((server[0] != '/') || strcmp(prot->sasl_service, "lmtp")) {
+       unless we're doing LMTP/CSYNC on a UNIX socket (deliver/sync_client) */
+    if ((server[0] != '/') ||
+	(strcmp(prot->sasl_service, "lmtp") &&
+	 strcmp(prot->sasl_service, "csync"))) {
 	if ((r = backend_authenticate(ret, prot, &mechlist, userid,
 				      cb, auth_status))) {
 	    syslog(LOG_ERR, "couldn't authenticate to backend server: %s",
@@ -488,4 +528,7 @@
 	sasl_dispose(&(s->saslconn));
 	s->saslconn = NULL;
     }
-}
+
+    /* free last_result buffer */
+    freebuf(&s->last_result);
+}

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/backend.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/backend.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/backend.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/backend.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* backend.h -- IMAP server proxy for Cyrus Murder
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: backend.h,v 1.14 2008/03/24 17:09:16 murch Exp $
  */
-
-/* $Id: backend.h,v 1.13 2006/11/30 17:11:17 murch Exp $ */
 
 #ifndef _INCLUDED_BACKEND_H
 #define _INCLUDED_BACKEND_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/chk_cyrus.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/chk_cyrus.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/chk_cyrus.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/chk_cyrus.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* chk_cyrus.c: cyrus mailstore consistancy checker
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,8 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * 
- * $Id: chk_cyrus.c,v 1.18 2007/02/05 18:41:46 jeaton Exp $
+ * $Id: chk_cyrus.c,v 1.19 2008/03/24 17:09:16 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cli_fatal.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cli_fatal.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cli_fatal.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cli_fatal.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* cli_fatal.c -- Provide a generic fatal() for the command line utilities
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: cli_fatal.c,v 1.4 2006/11/30 17:11:17 murch Exp $
+ * $Id: cli_fatal.c,v 1.5 2008/03/24 17:09:16 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/convert_code.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/convert_code.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/convert_code.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/convert_code.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /* convert_code.c: Convert IMAP_* error to exitcodes.h exit status
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,8 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
- * $Id: convert_code.c,v 1.7 2003/02/13 20:15:23 rjs3 Exp $ */
+ * $Id: convert_code.c,v 1.8 2008/03/24 17:09:16 murch Exp $
+ */
 
 /* Same old convert_code function moved into one place instead of being
  * redundant in every file.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/convert_code.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/convert_code.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/convert_code.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/convert_code.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* convert_code.h
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
-
+ * $Id: convert_code.h,v 1.7 2008/03/24 17:09:16 murch Exp $
  */
-
-/* $Id: convert_code.h,v 1.6 2003/10/22 18:50:07 rjs3 Exp $ */
 
 #ifndef CONVERT_CODE_H
 #define CONVERT_CODE_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_cyrusdb.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_cyrusdb.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_cyrusdb.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_cyrusdb.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* ctl_cyrusdb.c -- Program to perform operations common to all cyrus DBs
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ctl_cyrusdb.c,v 1.28 2006/11/30 17:11:17 murch Exp $
+ * $Id: ctl_cyrusdb.c,v 1.32 2008/03/24 17:09:16 murch Exp $
  */
 
 #include <config.h>
@@ -80,6 +81,7 @@
 #include "libcyr_cfg.h"
 #include "mboxlist.h"
 #include "seen.h"
+#include "statuscache.h"
 #include "tls.h"
 #include "util.h"
 #include "xmalloc.h"
@@ -100,6 +102,7 @@
     { FNAME_DELIVERDB,		&config_duplicate_db,	0 },
     { FNAME_TLSSESSIONS,	&config_tlscache_db,	0 },
     { FNAME_PTSDB,              &config_ptscache_db,    0 },
+    { FNAME_STATUSCACHEDB,	&config_statuscache_db,	0 },
     { NULL,			NULL,			0 }
 };
 
@@ -160,9 +163,16 @@
     annotatemore_init(0, NULL, NULL);
     annotatemore_open(NULL);
 
+    /* Need quotadb for deleting mailboxes with quotas */
+    quotadb_init(0);
+    quotadb_open(NULL);
+
     /* build a list of mailboxes - we're using internal names here */
     mboxlist_findall(NULL, pattern, 1, NULL,
 		     NULL, fixmbox, NULL);
+
+    quotadb_close();
+    quotadb_done();
 
     annotatemore_close();
     annotatemore_done();
@@ -184,7 +194,9 @@
     char *msg = "";
     int i, j, rotated = 0;
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
     r = r2 = 0;
 
     while ((opt = getopt(argc, argv, "C:rxc")) != EOF) {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_deliver.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_deliver.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_deliver.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_deliver.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* ctl_deliver.c -- Program to perform operations on duplicate delivery db
- * $Id: ctl_deliver.c,v 1.21 2006/11/30 17:11:17 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: ctl_deliver.c,v 1.24 2008/03/24 17:09:16 murch Exp $
  */
 
 #include <config.h>
@@ -83,7 +85,9 @@
     int flag = 0;
     enum { DUMP, PRUNE, NONE } op = NONE;
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     while ((opt = getopt(argc, argv, "C:drE:f:")) != EOF) {
 	switch (opt) {
@@ -122,7 +126,7 @@
 		"using cyr_expire -E instead\n");
 
 	r = snprintf(buf, sizeof(buf), "%s/cyr_expire", SERVICE_PATH);
-	if(r < 0 || r >= sizeof(buf)) {
+	if(r < 0 || r >= (int) sizeof(buf)) {
 	    fatal("cyr_expire command buffer not sufficiently big", EC_CONFIG);
 	}
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_mboxlist.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_mboxlist.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_mboxlist.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ctl_mboxlist.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* ctl_mboxlist.c -- do DB related operations on mboxlist
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,13 +39,30 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: ctl_mboxlist.c,v 1.63 2008/09/24 11:45:50 murch Exp $
  */
 
-/* $Id: ctl_mboxlist.c,v 1.53 2007/02/05 18:41:46 jeaton Exp $ */
-
 /* currently doesn't catch signals; probably SHOULD */
 
 #include <config.h>
+
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif
+
 #include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -62,6 +80,7 @@
 #include "libcyr_cfg.h"
 #include "mboxlist.h"
 #include "mupdate.h"
+#include "util.h"
 #include "xmalloc.h"
 #include "xstrlcpy.h"
 #include "xstrlcat.h"
@@ -81,6 +100,7 @@
 	      RECOVER,
 	      CHECKPOINT,
 	      UNDUMP,
+	      VERIFY,
 	      NONE };
 
 struct dumprock {
@@ -110,6 +130,7 @@
  * mupdate */
 static int local_authoritative = 0;
 static int warn_only = 0;
+static int interactive = 0;
 
 /* For each mailbox that this guy gets called for, check that
  * it is a mailbox that:
@@ -191,7 +212,7 @@
     switch (d->op) {
     case DUMP:
 	if(!d->partition || !strcmp(d->partition, part)) {
-	    printf("%s\t%d %s\t%s\n", name, mbtype, part, acl);
+	    printf("%s\t%d %s %s\n", name, mbtype, part, acl);
 	    if(d->purge) {
 		config_mboxlist_db->delete(mbdb, key, keylen, &(d->tid), 0);
 	    }
@@ -267,6 +288,17 @@
 		/* since it lives on another server, schedule it for a wipe */
 		struct mb_node *next;
 		
+		/*
+		 * Verify that what we found points at another host,
+		 * not back to this host.  Good idea, since if our assumption
+		 * if wrong, we'll end up removing the authoritative
+		 * mailbox.
+		 */
+		assert(strcmp(realpart, unused_mbdata->server));
+		
+		if (config_mupdate_config != 
+		    IMAP_ENUM_MUPDATE_CONFIG_UNIFIED) {
+		    /* But not for a unified configuration */
 		if(warn_only) {
 		    printf("Remove Local Mailbox: %s\n", name);
 		} else {
@@ -274,6 +306,7 @@
 		    strlcpy(next->mailbox, name, sizeof(next->mailbox));
 		    next->next = wipe_head;
 		    wipe_head = next;
+		}
 		}
 		
 		skip_flag = 1;		
@@ -340,6 +373,29 @@
     return 0;
 }
 
+/*
+ * True iff user types Y\n or y\n.  Anthing else is false.
+ */
+static int yes(void)
+{
+    int c, answer = 0;
+
+    c = getchar();
+    if (c == 'Y' || c == 'y') {
+	answer = 1;
+	
+	while ((c = getchar()) != EOF) {
+	    if (c == '\n') {
+		break;
+	    } else {
+		answer = 0;
+	    }
+	}
+    }
+
+    return(answer);
+}
+
 /* Resyncing with mupdate:
  *
  * If it is local and not present on mupdate at all, push to mupdate.
@@ -456,6 +512,21 @@
 	}
 
 	/* Delete local mailboxes where needed (wipe_head) */
+	if (interactive) {
+	    int count = 0;
+	    struct mb_node *me;
+
+	    for (me = wipe_head; me != NULL; me = me->next) count++;
+
+	    if ( count > 0 ) {
+		fprintf(stderr, "OK to delete %d local mailboxes? ", count);
+		if (!yes()) {
+		    fprintf(stderr, "Cancelled!\n");
+		    exit(1);
+		}
+	    }
+	}
+
 	while(wipe_head) {
 	    struct mb_node *me = wipe_head;
 	    
@@ -514,7 +585,7 @@
 	    if (*p == ' ') p++;
 	}
 	partition = p;
-	for (; *p && *p != '\t'; p++) ;
+	for (; *p && (*p != ' ') && (*p != '\t'); p++) ;
 	if (!*p) {
 	    fprintf(stderr, "line %d: no acl found\n", line);
 	    continue;
@@ -585,6 +656,265 @@
     
 
     return;
+}
+
+enum {
+    ROOT =	(1<<0), 
+    DOMAIN =	(1<<1),
+    MBOX =	(1<<2)
+};
+
+struct found_data {
+    int type;
+    char mboxname[MAX_MAILBOX_NAME+1];
+    char partition[MAX_MAILBOX_NAME+1];
+    char path[MAX_MAILBOX_PATH+1];
+};
+
+struct found_list {
+    int idx;
+    int size;
+    int alloc;
+    struct found_data *data;
+};
+
+void add_path(struct found_list *found, int type,
+	      const char *name, const char *part, const char *path)
+{
+    struct found_data *new;
+
+    if (found->size == found->alloc) {
+	/* reached the end of our allocated array, double it */
+	found->alloc *= 2;
+	found->data = xrealloc(found->data,
+			       found->alloc * sizeof(struct found_data));
+    }
+
+    /* add our new node to the end of the array */
+    new = &found->data[found->size++];
+    new->type = type;
+    strcpy(new->mboxname, name);
+    strcpy(new->partition, part);
+    strcpy(new->path, path);
+}
+
+void add_part(struct found_list *found,
+	      const char *part, const char *path, int override)
+{
+    int i;
+
+    /* see if we already added a partition having this name */
+    for (i = 0; i < found->size; i++){
+	if (!strcmp(found->data[i].partition, part)) {
+	    /* found it */
+	    if (override) {
+		/* replace the path with the one containing cyrus.header */
+		strcpy(found->data[i].path, path);
+	    }
+
+	    /* we already have the proper path, so we're done */
+	    return;
+	}
+    }
+
+    /* add the new partition path */
+    add_path(found, ROOT, "", part, path);
+}
+
+void get_partitions(const char *key, const char *value, void *rock)
+{
+    static int check_meta = -1;
+    struct found_list *found = (struct found_list *) rock;
+
+    if (check_meta == -1) {
+	/* see if cyrus.header might be contained in a metapartition */
+	check_meta = (config_metapartition_files &
+		      IMAP_ENUM_METAPARTITION_FILES_HEADER);
+    }
+
+    if (!strncmp(key, "partition-", 10)) {
+	add_part(found, key+10, value, 0);
+    }
+    else if (check_meta && !strncmp(key, "metapartition-", 14)) {
+	add_part(found, key+14, value, 1);
+    }
+    /* skip any other overflow strings */
+}
+
+int compar_mbox(const void *v1, const void *v2)
+{
+    struct found_data *d1 = (struct found_data *) v1;
+    struct found_data *d2 = (struct found_data *) v2;
+
+    /* non-mailboxes get pushed to the end of the array,
+       otherwise we do an ASCII sort */
+    if (d1->type & MBOX) {
+	if (d2->type & MBOX) return strcmp(d1->mboxname, d2->mboxname);
+	else return -1;
+    }
+    else if (d2->type & MBOX) return 1;
+    else return 0;
+}
+
+static int verify_cb(void *rockp,
+		     const char *key, int keylen,
+		     const char *data, int datalen __attribute__((unused)))
+{
+    struct found_list *found = (struct found_list *) rockp;
+    int r;
+    char *p;
+    char *name, *part, *acl;
+    int mbtype;
+
+    /* \0 terminate 'name' */
+    name = xstrndup(key, keylen);
+
+    /* Get mailbox type */
+    mbtype = strtol(data, &p, 10);
+
+    p = strchr(data, ' ');
+    if (p == NULL) {
+	abort();
+    }
+    p++;
+    acl = strchr(p, ' ');
+    if (acl == NULL) {
+	abort();
+    }
+    /* grab 'part', \0 terminate */
+    part = xstrndup(p, acl - p);
+
+    do {
+	r = -1;
+	if ((found->idx >= found->size) ||		/* end of array */
+	    !(found->data[found->idx].type & MBOX) ||	/* end of mailboxes */
+	    (r = strcmp(name, found->data[found->idx].mboxname)) < 0) {
+	    printf("'%s' has a DB entry but no directory on partition '%s'\n",
+		   name, part);
+	}
+	else if (r > 0) {
+	    printf("'%s' has a directory '%s' but no DB entry\n",
+		   found->data[found->idx].mboxname,
+		   found->data[found->idx].path);
+	    found->idx++;
+	}
+	else found->idx++;
+    } while (r > 0);
+
+    free(name);
+    free(part);
+
+    return 0;
+}
+
+void do_verify(void)
+{
+    struct found_list found;
+    int i;
+
+    found.idx = 0;
+    found.size = 0;
+    found.alloc = 10;
+    found.data = xmalloc(found.alloc * sizeof(struct found_data));
+
+    /* gather a list of partition paths to search */
+    config_foreachoverflowstring(get_partitions, &found);
+
+    /* scan all paths in our list, tagging valid mailboxes,
+       and adding paths as we find them */
+    for (i = 0; i < found.size; i++) {
+	DIR *dirp;
+	struct dirent *dirent;
+	char name[MAX_MAILBOX_NAME+1];
+	char part[MAX_MAILBOX_NAME+1]; 
+	char path[MAX_MAILBOX_PATH+1];
+	int type;
+
+	if (config_hashimapspool && (found.data[i].type & ROOT)) {
+	    /* need to add hashed directories */
+	    int config_fulldirhash = libcyrus_config_getswitch(CYRUSOPT_FULLDIRHASH);
+	    char *tail;
+	    int j, c;
+
+	    /* make the toplevel partition /a */
+	    if (config_fulldirhash) {
+		strcat(found.data[i].path, "/A");
+		c = 'B';
+	    } else {
+		strcat(found.data[i].path, "/a");
+		c = 'b';
+	    }
+	    type = (found.data[i].type &= ~ROOT);
+
+	    /* make a template path for /b - /z */
+	    strcpy(name, found.data[i].mboxname);
+	    strcpy(part, found.data[i].partition);
+	    strcpy(path, found.data[i].path);
+	    tail = path + strlen(path) - 1;
+
+	    for (j = 1; j < 26; j++, c++) {
+		*tail = c;
+		add_path(&found, type, name, part, path);
+	    }
+
+	    if (config_virtdomains && !type) {
+		/* need to add root domain directory */
+		strcpy(tail, "domain");
+		add_path(&found, DOMAIN | ROOT, name, part, path);
+	    }
+	}
+
+	if (!(dirp = opendir(found.data[i].path))) continue;
+	while ((dirent = readdir(dirp))) {
+	    struct mailbox mailbox;
+
+	    if (dirent->d_name[0] == '.') continue;
+	    else if (!strcmp(dirent->d_name, FNAME_HEADER+1) &&
+		     !mailbox_open_header_path(found.data[i].mboxname,
+					       found.data[i].path,
+					       found.data[i].path,
+					       "", NULL, &mailbox, 1)) {
+		mailbox_close(&mailbox);
+		found.data[i].type |= MBOX;
+	    }
+	    else if (!strchr(dirent->d_name, '.') ||
+		     (found.data[i].type & DOMAIN)) {
+		/* probably a directory, add it to the array */
+		type = 0;
+		strcpy(name, found.data[i].mboxname);
+
+		if (config_virtdomains &&
+		    (found.data[i].type == ROOT) &&
+		    !strcmp(dirent->d_name, "domain")) {
+		    /* root domain directory */
+		    type = DOMAIN | ROOT;
+		}
+		else if (!name[0] && found.data[i].type & DOMAIN) {
+		    /* toplevel domain directory */
+		    strcat(name, dirent->d_name);
+		    strcat(name, "!");
+		    type = DOMAIN | ROOT;
+		}
+		else {
+		    /* possibly a mailbox directory */
+		    if (name[0] && !(found.data[i].type & DOMAIN)) strcat(name, ".");
+		    strcat(name, dirent->d_name);
+		}
+
+		strcpy(part, found.data[i].partition);
+		strcpy(path, found.data[i].path);
+		strcat(path, "/");
+		strcat(path, dirent->d_name);
+		add_path(&found, type, name, part, path);
+	    }
+	}
+
+	closedir(dirp);
+    }
+
+    qsort(found.data, found.size, sizeof(struct found_data), compar_mbox);
+
+    config_mboxlist_db->foreach(mbdb, "", 0, NULL, &verify_cb, &found, NULL);
 }
 
 void usage(void)
@@ -597,6 +927,8 @@
 	    "    [< mboxlist.dump]\n");
     fprintf(stderr, "MUPDATE populate:\n");
     fprintf(stderr, "  ctl_mboxlist [-C <alt_config>] -m [-a] [-w] [-f filename]\n");
+    fprintf(stderr, "VERIFY:\n");
+    fprintf(stderr, "  ctl_mboxlist [-C <alt_config>] -v [-f filename]\n");
     exit(1);
 }
 
@@ -609,9 +941,11 @@
     enum mboxop op = NONE;
     char *alt_config = NULL;
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
-
-    while ((opt = getopt(argc, argv, "C:awmdurcxf:p:")) != EOF) {
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
+
+    while ((opt = getopt(argc, argv, "C:awmdurcxf:p:vi")) != EOF) {
 	switch (opt) {
 	case 'C': /* alt config file */
 	    alt_config = optarg;
@@ -676,6 +1010,15 @@
 	    warn_only = 1;
 	    break;
 
+	case 'v':
+	    if (op == NONE) op = VERIFY;
+	    else usage();
+	    break;
+
+	case 'i':
+	    interactive = 1;
+	    break;
+
 	default:
 	    usage();
 	    break;
@@ -739,6 +1082,16 @@
 	mboxlist_done();
 	break;
 
+    case VERIFY:
+	mboxlist_init(0);
+	mboxlist_open(mboxdb_fname);
+
+	do_verify();
+
+	mboxlist_close();
+	mboxlist_done();
+	break;
+
     default:
 	usage();
 	cyrus_done();

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cvt_cyrusdb.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cvt_cyrusdb.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cvt_cyrusdb.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cvt_cyrusdb.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
-/* dbcvt.c -- Convert between two database formats
+/* cvt_cyrusdb.c -- Convert between two database formats
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: cvt_cyrusdb.c,v 1.16 2006/11/30 17:11:17 murch Exp $
+ * $Id: cvt_cyrusdb.c,v 1.18 2008/03/24 17:09:16 murch Exp $
  */
 
 #include <config.h>
@@ -157,10 +156,10 @@
     printf("Converting from %s (%s) to %s (%s)\n", old_db, DB_OLD->name,
 	   new_db, DB_NEW->name);
 
-    r = DB_OLD->open(old_db, 0, &odb);
+    r = (DB_OLD->open)(old_db, 0, &odb);
     if(r != CYRUSDB_OK)
 	fatal("can't open old database", EC_TEMPFAIL);
-    r = DB_NEW->open(new_db, CYRUSDB_CREATE, &ndb);
+    r = (DB_NEW->open)(new_db, CYRUSDB_CREATE, &ndb);
     if(r != CYRUSDB_OK)
 	fatal("can't open new database", EC_TEMPFAIL);
 
@@ -173,8 +172,8 @@
 	fprintf(stderr, "Warning: apparently empty database converted.\n");
     
 
-    DB_OLD->close(odb);
-    DB_NEW->close(ndb);
+    (DB_OLD->close)(odb);
+    (DB_NEW->close)(ndb);
     
     cyrus_done();
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_dbtool.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_dbtool.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_dbtool.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_dbtool.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* cyr_dbtool.c -- manage Cyrus databases
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: cyr_dbtool.c,v 1.1 2007/01/09 17:41:35 murch Exp $
+ * $Id: cyr_dbtool.c,v 1.7 2008/10/14 14:53:40 murch Exp $
  */
 
 #include <config.h>
@@ -145,6 +144,7 @@
     int is_delete = 0;
     int use_stdin = 0;
     int db_flags = 0;
+    struct txn *tid = NULL;
 
     while ((opt = getopt(argc, argv, "C:n")) != EOF) {
 	switch (opt) {
@@ -158,15 +158,15 @@
     }
 	
     if((argc - optind) < 3) {
+	char sep;
+
 	fprintf(stderr, "Usage: %s [-C altconfig] <old db> <old db backend> <action> [<key>] [<value>]\n", argv[0]);
-	fprintf(stderr, "Usable Backends:  ");
-
-	if(!cyrusdb_backends || !cyrusdb_backends[0])
-	    fatal("we don't seem to have any db backends available", EC_OSERR);
+	fprintf(stderr, "Usable Backends");
 	
-	fprintf(stderr, "%s", cyrusdb_backends[0]->name);
-	for(i=1; cyrusdb_backends[i]; i++)
-	    fprintf(stderr, ", %s", cyrusdb_backends[i]->name);
+	for(i=0, sep = ':'; cyrusdb_backends[i]; i++) {
+	    fprintf(stderr, "%c %s", sep, cyrusdb_backends[i]->name);
+	    sep = ',';
+	}
 	
 	fprintf(stderr, "\n");
 	fprintf(stderr, "\n");
@@ -203,7 +203,7 @@
     cyrus_init(alt_config, "cyr_dbtool", 0);
 
 
-    r = DB_OLD->open(old_db, db_flags, &odb);
+    r = (DB_OLD->open)(old_db, db_flags, &odb);
     if(r != CYRUSDB_OK)
 	fatal("can't open database", EC_TEMPFAIL);
 
@@ -224,14 +224,13 @@
         }
         while ( loop ) {
           if (is_get) {
-            int i;
-            DB_OLD->fetch(odb, key, keylen, &res, &reslen, NULL);
+            DB_OLD->fetch(odb, key, keylen, &res, &reslen, &tid);
             fwrite(res, sizeof(char), reslen, stdout);
             printf("\n");
           } else if (is_set) {
-            DB_OLD->store(odb, key, keylen, value, vallen, NULL);
+            DB_OLD->store(odb, key, keylen, value, vallen, &tid);
           } else if (is_delete) {
-            DB_OLD->delete(odb, key, keylen, NULL, 1);
+            DB_OLD->delete(odb, key, keylen, &tid, 1);
           }
           loop = 0;
           if ( use_stdin ) {
@@ -240,17 +239,25 @@
         }
     } else if (!strcmp(action, "show")) {
         if ((argc - optind) < 4) {
-            DB_OLD->foreach(odb, "", 0, NULL, printer_cb, NULL, NULL);
+            DB_OLD->foreach(odb, "", 0, NULL, printer_cb, NULL, &tid);
         } else {
             key = argv[optind+3];
             keylen = strlen(key);
-            DB_OLD->foreach(odb, key, keylen, NULL, printer_cb, NULL, NULL);
+            DB_OLD->foreach(odb, key, keylen, NULL, printer_cb, NULL, &tid);
+        }
+    } else if (!strcmp(action, "consistency")) {
+        if (DB_OLD->consistent(odb)) {
+            printf("Consistency Error for %s\n", old_db);
         }
     } else {
         printf("Unknown action %s\n", action);
     }
-
-    DB_OLD->close(odb);
+    if (tid) {
+      DB_OLD->commit(odb, tid);
+      tid = NULL;
+    }
+
+    (DB_OLD->close)(odb);
     
     cyrus_done();
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_expire.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_expire.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_expire.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_expire.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* cyr_expire.c -- Program to expire deliver.db entries and messages
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: cyr_expire.c,v 1.10 2007/02/05 18:41:46 jeaton Exp $
+ * $Id: cyr_expire.c,v 1.20 2008/10/06 15:24:03 murch Exp $
  */
 
 #include <config.h>
@@ -56,6 +57,8 @@
 #include <errno.h>
 #include <signal.h>
 
+#include <sasl/sasl.h>
+
 #include "annotate.h"
 #include "cyrusdb.h"
 #include "duplicate.h"
@@ -75,7 +78,7 @@
 void usage(void)
 {
     fprintf(stderr,
-	    "cyr_expire [-C <altconfig>] -E <days> [-X <expunge-days>] [-v]\n");
+	    "cyr_expire [-C <altconfig>] -E <days> [-X <expunge-days>] [-p prefix] [-a] [-v]\n");
     exit(-1);
 }
 
@@ -88,13 +91,28 @@
     unsigned long messages;
     unsigned long deleted;
     int verbose;
+    int skip_annotate;
+};
+
+struct delete_node {
+    struct delete_node *next;
+    char *name;
+};
+
+struct delete_rock {
+    char prefix[100];
+    int prefixlen;
+    time_t delete_mark;
+    struct delete_node *head;
+    struct delete_node *tail;
+    int verbose;
 };
 
 /*
  * mailbox_expunge() callback to expunge expired articles.
  */
-static int expire_cb(struct mailbox *mailbox __attribute__((unused)),
-		      void *rock, char *index, int expunge_flags)
+static unsigned expire_cb(struct mailbox *mailbox __attribute__((unused)),
+			  void *rock, unsigned char *index, int expunge_flags)
 {
     struct expire_rock *erock = (struct expire_rock *) rock;
     bit32 tstamp;
@@ -104,14 +122,14 @@
     /* if we're cleaning up expunge, delete by expunge time */
     if (expunge_flags & EXPUNGE_CLEANUP) {
 	tstamp = ntohl(*((bit32 *)(index+OFFSET_LAST_UPDATED)));
-	if (tstamp < erock->expunge_mark) {
+	if ((time_t) tstamp < erock->expunge_mark) {
 	    erock->deleted++;
 	    return 1;
 	}
     } else {
 	/* otherwise, we're expiring messages by sent date */
 	tstamp = ntohl(*((bit32 *)(index+OFFSET_SENTDATE)));
-	if (tstamp < erock->expire_mark) {
+	if ((time_t) tstamp < erock->expire_mark) {
 	    erock->deleted++;
 	    return 1;
 	}
@@ -158,6 +176,11 @@
      * since mailboxes inherit /vendor/cmu/cyrus-imapd/expire,
      * we need to iterate all the way up to "" (server entry)
      */
+    if (erock->skip_annotate) {
+      /* we don't want to check for annotations, so we didn't find any */
+      attrib.value = 0;
+    }
+    else {
     while (1) {
 	r = annotatemore_lookup(buf, "/vendor/cmu/cyrus-imapd/expire", "",
 				&attrib);
@@ -178,6 +201,7 @@
 	    buf[0] = '\0';
 	else					/* domain entry */
 	    buf[domainlen] = '\0';
+    }
     }
 
     if (!r && (attrib.value ||
@@ -266,38 +290,116 @@
     return 0;
 }
 
+int delete(char *name,
+	   int matchlen __attribute__((unused)),
+	   int maycreate __attribute__((unused)),
+	   void *rock)
+{
+    struct delete_rock *drock = (struct delete_rock *) rock;
+    char *p;
+    int i, r, domainlen = 0;
+    struct delete_node *node;
+    int mbtype;
+    char *path, *mpath;
+    time_t timestamp;
+
+    if (config_virtdomains && (p = strchr(name, '!')))
+	domainlen = p - name + 1;
+
+    /* check if this is a mailbox we want to examine */
+    if (strncmp(name+domainlen, drock->prefix, drock->prefixlen))
+	return 0;
+
+    /* Skip remote mailboxes */
+    r = mboxlist_detail(name, &mbtype, &path, &mpath, NULL, NULL, NULL);
+    if (r) {
+	if (drock->verbose) {
+	    printf("error looking up %s: %s\n", name, error_message(r));
+	}
+	return 1;
+    }
+    if (mbtype & MBTYPE_REMOTE) return 0;
+
+    /* Sanity check for 8 hex digits only at the end */
+    p = strrchr(name, '.');
+    if (!p) return(0);
+    p++;
+
+    for (i = 0 ; i < 7; i++) {
+        if (!isxdigit(p[i])) return(0);
+    }
+    if (p[8] != '\0') return(0);
+
+    timestamp = strtoul(p, NULL, 16);
+    if ((timestamp == 0) || (timestamp > drock->delete_mark))
+        return(0);
+
+    /* Add this mailbox to list of mailboxes to delete */
+    node = xmalloc(sizeof(struct delete_node));
+    node->next = NULL;
+    node->name = xstrdup(name);
+
+    if (drock->tail) {
+	drock->tail->next = node;
+	drock->tail = node;
+    } else {
+	drock->head = drock->tail = node;
+    }
+    return(0);
+}
+
 int main(int argc, char *argv[])
 {
     extern char *optarg;
-    int opt, r = 0, expire_days = 0, expunge_days = 0;
+    int opt, r = 0, expire_days = 0, expunge_days = -1, delete_days = -1;
     char *alt_config = NULL;
+    char *find_prefix = NULL;
     char buf[100];
     struct hash_table expire_table;
     struct expire_rock erock;
-
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
-
-    /* zero the expire_rock */
+    struct delete_rock drock;
+    const char *deletedprefix;
+
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
+
+    /* zero the expire_rock & delete_rock */
     memset(&erock, 0, sizeof(erock));
-
-    while ((opt = getopt(argc, argv, "C:E:X:v")) != EOF) {
+    memset(&drock, 0, sizeof(drock));
+
+    while ((opt = getopt(argc, argv, "C:D:E:X:p:va")) != EOF) {
 	switch (opt) {
 	case 'C': /* alt config file */
 	    alt_config = optarg;
 	    break;
 
+	case 'D':
+	    if (delete_days >= 0) usage();
+	    delete_days = atoi(optarg);
+	    break;
+
 	case 'E':
 	    if (expire_days) usage();
 	    expire_days = atoi(optarg);
 	    break;
 
 	case 'X':
-	    if (expunge_days) usage();
+	    if (expunge_days >= 0) usage();
 	    expunge_days = atoi(optarg);
+	    break;
+
+	case 'p':
+	    find_prefix = optarg;
 	    break;
 
 	case 'v':
 	    erock.verbose++;
+	    drock.verbose++;
+	    break;
+
+	case 'a':
+	    erock.skip_annotate = 1;
 	    break;
 	
 	default:
@@ -309,6 +411,7 @@
     if (!expire_days) usage();
 
     cyrus_init(alt_config, "cyr_expire", 0);
+    global_sasl_init(1, 0, NULL);
 
     annotatemore_init(0, NULL, NULL);
     annotatemore_open(NULL);
@@ -335,23 +438,69 @@
      */
     erock.table = &expire_table;
     erock.expunge_mode = config_getenum(IMAPOPT_EXPUNGE_MODE);
+    if (expunge_days == -1) {
+	erock.expunge_mark = 0;
+    } else {
     erock.expunge_mark = time(0) - (expunge_days * 60 * 60 * 24);
 
     if (erock.verbose && 
 	erock.expunge_mode != IMAP_ENUM_EXPUNGE_MODE_IMMEDIATE) {
 	fprintf(stderr,
-		"expunging deleted messages in mailboxes older than %d days\n",
+		    "Expunging deleted messages in mailboxes older than %d days\n",
 		expunge_days);
     }
-
+    }
+
+    if (find_prefix) {
+	strlcpy(buf, find_prefix, sizeof(buf));
+    } else {
     strlcpy(buf, "*", sizeof(buf));
+    }
     mboxlist_findall(NULL, buf, 1, 0, 0, &expire, &erock);
 
-    syslog(LOG_NOTICE, "expunged %lu out of %lu messages from %lu mailboxes",
+    syslog(LOG_NOTICE, "Expunged %lu out of %lu messages from %lu mailboxes",
 	   erock.deleted, erock.messages, erock.mailboxes);
     if (erock.verbose) {
-	fprintf(stderr, "\nexpunged %lu out of %lu messages from %lu mailboxes\n",
+	fprintf(stderr, "\nExpunged %lu out of %lu messages from %lu mailboxes\n",
 		erock.deleted, erock.messages, erock.mailboxes);
+    }
+
+    if ((delete_days != -1) && mboxlist_delayed_delete_isenabled() &&
+        (deletedprefix = config_getstring(IMAPOPT_DELETEDPREFIX))) {
+        struct delete_node *node;
+        int count = 0;
+        
+        if (drock.verbose) {
+            fprintf(stderr,
+                    "Removing deleted mailboxes older than %d days\n",
+                    delete_days);
+        }
+
+        strlcpy(drock.prefix, deletedprefix, sizeof(drock.prefix));
+        strlcat(drock.prefix, ".", sizeof(drock.prefix));
+        drock.prefixlen = strlen(drock.prefix);
+        drock.delete_mark = time(0) - (delete_days * 60 * 60 * 24);
+        drock.head = NULL;
+        drock.tail = NULL;
+
+        mboxlist_findall(NULL, buf, 1, 0, 0, &delete, &drock);
+
+        for (node = drock.head ; node ; node = node->next) {
+            if (drock.verbose) {
+                fprintf(stderr, "Removing: %s\n", node->name);
+            }
+            r = mboxlist_deletemailbox(node->name, 1, NULL, NULL, 0, 0, 0);
+            count++;
+        }
+
+        if (drock.verbose) {
+            if (count != 1) {
+                fprintf(stderr, "Removed %d deleted mailboxes\n", count);
+            } else {
+                fprintf(stderr, "Removed 1 deleted mailbox\n");
+            }
+        }
+        syslog(LOG_NOTICE, "Removed %d deleted mailboxes", count);
     }
 
     /* purge deliver.db entries of expired messages */
@@ -366,6 +515,7 @@
     annotatemore_close();
     annotatemore_done();
     duplicate_done();
+    sasl_done();
     cyrus_done();
 
     exit(r);

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_synclog.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_synclog.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_synclog.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_synclog.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,161 @@
+/* cyr_synclog.c -- add a line to the sync log file for replication
+ *
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: cyr_synclog.c,v 1.2 2008/03/24 17:09:16 murch Exp $
+ *
+ * Originally written by Bron Gondwana <brong at fastmail.fm>
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "global.h"
+#include "sync_log.h"
+
+/* config.c stuff */
+const int config_need_data = 0;
+
+int main(int argc, char *argv[])
+{
+    char *alt_config = NULL;
+    char cmd = '\0';
+    char opt;
+
+    while ((opt = getopt(argc, argv, "C:uvmacqnsb")) != EOF) {
+	switch (opt) {
+	case 'C': /* alt config file */
+	    alt_config = optarg;
+	    break;
+	case 'u': /* User */
+	    cmd = 'u';
+	    break;
+	case 'v': /* sieVe */
+	    cmd = 'v';
+	    break;
+	case 'm': /* Mailbox */
+	    cmd = 'm';
+	    break;
+	case 'a': /* Append */
+	    cmd = 'a';
+	    break;
+	case 'c': /* aCl */
+	    cmd = 'c';
+	    break;
+	case 'q': /* Quota */
+	    cmd = 'q';
+	    break;
+	case 'n': /* aNnotation */
+	    cmd = 'n';
+	    break;
+	case 's': /* Seen */
+	    cmd = 's';
+	    break;
+	case 'b': /* suBscription */
+	    cmd = 'b';
+	    break;
+	}
+    }
+
+    if((argc - optind) < 1) {
+	fprintf(stderr, "Usage: %s [-C altconfig] [-{type}] value\n", argv[0]);
+	
+	fprintf(stderr, "\n");
+	fprintf(stderr, "\n");
+	fprintf(stderr, "types:\n");
+	fprintf(stderr, "  -u   USER\n");
+	fprintf(stderr, "  -v   SIEVE\n");
+	fprintf(stderr, "  -m   MAILBOX\n");
+	fprintf(stderr, "  -a   APPEND\n");
+	fprintf(stderr, "  -c   ACL\n");
+	fprintf(stderr, "  -q   QUOTA\n");
+	fprintf(stderr, "  -n   ANNOTATION\n");
+	fprintf(stderr, "  -s   SEEN\n");
+	fprintf(stderr, "  -b   SUBSCRIPTION\n");
+	fprintf(stderr, "\n");
+	fprintf(stderr,
+		"You may omit the type flag and just specify a complete log line\n");
+	exit(-1);
+    }
+
+    cyrus_init(alt_config, "cyr_synclog", 0);
+    sync_log_init();
+
+    switch(cmd) {
+	case 'u': /* User */
+	    sync_log_user(argv[optind]);
+	    break;
+	case 'v': /* sieVe */
+	    sync_log_sieve(argv[optind]);
+	    break;
+	case 'm': /* Mailbox */
+	    sync_log_mailbox(argv[optind]);
+	    break;
+	case 'a': /* Append */
+	    sync_log_append(argv[optind]);
+	    break;
+	case 'c': /* aCl */
+	    sync_log_acl(argv[optind]);
+	    break;
+	case 'q': /* Quota */
+	    sync_log_quota(argv[optind]);
+	    break;
+	case 'n': /* aNnotation */
+            sync_log_annotation(argv[optind]);
+	    break;
+	case 's': /* Seen */
+	    sync_log_seen(argv[optind], argv[optind+1]);
+	    break;
+	case 'b': /* suBscription */
+	    sync_log_subscribe(argv[optind], argv[optind+1], argv[optind+2]);
+	    break;
+        default:
+            /* just as is! */
+            sync_log(argv[optind]);
+            break;
+    }
+
+    return 0;
+}

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_virusscan.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_virusscan.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_virusscan.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyr_virusscan.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,549 @@
+/* cyr_virusscan.c - scan mailboxes for infected messages and remove them
+ *
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: cyr_virusscan.c,v 1.5 2008/09/23 16:17:09 murch Exp $
+ */
+
+#include <config.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+#include <stdio.h>
+#include <syslog.h>
+#include <string.h>
+#include <netinet/in.h>
+
+/* cyrus includes */
+#include "global.h"
+#include "sysexits.h"
+#include "exitcodes.h"
+#include "append.h"
+#include "imap_err.h"
+#include "index.h"
+#include "mailbox.h"
+#include "xmalloc.h"
+#include "mboxlist.h"
+#include "prot.h"
+#include "util.h"
+#include "sync_log.h"
+#include "rfc822date.h"
+
+/* config.c stuff */
+const int config_need_data = CONFIG_NEED_PARTITION_DATA;
+
+/* Stuff to make index.c link */
+int imapd_exists;
+struct protstream *imapd_out = NULL;
+struct auth_state *imapd_authstate = NULL;
+char *imapd_userid = NULL;
+int imapd_condstore_client = 0;
+void printastring(const char *s __attribute__((unused)))
+{
+    fatal("not implemented", EC_SOFTWARE);
+}
+/* end stuff to make index.c link */
+
+struct infected_msg {
+    char *mboxname;
+    char *virname;
+    char *msgid;
+    char *date;
+    char *from;
+    char *subj;
+    unsigned long uid;
+    struct infected_msg *next;
+};
+
+struct infected_mbox {
+    char *owner;
+    unsigned msgno; /* running count of which message we're scanning */
+    struct infected_msg *msgs;
+    struct infected_mbox *next;
+};
+
+/* globals for getopt routines */
+extern char *optarg;
+extern int  optind;
+extern int  opterr;
+extern int  optopt;
+
+/* globals for callback functions */
+int disinfect = 0;
+int notify = 0;
+struct infected_mbox *public = NULL;
+struct infected_mbox *user = NULL;
+
+/* current namespace */
+static struct namespace scan_namespace;
+
+int verbose = 1;
+
+/* abstract definition of a virus scan engine */
+struct scan_engine {
+    const char *name;
+    void *state;
+    void *(*init)(void);  /* initialize state */
+    int (*scanfile)(void *state,  /* scan fname & return non-zero if infected */
+		    const char *fname, const char **virname);
+    void (*destroy)(void *state);  /* destroy state */
+};
+
+
+#define HAVE_CLAMAV
+#ifdef HAVE_CLAMAV
+/* ClamAV implementation */
+#include <clamav.h>
+
+struct clamav_state {
+    struct cl_engine *av_engine;
+    struct cl_limits av_limits;
+};
+
+void *clamav_init()
+{
+    unsigned int sigs = 0;
+    int r;
+
+    struct clamav_state *st = xzmalloc(sizeof(struct clamav_state));
+
+    /* load all available databases from default directory */
+    if ((r = cl_load(cl_retdbdir(), &st->av_engine, &sigs, CL_DB_STDOPT))) {
+	syslog(LOG_ERR, "cl_load: %s", cl_strerror(r));
+	fatal(cl_strerror(r), EC_SOFTWARE);
+    }
+
+    if (verbose) printf("Loaded %d virus signatures.\n", sigs);
+
+    /* build av_engine */
+    if((r = cl_build(st->av_engine))) {
+	syslog(LOG_ERR,
+	       "Database initialization error: %s", cl_strerror(r));
+	cl_free(st->av_engine);
+	fatal(cl_strerror(r), EC_SOFTWARE);
+    }
+
+    /* set up archive av_limits */
+    st->av_limits.maxfiles = 10000; /* max files */
+    st->av_limits.maxscansize = 100 * 1048576; /* during the scanning of
+						* archives
+						* this size (100 MB) will never
+						* be exceeded
+						*/
+    st->av_limits.maxfilesize = 10 * 1048576; /* compressed files will only be
+					       * decompressed and scanned up to
+					       * this size (10 MB)
+					       */
+    st->av_limits.maxreclevel = 16; /* maximum recursion level for archives */
+
+    return (void *) st;
+}
+
+
+int clamav_scanfile(void *state, const char *fname,
+		    const char **virname)
+{
+    struct clamav_state *st = (struct clamav_state *) state;
+    int r;
+
+    /* scan file */
+    r = cl_scanfile(fname, virname, NULL, st->av_engine, &st->av_limits,
+		    CL_SCAN_STDOPT);
+
+    switch (r) {
+    case CL_CLEAN:
+	/* do nothing */
+	break;
+    case CL_VIRUS:
+	return 1;
+	break;
+
+    default:
+	printf("cl_scanfile error: %s\n", cl_strerror(r));
+	syslog(LOG_ERR, "cl_scanfile error: %s\n", cl_strerror(r));
+	break;
+    }
+
+    return 0;
+}
+
+void clamav_destroy(void *state)
+{
+    struct clamav_state *st = (struct clamav_state *) state;
+
+    if (st->av_engine) {
+	/* free memory */
+	cl_free(st->av_engine);
+    }
+    free(st);
+}
+
+struct scan_engine engine =
+{ "ClamAV", NULL, &clamav_init, &clamav_scanfile, &clamav_destroy };
+
+#elif defined(HAVE_SOME_UNKNOWN_VIRUS_SCANNER)
+/* XXX  Add other implementations here */
+
+#else
+/* NO configured virus scanner */
+struct scan_engine engine = { NULL, NULL, NULL, NULL, NULL };
+#endif
+
+
+/* forward declarations */
+int usage(char *name);
+int scan_me(char *, int, int, void *);
+unsigned virus_check(struct mailbox *, void *, unsigned char *, int);
+void append_notifications();
+
+
+int main (int argc, char *argv[]) {
+    int option;		/* getopt() returns an int */
+    char buf[MAX_MAILBOX_PATH+1];
+    char *alt_config = NULL;
+    int r;
+
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
+
+    while ((option = getopt(argc, argv, "C:rn")) != EOF) {
+	switch (option) {
+	case 'C': /* alt config file */
+	    alt_config = optarg;
+	    break;
+
+	case 'r':
+	    disinfect = 1;
+	    break;
+
+	case 'n':
+	    notify = 1;
+	    break;
+
+	case 'h':
+	default: usage(argv[0]);
+	}
+    }
+
+    cyrus_init(alt_config, "cyr_virusscan", 0);
+
+    if (!engine.name) {
+	fatal("no virus scanner configured", EC_SOFTWARE);
+    } else {
+	if (verbose) printf("Using %s virus scanner\n", engine.name);
+    }
+
+    engine.state = engine.init();
+
+    /* Set namespace -- force standard (internal) */
+    if ((r = mboxname_init_namespace(&scan_namespace, 1)) != 0) {
+	syslog(LOG_ERR, error_message(r));
+	fatal(error_message(r), EC_CONFIG);
+    }
+
+    mboxlist_init(0);
+    mboxlist_open(NULL);
+
+    /* open the quota db, we'll need it for expunge */
+    quotadb_init(0);
+    quotadb_open(NULL);
+
+    sync_log_init();
+
+    if (optind == argc) { /* do the whole partition */
+	strcpy(buf, "*");
+	(*scan_namespace.mboxlist_findall)(&scan_namespace, buf, 1, 0, 0,
+					   scan_me, NULL);
+    } else {
+	for (; optind < argc; optind++) {
+	    strncpy(buf, argv[optind], MAX_MAILBOX_NAME);
+	    /* Translate any separators in mailboxname */
+	    mboxname_hiersep_tointernal(&scan_namespace, buf,
+					config_virtdomains ?
+					strcspn(buf, "@") : 0);
+	    (*scan_namespace.mboxlist_findall)(&scan_namespace, buf, 1, 0, 0,
+					       scan_me, NULL);
+	}
+    }
+
+    if (notify) append_notifications();
+
+    quotadb_close();
+    quotadb_done();
+
+    mboxlist_close();
+    mboxlist_done();
+
+    engine.destroy(engine.state);
+
+    cyrus_done();
+
+    return 0;
+}
+
+int usage(char *name)
+{
+    printf("usage: %s [-C <alt_config>] [ -r [-n] ]\n"
+	   "\t[mboxpattern1 ... [mboxpatternN]]\n", name);
+    printf("\tif no mboxpattern is given %s works on all mailboxes\n", name);
+    printf("\t -r remove infected messages\n");
+    printf("\t -n notify mailbox owner of deleted messages via email\n");
+    exit(0);
+}
+
+/* we don't check what comes in on matchlen and maycreate, should we? */
+int scan_me(char *name,
+	    int matchlen __attribute__((unused)),
+	    int maycreate __attribute__((unused)),
+	    void *rock __attribute__((unused)))
+{
+    struct mailbox the_box;
+    int            error;
+    struct infected_mbox *i_mbox = NULL;
+
+    if (verbose) {
+	char mboxname[MAX_MAILBOX_NAME+1];
+
+	/* Convert internal name to external */
+	(*scan_namespace.mboxname_toexternal)(&scan_namespace, name,
+					     "cyrus", mboxname);
+	printf("Working on %s...\n", mboxname);
+    }
+
+    error = mailbox_open_header(name, 0, &the_box);
+    if (error != 0) { /* did we find it? */
+	syslog(LOG_ERR, "Couldn't find %s, check spelling", name);
+	return 0;
+    }
+    if (the_box.header_fd != -1) {
+	(void) mailbox_lock_header(&the_box);
+    }
+    the_box.header_lock_count = 1;
+
+    error = mailbox_open_index(&the_box);
+    if (error != 0) {
+	mailbox_close(&the_box);
+	syslog(LOG_ERR, "Couldn't open mailbox index for %s", name);
+	return 0;
+    }
+    (void) mailbox_lock_index(&the_box);
+    the_box.index_lock_count = 1;
+
+    if (notify) {
+	/* XXX  Need to handle virtdomains */
+	if (!strncmp(name, "user.", 5)) {
+	    size_t ownerlen;
+
+	    if (user && (ownerlen = strlen(user->owner)) &&
+		!strncmp(name, user->owner, ownerlen) &&
+		(name[ownerlen] == '.' || name[ownerlen] =='\0')) {
+		/* mailbox belongs to current owner */
+		i_mbox = user;
+	    } else {
+		/* new owner (Inbox) */
+		struct infected_mbox *new = xzmalloc(sizeof(struct infected_mbox));
+		new->owner = xstrdup(name);
+		new->next = user;
+		i_mbox = user = new;
+	    }
+	}
+#if 0  /* XXX what to do with public mailboxes (bboards)? */
+	else {
+	    if (!public) {
+		public = xzmalloc(sizeof(struct infected_mbox));
+		public->owner = xstrdup("");
+	    }
+
+	    i_mbox = public;
+	}
+#endif
+
+	if (i_mbox) i_mbox->msgno = 1;
+    }
+
+    mailbox_expunge(&the_box, virus_check, i_mbox, EXPUNGE_FORCE);
+
+    sync_log_mailbox(the_box.name);
+    mailbox_close(&the_box);
+
+    return 0;
+}
+
+void create_digest(struct infected_mbox *i_mbox, struct mailbox *mbox,
+		   unsigned msgno, unsigned long uid, const char *virname)
+{
+    struct infected_msg *i_msg = xmalloc(sizeof(struct infected_msg));
+    struct nntp_overview *over;
+
+    i_msg->mboxname = xstrdup(mbox->name);
+    i_msg->virname = xstrdup(virname);
+    i_msg->uid= uid;
+
+    index_operatemailbox(mbox);
+    over = index_overview(mbox, msgno);
+    i_msg->msgid = strdup(over->msgid);
+    i_msg->date = strdup(over->date);
+    i_msg->from = strdup(over->from);
+    i_msg->subj = strdup(over->subj);
+
+    i_msg->next = i_mbox->msgs;
+    i_mbox->msgs = i_msg;
+}
+
+/* thumbs up routine, checks for virus and returns yes or no for deletion */
+/* 0 = no, 1 = yes */
+unsigned virus_check(struct mailbox *mailbox,
+		     void *deciderock,
+		     unsigned char *buf,
+		     int expunge_flags __attribute__((unused)))
+{
+    struct infected_mbox *i_mbox = (struct infected_mbox *) deciderock;
+    unsigned long uid;
+    char fname[4096];
+    const char *virname;
+    int r = 0;
+
+    uid = ntohl(*((bit32 *)(buf+OFFSET_UID)));
+
+    snprintf(fname, sizeof(fname), "%s/%lu.", mailbox->path, uid);
+
+    if ((r = engine.scanfile(engine.state, fname, &virname))) {
+	if (verbose) {
+	    printf("Virus detected in message %lu: %s\n", uid, virname);
+	}
+	if (disinfect) {
+	    if (notify && i_mbox) {
+		create_digest(i_mbox, mailbox, i_mbox->msgno, uid, virname);
+	    }
+	}
+    }
+
+    if (i_mbox) i_mbox->msgno++;
+
+    return r;
+}
+
+void append_notifications()
+{
+    struct infected_mbox *i_mbox;
+    int outgoing_count = 0;
+    pid_t p = getpid();;
+    int fd = create_tempfile(config_getstring(IMAPOPT_TEMP_PATH));
+
+    while ((i_mbox = user)) {
+	if (i_mbox->msgs) {
+	    FILE *f = fdopen(fd, "w+");
+	    size_t ownerlen;
+	    struct infected_msg *msg;
+	    char buf[8192], datestr[80];
+	    time_t t;
+	    struct protstream *pout;
+	    struct appendstate as;
+	    struct body *body = NULL;
+	    long msgsize;
+
+	    fprintf(f, "Return-Path: <>\r\n");
+	    t = time(NULL);
+	    snprintf(buf, sizeof(buf), "<cmu-cyrus-%d-%d-%d@%s>",
+		     (int) p, (int) t, 
+		     outgoing_count++, config_servername);
+	    fprintf(f, "Message-ID: %s\r\n", buf);
+	    rfc822date_gen(datestr, sizeof(datestr), t);
+	    fprintf(f, "Date: %s\r\n", datestr);
+	    fprintf(f, "From: Mail System Administrator <%s>\r\n",
+		    config_getstring(IMAPOPT_POSTMASTER));
+	    /* XXX  Need to handle virtdomains */
+	    fprintf(f, "To: <%s>\r\n", i_mbox->owner+5);
+	    fprintf(f, "MIME-Version: 1.0\r\n");
+	    fprintf(f, "Subject: Automatically deleted mail\r\n");
+
+	    ownerlen = strlen(i_mbox->owner);
+
+	    while ((msg = i_mbox->msgs)) {
+		fprintf(f, "\r\n\r\nThe following message was deleted from mailbox "
+			"'Inbox%s'\r\n", msg->mboxname+ownerlen);
+		fprintf(f, "because it was infected with virus '%s'\r\n\r\n",
+			msg->virname);
+		fprintf(f, "\tMessage-ID: %s\r\n", msg->msgid);
+		fprintf(f, "\tDate: %s\r\n", msg->date);
+		fprintf(f, "\tFrom: %s\r\n", msg->from);
+		fprintf(f, "\tSubject: %s\r\n", msg->subj);
+		fprintf(f, "\tIMAP UID: %lu\r\n", msg->uid);
+
+		i_mbox->msgs = msg->next;
+
+		/* free msg digest */
+		free(msg->mboxname);
+		free(msg->msgid);
+		free(msg->date);
+		free(msg->from);
+		free(msg->subj);
+		free(msg->virname);
+		free(msg);
+	    }
+
+	    fflush(f);
+	    msgsize = ftell(f);
+
+	    append_setup(&as, i_mbox->owner, MAILBOX_FORMAT_NORMAL,
+			 NULL, NULL, 0, -1);
+	    pout = prot_new(fd, 0);
+	    prot_rewind(pout);
+	    append_fromstream(&as, &body, pout, msgsize, t, NULL, 0);
+	    append_commit(&as, -1, NULL, NULL, NULL);
+
+	    if (body) {
+		message_free_body(body);
+		free(body);
+	    }
+	    prot_free(pout);
+	    fclose(f);
+	}
+	
+	user = i_mbox->next;
+
+	/* free owner info */
+	free(i_mbox->owner);
+	free(i_mbox);
+    }
+}

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyrdump.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyrdump.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyrdump.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/cyrdump.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
-/* $Id: cyrdump.c,v 1.18 2007/02/05 18:41:46 jeaton Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/*
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,7 +38,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: cyrdump.c,v 1.21 2008/03/24 17:09:16 murch Exp $
  */
 
 #include <config.h>
@@ -60,6 +61,7 @@
 #include "mailbox.h"
 #include "mboxlist.h"
 #include "sysexits.h"
+#include "util.h"
 #include "xmalloc.h"
 #include "xstrlcpy.h"
 #include "xstrlcat.h"
@@ -90,7 +92,7 @@
 int imapd_condstore_client = 0;
 
 struct incremental_record {
-    int incruid;
+    unsigned incruid;
 };
 
 int main(int argc, char *argv[])
@@ -101,7 +103,9 @@
     char *alt_config = NULL;
     struct incremental_record irec;
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EX_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     while ((option = getopt(argc, argv, "v")) != EOF) {
 	switch (option) {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/deliver.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/deliver.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/deliver.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/deliver.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,7 @@
 /* deliver.c -- deliver shell - just calls lmtpd
  * Tim Martin
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,9 +40,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: deliver.c,v 1.181 2008/10/08 15:47:06 murch Exp $
  */
-
-/* $Id: deliver.c,v 1.176 2007/02/05 18:41:46 jeaton Exp $ */
 
 #include <config.h>
 
@@ -89,6 +89,21 @@
 
 static const char *sockaddr;
 
+static struct protocol_t lmtp_protocol =
+{ "lmtp", "lmtp",
+  { 0, "220 " },
+  { "LHLO", "deliver", "250 ", NULL,
+    { { "AUTH ", CAPA_AUTH },
+      { "STARTTLS", CAPA_STARTTLS },
+      { "PIPELINING", CAPA_PIPELINING },
+      { "IGNOREQUOTA", CAPA_IGNOREQUOTA },
+      { NULL, 0 } } },
+  { "STARTTLS", "220", "454", 0 },
+  { "AUTH", 512, 0, "235", "5", "334 ", "*", NULL, 0 },
+  { "NOOP", NULL, "250" },
+  { "QUIT", NULL, "221" }
+};
+
 /* unused for deliver.c, but needed to make lmtpengine.c happy */
 int deliver_logfd = -1;
 
@@ -295,7 +310,7 @@
   conn->out = prot_new(lmtpdsock, 1);
   conn->sock = lmtpdsock;
   prot_setflushonread(conn->in, conn->out);
-  conn->prot = &protocol[PROTOCOL_LMTP];
+  conn->prot = &lmtp_protocol;
 
   return conn;
 }
@@ -315,7 +330,7 @@
     }
 
     /* connect */
-    conn = backend_connect(NULL, sockaddr, &protocol[PROTOCOL_LMTP],
+    conn = backend_connect(NULL, sockaddr, &lmtp_protocol,
 			   "", NULL, NULL);
     if (!conn) {
 	just_exit("couldn't connect to lmtpd");
@@ -347,7 +362,8 @@
 
 		/* find the length of the userid minus the domain */
 		ulen = strcspn(users[j], "@");
-		sprintf(txn->rcpt[j].addr, "%.*s+%s", ulen, users[j], mailbox);
+		sprintf(txn->rcpt[j].addr, "%.*s+%s",
+			(int) ulen, users[j], mailbox);
 
 		/* add the domain if we have one */
 		if (ulen < strlen(users[j]))

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/delivered_prune.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/delivered_prune.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/delivered_prune.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/delivered_prune.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* cyr_expire.c -- Program to expire deliver.db entries and messages
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: delivered_prune.c,v 1.2 2006/11/30 17:11:17 murch Exp $
+ * $Id: delivered_prune.c,v 1.4 2008/03/24 17:09:16 murch Exp $
  */
 
 #include <config.h>
@@ -83,7 +84,9 @@
     int opt, r = 0, expire_days = 0;
     char *alt_config = NULL;
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     while ((opt = getopt(argc, argv, "C:E:")) != EOF) {
 	switch (opt) {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/duplicate.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/duplicate.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/duplicate.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/duplicate.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: duplicate.c,v 1.47 2008/03/24 17:09:16 murch Exp $
  */
-
-/* $Id: duplicate.c,v 1.42 2006/11/30 17:11:17 murch Exp $ */
 
 #include <config.h>
 
@@ -47,7 +47,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <syslog.h>
-#include <assert.h>
 #include <ctype.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -71,6 +70,7 @@
 #endif
 #include <errno.h>
 
+#include "assert.h"
 #include "xmalloc.h"
 #include "imap_err.h"
 #include "global.h"
@@ -105,7 +105,7 @@
 	    strcat(fname, FNAME_DELIVERDB);
 	}
 
-	r = DB->open(fname, CYRUSDB_CREATE, &dupdb);
+	r = (DB->open)(fname, CYRUSDB_CREATE, &dupdb);
 	if (r != 0)
 	    syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
 		   cyrusdb_strerror(r));
@@ -128,7 +128,7 @@
 
     if (!duplicate_dbopen) return 0;
 
-    if (idlen + tolen > sizeof(buf) - 30) return 0;
+    if (idlen + tolen > (int) sizeof(buf) - 30) return 0;
     memcpy(buf, id, idlen);
     buf[idlen] = '\0';
     memcpy(buf + idlen + 1, to, tolen);
@@ -164,17 +164,8 @@
 
 void duplicate_log(char *msgid, const char *name, char *action)
 {
-    if (strlen(msgid) < 80) {
-	char pretty[160];
-
-	beautify_copy(pretty, msgid);
 	syslog(LOG_INFO, "dupelim: eliminated duplicate message to %s id %s (%s)",
 	       name, msgid, action);
-    }
-    else {
-	syslog(LOG_INFO, "dupelim: eliminated duplicate message to %s (%s)",
-	       name, action);
-    }	
 }
 
 void duplicate_mark(char *id, int idlen, const char *to, int tolen, time_t mark,
@@ -185,7 +176,7 @@
 
     if (!duplicate_dbopen) return;
 
-    if (idlen + tolen > sizeof(buf) - 30) return;
+    if (idlen + tolen > (int) sizeof(buf) - 30) return;
     memcpy(buf, id, idlen);
     buf[idlen] = '\0';
     memcpy(buf + idlen + 1, to, tolen);
@@ -240,7 +231,7 @@
 
     /* grab the mark and uid */
     memcpy(&mark, data, sizeof(time_t));
-    if (datalen > sizeof(mark))
+    if (datalen > (int) sizeof(mark))
 	memcpy(&uid, data + sizeof(mark), sizeof(unsigned long));
 
     r = (*frock->proc)(id, rcpt, mark, uid, frock->rock);
@@ -355,7 +346,7 @@
     drock->count++;
 
     memcpy(&mark, data, sizeof(time_t));
-    if (datalen > sizeof(mark))
+    if (datalen > (int) sizeof(mark))
 	memcpy(&uid, data + sizeof(mark), sizeof(unsigned long));
     to = (char*) key + strlen(key) + 1;
     id = (char *) key;
@@ -404,7 +395,7 @@
     int r = 0;
 
     if (duplicate_dbopen) {
-	r = DB->close(dupdb);
+	r = (DB->close)(dupdb);
 	if (r) {
 	    syslog(LOG_ERR, "DBERROR: error closing deliverdb: %s",
 		   cyrusdb_strerror(r));

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/duplicate.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/duplicate.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/duplicate.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/duplicate.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: duplicate.h,v 1.17 2008/03/24 17:09:16 murch Exp $
  */
-
-/* $Id: duplicate.h,v 1.16 2006/11/30 17:11:17 murch Exp $ */
 
 #ifndef DUPLICATE_H
 #define DUPLICATE_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/fetchnews.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/fetchnews.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/fetchnews.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/fetchnews.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* fetchnews.c -- Program to pull new articles from a peer and push to server
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: fetchnews.c,v 1.16 2006/11/30 17:11:17 murch Exp $
+ * $Id: fetchnews.c,v 1.21 2008/08/27 08:28:46 selsky Exp $
  */
 
 #include <config.h>
@@ -63,7 +64,9 @@
 #include "gmtoff.h"
 #include "lock.h"
 #include "prot.h"
+#include "util.h"
 #include "xmalloc.h"
+#include "xstrlcat.h"
 
 /* global state */
 const int config_need_data = 0;
@@ -94,7 +97,7 @@
 	    strcat(fname, FNAME_NEWSRCDB);
 	}
 
-	r = DB->open(fname, CYRUSDB_CREATE, &newsrc_db);
+	r = (DB->open)(fname, CYRUSDB_CREATE, &newsrc_db);
 	if (r != 0)
 	    syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
 		   cyrusdb_strerror(r));
@@ -112,7 +115,7 @@
     int r = 0;
 
     if (newsrc_dbopen) {
-	r = DB->close(newsrc_db);
+	r = (DB->close)(newsrc_db);
 	if (r) {
 	    syslog(LOG_ERR, "DBERROR: error closing fetchnews.db: %s",
 		   cyrusdb_strerror(r));
@@ -267,7 +270,9 @@
     int newnews = 1;
     char *datefmt = "%y%m%d %H%M%S";
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     while ((opt = getopt(argc, argv, "C:s:w:f:a:p:ny")) != EOF) {
 	switch (opt) {
@@ -403,15 +408,15 @@
 	}
 
 	if ((fd = open(sfile, O_RDWR | O_CREAT, 0644)) == -1) {
-	    syslog(LOG_ERR, "can not open %s", sfile);
+	    syslog(LOG_ERR, "cannot open %s", sfile);
 	    goto quit;
 	}
 	if (lock_nonblocking(fd) == -1) {
-	    syslog(LOG_ERR, "can not lock %s: %m", sfile);
+	    syslog(LOG_ERR, "cannot lock %s: %m", sfile);
 	    goto quit;
 	}
 
-	if (read(fd, &stamp, sizeof(stamp)) < sizeof(stamp)) {
+	if (read(fd, &stamp, sizeof(stamp)) < (int) sizeof(stamp)) {
 	    /* XXX do something better here */
 	    stamp = 0;
 	}
@@ -499,7 +504,7 @@
 
 	/* write the current timestamp */
 	lseek(fd, 0, SEEK_SET);
-	if (write(fd, &stamp, sizeof(stamp)) < sizeof(stamp))
+	if (write(fd, &stamp, sizeof(stamp)) < (int) sizeof(stamp))
 	    syslog(LOG_ERR, "error writing %s", sfile);
 	lock_unlock(fd);
 	close(fd);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/fud.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/fud.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/fud.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/fud.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /* fud.c -- long-lived finger information provider
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,12 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
-
+ * $Id: fud.c,v 1.56 2008/03/24 17:09:16 murch Exp $
  */
 
 #include <config.h>
-
-/* $Id: fud.c,v 1.55 2007/02/05 18:41:46 jeaton Exp $ */
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/global.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/global.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/global.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/global.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /* global.c -- Configuration routines
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: global.c,v 1.28 2008/07/30 16:03:37 murch Exp $
  */
-
-/* $Id: global.c,v 1.21 2007/02/05 18:41:46 jeaton Exp $ */
 
 #include <config.h>
 
@@ -83,7 +84,8 @@
 
 static int cyrus_init_nodb = 0;
 
-int config_implicitrights;        /* "lca" */
+int config_fulldirhash;				/* 0 */
+int config_implicitrights;			/* "lkxa" */
 unsigned long config_metapartition_files;    /* 0 */
 struct cyrusdb_backend *config_mboxlist_db;
 struct cyrusdb_backend *config_quota_db;
@@ -94,6 +96,7 @@
 struct cyrusdb_backend *config_duplicate_db;
 struct cyrusdb_backend *config_tlscache_db;
 struct cyrusdb_backend *config_ptscache_db;
+struct cyrusdb_backend *config_statuscache_db;
 
 /* Called before a cyrus application starts (but after command line parameters
  * are read) */
@@ -160,6 +163,8 @@
 	val++;
     }
     umask(umaskval);
+
+    config_fulldirhash = config_getswitch(IMAPOPT_FULLDIRHASH);
 
     /* look up and canonify the implicit rights of mailbox owners */
     config_implicitrights =
@@ -187,6 +192,8 @@
 	    cyrusdb_fromname(config_getstring(IMAPOPT_TLSCACHE_DB));
 	config_ptscache_db =
 	    cyrusdb_fromname(config_getstring(IMAPOPT_PTSCACHE_DB));
+	config_statuscache_db =
+	    cyrusdb_fromname(config_getstring(IMAPOPT_STATUSCACHE_DB));
 
 	/* configure libcyrus as needed */
 	libcyrus_config_setstring(CYRUSOPT_CONFIG_DIR, config_dir);
@@ -218,6 +225,18 @@
 			       config_getint(IMAPOPT_BERKELEY_TXNS_MAX));
 	libcyrus_config_setstring(CYRUSOPT_DELETERIGHT,
 				  config_getstring(IMAPOPT_DELETERIGHT));
+	libcyrus_config_setstring(CYRUSOPT_SQL_DATABASE,
+				  config_getstring(IMAPOPT_SQL_DATABASE));
+	libcyrus_config_setstring(CYRUSOPT_SQL_ENGINE,
+				  config_getstring(IMAPOPT_SQL_ENGINE));
+	libcyrus_config_setstring(CYRUSOPT_SQL_HOSTNAMES,
+				  config_getstring(IMAPOPT_SQL_HOSTNAMES));
+	libcyrus_config_setstring(CYRUSOPT_SQL_USER,
+				  config_getstring(IMAPOPT_SQL_USER));
+	libcyrus_config_setstring(CYRUSOPT_SQL_PASSWD,
+				  config_getstring(IMAPOPT_SQL_PASSWD));
+	libcyrus_config_setswitch(CYRUSOPT_SQL_USESSL,
+				  config_getswitch(IMAPOPT_SQL_USESSL));
 
 	/* Not until all configuration parameters are set! */
 	libcyrus_init();
@@ -310,7 +329,9 @@
 				/* maximum allowable security strength */
 
     ret.security_flags = flags;
-    /* ret.security_flags |= SASL_SEC_NOPLAINTEXT; */
+    if (!config_getswitch(IMAPOPT_ALLOWPLAINTEXT)) {
+	ret.security_flags |= SASL_SEC_NOPLAINTEXT;
+    }
     if (!config_getswitch(IMAPOPT_ALLOWANONYMOUSLOGIN)) {
 	ret.security_flags |= SASL_SEC_NOANONYMOUS;
     }
@@ -325,7 +346,7 @@
 {
     char buf[1024];
     const char *val = config_getstring(opt);
-    int len;
+    size_t len;
 
     /* Is the option defined? */
     if(!val) return 0;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/global.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/global.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/global.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/global.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* global.h -- Header for global/shared variables & functions.
- * $Id: global.h,v 1.8 2006/11/30 17:11:17 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: global.h,v 1.11 2008/03/24 17:09:16 murch Exp $
  */
 
 #ifndef INCLUDED_GLOBAL_H
@@ -142,6 +144,7 @@
 extern int shutdown_file(char *buf, int size);
 
 /* Misc globals */
+extern int config_fulldirhash;
 extern int config_implicitrights;
 extern unsigned long config_metapartition_files;
 extern struct cyrusdb_backend *config_mboxlist_db;
@@ -153,5 +156,6 @@
 extern struct cyrusdb_backend *config_duplicate_db;
 extern struct cyrusdb_backend *config_tlscache_db;
 extern struct cyrusdb_backend *config_ptscache_db;
+extern struct cyrusdb_backend *config_statuscache_db;
 
 #endif /* INCLUDED_GLOBAL_H */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idle.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idle.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idle.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idle.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
- */
-
-/* $Id: idle.c,v 1.3 2006/11/30 17:11:17 murch Exp $ */
+ *
+ * $Id: idle.c,v 1.5 2008/03/24 17:09:16 murch Exp $
+ */
 
 #include <config.h>
 
@@ -77,14 +78,14 @@
 /*
  * Send a message to idled
  */
-static int idle_send_msg(int msg, struct mailbox *mailbox)
+static int idle_send_msg(int msg, const char *mboxname)
 {
     idle_data_t idledata;
 
     /* fill the structure */
     idledata.msg = msg;
     idledata.pid = getpid();
-    strcpy(idledata.mboxname, mailbox ? mailbox->name : ".");
+    strcpy(idledata.mboxname, mboxname ? mboxname : ".");
 
     /* send */
     if (sendto(notify_sock, (void *) &idledata,
@@ -100,12 +101,12 @@
 /*
  * Notify idled of a mailbox change
  */
-void idle_notify(struct mailbox *mailbox)
+void idle_notify(const char *mboxname)
 {
     /* We should try to determine if we need to send this
      * (ie, is an imapd is IDLE on 'mailbox'?).
      */
-    idle_send_msg(IDLE_NOTIFY, mailbox);
+    idle_send_msg(IDLE_NOTIFY, mboxname);
 }
 
 /*
@@ -229,21 +230,21 @@
     return 1;
 }
 
-void idle_start(struct mailbox *mailbox)
+void idle_start(const char *mboxname)
 {
     idle_started = 1;
 
     /* Tell idled that we're idling */
-    if (notify_sock == -1 || !idle_send_msg(IDLE_INIT, mailbox)) {
+    if (notify_sock == -1 || !idle_send_msg(IDLE_INIT, mboxname)) {
 	/* otherwise, we'll poll with SIGALRM */
 	alarm(idle_period);
     }
 }
 
-void idle_done(struct mailbox *mailbox)
+void idle_done(const char *mboxname)
 {
     /* Tell idled that we're done idling */
-    if (notify_sock != -1) idle_send_msg(IDLE_DONE, mailbox);
+    if (notify_sock != -1) idle_send_msg(IDLE_DONE, mboxname);
 
     /* Cancel alarm */
     alarm(0);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idle.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idle.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idle.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idle.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: idle.h,v 1.10 2008/03/24 17:09:16 murch Exp $
  */
-
-/* $Id: idle.h,v 1.8 2006/11/30 17:11:17 murch Exp $ */
 
 #ifndef IDLE_H
 #define IDLE_H
@@ -65,9 +66,9 @@
 int idle_init(idle_updateproc_t *proc);
 
 /* Start IDLEing on 'mailbox'. */
-void idle_start(struct mailbox *mailbox);
+void idle_start(const char *mboxname);
 
 /* Cleanup when IDLE is completed. */
-void idle_done(struct mailbox *mailbox);
+void idle_done(const char *mboxname);
 
 #endif

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idled.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idled.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idled.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idled.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* idled.c - daemon for handling IMAP IDLE notifications
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +38,9 @@
  * 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.
+ *
+ * $Id: idled.c,v 1.26 2008/03/24 17:09:16 murch Exp $
  */
-
-/* $Id: idled.c,v 1.25 2007/02/05 18:41:46 jeaton Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idled.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idled.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idled.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/idled.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* idled.h - daemon for handling IMAP IDLE notifications
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +38,9 @@
  * 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.
+ *
+ * $Id: idled.h,v 1.7 2008/03/24 17:09:16 murch Exp $
  */
-
-/* $Id: idled.h,v 1.5 2006/11/30 17:11:18 murch Exp $ */
 
 #ifndef IDLED_H
 #define IDLED_H
@@ -56,7 +58,7 @@
     char mboxname[MAX_MAILBOX_NAME+1];
 } idle_data_t;
 
-#define IDLEDATA_BASE_SIZE	(2 * sizeof(unsigned long))
+#define IDLEDATA_BASE_SIZE	(2 * (int) sizeof(unsigned long))
 
 typedef enum {
     IDLE_INIT,

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_err.et
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_err.et?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_err.et (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_err.et Mon Feb  9 12:49:22 2009
@@ -1,30 +1,45 @@
 # imap_err.et -- Error codes for Cyrus IMAP server programs
 #
-# Copyright 1998 Carnegie Mellon University
+# Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
 # 
-# No warranties, either expressed or implied, are made regarding the
-# operation, use, or results of the software.
-#
-# Permission to use, copy, modify and distribute this software and its
-# documentation is hereby granted for non-commercial purposes only
-# provided that this copyright notice appears in all copies and in
-# supporting documentation.
-#
-# Permission is also granted to Internet Service Providers and others
-# entities to use the software for internal purposes.
-#
-# The distribution, modification or sale of a product which uses or is
-# based on the software, in whole or in part, for commercial purposes or
-# benefits requires specific, additional permission from:
-#
-#  Office of Technology Transfer
+# 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 legal
+#    details, please contact
 #  Carnegie Mellon University
-#  5000 Forbes Avenue
-#  Pittsburgh, PA  15213-3890
-#  (412) 268-4387, fax: (412) 268-7395
-#  tech-transfer at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
 # 
-# $Id: imap_err.et,v 1.53 2006/11/30 17:11:18 murch Exp $
+# $Id: imap_err.et,v 1.54 2008/03/24 17:09:16 murch Exp $
 
 error_table imap
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_proxy.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_proxy.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_proxy.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_proxy.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
-/*
- * imap_proxy.c - IMAP proxy support functions
+/* imap_proxy.c - IMAP proxy support functions
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,18 +16,19 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
  *    "This product includes software developed by Computing Services
- *    acknowledgment:
  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
  *
  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
@@ -39,18 +39,18 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: imap_proxy.c,v 1.2 2006/11/30 17:11:18 murch Exp $
+ * $Id: imap_proxy.c,v 1.11 2008/10/08 15:47:06 murch Exp $
  */
 
 #include <config.h>
 
-#include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <string.h>
 #include <syslog.h>
 #include <sys/un.h>
 
+#include "assert.h"
 #include "acl.h"
 #include "annotate.h"
 #include "backend.h"
@@ -63,6 +63,7 @@
 #include "mupdate-client.h"
 #include "prot.h"
 #include "xmalloc.h"
+#include "xstrlcat.h"
 
 extern unsigned int proxy_cmdcnt;
 extern struct protstream *imapd_in, *imapd_out;
@@ -76,6 +77,51 @@
 		   const char *name, int *flags, char **pathp, char **mpathp,
 		   char **partp, char **aclp, struct txn **tid) ;
 
+static char *imap_parsemechlist(const char *str, struct protocol_t *prot)
+{
+    char *ret = xzmalloc(strlen(str)+1);
+    char *tmp;
+    int num = 0;
+    
+    if (strstr(str, "SASL-IR")) {
+	/* server supports initial response in AUTHENTICATE command */
+	prot->sasl_cmd.maxlen = INT_MAX;
+    }
+    
+    while ((tmp = strstr(str, "AUTH="))) {
+	char *end = (tmp += 5);
+	
+	while((*end != ' ') && (*end != '\0')) end++;
+	
+	/* add entry to list */
+	if (num++ > 0) strcat(ret, " ");
+	strlcat(ret, tmp, strlen(ret) + (end - tmp) + 1);
+	
+	/* reset the string */
+	str = end + 1;
+    }
+    
+    return ret;
+}
+
+struct protocol_t imap_protocol =
+{ "imap", "imap",
+  { 1, NULL },
+  { "C01 CAPABILITY", NULL, "C01 ", &imap_parsemechlist,
+    { { " AUTH=", CAPA_AUTH },
+      { " STARTTLS", CAPA_STARTTLS },
+      { " IDLE", CAPA_IDLE },
+      { " MUPDATE", CAPA_MUPDATE },
+      { " MULTIAPPEND", CAPA_MULTIAPPEND },
+      { " LIST-SUBSCRIBED", CAPA_LISTSUBSCRIBED },
+      { " RIGHTS=kxte", CAPA_ACLRIGHTS },
+      { NULL, 0 } } },
+  { "S01 STARTTLS", "S01 OK", "S01 NO", 0 },
+  { "A01 AUTHENTICATE", 0, 0, "A01 OK", "A01 NO", "+ ", "*", NULL, 0 },
+  { "N01 NOOP", "* ", "N01 OK" },
+  { "Q01 LOGOUT", "* ", "Q01 " }
+};
+
 void proxy_gentag(char *tag, size_t len)
 {
     snprintf(tag, len, "PROXY%d", proxy_cmdcnt++);
@@ -94,7 +140,7 @@
     if(!r) {
 	r = mlookup(NULL, NULL, inbox, &mbtype, NULL, NULL, &server, NULL, NULL);
 	if (!r && (mbtype & MBTYPE_REMOTE)) {
-	    s = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+	    s = proxy_findserver(server, &imap_protocol,
 				 proxy_userid, &backend_cached,
 				 &backend_current, &backend_inbox, imapd_in);
 	}
@@ -105,23 +151,24 @@
 
 /* pipe_response() reads from 's->in' until either the tagged response
    starting with 'tag' appears, or if 'tag' is NULL, to the end of the
-   current line.  If 'include_tag' is set, the tagged line is included
-   in the output, otherwise the tagged line is stored in 's->last_result'. 
+   current line.  If 'include_last' is set, the last/tagged line is included
+   in the output, otherwise the last/tagged line is stored in 's->last_result'. 
    In either case, the result of the tagged command is returned.
 
-/* 's->last_result' assumes that tagged responses don't contain literals.
-   Unfortunately, the IMAP grammar allows them */
-
-/* force_notfatal says to not fatal() if we lose connection to backend_current
- * even though it is in 95% of the cases, a good idea... */
-static int pipe_response(struct backend *s, const char *tag, int include_tag,
+   's->last_result' assumes that tagged responses don't contain literals.
+   Unfortunately, the IMAP grammar allows them
+
+   force_notfatal says to not fatal() if we lose connection to backend_current
+   even though it is in 95% of the cases, a good idea...
+*/
+static int pipe_response(struct backend *s, const char *tag, int include_last,
 			 int force_notfatal)
 {
     char buf[2048];
     char eol[128];
     int sl;
     int cont = 0, last = !tag, r = PROXY_OK;
-    size_t taglen;
+    size_t taglen = 0;
 
     s->timeout->mark = time(NULL) + IDLE_TIMEOUT;
 
@@ -178,11 +225,11 @@
 		last = 1;
 	    }
 	
-	    if (last && !include_tag) {
+	    if (last && !include_last) {
 		/* Store the tagged line */
 		if (sl > s->last_result.alloc - s->last_result.len) {
 		    s->last_result.alloc =
-			(s->last_result.alloc == 0) ? sizeof(buf) :
+			(s->last_result.alloc == 0) ? (int) sizeof(buf) :
 			s->last_result.alloc * 2;
 		    s->last_result.s = xrealloc(s->last_result.s,
 						s->last_result.alloc+1);
@@ -201,14 +248,14 @@
 
 	    /* write out this part, but we have to keep reading until we
 	       hit the end of the line */
-	    if (!last || include_tag) prot_write(imapd_out, buf, sl);
+	    if (!last || include_last) prot_write(imapd_out, buf, sl);
 	    cont = 1;
 	    continue;
 	} else {		/* we got the end of the line */
 	    int i;
 	    int litlen = 0, islit = 0;
 
-	    if (!last || include_tag) prot_write(imapd_out, buf, sl);
+	    if (!last || include_last) prot_write(imapd_out, buf, sl);
 
 	    /* now we have to see if this line ends with a literal */
 	    if (sl < 64) {
@@ -236,14 +283,15 @@
 	    /* copy the literal over */
 	    if (islit) {
 		while (litlen > 0) {
-		    int j = (litlen > sizeof(buf) ? sizeof(buf) : litlen);
+		    int j = (litlen > (int) sizeof(buf) ?
+			     (int) sizeof(buf) : litlen);
 		    
 		    j = prot_read(s->in, buf, j);
 		    if(!j) {
 			/* EOF or other error */
 			return -1;
 		    }
-		    if (!last || include_tag) prot_write(imapd_out, buf, j);
+		    if (!last || include_last) prot_write(imapd_out, buf, j);
 		    litlen -= j;
 		}
 
@@ -269,7 +317,8 @@
     return pipe_response(s, tag, 0, force_notfatal);
 }
 
-int pipe_including_tag(struct backend *s, const char *tag, int force_notfatal) {
+int pipe_including_tag(struct backend *s, const char *tag, int force_notfatal)
+{
     int r;
 
     r = pipe_response(s, tag, 1, force_notfatal);
@@ -284,7 +333,7 @@
 
 static int pipe_to_end_of_response(struct backend *s, int force_notfatal)
 {
-    return pipe_response(s, NULL, 0, force_notfatal);
+    return pipe_response(s, NULL, 1, force_notfatal);
 }
 
 /* copy our current input to 's' until we hit a true EOL.
@@ -378,7 +427,8 @@
 
 		/* gobble literal and sent it onward */
 		while (litlen > 0) {
-		    int j = (litlen > sizeof(buf) ? sizeof(buf) : litlen);
+		    int j = (litlen > (int) sizeof(buf) ?
+			     (int) sizeof(buf) : litlen);
 
 		    j = prot_read(imapd_in, buf, j);
 		    if(!j) {
@@ -861,7 +911,8 @@
     }
 
     /* start the append */
-    prot_printf(s->out, "%s Append {%d+}\r\n%s", tag, strlen(name), name);
+    prot_printf(s->out, "%s Append {" SIZE_T_FMT "+}\r\n%s",
+		tag, strlen(name), name);
     prot_printf(backend_current->out, "%s %s %s (Rfc822.peek)\r\n",
 		mytag, usinguid ? "Uid Fetch" : "Fetch", sequence);
     for (/* each FETCH response */;;) {
@@ -954,7 +1005,8 @@
 				q->flags, q->idate, sz);
 		    while (sz) {
 			char buf[2048];
-			int j = (sz > sizeof(buf) ? sizeof(buf) : sz);
+			int j = (sz > (int) sizeof(buf) ?
+				 (int) sizeof(buf) : sz);
 
 			j = prot_read(backend_current->in, buf, j);
 			if(!j) break;
@@ -1054,7 +1106,7 @@
 
     /* select the mailbox (read-only) */
     proxy_gentag(mytag, sizeof(mytag));
-    prot_printf(s->out, "%s Examine {%d+}\r\n%s\r\n",
+    prot_printf(s->out, "%s Examine {" SIZE_T_FMT "+}\r\n%s\r\n",
 		mytag, strlen(url->mailbox), url->mailbox);
     for (/* each examine response */;;) {
 	/* read a line */
@@ -1126,7 +1178,7 @@
 	}
 
 	for (/* each fetch item */;;) {
-	    unsigned long uid, sz;
+	    unsigned long uid, sz = 0;
 
 	    switch (c) {
 	    case 'u': case 'U':
@@ -1259,7 +1311,7 @@
     
     assert(server && mbox_pat && entry_pat && attribute_pat);
     
-    be = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+    be = proxy_findserver(server, &imap_protocol,
 			  proxy_userid, &backend_cached,
 			  &backend_current, &backend_inbox, imapd_in);
     if (!be) return IMAP_SERVER_UNAVAILABLE;
@@ -1295,7 +1347,7 @@
     
     assert(server && mbox_pat && entryatts);
     
-    be = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+    be = proxy_findserver(server, &imap_protocol,
 			  proxy_userid, &backend_cached,
 			  &backend_current, &backend_inbox, imapd_in);
     if (!be) return IMAP_SERVER_UNAVAILABLE;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_proxy.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_proxy.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_proxy.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imap_proxy.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
-/*
- * imap_proxy.h - IMAP proxy support functions
+/* imap_proxy.h - IMAP proxy support functions
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,18 +16,19 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
  *    "This product includes software developed by Computing Services
- *    acknowledgment:
  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
  *
  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: imap_proxy.h,v 1.2 2006/11/30 17:11:18 murch Exp $
+ * $Id: imap_proxy.h,v 1.4 2008/04/03 21:09:51 murch Exp $
  */
 
 #ifndef _IMAP_PROXY_H
@@ -55,6 +55,17 @@
     PROXY_NO = 1,
     PROXY_BAD = 2
 };
+
+enum {
+    /* IMAP capabilities */
+    CAPA_IDLE		= (1 << 2),
+    CAPA_MUPDATE	= (1 << 3),
+    CAPA_MULTIAPPEND	= (1 << 4),
+    CAPA_LISTSUBSCRIBED	= (1 << 5),
+    CAPA_ACLRIGHTS	= (1 << 6)
+};
+
+extern struct protocol_t imap_protocol;
 
 void proxy_gentag(char *tag, size_t len);
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapd.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapd.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapd.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapd.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,18 +15,19 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
  *    "This product includes software developed by Computing Services
- *    acknowledgment:
  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
  *
  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: imapd.c,v 1.553 2008/10/08 15:47:06 murch Exp $
  */
-
-/* $Id: imapd.c,v 1.509 2007/02/05 18:49:55 jeaton Exp $ */
 
 #include <config.h>
 
@@ -77,6 +78,7 @@
 #include "exitcodes.h"
 #include "idle.h"
 #include "global.h"
+#include "hash.h"
 #include "imap_err.h"
 #include "proxy.h"
 #include "imap_proxy.h"
@@ -94,6 +96,7 @@
 #include "mkgmtime.h"
 #include "mupdate-client.h"
 #include "quota.h"
+#include "statuscache.h"
 #include "sync_log.h"
 #include "telemetry.h"
 #include "tls.h"
@@ -117,6 +120,7 @@
 static char shutdownfilename[1024];
 static int imaps = 0;
 static sasl_ssf_t extprops_ssf = 0;
+static int nosaslpasswdcheck = 0;
 
 /* PROXY STUFF */
 /* we want a list of our outgoing connections here and which one we're
@@ -148,6 +152,7 @@
 /* end PROXY STUFF */
 
 /* per-user/session state */
+int imapd_timeout;
 struct protstream *imapd_out = NULL;
 struct protstream *imapd_in = NULL;
 struct protgroup *protin = NULL;
@@ -231,7 +236,7 @@
 void cmd_rename(char *tag, char *oldname, char *newname, char *partition);
 void cmd_reconstruct(const char *tag, const char *name, int recursive);
 void cmd_find(char *tag, char *namespace, char *pattern);
-void cmd_list(char *tag, int listopts, char *reference, char *pattern);
+void cmd_list(char *tag, struct listargs *listargs);
 void cmd_changesub(char *tag, char *namespace, char *name, int add);
 void cmd_getacl(const char *tag, const char *name);
 void cmd_listrights(char *tag, char *name, char *identifier);
@@ -274,7 +279,7 @@
 void annotate_response(struct entryattlist *l);
 
 #ifdef ENABLE_LISTEXT
-int getlistopts(char *tag, int *listopts);
+int getlistopts(char *tag, unsigned *listopts);
 #endif
 
 int getsearchprogram(char *tag, struct searchargs *searchargs,
@@ -301,7 +306,7 @@
 static int mailboxdata(char *name, int matchlen, int maycreate, void *rock);
 static int listdata(char *name, int matchlen, int maycreate, void *rock);
 static void mstringdata(char *cmd, char *name, int matchlen, int maycreate,
-			int listopts);
+			unsigned listopts);
 
 extern void setproctitle_init(int argc, char **argv, char **envp);
 extern int proc_register(const char *progname, const char *clienthost, 
@@ -592,6 +597,7 @@
     imapd_condstore_client = 0;
     if (imapd_saslconn) {
 	sasl_dispose(&imapd_saslconn);
+	free(imapd_saslconn);
 	imapd_saslconn = NULL;
     }
     imapd_starttls_done = 0;
@@ -636,7 +642,7 @@
     ret = snprintf(shutdownfilename, sizeof(shutdownfilename),
 		   "%s/msg/shutdown", config_dir);
     
-    if(ret < 0 || ret >= sizeof(shutdownfilename)) {
+    if(ret < 0 || ret >= (int) sizeof(shutdownfilename)) {
        fatal("shutdownfilename buffer too small (configdirectory too long)",
 	     EC_CONFIG);
     }
@@ -657,7 +663,7 @@
     snmp_connect(); /* ignore return code */
     snmp_set_str(SERVER_NAME_VERSION,CYRUS_VERSION);
 
-    while ((opt = getopt(argc, argv, "sp:")) != EOF) {
+    while ((opt = getopt(argc, argv, "sp:N")) != EOF) {
 	switch (opt) {
 	case 's': /* imaps (do starttls right away) */
 	    imaps = 1;
@@ -670,6 +676,10 @@
 	case 'p': /* external protection */
 	    extprops_ssf = atoi(optarg);
 	    break;
+	case 'N': /* bypass SASL password check.  Not recommended unless
+		   * you know what you're doing! */
+	    nosaslpasswdcheck = 1;
+	    break;
 	default:
 	    break;
 	}
@@ -682,11 +692,12 @@
 	annotatemore_init(0, NULL, NULL);
     annotatemore_open(NULL);
 
+    if (config_getswitch(IMAPOPT_STATUSCACHE)) {
+	statuscache_open(NULL);
+    }
+
     /* Create a protgroup for input from the client and selected backend */
     protin = protgroup_new(2);
-
-    /* YYY Sanity checks possible here? */
-    message_uuid_client_init(getenv("CYRUS_UUID_PREFIX"));
 
     return 0;
 }
@@ -703,7 +714,6 @@
 #endif
 {
     socklen_t salen;
-    int timeout;
     sasl_security_properties_t *secprops = NULL;
     struct sockaddr_storage imapd_localaddr, imapd_remoteaddr;
     char localip[60], remoteip[60];
@@ -766,8 +776,7 @@
 	fatal("SASL failed initializing: sasl_server_new()", EC_TEMPFAIL);
     }
 
-    /* never allow plaintext, since IMAP has the LOGIN command */
-    secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
+    secprops = mysasl_secprops(0);
     sasl_setprop(imapd_saslconn, SASL_SEC_PROPS, secprops);
     sasl_setprop(imapd_saslconn, SASL_SSF_EXTERNAL, &extprops_ssf);
 
@@ -781,9 +790,10 @@
     proc_register("imapd", imapd_clienthost, NULL, NULL);
 
     /* Set inactivity timer */
-    timeout = config_getint(IMAPOPT_TIMEOUT);
-    if (timeout < 30) timeout = 30;
-    prot_settimeout(imapd_in, timeout*60);
+    imapd_timeout = config_getint(IMAPOPT_TIMEOUT);
+    if (imapd_timeout < 30) imapd_timeout = 30;
+    imapd_timeout *= 60;
+    prot_settimeout(imapd_in, imapd_timeout);
     prot_setflushonread(imapd_in, imapd_out);
 
     /* we were connected on imaps port so we should do 
@@ -866,6 +876,11 @@
 
     annotatemore_close();
     annotatemore_done();
+
+    if (config_getswitch(IMAPOPT_STATUSCACHE)) {
+	statuscache_close();
+	statuscache_done();
+    }
 
     if (imapd_in) {
 	/* Flush the incoming buffer */
@@ -968,14 +983,18 @@
 
     prot_printf(imapd_out, "* OK [CAPABILITY ");
     capa_response(CAPA_PREAUTH);
-    prot_printf(imapd_out, "] %s Cyrus IMAP4 %s%s server ready\r\n",
-		config_servername,
-		config_mupdate_server ? "(Murder) " : "", CYRUS_VERSION);
+    prot_printf(imapd_out, "]");
+    if (config_serverinfo) prot_printf(imapd_out, " %s", config_servername);
+    if (config_serverinfo == IMAP_ENUM_SERVERINFO_ON) {
+	prot_printf(imapd_out, " Cyrus IMAP%s %s",
+		    config_mupdate_server ? " Murder" : "", CYRUS_VERSION);
+    }
+    prot_printf(imapd_out, " server ready\r\n");
 
     ret = snprintf(motdfilename, sizeof(motdfilename), "%s/msg/motd",
 		   config_dir);
     
-    if(ret < 0 || ret >= sizeof(motdfilename)) {
+    if(ret < 0 || ret >= (int) sizeof(motdfilename)) {
        fatal("motdfilename buffer too small (configdirectory too long)",
 	     EC_CONFIG);
     }
@@ -1363,12 +1382,15 @@
 	    }
 	    else if (!imapd_userid) goto nologin;
 	    else if (!strcmp(cmd.s, "List")) {
-		int listopts = LIST_CHILDREN;
+		struct listargs listargs;
+
+		memset(&listargs, 0, sizeof(struct listargs));
+		listargs.opts = LIST_CHILDREN;
 #ifdef ENABLE_LISTEXT
 		/* Check for and parse LISTEXT options */
 		c = prot_getc(imapd_in);
 		if (c == '(') {
-		    c = getlistopts(tag.s, &listopts);
+		    c = getlistopts(tag.s, &listargs.opts);
 		    if (c == EOF) {
 			eatline(imapd_in, c);
 			continue;
@@ -1377,23 +1399,34 @@
 		else
 		    prot_ungetc(c, imapd_in);
 #endif /* ENABLE_LISTEXT */
-		if (imapd_magicplus) listopts += LIST_SUBSCRIBED;
+		if (imapd_magicplus) listargs.opts += LIST_SUBSCRIBED;
+
 		c = getastring(imapd_in, imapd_out, &arg1);
 		if (c != ' ') goto missingargs;
 		c = getastring(imapd_in, imapd_out, &arg2);
 		if (c == '\r') c = prot_getc(imapd_in);
 		if (c != '\n') goto extraargs;
-		cmd_list(tag.s, listopts, arg1.s, arg2.s);
+
+		listargs.ref = arg1.s;
+		listargs.pat = arg2.s;
+		cmd_list(tag.s, &listargs);
 
 		snmp_increment(LIST_COUNT, 1);
 	    }
 	    else if (!strcmp(cmd.s, "Lsub")) {
+		struct listargs listargs;
+
 		c = getastring(imapd_in, imapd_out, &arg1);
 		if (c != ' ') goto missingargs;
 		c = getastring(imapd_in, imapd_out, &arg2);
 		if (c == '\r') c = prot_getc(imapd_in);
 		if (c != '\n') goto extraargs;
-		cmd_list(tag.s, LIST_LSUB | LIST_CHILDREN, arg1.s, arg2.s);
+
+		memset(&listargs, 0, sizeof(struct listargs));
+		listargs.opts = LIST_LSUB | LIST_CHILDREN;
+		listargs.ref = arg1.s;
+		listargs.pat = arg2.s;
+		cmd_list(tag.s, &listargs);
 
 		snmp_increment(LSUB_COUNT, 1);
 	    }
@@ -1560,23 +1593,37 @@
 		/* snmp_increment(RECONSTRUCT_COUNT, 1); */
 	    } 
 	    else if (!strcmp(cmd.s, "Rlist")) {
+		struct listargs listargs;
+
 		c = getastring(imapd_in, imapd_out, &arg1);
 		if (c != ' ') goto missingargs;
 		c = getastring(imapd_in, imapd_out, &arg2);
 		if (c == '\r') c = prot_getc(imapd_in);
 		if (c != '\n') goto extraargs;
-		cmd_list(tag.s, LIST_CHILDREN | LIST_REMOTE, arg1.s, arg2.s);
+
+		memset(&listargs, 0, sizeof(struct listargs));
+		listargs.opts = LIST_CHILDREN | LIST_REMOTE;
+		listargs.ref = arg1.s;
+		listargs.pat = arg2.s;
+		cmd_list(tag.s, &listargs);
 
 /* 		snmp_increment(LIST_COUNT, 1); */
 	    }
 	    else if (!strcmp(cmd.s, "Rlsub")) {
+		struct listargs listargs;
+
 		c = getastring(imapd_in, imapd_out, &arg1);
 		if (c != ' ') goto missingargs;
 		c = getastring(imapd_in, imapd_out, &arg2);
 		if (c == '\r') c = prot_getc(imapd_in);
 		if (c != '\n') goto extraargs;
-		cmd_list(tag.s, LIST_LSUB | LIST_CHILDREN | LIST_REMOTE,
-			 arg1.s, arg2.s);
+
+		memset(&listargs, 0, sizeof(struct listargs));
+		listargs.opts = LIST_LSUB | LIST_CHILDREN | LIST_REMOTE;
+		listargs.ref = arg1.s;
+		listargs.pat = arg2.s;
+		cmd_list(tag.s, &listargs);
+
 /* 		snmp_increment(LSUB_COUNT, 1); */
 	    }
 #ifdef HAVE_SSL
@@ -1732,6 +1779,25 @@
 		cmd_status(tag.s, arg1.s);
 
 		snmp_increment(STATUS_COUNT, 1);
+	    }
+	    else if (!strcmp(cmd.s, "Scan")) {
+		struct listargs listargs;
+
+		c = getastring(imapd_in, imapd_out, &arg1);
+		if (c != ' ') goto missingargs;
+		c = getastring(imapd_in, imapd_out, &arg2);
+		if (c != ' ') goto missingargs;
+		c = getastring(imapd_in, imapd_out, &arg3);
+		if (c == '\r') c = prot_getc(imapd_in);
+		if (c != '\n') goto extraargs;
+
+		memset(&listargs, 0, sizeof(struct listargs));
+		listargs.ref = arg1.s;
+		listargs.pat = arg2.s;
+		listargs.scan = arg3.s;
+		cmd_list(tag.s, &listargs);
+
+		snmp_increment(SCAN_COUNT, 1);
 	    }
 	    else goto badcmd;
 	    break;
@@ -1916,6 +1982,7 @@
     char userbuf[MAX_MAILBOX_NAME+1];
     unsigned userlen;
     const char *canon_user = userbuf;
+    const void *val;
     char c;
     struct buf passwdbuf;
     char *passwd;
@@ -1942,8 +2009,8 @@
     }
 
     /* possibly disallow login */
-    if ((imapd_starttls_done == 0) &&
-	(config_getswitch(IMAPOPT_ALLOWPLAINTEXT) == 0) &&
+    if (!imapd_starttls_done && (extprops_ssf < 2) &&
+	!config_getswitch(IMAPOPT_ALLOWPLAINTEXT) &&
 	!is_userid_anonymous(canon_user)) {
 	eatline(imapd_in, ' ');
 	prot_printf(imapd_out, "%s NO Login only available under a layer\r\n",
@@ -1984,6 +2051,15 @@
 	    return;
 	}
     }
+    else if ( nosaslpasswdcheck ) {
+	reply = "User logged in";
+	imapd_userid = xstrdup(canon_user);
+	imapd_authstate = auth_newstate(canon_user);
+	syslog(LOG_NOTICE, "login: %s %s%s nopassword%s %s", imapd_clienthost,
+	       imapd_userid, imapd_magicplus ? imapd_magicplus : "",
+	       imapd_starttls_done ? "+TLS" : "", 
+	       reply ? reply : "");
+    }
     else if ((r = sasl_checkpass(imapd_saslconn,
 				 canon_user,
 				 strlen(canon_user),
@@ -2010,8 +2086,7 @@
 	return;
     }
     else {
-	r = sasl_getprop(imapd_saslconn, SASL_USERNAME,
-			 (const void **) &canon_user);
+	r = sasl_getprop(imapd_saslconn, SASL_USERNAME, &val);
 
 	if(r != SASL_OK) {
 	    if ((reply = sasl_errstring(r, NULL, NULL)) != NULL) {
@@ -2029,7 +2104,7 @@
 	}
 
 	reply = "User logged in";
-	imapd_userid = xstrdup(canon_user);
+	imapd_userid = xstrdup((const char *) val);
 	snmp_increment_args(AUTHENTICATION_YES, 1,
 			    VARIABLE_AUTH, 0 /*hash_simple("LOGIN") */, 
 			    VARIABLE_LISTEND);
@@ -2050,8 +2125,7 @@
 	}
     }
     
-    imapd_authstate = auth_newstate(imapd_userid);
-
+    /* authstate already created by mysasl_proxy_policy() */
     imapd_userisadmin = global_authisa(imapd_authstate, IMAPOPT_ADMINS);
 
     prot_printf(imapd_out, "%s OK [CAPABILITY ", tag);
@@ -2088,7 +2162,7 @@
 {
     int sasl_result;
     
-    const int *ssfp;
+    const void *val;
     char *ssfmsg=NULL;
 
     const char *canon_user;
@@ -2143,8 +2217,7 @@
     /* get the userid from SASL --- already canonicalized from
      * mysasl_proxy_policy()
      */
-    sasl_result = sasl_getprop(imapd_saslconn, SASL_USERNAME,
-			       (const void **) &canon_user);
+    sasl_result = sasl_getprop(imapd_saslconn, SASL_USERNAME, &val);
     if (sasl_result != SASL_OK) {
 	prot_printf(imapd_out, "%s NO weird SASL error %d SASL_USERNAME\r\n", 
 		    tag, sasl_result);
@@ -2153,6 +2226,7 @@
 	reset_saslconn(&imapd_saslconn);
 	return;
     }
+    canon_user = (const char *) val;
 
     /* If we're proxying, the authzid may contain a magic plus,
        so re-canonify it */
@@ -2182,18 +2256,19 @@
 	   imapd_userid, imapd_magicplus ? imapd_magicplus : "",
 	   authtype, imapd_starttls_done ? "+TLS" : "", "User logged in");
 
-    sasl_getprop(imapd_saslconn, SASL_SSF, (const void **) &ssfp);
+    sasl_getprop(imapd_saslconn, SASL_SSF, &val);
+    saslprops.ssf = *((sasl_ssf_t *) val);
 
     /* really, we should be doing a sasl_getprop on SASL_SSF_EXTERNAL,
        but the current libsasl doesn't allow that. */
     if (imapd_starttls_done) {
-	switch(*ssfp) {
+	switch(saslprops.ssf) {
 	case 0: ssfmsg = "tls protection"; break;
 	case 1: ssfmsg = "tls plus integrity protection"; break;
 	default: ssfmsg = "tls plus privacy protection"; break;
 	}
     } else {
-	switch(*ssfp) {
+	switch(saslprops.ssf) {
 	case 0: ssfmsg = "no protection"; break;
 	case 1: ssfmsg = "integrity protection"; break;
 	default: ssfmsg = "privacy protection"; break;
@@ -2204,7 +2279,7 @@
 			VARIABLE_AUTH, 0, /* hash_simple(authtype) */
 			VARIABLE_LISTEND);
 
-    if (!*ssfp) {
+    if (!saslprops.ssf) {
 	prot_printf(imapd_out, "%s OK [CAPABILITY ", tag);
 	capa_response(CAPA_PREAUTH|CAPA_POSTAUTH);
 	prot_printf(imapd_out, "] Success (%s)\r\n", ssfmsg);
@@ -2405,7 +2480,8 @@
 
     /* spit out our ID string.
        eventually this might be configurable. */
-    if (config_getswitch(IMAPOPT_IMAPIDRESPONSE)) {
+    if (config_getswitch(IMAPOPT_IMAPIDRESPONSE) &&
+	(imapd_authstate || (config_serverinfo == IMAP_ENUM_SERVERINFO_ON))) {
 	id_response(imapd_out);
 	prot_printf(imapd_out, ")\r\n");
     }
@@ -2444,13 +2520,13 @@
 
 	/* Start doing mailbox updates */
 	if (imapd_mailbox) index_check(imapd_mailbox, 0, 1);
-	idle_start(imapd_mailbox);
+	idle_start(imapd_mailbox ? imapd_mailbox->name : NULL);
 
 	/* Get continuation data */
 	c = getword(imapd_in, &arg);
 
 	/* Stop updates and do any necessary cleanup */
-	idle_done(imapd_mailbox);
+	idle_done(imapd_mailbox ? imapd_mailbox->name : NULL);
     }
     else {  /* Remote mailbox */
 	int done = 0, shutdown = 0;
@@ -2573,15 +2649,16 @@
 	prot_printf(imapd_out, " STARTTLS");
     }
     if (imapd_authstate ||
-	(!imapd_starttls_done && !config_getswitch(IMAPOPT_ALLOWPLAINTEXT))) {
+	(!imapd_starttls_done && (extprops_ssf < 2) &&
+	 !config_getswitch(IMAPOPT_ALLOWPLAINTEXT))) {
 	prot_printf(imapd_out, " LOGINDISABLED");
     }
 
     /* add the SASL mechs */
-    if (!imapd_authstate &&
+    if ((!imapd_authstate || saslprops.ssf) &&
 	sasl_listmech(imapd_saslconn, NULL, 
-		      "AUTH=", " AUTH=", " SASL-IR",
-		      &sasllist,
+		      "AUTH=", " AUTH=",
+		      !imapd_authstate ? " SASL-IR" : "", &sasllist,
 		      NULL, &mechcount) == SASL_OK && mechcount > 0) {
 	prot_printf(imapd_out, " %s", sasllist);      
     } else {
@@ -2716,7 +2793,7 @@
     static struct buf arg;
     unsigned size = 0;
     char buf[4096+1];
-    int n;
+    unsigned n;
     int r;
 
     c = getword(imapd_in, &arg);
@@ -2773,7 +2850,7 @@
 	r = IMAP_BADURL;
 #if 0
     } else if (url.server && strcmp(url.server, config_servername)) {
-	*parseerr = "Can not catenate messages from another server";
+	*parseerr = "Cannot catenate messages from another server";
 	r = IMAP_BADURL;
 #endif
     } else if (!url.mailbox && !imapd_mailbox && !cur_name) {
@@ -2797,7 +2874,7 @@
 		    /* remote mailbox */
 		    struct backend *be;
 
-		    be = proxy_findserver(newserver, &protocol[PROTOCOL_IMAP],
+		    be = proxy_findserver(newserver, &imap_protocol,
 					 proxy_userid, &backend_cached,
 					 &backend_current, &backend_inbox, imapd_in);
 		    if (!s) {
@@ -2954,11 +3031,11 @@
 {
     int c;
     static struct buf arg;
-    char *p;
     time_t now = time(NULL);
     unsigned size, totalsize = 0;
     int sync_seen = 0;
-    int r, i;
+    int r;
+    unsigned i;
     char mailboxname[MAX_MAILBOX_NAME+1];
     struct appendstate mailbox;
     unsigned long uidvalidity;
@@ -2967,7 +3044,7 @@
     const char *parseerr = NULL, *url = NULL;
     int mbtype;
     char *newserver;
-    int numalloc = 5;
+    unsigned numalloc = 5;
     struct appendstage *curstage;
 
     /* See if we can append */
@@ -2989,7 +3066,7 @@
 	    return;
 	}
 
-	s = proxy_findserver(newserver, &protocol[PROTOCOL_IMAP],
+	s = proxy_findserver(newserver, &imap_protocol,
 			     proxy_userid, &backend_cached,
 			     &backend_current, &backend_inbox, imapd_in);
 	if (!s) r = IMAP_SERVER_UNAVAILABLE;
@@ -3000,11 +3077,13 @@
 	    int is_active = 1;
 	    s->context = (void*) &is_active;
 	    if (imapd_mailbox) {
-		prot_printf(s->out, "%s Localappend {%d+}\r\n%s {%d+}\r\n%s ",
+		prot_printf(s->out, "%s Localappend {" SIZE_T_FMT "+}\r\n%s"
+			    " {" SIZE_T_FMT "+}\r\n%s ",
 			    tag, strlen(name), name,
 			    strlen(imapd_mailbox->name), imapd_mailbox->name);
 	    } else {
-		prot_printf(s->out, "%s Localappend {%d+}\r\n%s {%d+}\r\n%s ",
+		prot_printf(s->out, "%s Localappend {" SIZE_T_FMT "+}\r\n%s"
+			    " {" SIZE_T_FMT "+}\r\n%s ",
 			    tag, strlen(name), name, 0, "");
 	    }
 	    if (!(r = pipe_command(s, 16384))) {
@@ -3193,10 +3272,15 @@
 	if (body) free(body);
 
 	if (!r) {
+	    int sharedseen = (mailbox.m.options & OPT_IMAP_SHAREDSEEN);
+
 	    r = append_commit(&mailbox, totalsize, &uidvalidity, &firstuid, &num);
             if (!r) {
 		sync_log_append(mailboxname);
-		if (sync_seen) sync_log_seen(imapd_userid, mailboxname);
+		if (sync_seen) {
+		    sync_log_seen(sharedseen ? "anyone" : imapd_userid,
+				  mailboxname);
+		}
 	    }
 	} else {
 	    append_abort(&mailbox);
@@ -3277,8 +3361,8 @@
 	c = getword(imapd_in, &arg);
 	if (arg.s[0] == '\0') goto badlist;
 	for (;;) {
-	    lcase(arg.s);
-	    if (!strcmp(arg.s, "condstore")) {
+	    ucase(arg.s);
+	    if (!strcmp(arg.s, "CONDSTORE")) {
 		imapd_condstore_client = 1;
 	    }
 	    else {
@@ -3340,7 +3424,7 @@
 	    return;
 	}
 
-	backend_next = proxy_findserver(newserver, &protocol[PROTOCOL_IMAP],
+	backend_next = proxy_findserver(newserver, &imap_protocol,
 					proxy_userid, &backend_cached,
 					&backend_current, &backend_inbox,
 					imapd_in);
@@ -3363,8 +3447,8 @@
 	    return;
 	}
 
-	prot_printf(backend_current->out, "%s %s {%d+}\r\n%s%s\r\n", tag, cmd, 
-		    strlen(name), name,
+	prot_printf(backend_current->out, "%s %s {" SIZE_T_FMT "+}\r\n%s%s\r\n",
+		    tag, cmd, strlen(name), name,
 		    imapd_condstore_client ? " (CONDSTORE)" : "");
 	switch (pipe_including_tag(backend_current, tag, 0)) {
 	case PROXY_OK:
@@ -3501,7 +3585,7 @@
     /* local mailbox */
     if (!(imapd_mailbox->myrights & ACL_EXPUNGE)) r = 0;
     else {
-	r = mailbox_expunge(imapd_mailbox, (int (*)())0, (char *)0, 0);
+	r = mailbox_expunge(imapd_mailbox, NULL, NULL, 0);
 	if (!r) sync_log_mailbox(imapd_mailbox->name);
     }
 
@@ -3648,7 +3732,7 @@
 		}
 		while (isdigit((int) *p) || *p == '.') {
 		    if (*p == '.' && !isdigit((int) p[-1])) break;
-		    /* Part number can not begin with '0' */
+		    /* Part number cannot begin with '0' */
 		    if (*p == '0' && !isdigit((int) p[-1])) break;
 		    p++;
 		}
@@ -3933,6 +4017,14 @@
     if (inlist && c == ')') {
 	inlist = 0;
 	c = prot_getc(imapd_in);
+    }
+    if (inlist) {
+	prot_printf(imapd_out, "%s BAD Missing close parenthesis in %s\r\n",
+		    tag, cmd);
+	eatline(imapd_in, c);
+	goto freeargs;
+    }
+
 	if (c == ' ') {
 	    /* Grab/parse the modifier(s) */
 	    c = prot_getc(imapd_in);
@@ -3943,7 +4035,6 @@
 		eatline(imapd_in, c);
 		goto freeargs;
 	    }
-	    inlist = 1;
 	    do {
 		c = getword(imapd_in, &fetchatt);
 		ucase(fetchatt.s);
@@ -3974,18 +4065,15 @@
 		    goto freeargs;
 		}
 	    } while (c == ' ');
-	    if (c == ')') {
-		inlist = 0;
-		c = prot_getc(imapd_in);
-	    }
-	}
-    }
-    if (inlist) {
+	if (c != ')') {
 	prot_printf(imapd_out, "%s BAD Missing close parenthesis in %s\r\n",
 		    tag, cmd);
 	eatline(imapd_in, c);
 	goto freeargs;
     }
+	c = prot_getc(imapd_in);
+    }
+
     if (c == '\r') c = prot_getc(imapd_in);
     if (c != '\n') {
 	prot_printf(imapd_out, "%s BAD Unexpected extra arguments to %s\r\n", tag, cmd);
@@ -4006,15 +4094,21 @@
 			imapd_mailbox->highestmodseq);
     }
 
-    if (usinguid || config_getswitch(IMAPOPT_FLUSHSEENSTATE)) {
-	if (usinguid) fetchitems |= FETCH_UID; 
-	index_check(imapd_mailbox, usinguid, /* update \Seen state from disk? */
-		    config_getswitch(IMAPOPT_FLUSHSEENSTATE) << 1 /* quiet */);
+    /* EXPUNGE responses allowed for UID FETCH */
+    if (usinguid) {
+	fetchitems |= FETCH_UID;
+	index_check(imapd_mailbox, 1, 0);
     }
 
     fetchargs.fetchitems = fetchitems;
     r = index_fetch(imapd_mailbox, sequence, usinguid, &fetchargs,
 		&fetchedsomething);
+
+    if (config_getswitch(IMAPOPT_FLUSHSEENSTATE)) {
+        /* Flush \Seen state to disk immediately (but only if anything
+           changed) and check for updates by other processes */
+        index_check_existing(imapd_mailbox, usinguid, 1);  
+    }
 
     snprintf(mytime, sizeof(mytime), "%2.3f", 
 	     (clock() - start) / (double) CLOCKS_PER_SEC);
@@ -4025,11 +4119,6 @@
     } else if (fetchedsomething || usinguid) {
 	prot_printf(imapd_out, "%s OK %s (%s sec)\r\n", tag,
 		    error_message(IMAP_OK_COMPLETED), mytime);
-	if (config_getswitch(IMAPOPT_FLUSHSEENSTATE) &&
-	    (fetchargs.fetchitems & FETCH_SETSEEN)) {
-	    /* flush \Seen state to disk */
-	    index_check(imapd_mailbox, usinguid, 2 /* quiet */);
-	}
     } else {
 	/* normal FETCH, nothing came back */
 	prot_printf(imapd_out, "%s NO %s (%s sec)\r\n", tag,
@@ -4157,9 +4246,11 @@
 
     index_fetch(imapd_mailbox, msgno, 0, &fetchargs, &fetchedsomething);
 
-    index_check(imapd_mailbox, 0,  /* flush \Seen state to disk? */
-		config_getswitch(IMAPOPT_FLUSHSEENSTATE) &&
-		fetchedsomething && (fetchargs.fetchitems & FETCH_SETSEEN));
+    if (config_getswitch(IMAPOPT_FLUSHSEENSTATE)) {
+        /* Flush \Seen state to disk immediately (but only if anything
+           changed) and check for updates by other processes */
+        index_check_existing(imapd_mailbox, 0, 1);
+    }
 
     if (fetchedsomething) {
 	prot_printf(imapd_out, "%s OK %s\r\n", tag,
@@ -4211,9 +4302,9 @@
 
 	do {
 	    c = getword(imapd_in, &storemod);
-	    lcase(storemod.s);
+	    ucase(storemod.s);
 	    if ((imapd_mailbox->options & OPT_IMAP_CONDSTORE) &&
-		!strcmp(storemod.s, "unchangedsince")) {
+		!strcmp(storemod.s, "UNCHANGEDSINCE")) {
 		if (c != ' ') {
 		    prot_printf(imapd_out,
 				"%s BAD Missing required argument to %s %s\r\n",
@@ -4369,13 +4460,12 @@
     r = index_store(imapd_mailbox, sequence, usinguid, &storeargs,
 		    flag, nflags);
 
-    if (config_getswitch(IMAPOPT_FLUSHSEENSTATE) &&
-	(storeargs.seen || storeargs.operation == STORE_REPLACE)) {
-	/* flush \Seen state to disk */
-	index_check(imapd_mailbox, usinguid, 1);
-    }
-    else if (usinguid) {
-	index_check(imapd_mailbox, 1, 0);
+    if (usinguid) {
+	index_check(imapd_mailbox, 1, 1);   /* Check \Seen too */
+    } else if (config_getswitch(IMAPOPT_FLUSHSEENSTATE)) {
+        /* Flush \Seen state to disk immediately (but only if anything
+           changed) and check for updates by other processes */
+        index_check_existing(imapd_mailbox, 0, 1);
     }
 
     if (r) {
@@ -4666,7 +4756,7 @@
 	   (remove when we move to a unified environment) */
 	struct backend *s = NULL;
 
-	s = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+	s = proxy_findserver(server, &imap_protocol,
 			     proxy_userid, &backend_cached,
 			     &backend_current, &backend_inbox, imapd_in);
 	if (!s) {
@@ -4684,7 +4774,7 @@
 	/* xxx  end of separate proxy-only code */
 
 	/* simply send the COPY to the backend */
-	prot_printf(backend_current->out, "%s %s %s {%d+}\r\n%s\r\n",
+	prot_printf(backend_current->out, "%s %s %s {" SIZE_T_FMT "+}\r\n%s\r\n",
 		    tag, usinguid ? "UID Copy" : "Copy",
 		    sequence, strlen(name), name);
 	pipe_including_tag(backend_current, tag, 0);
@@ -4703,7 +4793,7 @@
 
 	index_check(imapd_mailbox, usinguid, 0);
 
-	s = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+	s = proxy_findserver(server, &imap_protocol,
 			     proxy_userid, &backend_cached,
 			     &backend_current, &backend_inbox, imapd_in);
 	if (!s) r = IMAP_SERVER_UNAVAILABLE;
@@ -4715,7 +4805,8 @@
 	if (r) goto done;
 
 	/* start the append */
-	prot_printf(s->out, "%s Append {%d+}\r\n%s", tag, strlen(name), name);
+	prot_printf(s->out, "%s Append {" SIZE_T_FMT "+}\r\n%s",
+		    tag, strlen(name), name);
 
 	/* append the messages */
 	r = index_copy_remote(imapd_mailbox, sequence, usinguid, s->out);
@@ -4809,7 +4900,10 @@
     /* local mailbox */
     if (!(imapd_mailbox->myrights & ACL_EXPUNGE)) r = IMAP_PERMISSION_DENIED;
     else if (sequence) {
-	r = mailbox_expunge(imapd_mailbox, index_expungeuidlist, sequence, 0);
+	struct seq_set *seq_set = index_parse_sequence(sequence, 1, NULL);
+
+	r = mailbox_expunge(imapd_mailbox, index_expungeuidlist, seq_set, 0);
+	freesequencelist(seq_set);
     }
     else {
 	r = mailbox_expunge(imapd_mailbox, (mailbox_decideproc_t *)0,
@@ -4836,7 +4930,6 @@
     int r = 0;
     char mailboxname[MAX_MAILBOX_NAME+1];
     int autocreatequota;
-    int sync_lockfd = (-1);
 
     if (partition && !imapd_userisadmin) {
 	r = IMAP_PERMISSION_DENIED;
@@ -4876,10 +4969,17 @@
 	    if (partition) *partition++ = '\0';
 	    if (guessedpart) partition = NULL;
 
-	    s = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+	    s = proxy_findserver(server, &imap_protocol,
 				 proxy_userid, &backend_cached,
 				 &backend_current, &backend_inbox, imapd_in);
 	    if (!s) r = IMAP_SERVER_UNAVAILABLE;
+
+	    if (!r && imapd_userisadmin && supports_referrals) {
+		/* They aren't an admin remotely, so let's refer them */
+		imapd_refer(tag, server, name);
+		referral_kick = 1;
+		return;
+	    }
 
 	    if (!r) {
 		if (!CAPA(s, CAPA_MUPDATE)) {
@@ -4889,13 +4989,14 @@
 
 	    if (!r) {
 		/* ok, send the create to that server */
-		if (partition)
+		if (partition) {
+		    /* Send partition as an atom, since its all we accept */
 		    prot_printf(s->out,
-				"%s CREATE {%d+}\r\n%s {%d+}\r\n%s\r\n", 
-				tag, strlen(name), name,
-				strlen(partition), partition);
+				"%s CREATE {" SIZE_T_FMT "+}\r\n%s %s\r\n", 
+				tag, strlen(name), name, partition);
+		}
 		else
-		    prot_printf(s->out, "%s CREATE {%d+}\r\n%s\r\n", 
+		    prot_printf(s->out, "%s CREATE {" SIZE_T_FMT "+}\r\n%s\r\n", 
 				tag, strlen(name), name);
 		res = pipe_until_tag(s, tag, 0);
 	
@@ -4926,7 +5027,10 @@
 	}
 
 	/* local mailbox -- fall through */
-	if (guessedpart) partition = NULL;
+	if (guessedpart) {
+	    partition = NULL;
+	    r = 0;
+	}
     }
 
     /* local mailbox */
@@ -4966,10 +5070,12 @@
 	prot_printf(imapd_out, "%s OK %s\r\n", tag,
 		    error_message(IMAP_OK_COMPLETED));
 
+	if ( !localonly ) {
 	if (mboxname_isusermailbox(mailboxname, 1))
-	    sync_log_user(name+5);
+		sync_log_user(mboxname_inbox_touserid(mailboxname));
 	else
 	    sync_log_mailbox(mailboxname);
+    }
     }
 }	
 
@@ -4981,9 +5087,19 @@
 {
     int r;
 
+    if (!mboxlist_delayed_delete_isenabled()) {
+        r = mboxlist_deletemailbox(name, imapd_userisadmin,
+                                   imapd_userid, imapd_authstate,
+                                   0, 0, 0);
+    } else if (imapd_userisadmin && mboxname_isdeletedmailbox(name)) {
     r = mboxlist_deletemailbox(name, imapd_userisadmin,
 			       imapd_userid, imapd_authstate,
 			       0, 0, 0);
+    } else {
+        r = mboxlist_delayed_deletemailbox(name, imapd_userisadmin,
+                                           imapd_userid, imapd_authstate,
+                                           0, 0, 0);
+    }
     
     if (!r) sync_log_mailbox(name);
 
@@ -5005,8 +5121,7 @@
     int mbtype;
     char *server;
     char *p;
-    int domainlen = 0;
-    int sync_lockfd = (-1);
+    size_t domainlen = 0;
 
     r = (*imapd_namespace.mboxname_tointernal)(&imapd_namespace, name,
 					       imapd_userid, mailboxname);
@@ -5027,13 +5142,13 @@
 	    return;
 	}
 
-	s = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+	s = proxy_findserver(server, &imap_protocol,
 			     proxy_userid, &backend_cached,
 			     &backend_current, &backend_inbox, imapd_in);
 	if (!s) r = IMAP_SERVER_UNAVAILABLE;
 
 	if (!r) {
-	    prot_printf(s->out, "%s DELETE {%d+}\r\n%s\r\n", 
+	    prot_printf(s->out, "%s DELETE {" SIZE_T_FMT "+}\r\n%s\r\n", 
 			tag, strlen(name), name);
 	    res = pipe_until_tag(s, tag, 0);
 
@@ -5063,9 +5178,20 @@
 	if (config_virtdomains && (p = strchr(mailboxname, '!')))
 	    domainlen = p - mailboxname + 1;
 
+        if (localonly || !mboxlist_delayed_delete_isenabled()) {
+            r = mboxlist_deletemailbox(mailboxname, imapd_userisadmin,
+                                       imapd_userid, imapd_authstate, 
+                                       1-force, localonly, 0);
+        } else if (imapd_userisadmin &&
+                   mboxname_isdeletedmailbox(mailboxname)) {
 	r = mboxlist_deletemailbox(mailboxname, imapd_userisadmin,
-				   imapd_userid, imapd_authstate, 1-force,
-				   localonly, 0);
+                                       imapd_userid, imapd_authstate,
+                                       0 /* checkacl */, localonly, 0);
+        } else {
+            r = mboxlist_delayed_deletemailbox(mailboxname, imapd_userisadmin,
+                                               imapd_userid, imapd_authstate,
+                                               1-force, localonly, 0);
+        }
     }
 
     /* was it a top-level user mailbox? */
@@ -5073,7 +5199,7 @@
     if (!r && !localonly &&
 	!strncmp(mailboxname+domainlen, "user.", 5) &&
 	!strchr(mailboxname+domainlen+5, '.')) {
- 	int mailboxname_len = strlen(mailboxname);
+ 	size_t mailboxname_len = strlen(mailboxname);
 
  	/* If we aren't too close to MAX_MAILBOX_NAME, append .* */
  	p = mailboxname + mailboxname_len; /* end of mailboxname */
@@ -5199,9 +5325,7 @@
     char newmailboxname2[MAX_MAILBOX_NAME+1];
     char oldextname[MAX_MAILBOX_NAME+1];
     char newextname[MAX_MAILBOX_NAME+1];
-    int sync_lockfd = (-1);
     int omlen, nmlen;
-    char *p;
     int recursive_rename = 1;
     int rename_user = 0;
     char olduser[128], newuser[128];
@@ -5234,7 +5358,7 @@
 	struct backend *s = NULL;
 	int res;
 
-	s = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+	s = proxy_findserver(server, &imap_protocol,
 			     proxy_userid, &backend_cached,
 			     &backend_current, &backend_inbox, imapd_in);
 	if (!s) r = IMAP_SERVER_UNAVAILABLE;
@@ -5279,7 +5403,9 @@
 		    /* Cross Server */
 		    /* <tag> XFER <name> <dest server> <dest partition> */
 		    prot_printf(s->out,
-				"%s XFER {%d+}\r\n%s {%d+}\r\n%s {%d+}\r\n%s\r\n", 
+				"%s XFER {" SIZE_T_FMT "+}\r\n%s"
+				" {" SIZE_T_FMT "+}\r\n%s"
+				" {" SIZE_T_FMT "+}\r\n%s\r\n", 
 				tag, strlen(oldname), oldname,
 				strlen(newserver), newserver,
 				strlen(destpart), destpart);
@@ -5287,7 +5413,8 @@
 	    
 	    } else {
 		/* <tag> XFER <name> <dest server> */
-		prot_printf(s->out, "%s XFER {%d+}\r\n%s {%d+}\r\n%s\r\n", 
+		prot_printf(s->out, "%s XFER {" SIZE_T_FMT "+}\r\n%s"
+			    " {" SIZE_T_FMT "+}\r\n%s\r\n", 
 			    tag, strlen(oldname), oldname,
 			    strlen(partition), partition);
 	    }
@@ -5306,7 +5433,8 @@
 		/* do MUPDATE create operations for new mailbox */
 	    }
 
-	    prot_printf(s->out, "%s RENAME {%d+}\r\n%s {%d+}\r\n%s\r\n", 
+	    prot_printf(s->out, "%s RENAME {" SIZE_T_FMT "+}\r\n%s"
+			" {" SIZE_T_FMT "+}\r\n%s\r\n", 
 			tag, strlen(oldname), oldname,
 			strlen(newname), newname);
 	    res = pipe_until_tag(s, tag, 0);
@@ -5405,7 +5533,7 @@
 	strcpy(olduser, domain ? domain+6 : oldmailboxname+5);
 	if (domain)
 	    sprintf(olduser+strlen(olduser), "@%.*s",
-		    domain - oldmailboxname, oldmailboxname);
+		    (int) (domain - oldmailboxname), oldmailboxname);
 	strcpy(acl_olduser, olduser);
 
 	/* Translate any separators in source old userid (for ACLs) */
@@ -5417,7 +5545,7 @@
 	strcpy(newuser, domain ? domain+6 : newmailboxname+5);
 	if (domain)
 	    sprintf(newuser+strlen(newuser), "@%.*s",
-		    domain - newmailboxname, newmailboxname);
+		    (int) (domain - newmailboxname), newmailboxname);
 	strcpy(acl_newuser, newuser);
 
 	/* Translate any separators in destination new userid (for ACLs) */
@@ -5493,6 +5621,12 @@
 	prot_printf(imapd_out, "%s OK %s\r\n", tag,
 		    error_message(IMAP_OK_COMPLETED));
         sync_log_mailbox_double(oldmailboxname2, newmailboxname2);
+
+	/* if user is renaming inbox, sync seen state on new mailbox */
+	if (!strcasecmp(oldname, "inbox")) {
+	    /* XXX  Need to check for sharedseen somehow */
+	    sync_log_seen(imapd_userid, newmailboxname2);
+	}
     }
 }	
 
@@ -5553,7 +5687,7 @@
 	    fclose(stderr);
 
 	    ret = snprintf(buf, sizeof(buf), "%s/reconstruct", SERVICE_PATH);
-	    if(ret < 0 || ret >= sizeof(buf)) {
+	    if(ret < 0 || ret >= (int) sizeof(buf)) {
 		/* in child, so fatailing won't disconnect our user */ 
 	        fatal("reconstruct buffer not sufficiently big", EC_CONFIG);
 	    }
@@ -5615,7 +5749,7 @@
 	    fclose(stderr);
 
 	    ret = snprintf(buf, sizeof(buf), "%s/quota", SERVICE_PATH);
-	    if(ret < 0 || ret >= sizeof(buf)) {
+	    if(ret < 0 || ret >= (int) sizeof(buf)) {
 		/* in child, so fatailing won't disconnect our user */ 
 	        fatal("quota buffer not sufficiently big", EC_CONFIG);
 	    }
@@ -5640,7 +5774,7 @@
     } else {
 	prot_printf(imapd_out, "%s OK %s\r\n", tag,
 		    error_message(IMAP_OK_COMPLETED));
-        sync_log_user(imapd_userid);
+        sync_log_mailbox(mailboxname);
     }
 }	
 
@@ -5660,7 +5794,7 @@
 	if (backend_inbox || (backend_inbox = proxy_findinboxserver())) {
 	    /* remote INBOX */
 	    prot_printf(backend_inbox->out, 
-			"%s Lsub \"\" {%d+}\r\n%s\r\n",
+			"%s Lsub \"\" {" SIZE_T_FMT "+}\r\n%s\r\n",
 			tag, strlen(pattern), pattern);
 	    pipe_lsub(backend_inbox, tag, 0, "MAILBOX");
 	} else {
@@ -5708,11 +5842,8 @@
 /*
  * Perform a LIST or LSUB command
  */
-void cmd_list(char *tag, int listopts, char *reference, char *pattern)
+void cmd_list(char *tag, struct listargs *listargs)
 {
-    char *buf = NULL;
-    int patlen = 0;
-    int reflen = 0;
     static int ignorereference = 0;
     clock_t start = clock();
     char mytime[100];
@@ -5725,7 +5856,11 @@
 		   struct auth_state *auth_state, int (*proc)(),
 		   void *rock, int force);
 
-    if (listopts & LIST_REMOTE) supports_referrals = !disable_referrals;
+    if (listargs->opts & LIST_REMOTE) {
+	if (!config_getswitch(IMAPOPT_PROXYD_DISABLE_MAILBOX_REFERRALS)) {
+	    supports_referrals = !disable_referrals;
+	}
+    }
 
     /* Ignore the reference argument?
        (the behavior in 1.5.10 & older) */
@@ -5736,54 +5871,58 @@
     /* Reset state in mstringdata */
     mstringdata(NULL, NULL, 0, 0, 0);
 
-    if (!pattern[0] && !(listopts & LIST_LSUB)) {
+    if (!listargs->pat[0] && !(listargs->opts & LIST_LSUB)) {
 	/* Special case: query top-level hierarchy separator */
 	prot_printf(imapd_out, "* LIST (\\Noselect) \"%c\" \"\"\r\n",
 		    imapd_namespace.hier_sep);
-    } else if ((listopts & (LIST_LSUB | LIST_SUBSCRIBED)) &&
+    } else if ((listargs->opts & (LIST_LSUB | LIST_SUBSCRIBED)) &&
 	       (backend_inbox || (backend_inbox = proxy_findinboxserver()))) {
 	/* remote INBOX */
-	if ((listopts & LIST_SUBSCRIBED) && (listopts & LIST_EXT) &&
+	if ((listargs->opts & LIST_SUBSCRIBED) && (listargs->opts & LIST_EXT) &&
 	    CAPA(backend_inbox, CAPA_LISTSUBSCRIBED)) {
 	    prot_printf(backend_inbox->out, "%s List (subscribed", tag);
-	    if (listopts & LIST_CHILDREN)
+	    if (listargs->opts & LIST_CHILDREN)
 		prot_printf(backend_inbox->out, " children");
-	    if (listopts & LIST_REMOTE)
+	    if (listargs->opts & LIST_REMOTE)
 		prot_printf(backend_inbox->out, " remote");
 	    prot_printf(backend_inbox->out, ") ");
 	} else {
 	    prot_printf(backend_inbox->out, "%s Lsub ", tag);
 	}
 	prot_printf(backend_inbox->out, 
-		    "{%d+}\r\n%s {%d+}\r\n%s\r\n",
-		    strlen(reference), reference,
-		    strlen(pattern), pattern);
-	pipe_lsub(backend_inbox, tag, 0, (listopts & LIST_LSUB) ? "LSUB" : "LIST");
+		    "{" SIZE_T_FMT "+}\r\n%s {" SIZE_T_FMT "+}\r\n%s\r\n",
+		    strlen(listargs->ref), listargs->ref,
+		    strlen(listargs->pat), listargs->pat);
+	pipe_lsub(backend_inbox, tag, 0,
+		  (listargs->opts & LIST_LSUB) ? "LSUB" : "LIST");
     } else {
+	char *pattern = NULL;
+
 	/* Do we need to concatenate fields? */
-	if (!ignorereference || pattern[0] == imapd_namespace.hier_sep) {
+	if (!ignorereference || listargs->pat[0] == imapd_namespace.hier_sep) {
 	    /* Either
 	     * - name begins with dot
 	     * - we're configured to honor the reference argument */
 
 	    /* Allocate a buffer, figure out how to stick the arguments
 	       together, do it, then do that instead of using pattern. */
-	    patlen = strlen(pattern);
-	    reflen = strlen(reference);
+	    int patlen = strlen(listargs->pat);
+	    int reflen = strlen(listargs->ref);
 	    
-	    buf = xmalloc(patlen + reflen + 1);
-	    buf[0] = '\0';
-
-	    if (*reference) {
+	    pattern = xmalloc(patlen + reflen + 1);
+	    pattern[0] = '\0';
+
+	    if (*listargs->ref) {
+		strcpy(pattern, listargs->ref);
 		/* check for LIST A. .B, change to LIST "" A.B */
-		if (reference[reflen-1] == imapd_namespace.hier_sep &&
-		    pattern[0] == imapd_namespace.hier_sep) {
-		    reference[--reflen] = '\0';
+		if (listargs->ref[reflen-1] == imapd_namespace.hier_sep &&
+		    listargs->pat[0] == imapd_namespace.hier_sep) {
+		    pattern[--reflen] = '\0';
 		}
-		strcpy(buf, reference);
-	    }
-	    strcat(buf, pattern);
-	    pattern = buf;
+	    }
+	    strcat(pattern, listargs->pat);
+	} else {
+	    pattern = xstrdup(listargs->pat);
 	}
 
 	/* Translate any separators in pattern */
@@ -5794,9 +5933,8 @@
 	/* Check to see if we should only list the personal namespace */
 	if (!strcmp(pattern, "*")
 	    && config_getswitch(IMAPOPT_FOOLSTUPIDCLIENTS)) {
-	    if (buf) free(buf);
-	    buf = xstrdup("INBOX*");
-	    pattern = buf;
+	    if (pattern) free(pattern);
+	    pattern = xstrdup("INBOX*");
 	    findsub = mboxlist_findsub;
 	    findall = mboxlist_findall;
 	}
@@ -5805,25 +5943,37 @@
 	    findall = imapd_namespace.mboxlist_findall;
 	}
 
-	if (listopts & (LIST_LSUB | LIST_SUBSCRIBED)) {
+	if (listargs->opts & (LIST_LSUB | LIST_SUBSCRIBED)) {
 	    int force = config_getswitch(IMAPOPT_ALLOWALLSUBSCRIBE);
 
 	    (*findsub)(&imapd_namespace, pattern,
 		       imapd_userisadmin, imapd_userid, imapd_authstate,
-		       listdata, &listopts, force);
+		       listdata, listargs, force);
 	}
 	else {
+	    if (listargs->scan) {
+		construct_hash_table(&listargs->server_table, 10, 1);
+	    }
+
 	    (*findall)(&imapd_namespace, pattern,
 		       imapd_userisadmin, imapd_userid, imapd_authstate,
-		       listdata, &listopts);
-	}
-
-	listdata((char *)0, 0, 0, &listopts);
-
-	if (buf) free(buf);
-    }
-
-    imapd_check(!(listopts & (LIST_LSUB | LIST_SUBSCRIBED)) ?
+		       listdata, listargs);
+
+	    free_hash_table(&listargs->server_table, NULL);
+	}
+
+	listdata((char *)0, 0, 0, listargs);
+
+	if (pattern) free(pattern);
+    }
+
+    if (listargs->scan && imapd_mailbox) {
+	/* SCAN will mess with the globals in index.c,
+	   so reset them for our currently mailbox */
+	index_operatemailbox(imapd_mailbox);
+    }
+
+    imapd_check(!(listargs->opts & (LIST_LSUB | LIST_SUBSCRIBED)) ?
 		backend_inbox : NULL, 0, 0);
 
     snprintf(mytime, sizeof(mytime), "%2.3f",
@@ -5860,12 +6010,13 @@
 	if (!r) {
 	    if (namespace) {
 		prot_printf(backend_inbox->out, 
-			    "%s %s {%d+}\r\n%s {%d+}\r\n%s\r\n", 
+			    "%s %s {" SIZE_T_FMT "+}\r\n%s"
+			    " {" SIZE_T_FMT "+}\r\n%s\r\n", 
 			    tag, cmd, 
 			    strlen(namespace), namespace,
 			    strlen(name), name);
 	    } else {
-		prot_printf(backend_inbox->out, "%s %s {%d+}\r\n%s\r\n", 
+		prot_printf(backend_inbox->out, "%s %s {" SIZE_T_FMT "+}\r\n%s\r\n", 
 			    tag, cmd, 
 			    strlen(name), name);
 	    }
@@ -5881,7 +6032,7 @@
     /* local INBOX */
     if (namespace) lcase(namespace);
     if (!namespace || !strcmp(namespace, "mailbox")) {
-	int len = strlen(name);
+	size_t len = strlen(name);
 	if (force && imapd_namespace.isalt &&
 	    (((len == strlen(imapd_namespace.prefix[NAMESPACE_USER]) - 1) &&
 	      !strncmp(name, imapd_namespace.prefix[NAMESPACE_USER], len)) ||
@@ -6151,7 +6302,7 @@
 	struct backend *s = NULL;
 	int res;
 
-	s = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+	s = proxy_findserver(server, &imap_protocol,
 			     proxy_userid, &backend_cached,
 			     &backend_current, &backend_inbox, imapd_in);
 	if (!s) r = IMAP_SERVER_UNAVAILABLE;
@@ -6164,13 +6315,15 @@
 	} else if (!r) {
 	    if (rights) {
 		prot_printf(s->out, 
-			    "%s Setacl {%d+}\r\n%s {%d+}\r\n%s {%d+}\r\n%s\r\n",
+			    "%s Setacl {" SIZE_T_FMT "+}\r\n%s"
+			    " {" SIZE_T_FMT "+}\r\n%s {" SIZE_T_FMT "+}\r\n%s\r\n",
 			    tag, strlen(name), name,
 			    strlen(identifier), identifier,
 			    strlen(rights), rights);
 	    } else {
 		prot_printf(s->out, 
-			    "%s Deleteacl {%d+}\r\n%s {%d+}\r\n%s\r\n",
+			    "%s Deleteacl {" SIZE_T_FMT "+}\r\n%s"
+			    " {" SIZE_T_FMT "+}\r\n%s\r\n",
 			    tag, strlen(name), name,
 			    strlen(identifier), identifier);
 	    }
@@ -6345,7 +6498,7 @@
 	} else {
 	    struct backend *s;
 
-	    s = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+	    s = proxy_findserver(server, &imap_protocol,
 				 proxy_userid, &backend_cached,
 				 &backend_current, &backend_inbox, imapd_in);
 	    if (!s) r = IMAP_SERVER_UNAVAILABLE;
@@ -6353,7 +6506,7 @@
 	    imapd_check(s, 0, 0);
 
 	    if (!r) {
-		prot_printf(s->out, "%s Getquotaroot {%d+}\r\n%s\r\n",
+		prot_printf(s->out, "%s Getquotaroot {" SIZE_T_FMT "+}\r\n%s\r\n",
 			    tag, strlen(name), name);
 		pipe_including_tag(s, tag, 0);
 	    } else {
@@ -6581,6 +6734,7 @@
   
     result=tls_start_servertls(0, /* read */
 			       1, /* write */
+			       imaps ? 180 : imapd_timeout,
 			       layerp,
 			       &auth_id,
 			       &tls_conn);
@@ -6640,21 +6794,19 @@
 void cmd_status(char *tag, char *name)
 {
     int c;
-    int statusitems = 0;
+    unsigned statusitems = 0;
     static struct buf arg;
-    struct mailbox mailbox;
     char mailboxname[MAX_MAILBOX_NAME+1];
     int mbtype;
-    char *server;
+    char *server, *acl;
     int r = 0;
-    int doclose = 0;
 
     r = (*imapd_namespace.mboxname_tointernal)(&imapd_namespace, name,
 					       imapd_userid, mailboxname);
 
     if (!r) {
 	r = mlookup(tag, name, mailboxname, &mbtype, NULL, NULL,
-		    &server, NULL, NULL);
+		    &server, &acl, NULL);
     }
     if (r == IMAP_MAILBOX_MOVED) {
 	/* Eat the argument */
@@ -6674,7 +6826,7 @@
 	else {
 	    struct backend *s;
 
-	    s = proxy_findserver(server, &protocol[PROTOCOL_IMAP],
+	    s = proxy_findserver(server, &imap_protocol,
 				 proxy_userid, &backend_cached,
 				 &backend_current, &backend_inbox, imapd_in);
 	    if (!s) r = IMAP_SERVER_UNAVAILABLE;
@@ -6682,7 +6834,7 @@
 	    imapd_check(s, 0, 0);
 
 	    if (!r) {
-		prot_printf(s->out, "%s Status {%d+}\r\n%s ", tag,
+		prot_printf(s->out, "%s Status {" SIZE_T_FMT "+}\r\n%s ", tag,
 			    strlen(name), name);
 		if (!pipe_command(s, 65536)) {
 		    pipe_including_tag(s, tag, 0);
@@ -6757,24 +6909,18 @@
     }
 
     if (!r) {
-	r = mailbox_open_header(mailboxname, imapd_authstate, &mailbox);
+	int myrights = cyrus_acl_myrights(imapd_authstate, acl);
+
+	if (!(myrights & ACL_READ)) {
+	    r = (imapd_userisadmin || (myrights & ACL_LOOKUP)) ?
+	  IMAP_PERMISSION_DENIED : IMAP_MAILBOX_NONEXISTENT;
+    }
     }
 
     if (!r) {
-	doclose = 1;
-	r = mailbox_open_index(&mailbox);
-    }
-    if (!r && !(mailbox.myrights & ACL_READ)) {
-	r = (imapd_userisadmin || (mailbox.myrights & ACL_LOOKUP)) ?
-	  IMAP_PERMISSION_DENIED : IMAP_MAILBOX_NONEXISTENT;
-    }
-
-    if (!r) {
-	r = index_status(&mailbox, name, statusitems);
-    }
-
-    if (doclose) mailbox_close(&mailbox);
-    
+	r = index_status(mailboxname, name, statusitems);
+    }
+
     if (r) {
 	prot_printf(imapd_out, "%s NO %s\r\n", tag, error_message(r));
 	return;
@@ -7307,7 +7453,7 @@
     case '5': case '6': case '7': case '8': case '9':
     case '*':
 	if (imparse_issequence(criteria.s)) {
-	    appendstrlist(&searchargs->sequence, criteria.s);
+	    appendsequencelist(&searchargs->sequence, criteria.s, 0);
 	}
 	else goto badcri;
 	break;
@@ -7683,7 +7829,7 @@
 	    if (c != ' ') goto missingarg;
 	    c = getword(imapd_in, &arg);
 	    if (!imparse_issequence(arg.s)) goto badcri;
-	    appendstrlist(&searchargs->uidsequence, arg.s);
+	    appendsequencelist(&searchargs->uidsequence, arg.s, 1);
 	}
 	else if (!strcmp(criteria.s, "unseen")) {
 	    searchargs->flags |= SEARCH_SEEN_UNSET;
@@ -7829,6 +7975,10 @@
     } else {
 	prot_printf(imapd_out, "%s OK %s\r\n", tag,
 		    error_message(IMAP_OK_COMPLETED));
+	if (mboxname_isusermailbox(mailboxname, 1))
+	    sync_log_user(mboxname_inbox_touserid(mailboxname));
+	else
+	    sync_log_mailbox(mailboxname);
     }
 }
 
@@ -7871,7 +8021,7 @@
     memset(&tmp, 0, sizeof(struct buf));
     memset(&user, 0, sizeof(struct buf));
 
-    prot_printf(pout, "ACL0 GETACL {%d+}\r\n%s\r\n",
+    prot_printf(pout, "ACL0 GETACL {" SIZE_T_FMT "+}\r\n%s\r\n",
 		strlen(mailbox), mailbox);
 
     while(1) {
@@ -7922,7 +8072,8 @@
 
 		snprintf(tagbuf, sizeof(tagbuf), "ACL%d", ++i);
 		
-		prot_printf(pout, "%s DELETEACL {%d+}\r\n%s {%d+}\r\n%s\r\n",
+		prot_printf(pout, "%s DELETEACL {" SIZE_T_FMT "+}\r\n%s"
+			    " {" SIZE_T_FMT "+}\r\n%s\r\n",
 			    tagbuf, strlen(mailbox), mailbox,
 			    strlen(user.s), user.s);
 		if(c == '\r') {
@@ -7981,7 +8132,6 @@
     char tag[128];
     int tagnum = 1;
     char *rights, *nextid;
-    int mailboxlen = strlen(mailbox);
     char *acl_safe = acl_in ? xstrdup(acl_in) : NULL;
     char *acl = acl_safe;
     struct buf inbuf;
@@ -7999,9 +8149,10 @@
 
 	snprintf(tag, sizeof(tag), "SACL%d", tagnum++);
 	
-	prot_printf(pout, "%s SETACL {%d+}\r\n%s {%d+}\r\n%s {%d+}\r\n%s\r\n",
+	prot_printf(pout, "%s SETACL {" SIZE_T_FMT "+}\r\n%s"
+		    " {" SIZE_T_FMT "+}\r\n%s {" SIZE_T_FMT "+}\r\n%s\r\n",
 		    tag,
-		    mailboxlen, mailbox,
+		    strlen(mailbox), mailbox,
 		    strlen(acl), acl,
 		    strlen(rights), rights);
 
@@ -8090,7 +8241,7 @@
     /* Step 1: Connect to remote server */
     if(!r && !be_in) {
 	/* Just authorize as the IMAP server, so pass "" as our authzid */
-	be = backend_connect(NULL, toserver, &protocol[PROTOCOL_IMAP],
+	be = backend_connect(NULL, toserver, &imap_protocol,
 			     "", NULL, NULL);
 	if(!be) r = IMAP_SERVER_UNAVAILABLE;
 	if(r) syslog(LOG_ERR,
@@ -8118,10 +8269,10 @@
     if(!r) {
 	if(topart) {
 	    /* need to send partition as an atom */
-	    prot_printf(be->out, "LC1 LOCALCREATE {%d+}\r\n%s %s\r\n",
+	    prot_printf(be->out, "LC1 LOCALCREATE {" SIZE_T_FMT "+}\r\n%s %s\r\n",
 			strlen(name), name, topart);
 	} else {
-	    prot_printf(be->out, "LC1 LOCALCREATE {%d+}\r\n%s\r\n",
+	    prot_printf(be->out, "LC1 LOCALCREATE {" SIZE_T_FMT "+}\r\n%s\r\n",
 			strlen(name), name);
 	}
 	r = getresult(be->in, "LC1");
@@ -8156,7 +8307,8 @@
     if(!r) {
 	backout_mupdate = 1;
 
-	prot_printf(be->out, "D01 UNDUMP {%d+}\r\n%s ", strlen(name), name);
+	prot_printf(be->out, "D01 UNDUMP {" SIZE_T_FMT "+}\r\n%s ",
+		    strlen(name), name);
 
 	r = dump_mailbox(NULL, mailboxname, path, mpath, acl,
 			 0, be->in, be->out, imapd_authstate);
@@ -8202,7 +8354,7 @@
 	/* 6.5) Kick remote server to correct mupdate entry */
 	/* Note that we don't really care if this succeeds or not */
 	if (mupdate_h) {
-	    prot_printf(be->out, "MP1 MUPDATEPUSH {%d+}\r\n%s\r\n",
+	    prot_printf(be->out, "MP1 MUPDATEPUSH {" SIZE_T_FMT "+}\r\n%s\r\n",
 			strlen(name), name);
 	    rerr = getresult(be->in, "MP1");
 	    if(rerr) {
@@ -8217,6 +8369,7 @@
     /* 7) local delete of mailbox
      * & remove local "remote" mailboxlist entry */
     if(!r) {
+	if (config_mupdate_config != IMAP_ENUM_MUPDATE_CONFIG_UNIFIED) {
 	/* Note that we do not check the ACL, and we don't update MUPDATE */
 	/* note also that we need to remember to let proxyadmins do this */
 	r = mboxlist_deletemailbox(mailboxname,
@@ -8225,6 +8378,23 @@
 	if(r) syslog(LOG_ERR,
 		     "Could not delete local mailbox during move of %s",
 		     mailboxname);
+	} else {
+	    /* Can't trust local mailboxes database with unified config */
+	    struct mailbox mailbox;
+
+	    r = mailbox_open_locked(mailboxname, path, mpath,
+				    acl, 0, &mailbox, 0);
+	    if(r) syslog(LOG_ERR,
+			 "Could not open local mailbox during move of %s",
+			 mailboxname);
+	    if(!r) {
+		/* Delete mailbox and quota root */
+		r = mailbox_delete(&mailbox, 0);
+		if(r) syslog(LOG_ERR,
+			     "Could not delete local mailbox during move of %s",
+			     mailboxname);
+	    }
+	}
 
 	if (!r) {
 	    /* Delete mailbox annotations */
@@ -8248,7 +8418,7 @@
     }
     if(r && backout_remotebox) {
 	rerr = 0;
-	prot_printf(be->out, "LD1 LOCALDELETE {%d+}\r\n%s\r\n",
+	prot_printf(be->out, "LD1 LOCALDELETE {" SIZE_T_FMT "+}\r\n%s\r\n",
 		    strlen(name), name);
 	rerr = getresult(be->in, "LD1");
  	if(rerr) {
@@ -8299,12 +8469,15 @@
 
     if (!r) {
 	/* NOTE: NOT mlookup() because we don't want to issue a referral */
-	/* xxx but what happens if they are remote
-	 * mailboxes? */
 	r = mboxlist_detail(name, &mbflags,
 			    &inpath, &inmpath, &inpart, &inacl, NULL);
     }
     
+    if (!r && (mbflags & MBTYPE_REMOTE)) {
+	/* Skip remote mailbox */
+	return 0;
+    }
+
     if (!r) {
 	path = xstrdup(inpath);
 	if (inmpath) mpath = xstrdup(inmpath);
@@ -8416,7 +8589,7 @@
 	}
 
 	/* Get a single connection to the remote backend */
-	be = backend_connect(NULL, toserver, &protocol[PROTOCOL_IMAP],
+	be = backend_connect(NULL, toserver, &imap_protocol,
 			     "", NULL, NULL);
 	if(!be) {
 	    r = IMAP_SERVER_UNAVAILABLE;
@@ -8433,8 +8606,8 @@
 	    snprintf(buf, sizeof(buf), "%s!%s", config_servername, part);
 	    r = mupdate_deactivate(mupdate_h, mailboxname, buf);
 	    if(r) syslog(LOG_ERR,
-			 "Could deactivate mailbox: %s, during move",
-			 mailboxname);
+			 "Could not deactivate mailbox: %s, during move (%s)",
+			 mailboxname, error_message(r));
 	    else backout_mupdate = 1;
 	}
 
@@ -8448,7 +8621,7 @@
 	    if(!r) {
 		/* note use of + to force the setting of a nonexistant
 		 * quotaroot */
-		prot_printf(be->out, "Q01 SETQUOTA {%d+}\r\n" \
+		prot_printf(be->out, "Q01 SETQUOTA {" SIZE_T_FMT "+}\r\n" \
 			    "+%s (STORAGE %d)\r\n",
 			    strlen(name)+1, name, quota.limit);
 		r = getresult(be->in, "Q01");
@@ -8505,7 +8678,7 @@
 	    /* this was a successful user delete, and we need to delete
 	       certain user meta-data (but not seen state!) */
 	    user_deletedata(mailboxname+5, imapd_userid, imapd_authstate, 0);
-	    sync_log_user(mailboxname+5);
+	    sync_log_user(mboxname_inbox_touserid(mailboxname));
 	}
 	
 	if(!r && mupdate_h) {
@@ -8612,8 +8785,7 @@
     tm.tm_isdst = -1;
     *start = mktime(&tm);
 
-    tm.tm_sec = tm.tm_min = 59;
-    tm.tm_hour = 23;
+    tm.tm_hour = 24;
     tm.tm_isdst = -1;
     *end = mktime(&tm);
 
@@ -8743,7 +8915,7 @@
  * Parse LIST options.
  * The command has been parsed up to and including the opening '('.
  */
-int getlistopts(char *tag, int *listopts)
+int getlistopts(char *tag, unsigned *listopts)
 {
     int c;
     static struct buf arg;
@@ -9110,8 +9282,8 @@
 
     if (!s) return;
 
-    freestrlist(s->sequence);
-    freestrlist(s->uidsequence);
+    freesequencelist(s->sequence);
+    freesequencelist(s->uidsequence);
     freestrlist(s->from);
     freestrlist(s->to);
     freestrlist(s->cc);
@@ -9171,7 +9343,7 @@
  * Issue a LIST or LSUB untagged response
  */
 static void mstringdata(char *cmd, char *name, int matchlen, int maycreate,
-			int listopts)
+			unsigned listopts)
 {
     static char lastname[MAX_MAILBOX_PATH+1];
     static int lastnamedelayed = 0;
@@ -9313,10 +9485,89 @@
  */
 static int listdata(char *name, int matchlen, int maycreate, void *rock)
 {
-    int listopts = *((int *)rock);
+    struct listargs *listargs = (struct listargs *) rock;
     
-    mstringdata(((listopts & LIST_LSUB) ? "LSUB" : "LIST"),
-	name, matchlen, maycreate, listopts);
+    if (name && listargs->scan) {
+	/* SCAN mailbox for content */
+	char mailboxname[MAX_MAILBOX_NAME+1];
+	int r = 0;
+	int mbtype;
+	char *server;
+	static struct mailbox mailbox;
+
+	/* Convert "INBOX" to "user.<userid>" */
+	if (!strncasecmp(name, "inbox", 5)) {
+	    (*imapd_namespace.mboxname_tointernal)(&imapd_namespace, "INBOX",
+						   imapd_userid, mailboxname);
+	    strlcat(mailboxname, name+5, sizeof(mailboxname));
+	}
+	else
+	    strlcpy(mailboxname, name, sizeof(mailboxname));
+
+	if (!r) r = mlookup(NULL, NULL, mailboxname, &mbtype, NULL, NULL,
+			    &server, NULL, NULL);
+
+	if (!r && (mbtype & MBTYPE_REMOTE) &&
+	    !hash_lookup(server, &listargs->server_table)) {
+	    /* remote mailbox that we haven't proxied to yet */
+	    struct backend *s;
+
+	    hash_insert(server,  (void *)0xDEADBEEF, &listargs->server_table);
+	    s = proxy_findserver(server, &imap_protocol,
+				 proxy_userid, &backend_cached,
+				 &backend_current, &backend_inbox, imapd_in);
+	    if (!s) r = IMAP_SERVER_UNAVAILABLE;
+
+	    if (!r) {
+		char mytag[128];
+		proxy_gentag(mytag, sizeof(mytag));
+
+		prot_printf(s->out,
+			    "%s Scan {" SIZE_T_FMT "+}\r\n%s"
+			    " {" SIZE_T_FMT "+}\r\n%s {" SIZE_T_FMT "+}\r\n%s\r\n",
+			    mytag,
+			    strlen(listargs->ref), listargs->ref,
+			    strlen(listargs->pat), listargs->pat,
+			    strlen(listargs->scan), listargs->scan);
+
+		r = pipe_until_tag(s, mytag, 0);
+	    }
+
+	    return 0;
+	}
+	else if (!r) {
+	    /* local mailbox */
+	    int doclose = 0;
+
+	    r = mailbox_open_header(mailboxname, imapd_authstate, &mailbox);
+
+	    if (!r) {
+		doclose = 1;
+		r = mailbox_open_index(&mailbox);
+	    }
+
+	    if (!r && !(mailbox.myrights & ACL_READ)) {
+		r = (imapd_userisadmin || (mailbox.myrights & ACL_LOOKUP)) ?
+		    IMAP_PERMISSION_DENIED : IMAP_MAILBOX_NONEXISTENT;
+	    }
+
+	    if (!r) {
+		/* Set the globals in index.c for this mailbox.
+		   The globals are used by the search_engines.c */
+		index_operatemailbox(&mailbox);
+		if (index_scan(&mailbox, listargs->scan) > 0) {
+		    mstringdata("LIST", name, matchlen, maycreate, 0);
+		}
+	    }
+
+	    if (doclose) mailbox_close(&mailbox);
+
+	    return 0;
+	}
+    }
+
+    mstringdata(((listargs->opts & LIST_LSUB) ? "LSUB" : "LIST"),
+	name, matchlen, maycreate, listargs->opts);
 
     return 0;
 }
@@ -9344,7 +9595,7 @@
 			   saslprops.iplocalport);
     if(ret != SASL_OK) return ret;
     
-    secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
+    secprops = mysasl_secprops(0);
     ret = sasl_setprop(*conn, SASL_SEC_PROPS, secprops);
     if(ret != SASL_OK) return ret;
     /* end of service_main initialization excepting SSF */
@@ -9448,7 +9699,7 @@
     static struct buf arg;
     struct imapurl url;
     char mailboxname[MAX_MAILBOX_NAME+1];
-    struct mailbox mboxstruct, *mailbox;
+    struct mailbox mboxstruct, *mailbox = NULL;
     unsigned msgno;
     unsigned int token_len;
     int mbtype;
@@ -9519,7 +9770,7 @@
 	    /* remote mailbox */
 	    struct backend *be;
 
-	    be = proxy_findserver(newserver, &protocol[PROTOCOL_IMAP],
+	    be = proxy_findserver(newserver, &imap_protocol,
 				  proxy_userid, &backend_cached,
 				  &backend_current, &backend_inbox, imapd_in);
 	    if (!be) {
@@ -9662,7 +9913,7 @@
 {
     struct mboxkey *mboxkey_db;
     int first = 1;
-    int c, r, doclose;
+    int c, r;
     static struct buf arg1, arg2;
     struct imapurl url;
     char mailboxname[MAX_MAILBOX_NAME+1], *urlauth = NULL;
@@ -9678,7 +9929,7 @@
     r = mboxkey_open(imapd_userid, MBOXKEY_CREATE, &mboxkey_db);
     if (r) {
 	prot_printf(imapd_out,
-		   "%s NO Can not open mailbox key db for %s: %s\r\n",
+		   "%s NO Cannot open mailbox key db for %s: %s\r\n",
 		   tag, imapd_userid, error_message(r));
 	return;
     }

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapd.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapd.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapd.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapd.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* imapd.h -- Common state for IMAP daemon
- * $Id: imapd.h,v 1.63 2006/11/30 17:11:18 murch Exp $
- *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: imapd.h,v 1.71 2008/03/24 17:09:17 murch Exp $
  */
 
 #ifndef INCLUDED_IMAPD_H
@@ -46,6 +47,7 @@
 
 #include "annotate.h"
 #include "charset.h"
+#include "hash.h"
 #include "mailbox.h"
 #include "prot.h"
 
@@ -129,8 +131,8 @@
     time_t update_time;
     int usinguid;
     /* private to index_storeflag() */
-    int last_msgno;
-    int last_found;
+    unsigned last_msgno;
+    unsigned last_found;
 };
 
 /* values for operation */
@@ -168,8 +170,8 @@
     bit32 system_flags_unset;
     bit32 user_flags_set[MAX_USER_FLAGS/32];
     bit32 user_flags_unset[MAX_USER_FLAGS/32];
-    struct strlist *sequence;
-    struct strlist *uidsequence;
+    struct seq_set *sequence;
+    struct seq_set *uidsequence;
     struct strlist *from;
     struct strlist *to;
     struct strlist *cc;
@@ -225,6 +227,15 @@
     STATUS_HIGHESTMODSEQ =	(1<<5)
 };
 
+/* Arguments to List functions */
+struct listargs {
+    unsigned opts;		/* LISTEXT options */
+    const char *ref;		/* Reference name */
+    const char *pat;		/* Mailbox pattern */
+    const char *scan;		/* SCAN content */
+    hash_table server_table;	/* for proxying SCAN */
+};
+
 /* Bitmask for list options */
 enum {
     LIST_LSUB =			(1<<0),
@@ -241,6 +252,8 @@
 extern void index_operatemailbox(struct mailbox *mailbox);
 extern void index_check(struct mailbox *mailbox, int usinguid,
 			   int checkseen);
+extern void index_check_existing(struct mailbox *mailbox,
+                                 int usinguid, int checkseen);
 extern void index_checkseen(struct mailbox *mailbox, int quiet,
 			       int usinguid, int oldexists);
 
@@ -253,26 +266,30 @@
 extern int index_search(struct mailbox *mailbox,
 			struct searchargs *searchargs, int usinguid);
 extern int find_thread_algorithm(char *arg);
+extern int index_scan(struct mailbox *mailbox, const char *contents);
 extern int index_sort(struct mailbox *mailbox, struct sortcrit *sortcrit,
 		      struct searchargs *searchargs, int usinguid);
 extern int index_thread(struct mailbox *mailbox, int algorithm,
 			struct searchargs *searchargs, int usinguid);
 extern int index_copy(struct mailbox *mailbox, char *sequence,
 		      int usinguid, char *name, char **copyuidp, int nolink);
-extern int index_status(struct mailbox *mailbox, char *name,
-			   int statusitems);
+extern int index_status(char *mboxname, char *name, unsigned statusitems);
 
 extern int index_getuids(struct mailbox *mailbox, unsigned lowuid);
 extern int index_getstate(struct mailbox *mailbox);
 extern int index_checkstate(struct mailbox *mailbox, unsigned indexdate,
 			       unsigned seendate);
 
-extern int index_finduid(unsigned uid);
-extern int index_getuid(unsigned msgno);
+extern unsigned index_finduid(unsigned uid);
+extern unsigned index_getuid(unsigned msgno);
 
 extern mailbox_decideproc_t index_expungeuidlist;
 
 /* See lib/charset.h for the definition of receiver. */
+extern void index_getsearchtext_single(struct mailbox* mailbox, unsigned msgno,
+                                       index_search_text_receiver_t receiver,
+                                       void* rock);
+
 extern void index_getsearchtext(struct mailbox* mailbox,
                                 index_search_text_receiver_t receiver,
                                 void* rock);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapparse.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapparse.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapparse.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/imapparse.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: imapparse.c,v 1.19 2008/09/23 17:34:37 murch Exp $
  */
-
-/* $Id: imapparse.c,v 1.16 2006/11/30 17:11:18 murch Exp $ */
 
 #include <config.h>
 
@@ -52,8 +53,6 @@
 #include "exitcodes.h"
 
 enum {
-    MAXQUOTED = 32768,
-    MAXWORD = 32768,
     MAXLITERAL = INT_MAX / 20
 };
 
@@ -93,7 +92,7 @@
             /* xxx limit len */
 	    buf->alloc += BUFGROWSIZE;
 	    buf->s = xrealloc(buf->s, buf->alloc+1);
-            if (len > MAXWORD) {
+            if (len > config_maxword) {
                 fatal("word too long", EC_IOERR);
             }
 	}
@@ -158,7 +157,7 @@
 		buf->alloc += BUFGROWSIZE;
 		buf->s = xrealloc(buf->s, buf->alloc+1);
 
-                if (len > MAXQUOTED) {
+                if (len > config_maxquoted) {
                     fatal("word too long", EC_IOERR);
                 }
 	    }
@@ -224,7 +223,7 @@
 	}
 	buf->s[len] = '\0';
 	buf->len = len;
-	if (type != IMAP_BIN_ASTRING && strlen(buf->s) != len)
+	if (type != IMAP_BIN_ASTRING && (int) strlen(buf->s) != len)
 	    return EOF; /* Disallow imbedded NUL for non IMAP_BIN_ASTRING */
 	return prot_getc(pin);
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/index.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/index.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/index.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/index.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* index.c -- Routines for dealing with the index file in the imapd
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,11 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
- */
-/*
- * $Id: index.c,v 1.223 2007/02/05 18:41:46 jeaton Exp $
- */
+ * $Id: index.c,v 1.246 2008/10/09 13:59:53 murch Exp $
+ */
+
 #include <config.h>
 
 #include <stdio.h>
@@ -54,6 +53,7 @@
 #include <syslog.h>
 #include <errno.h>
 #include <ctype.h>
+#include <stdlib.h>
 
 #include "acl.h"
 #include "annotate.h"
@@ -72,6 +72,7 @@
 #include "parseaddr.h"
 #include "search_engines.h"
 #include "seen.h"
+#include "statuscache.h"
 #include "strhash.h"
 #include "stristr.h"
 #include "util.h"
@@ -103,7 +104,7 @@
 static time_t *flagreport;	/* Array for each msgno of last_updated when
 				 * FLAGS data reported to client.
 				 * Zero if FLAGS data never reported */
-static char *seenflag;		/* Array for each msgno, nonzero if \Seen */
+static unsigned char *seenflag;	/* Array for each msgno, nonzero if \Seen */
 static time_t seen_last_change;	/* Last mod time of \Seen state change */
 static int flagalloced = -1;	/* Allocated size of above two arrays */
 struct seen *seendb;		/* Seen state database object */
@@ -117,7 +118,7 @@
 			     int usinguid,
 			     index_sequenceproc_t *proc, void *rock,
 			     int* fetchedsomething);
-static int index_insequence(int num, char *sequence, int usinguid);
+static int index_insequence(unsigned num, struct seq_set *set, int use_mark);
 
 void index_fetchmsg(const char *msg_base, unsigned long msg_size,
 		    int format, unsigned offset, unsigned size,
@@ -172,7 +173,7 @@
 static char *index_extract_subject(const char *subj, size_t len, int *is_refwd);
 static char *_index_extract_subject(char *s, int *is_refwd);
 static void index_get_ids(MsgData *msgdata,
-			  char *envtokens[], const char *headers);
+			  char *envtokens[], const char *headers, unsigned size);
 static MsgData *index_msgdata_load(unsigned *msgno_list, int n,
 				   struct sortcrit *sortcrit);
 
@@ -304,7 +305,7 @@
 
 	    for (oldmsgno = msgno = 1; oldmsgno <= imapd_exists;
 		 oldmsgno++, msgno++) {
-		if (msgno <= mailbox->exists) {
+		if ((unsigned) msgno <= mailbox->exists) {
 		    mailbox_read_index_record(mailbox, msgno, &record);
 		}
 		else {
@@ -358,7 +359,7 @@
 	       mailbox->name);
 	fatal("failed to stat cache file", EC_IOERR);
     }
-    if (cache_end < sbuf.st_size) {
+    if (cache_end < (unsigned long) sbuf.st_size) {
 	cache_end = sbuf.st_size;
 	map_refresh(mailbox->cache_fd, 0, &cache_base, &cache_len,
 		    cache_end, "cache", mailbox->name);
@@ -367,7 +368,10 @@
 
     /* If opening mailbox, get \Recent info */
     if (oldexists == -1 && mailbox->keepingseen) {
-	r = seen_open(mailbox, imapd_userid, SEEN_CREATE, &seendb);
+	r = seen_open(mailbox,
+		      (mailbox->options & OPT_IMAP_SHAREDSEEN) ? "anyone" :
+		      imapd_userid,
+		      SEEN_CREATE, &seendb);
 	if (!r) {
 	    free(seenuids);
 	    seenuids = NULL;
@@ -445,7 +449,7 @@
 
     for (msgno = 1; msgno <= oldexists; msgno++) {
 	if (flagreport[msgno] < LAST_UPDATED(msgno)) {
-	    for (i = 0; i < VECTOR_SIZE(user_flags); i++) {
+	    for (i = 0; (unsigned) i < VECTOR_SIZE(user_flags); i++) {
 		user_flags[i] = USER_FLAGS(msgno, i);
 	    }
 	    index_fetchflags(mailbox, msgno, SYSTEM_FLAGS(msgno), user_flags,
@@ -454,6 +458,55 @@
 		imapd_condstore_client) {
 		prot_printf(imapd_out, " MODSEQ (" MODSEQ_FMT ")", MODSEQ(msgno));
 	    }
+	    if (usinguid) prot_printf(imapd_out, " UID %u", UID(msgno));
+	    prot_printf(imapd_out, ")\r\n");
+	}
+    }
+}
+
+/* Flush seen state (but only if anything changed) and check for flag/seen
+ * updates from other processes.  Bails out if the cyrus.index file has
+ * changed under our feet, which indicates an expunge from another process.
+ * In this case pending updates will be flushed on the next index_check()
+ */
+void
+index_check_existing(struct mailbox *mailbox, int usinguid, int checkseen)
+{
+    struct stat sbuf;
+    int msgno;
+    unsigned i;
+    bit32 user_flags[MAX_USER_FLAGS/32];
+
+    if (imapd_exists == -1)
+        return;
+
+    /* Check for expunge, just like index_check() */
+    if (index_len) {
+        char fnamebuf[MAX_MAILBOX_PATH+1], *path;
+
+	path = (mailbox->mpath &&
+		(config_metapartition_files &
+		 IMAP_ENUM_METAPARTITION_FILES_INDEX)) ?
+	    mailbox->mpath : mailbox->path;
+	strlcpy(fnamebuf, path, sizeof(fnamebuf));
+	strlcat(fnamebuf, FNAME_INDEX, sizeof(fnamebuf));
+
+	if ((stat(fnamebuf, &sbuf) != 0) ||
+            (sbuf.st_ino != mailbox->index_ino) ||
+	    (index_ino != mailbox->index_ino))
+            return;
+    }
+
+    if (checkseen)
+        index_checkseen(mailbox, 0, usinguid, imapd_exists);
+
+    for (msgno = 1; msgno <= imapd_exists; msgno++) {
+	if (flagreport[msgno] < LAST_UPDATED(msgno)) {
+	    for (i = 0; i < VECTOR_SIZE(user_flags); i++) {
+		user_flags[i] = USER_FLAGS(msgno, i);
+	    }
+	    index_fetchflags(mailbox, msgno, SYSTEM_FLAGS(msgno), user_flags,
+			     LAST_UPDATED(msgno));
 	    if (usinguid) prot_printf(imapd_out, " UID %u", UID(msgno));
 	    prot_printf(imapd_out, ")\r\n");
 	}
@@ -487,11 +540,11 @@
     unsigned oldnext = 0, oldseen = 0;
     unsigned newnext = 0, newseen = 0;
     int neweof = 0;
-    unsigned msgno, uid, dirty = 0;
-    int i;
+    unsigned uid, dirty = 0, i;
+    int msgno;
     bit32 user_flags[MAX_USER_FLAGS/32];
     char *saveseenuids, *save;
-    int savealloced;
+    size_t savealloced;
     unsigned start, newallseen, inrange, usecomma;
     mailbox_notifyproc_t *updatenotifier;
     int dosync = 0;
@@ -531,7 +584,16 @@
 	    else {
 		oldseen = (*old == ':');
 		oldnext = 0;
-		if (!*old) oldnext = mailbox->last_uid+1;
+		if (!*old) {
+		    oldnext = mailbox->last_uid+1;
+		    /* just in case the index is corrupted, don't
+		     * loop forever */
+		    if (oldnext < uid) {
+			syslog(LOG_ERR, "index corrupted, needs reconstruct %s",
+			       mailbox->name);
+			oldnext = uid;
+		    }
+		}
 		else old++;
 		while (isdigit((int) *old)) {
 		    oldnext = oldnext * 10 + *old++ - '0';
@@ -549,6 +611,13 @@
 		newnext = 0;
 		if (!*new) {
 		    newnext = mailbox->last_uid+1;
+		    /* just in case the index is corrupted, don't
+		     * loop forever */
+		    if (newnext < uid) {
+			syslog(LOG_ERR, "index corrupted, needs reconstruct %s",
+			       mailbox->name);
+			newnext = uid;
+		    }
 		    neweof++;
 		}
 		else new++;
@@ -660,7 +729,7 @@
 		inrange = 1;
 	    }
 	}
-	if (save - saveseenuids > savealloced - 30) {
+	if ((size_t) (save - saveseenuids) > savealloced - 30) {
 	    savealloced += SAVEGROW;
 	    saveseenuids = xrealloc(saveseenuids, savealloced);
 	    save = saveseenuids + strlen(saveseenuids);
@@ -774,7 +843,8 @@
      * imapd.c doesn't have enough context to work out where seen flags set.
      * Downside: we have to link sync_client, sync_server with sync_log */
     if (!r && dosync) {
-        sync_log_seen(imapd_userid, mailbox->name);
+        sync_log_seen((mailbox->options & OPT_IMAP_SHAREDSEEN) ? "anyone" :
+		      imapd_userid, mailbox->name);
     }
 
 #if TOIMSP
@@ -792,7 +862,7 @@
     seenuids = saveseenuids;
 
     updatenotifier = mailbox_get_updatenotifier();
-    if (updatenotifier) updatenotifier(mailbox);
+    if (updatenotifier) updatenotifier(mailbox->name);
 }
 
 
@@ -826,7 +896,8 @@
 char **flag;
 int nflags;
 {
-    int i, r, userflag, emptyflag;
+    int i, r, emptyflag;
+    unsigned userflag;
     int writeheader = 0;
     int newflag[MAX_USER_FLAGS];
     long myrights = mailbox->myrights;
@@ -979,6 +1050,80 @@
     return r;
 }
 
+static int index_scan_work(const char *s, unsigned long len,
+			   const char *match, unsigned long min)
+{
+    while (len > min) {
+        if (!strncasecmp(s, match, min)) return(1);
+        s++;
+        len--;
+    }
+    return(0);
+}
+
+/*
+ * Guts of the SCAN command, lifted from _index_search()
+ * 
+ * Returns 1 if we get a hit, otherwise returns 0.
+ */
+int index_scan(struct mailbox *mailbox, const char *contents)
+{
+    unsigned *msgno_list;
+    unsigned msgno;
+    struct mapfile msgfile;
+    int n = 0;
+    int listindex;
+    int listcount;
+    struct searchargs searchargs;
+    struct strlist strlist;
+    struct index_record record;
+    unsigned long length;
+
+    if (!(contents && contents[0])) return(0);
+
+    if (mailbox->exists <= 0) return 0;
+
+    length = strlen(contents);
+
+    memset(&searchargs, 0, sizeof(struct searchargs));
+    searchargs.text = &strlist;
+
+    /* Use US-ASCII to emulate fgrep */
+    strlist.s = charset_convert(contents, charset_lookupname("US-ASCII"),
+				NULL, 0); 
+    strlist.p = charset_compilepat(strlist.s);
+    strlist.next = NULL;
+
+    msgno_list = (unsigned *) xmalloc(mailbox->exists * sizeof(unsigned));
+
+    listcount = search_prefilter_messages(msgno_list, mailbox, &searchargs);
+
+    for (listindex = 0; !n && listindex < listcount; listindex++) {
+        msgno = msgno_list[listindex];
+
+        if (mailbox_read_index_record(mailbox, msgno, &record))
+            continue;
+
+	msgfile.base = 0;
+	msgfile.size = 0;
+
+        if (mailbox_map_message(mailbox, record.uid,
+                                &msgfile.base, &msgfile.size))
+            continue;
+
+        n += index_scan_work(msgfile.base, msgfile.size, contents, length);
+
+        mailbox_unmap_message(mailbox, record.uid,
+                              &msgfile.base, &msgfile.size);
+    }
+
+    free(strlist.s);
+    free(strlist.p);
+    free(msgno_list);
+
+    return(n);
+}
+
 /*
  * Guts of the SEARCH command.
  * 
@@ -1032,7 +1177,7 @@
     return n;
 }
 
-int index_getuid(unsigned msgno) {
+unsigned index_getuid(unsigned msgno) {
   return UID(msgno);
 }
 
@@ -1276,13 +1421,19 @@
 
     r = append_copy(mailbox, &append_mailbox, copyargs.nummsg,
 		    copyargs.copymsg, nolink);
-    if (!r) append_commit(&append_mailbox, totalsize,
+    if (!r) {
+	int sharedseen = (append_mailbox.m.options & OPT_IMAP_SHAREDSEEN);
+
+	r = append_commit(&append_mailbox, totalsize,
 			  &uidvalidity, &startuid, &num);
 
     if (!r) {
 	sync_log_mailbox_double(mailbox->name, name);
 	/* if any messages are seen then we need to sync the seen state */
-	if (haveseen) sync_log_seen(imapd_userid, name);
+	    if (haveseen) {
+		sync_log_seen(sharedseen ? "anyone" : imapd_userid, name);
+	    }
+	}
     }
 
     if (!r && docopyuid) {
@@ -1415,49 +1566,87 @@
 /*
  * Performs a STATUS command
  */
-int
-index_status(mailbox, name, statusitems)
-struct mailbox *mailbox;
-char *name;
-int statusitems;
+int index_status(char *mboxname, char *name, unsigned statusitems)
 {
     int r;
+    struct statuscache_data scdata;
+    struct mailbox mailbox;
+    int doclose = 0;
+    int num_recent = 0;
+    int num_unseen = 0;
+    int sepchar;
+    static struct seq_set seq_set = { NULL, 0, 0, 0 , NULL};
+
+    /* Check status cache if possible */
+    if (config_getswitch(IMAPOPT_STATUSCACHE)) {
+	/* Do actual lookup of cache item. */
+	r = statuscache_lookup(mboxname, imapd_userid, statusitems, &scdata);
+
+	/* Seen/recent status uses "push" invalidation events from
+	 * seen_db.c.   This avoids needing to open cyrus.header to get
+	 * the mailbox uniqueid to open the seen db and get the
+	 * unseen_mtime and recentuid.
+	 */
+
+	if (!r) {
+	    syslog(LOG_DEBUG, "statuscache, '%s', '%s', '0x%02x', 'yes'",
+		   mboxname, imapd_userid, statusitems);
+	    goto statusdone;
+	}
+
+	syslog(LOG_DEBUG, "statuscache, '%s', '%s', '0x%02x', 'no'",
+	       mboxname, imapd_userid, statusitems);
+    }
+
+    /* Missing or invalid cache entry */
+    r = mailbox_open_header(mboxname, imapd_authstate, &mailbox);
+
+    if (!r) {
+	doclose = 1;
+	r = mailbox_open_index(&mailbox);
+    }
+
+    if (!r && mailbox.exists != 0 &&
+	(statusitems & (STATUS_RECENT | STATUS_UNSEEN))) {
+	/* Read \Seen state */
     struct seen *status_seendb;
     time_t last_read, last_change = 0;
     unsigned last_uid;
     char *last_seenuids;
-    int num_recent = 0;
-    int num_unseen = 0;
-    int sepchar;
-
-    if (mailbox->exists != 0 &&
-	(statusitems &
-	 (STATUS_RECENT | STATUS_UNSEEN))) {
-	r = seen_open(mailbox, imapd_userid, SEEN_CREATE, &status_seendb);
-	if (r) return r;
-
+
+	r = seen_open(&mailbox,
+		      (mailbox.options & OPT_IMAP_SHAREDSEEN) ? "anyone" :
+		      imapd_userid,
+		      SEEN_CREATE, &status_seendb);
+
+	if (!r) {
 	r = seen_lockread(status_seendb, &last_read, &last_uid,
 			  &last_change, &last_seenuids);
 	seen_close(status_seendb);
-	if (r) return r;
-
-	if (statusitems & (STATUS_RECENT | STATUS_UNSEEN)) {
+	}
+
+	if (!r) {
 	    const char *base;
 	    unsigned long len = 0;
-	    int msg;
-	    unsigned uid;
-
-	    map_refresh(mailbox->index_fd, 0, &base, &len,
-			mailbox->start_offset +
-			mailbox->exists * mailbox->record_size,
-			"index", mailbox->name);
-	    for (msg = 0; msg < mailbox->exists; msg++) {
-		uid = ntohl(*((bit32 *)(base + mailbox->start_offset +
-					msg * mailbox->record_size +
+	    unsigned msg, uid;
+
+	    map_refresh(mailbox.index_fd, 0, &base, &len,
+			mailbox.start_offset +
+			mailbox.exists * mailbox.record_size,
+			"index", mailbox.name);
+
+	    seq_set.len = seq_set.mark = 0;
+	    index_parse_sequence(last_seenuids, 0, &seq_set);
+
+	    for (msg = 0; msg < mailbox.exists; msg++) {
+		uid = ntohl(*((bit32 *)(base + mailbox.start_offset +
+					msg * mailbox.record_size +
 					OFFSET_UID)));
+		/* Always calculate num_recent,
+		   even if only need num_unseen... for caching below */
 		if (uid > last_uid) num_recent++;
 		if ((statusitems & STATUS_UNSEEN) &&
-		    !index_insequence(uid, last_seenuids, 0)) num_unseen++;
+		    !index_insequence(uid, &seq_set, 1)) num_unseen++;
 		/* NB: The value of the third argument to index_insequence()
 		 * above does not matter.
 		 */
@@ -1467,170 +1656,71 @@
 	}
     }
 
+    if (!r) {
+	/* We always have message count, uidnext,
+	   uidvalidity, and highestmodseq for cache */
+	unsigned c_statusitems = statusitems | STATUS_MESSAGES |
+	    STATUS_UIDNEXT | STATUS_UIDVALIDITY | STATUS_HIGHESTMODSEQ;
+
+	/* If we calculated num_unseen, we implicitly calculated num_recent */
+	if (c_statusitems & STATUS_UNSEEN) c_statusitems |= STATUS_RECENT;
+
+	statuscache_fill(&scdata, &mailbox,
+			 c_statusitems, num_recent, num_unseen);
+    }
+
+    if (doclose) mailbox_close(&mailbox);
+    if (r) return r;
+
+    /* Upate the statuscache entry */
+    if (config_getswitch(IMAPOPT_STATUSCACHE)) {
+	statuscache_update(mboxname, imapd_userid, &scdata);
+    }
+
+  statusdone:
     prot_printf(imapd_out, "* STATUS ");
     printastring(name);
     prot_printf(imapd_out, " ");
     sepchar = '(';
 
     if (statusitems & STATUS_MESSAGES) {
-	prot_printf(imapd_out, "%cMESSAGES %lu", sepchar, mailbox->exists);
+	prot_printf(imapd_out, "%cMESSAGES %lu", sepchar, scdata.messages);
 	sepchar = ' ';
     }
     if (statusitems & STATUS_RECENT) {
-	prot_printf(imapd_out, "%cRECENT %u", sepchar, num_recent);
+	prot_printf(imapd_out, "%cRECENT %u", sepchar, scdata.recent);
 	sepchar = ' ';
     }
     if (statusitems & STATUS_UIDNEXT) {
-	prot_printf(imapd_out, "%cUIDNEXT %lu", sepchar, mailbox->last_uid+1);
+	prot_printf(imapd_out, "%cUIDNEXT %lu", sepchar, scdata.uidnext);
 	sepchar = ' ';
     }
     if (statusitems & STATUS_UIDVALIDITY) {
 	prot_printf(imapd_out, "%cUIDVALIDITY %lu", sepchar,
-		    mailbox->uidvalidity);
+		    scdata.uidvalidity);
 	sepchar = ' ';
     }
     if (statusitems & STATUS_UNSEEN) {
-	prot_printf(imapd_out, "%cUNSEEN %u", sepchar, num_unseen);
+	prot_printf(imapd_out, "%cUNSEEN %u", sepchar, scdata.unseen);
 	sepchar = ' ';
     }
     if (statusitems & STATUS_HIGHESTMODSEQ) {
 	prot_printf(imapd_out, "%cHIGHESTMODSEQ " MODSEQ_FMT, sepchar,
-		    (mailbox->options & OPT_IMAP_CONDSTORE) ?
-		    mailbox->highestmodseq : 0);
+		    scdata.highestmodseq);
 	sepchar = ' ';
     }
     prot_printf(imapd_out, ")\r\n");
     return 0;
 }
-
-/*
- * Performs a GETUIDS command
- */
-int
-index_getuids(mailbox, lowuid)
-struct mailbox *mailbox __attribute__((unused));
-unsigned lowuid;
-{
-    int msgno;
-    unsigned firstuid = 0, lastuid = 0;
-
-
-    prot_printf(imapd_out, "* GETUIDS");
-
-    for (msgno = 1; msgno <= imapd_exists; msgno++) {
-	if (firstuid == 0) {
-	    if (UID(msgno) >= lowuid) {
-		prot_printf(imapd_out, " %u %u", msgno, UID(msgno));
-		firstuid = lastuid = UID(msgno);
-	    }
-	}
-	else {
-	    if (UID(msgno) != ++lastuid) {
-		if (lastuid-1 != firstuid) {
-		    prot_printf(imapd_out, ":%u", lastuid-1);
-		}
-		firstuid = lastuid = UID(msgno);
-		prot_printf(imapd_out, ",%u", firstuid);
-	    }
-	}
-    }
-    if (lastuid != firstuid) {
-	prot_printf(imapd_out, ":%u", lastuid);
-    }
-    prot_printf(imapd_out, "\r\n");
-
-    return 0;
-}
-
-/*
- * Performs a XGETSTATE command
- */
-int
-index_getstate(mailbox)
-struct mailbox *mailbox;
-{    
-
-    prot_printf(imapd_out, "* XSTATE %lu %lu\r\n", mailbox->index_mtime,
-		seen_last_change);
-
-    return 0;
-}
-
-#if 0
-/* What's this for?  Might as well keep it around. */
-/*
- * Performs a XCHECKSTATE command
- */
-int
-index_checkstate(mailbox, indexdate, seendate)
-struct mailbox *mailbox;
-unsigned indexdate;
-unsigned seendate;
-{
-    int r;
-    int msgno;
-    unsigned int startmsgno = 0;
-    int sepchar = ' ';
-
-    /* No messages == everything OK */
-    if (imapd_exists < 1) {
-	prot_printf(imapd_out, "* XCHECKSTATE\r\n");
-	return 0;
-    }
-	
-    /* If \Seen data changed, we don't know anything */
-    if (seendate != seen_last_change) {
-	if (imapd_exists == 1) {
-	    prot_printf(imapd_out,
-			"* XCHECKSTATE %u\r\n", UID(1));
-	}
-	else {
-	    prot_printf(imapd_out,
-			"* XCHECKSTATE %u:%u\r\n", UID(1), UID(imapd_exists));
-	}
-	return 0;
-    }
-
-    prot_printf(imapd_out, "* XCHECKSTATE");
-    for (msgno = 1; msgno <= imapd_exists; msgno++) {
-	/*
-	 * Below is >= instead of > because we can get
-	 * two STORE commands within the same second.
-	 */
-	if (LAST_UPDATED(msgno) >= indexdate) {
-	    if (startmsgno == 0) {
-		prot_printf(imapd_out, "%c%u", sepchar, UID(msgno));
-		sepchar = ',';
-		startmsgno = msgno;
-	    }
-	}
-	else {
-	    if (startmsgno != 0 && startmsgno < msgno - 1) {
-		prot_printf(imapd_out, ":%u", UID(msgno-1));
-	    }
-	    startmsgno = 0;
-	}
-    }
-
-    if (startmsgno != 0 && startmsgno < imapd_exists) {
-	prot_printf(imapd_out, ":%u", UID(imapd_exists));
-    }
-
-    prot_printf(imapd_out, "\r\n");
-    return 0;
-}
-#endif
 
 /*
  * Returns the msgno of the message with UID 'uid'.
  * If no message with UID 'uid', returns the message with
  * the higest UID not greater than 'uid'.
  */
-int
-index_finduid(uid)
-unsigned uid;
-{
-    int low=1, high=imapd_exists, mid;
+unsigned index_finduid(unsigned uid)
+{
+    unsigned low=1, high=imapd_exists, mid;
     unsigned miduid;
 
     while (low <= high) {
@@ -1653,18 +1743,20 @@
  * Expunge decision procedure to get rid of articles
  * both \Deleted and listed in the sequence under 'rock'.
  */
-int index_expungeuidlist(struct mailbox *mailbox __attribute__((unused)),
-			 void *rock, char *indexbuf,
+unsigned index_expungeuidlist(struct mailbox *mailbox __attribute__((unused)),
+			      void *rock,
+			      unsigned char *indexbuf,
 			 int expunge_flags __attribute__((unused)))
 {
-    char *sequence = (char *)rock;
+    struct seq_set *sequence = (struct seq_set *)rock;
     unsigned uid = ntohl(*((bit32 *)(indexbuf+OFFSET_UID)));
 
     /* Don't expunge if not \Deleted */
     if (!(ntohl(*((bit32 *)(indexbuf+OFFSET_SYSTEM_FLAGS))) & FLAG_DELETED))
 	return 0;
 
-    return index_insequence(uid, sequence, 1);
+    /* XXX  Can we use the previous range marker? */
+    return index_insequence(uid, sequence, 0);
 }
 
 /*
@@ -1682,116 +1774,38 @@
 		  void* rock,
 		  int* fetchedsomething)
 {
-    unsigned i, start = 0, end;
+    struct seq_set *seq;
+    unsigned i, j;
     int r, result = 0;
 
-    /* no messages, no calls.  dumps core otherwise */
-    if (! imapd_exists) {
-	return 0;
-    }
-
-    for (;;) {
-	if (isdigit((int) *sequence)) {
-	    start = start*10 + *sequence - '0';
-	}
-	else if (*sequence == '*') {
-	    start = usinguid ? UID(imapd_exists) : imapd_exists;
-	}
-	else if (*sequence == ':') {
-	    end = 0;
-	    sequence++;
-	    while (isdigit((int) *sequence)) {
-		end = end*10 + *sequence++ - '0';
-	    }
-	    if (*sequence == '*') {
-		sequence++;
-		end = usinguid ? UID(imapd_exists) : imapd_exists;
-	    }
-	    if (start > end) {
-		i = end;
-		end = start;
-		start = i;
-	    }
-	    if (usinguid) {
-		i = index_finduid(start);
-		if (!i || start != UID(i)) i++;
-		start = i;
-		end = index_finduid(end);
-	    }
-	    if (start < 1) start = 1;
-	    if (end > imapd_exists) end = imapd_exists;
-	    for (i = start; i <= end; i++) {
-		if (fetchedsomething) *fetchedsomething = 1;
-		r = (*proc)(mailbox, i, rock);
-		if (r && !result) result = r;
-	    }
-	    start = 0;
-	    if (!*sequence) return result;
-	}
-	else {
-	    if (start && usinguid) {
-		i = index_finduid(start);
-		if (!i || start != UID(i)) i = 0;
-		start = i;
-	    }
-	    if (start > 0 && start <= imapd_exists) {
-		if (fetchedsomething) *fetchedsomething = 1;
-		r = (*proc)(mailbox, start, rock);
-		if (r && !result) result = r;
-	    }
-	    start = 0;
-	    if (!*sequence) return result;
-	}
-	sequence++;
-    }
-}
-
-/*
- * Return nonzero iff 'num' is included in 'sequence'
- */
-static int
-index_insequence(num, sequence, usinguid)
-int num;
-char *sequence;
-int usinguid;
-{
-    unsigned i, start = 0, end;
-
-    for (;;) {
-	if (isdigit((int) *sequence)) {
-	    start = start*10 + *sequence - '0';
-	}
-	else if (*sequence == '*') {
-	    sequence++;
-	    start = usinguid ? UID(imapd_exists) : imapd_exists;
-	}
-	else if (*sequence == ':') {
-	    end = 0;
-	    sequence++;
-	    while (isdigit((int) *sequence)) {
-		end = end*10 + *sequence++ - '0';
-	    }
-	    if (*sequence == '*') {
-		sequence++;
-		end = usinguid ? UID(imapd_exists) : imapd_exists;
-	    }
-	    if (start > end) {
-		i = end;
-		end = start;
-		start = i;
-	    }
-	    if (num >= start && num <= end) return 1;
-	    start = 0;
-	    if (!*sequence) return 0;
-	}
-	else {
-	    if (num == start) return 1;
-	    start = 0;
-	    if (!*sequence) return 0;
-	}
-	sequence++;
-    }
-}    
+    /* no messages, no calls. */
+    if (!imapd_exists) return 0;
+
+    seq = index_parse_sequence(sequence, usinguid, NULL);
+
+    for (i = 0; i < seq->len; i++) {
+	unsigned start = seq->set[i].low;
+	unsigned end = seq->set[i].high;
+
+	if (usinguid) {
+	    j = index_finduid(start);
+	    if (!j || start != UID(j)) j++;
+	    start = j;
+	    end = index_finduid(end);
+	}
+	if (start < 1) start = 1;
+	if (end > (unsigned) imapd_exists) end = imapd_exists;
+
+	for (j = start; j <= end; j++) {
+	    if (fetchedsomething) *fetchedsomething = 1;
+	    r = (*proc)(mailbox, j, rock);
+	    if (r && !result) result = r;
+	}
+    }
+
+    freesequencelist(seq);
+    return result;
+}
 
 /*
  * Helper function to fetch data from a message file.  Writes a
@@ -1814,7 +1828,7 @@
 unsigned octet_count;
 struct protstream *pout;
 {
-    int n;
+    unsigned n;
 
     /* If no data, output NIL */
     if (!msg_base) {
@@ -1876,7 +1890,7 @@
 			      unsigned start_octet, unsigned octet_count)
 {
     char *p;
-    int skip = 0;
+    unsigned skip = 0;
     int fetchmime = 0;
     unsigned offset = 0;
     char *decbuf = NULL;
@@ -1952,7 +1966,8 @@
 
     cacheitem += skip * 5 * 4 + CACHE_ITEM_SIZE_SKIP + (fetchmime ? 0 : 2 * 4);
     
-    if (CACHE_ITEM_BIT32(cacheitem + CACHE_ITEM_SIZE_SKIP) == -1) goto badpart;
+    if (CACHE_ITEM_BIT32(cacheitem + CACHE_ITEM_SIZE_SKIP) == (bit32) -1)
+	goto badpart;
 
     offset = CACHE_ITEM_BIT32(cacheitem);
     size = CACHE_ITEM_BIT32(cacheitem + CACHE_ITEM_SIZE_SKIP);
@@ -2010,7 +2025,7 @@
 				unsigned start_octet, unsigned octet_count)
 {
     char *p;
-    int skip = 0;
+    unsigned skip = 0;
     int fields_not = 0;
     unsigned crlf_start = 0;
     unsigned crlf_size = 2;
@@ -2052,7 +2067,8 @@
 
     cacheitem += 4;
 
-    if (CACHE_ITEM_BIT32(cacheitem+CACHE_ITEM_SIZE_SKIP) == -1) goto badpart;
+    if (CACHE_ITEM_BIT32(cacheitem+CACHE_ITEM_SIZE_SKIP) == (bit32) -1)
+	goto badpart;
 	
     if (p[13]) fields_not++;	/* Check for "." after "HEADER.FIELDS" */
 
@@ -2122,7 +2138,7 @@
 unsigned size;
 {
     static char *buf;
-    static int bufsize;
+    static unsigned bufsize;
 
     if (offset + size > msg_size) {
 	/* Message file is too short, truncate request */
@@ -2167,7 +2183,7 @@
 	if (colon && headers_not) {
 	    goodheader = 1;
 	    for (l = headers_not; l; l = l->next) {
-		if (colon - p == strlen(l->s) &&
+		if ((size_t) (colon - p) == strlen(l->s) &&
 		    !strncasecmp(p, l->s, colon - p)) {
 		    goodheader = 0;
 		    break;
@@ -2178,7 +2194,7 @@
 	}
 	if (colon) {
 	    for (l = headers; l; l = l->next) {
-		if (colon - p == strlen(l->s) &&
+		if ((size_t) (colon - p) == strlen(l->s) &&
 		    !strncasecmp(p, l->s, colon - p)) {
 		    goodheader = 1;
 		    break;
@@ -2246,7 +2262,7 @@
 		       unsigned start_octet, unsigned octet_count)
 {
     static char *buf;
-    static int bufsize;
+    static unsigned bufsize;
     const char *cacheitem;
     unsigned size;
     unsigned crlf_start = 0;
@@ -2310,7 +2326,7 @@
  */
 static void index_listflags(struct mailbox *mailbox)
 {
-    int i;
+    unsigned i;
     int cancreate = 0;
     char sepchar = '(';
 
@@ -2414,7 +2430,7 @@
     if (sepchar == '(') prot_putc('(', imapd_out);
     prot_putc(')', imapd_out);
 
-    assert(flagalloced > 0 || msgno < flagalloced);
+    assert(flagalloced > 0 || msgno < (unsigned) flagalloced);
 
     flagreport[msgno] = last_updated;
 }
@@ -2432,7 +2448,7 @@
     struct octetinfo *oi = NULL;
     int sepchar = '(';
     int started = 0;
-    int i;
+    unsigned i;
     bit32 user_flags[MAX_USER_FLAGS/32];
     const char *cacheitem;
     struct strlist *section, *field;
@@ -2703,9 +2719,8 @@
     const char *msg_base = 0;
     unsigned long msg_size = 0;
     const char *cacheitem;
-    int skip = 0;
     int fetchmime = 0;
-    unsigned size, offset = 0;
+    unsigned size, offset = 0, skip = 0;
     int n, r = 0;
 
     if (outsize) *outsize = 0;
@@ -2791,7 +2806,7 @@
 	cacheitem += skip * 5 * 4 + CACHE_ITEM_SIZE_SKIP +
 	    (fetchmime ? 0 : 2 * 4);
     
-	if (CACHE_ITEM_BIT32(cacheitem + CACHE_ITEM_SIZE_SKIP) == -1) {
+	if (CACHE_ITEM_BIT32(cacheitem + CACHE_ITEM_SIZE_SKIP) == (bit32) -1) {
 	    r = IMAP_BADURL;
 	    goto done;
 	}
@@ -2832,7 +2847,7 @@
 {
     struct storeargs *storeargs = (struct storeargs *)rock;
     int val = (storeargs->operation == STORE_ADD) ? 1 : 0;
-    int i;
+    unsigned i;
     bit32 user_flags[MAX_USER_FLAGS/32];
     
     if (seenflag[msgno] == val) return 0;
@@ -2860,11 +2875,11 @@
 			   unsigned msgno, void *rock)
 {
     struct storeargs *storeargs = (struct storeargs *)rock;
-    int i;
+    unsigned i;
     struct index_record record;
-    int uid = UID(msgno);
-    int low=1, high=mailbox->exists;
-    int mid = 0;
+    unsigned long uid = UID(msgno);
+    unsigned low=1, high=mailbox->exists;
+    unsigned mid = 0;
     int r;
     int firsttry = 1;
     int dirty = 0;
@@ -3059,11 +3074,12 @@
 				 unsigned msgno,
 				 struct mapfile *msgfile)
 {
-    int i;
+    unsigned i;
     struct strlist *l, *h;
     const char *cacheitem;
     int cachelen;
     struct searchsub *s;
+    struct seq_set *seq;
 
     if ((searchargs->flags & SEARCH_RECENT_SET) && msgno <= lastnotrecent) 
 	return 0;
@@ -3075,13 +3091,13 @@
     if (searchargs->smaller && SIZE(msgno) >= searchargs->smaller) return 0;
     if (searchargs->larger && SIZE(msgno) <= searchargs->larger) return 0;
 
-    if (searchargs->after && INTERNALDATE(msgno) < searchargs->after)
+    if (searchargs->after && (time_t) INTERNALDATE(msgno) < searchargs->after)
       return 0;
-    if (searchargs->before && INTERNALDATE(msgno) > searchargs->before)
+    if (searchargs->before && (time_t) INTERNALDATE(msgno) >= searchargs->before)
       return 0;
-    if (searchargs->sentafter && SENTDATE(msgno) < searchargs->sentafter)
+    if (searchargs->sentafter && (time_t) SENTDATE(msgno) < searchargs->sentafter)
       return 0;
-    if (searchargs->sentbefore && SENTDATE(msgno) > searchargs->sentbefore)
+    if (searchargs->sentbefore && (time_t) SENTDATE(msgno) >= searchargs->sentbefore)
       return 0;
 
     if (searchargs->modseq && MODSEQ(msgno) < searchargs->modseq) return 0;
@@ -3096,11 +3112,11 @@
 	  return 0;
     }
 
-    for (l = searchargs->sequence; l; l = l->next) {
-	if (!index_insequence(msgno, l->s, 0)) return 0;
-    }
-    for (l = searchargs->uidsequence; l; l = l->next) {
-	if (!index_insequence(UID(msgno), l->s, 1)) return 0;
+    for (seq = searchargs->sequence; seq; seq = seq->next) {
+	if (!index_insequence(msgno, seq, 1)) return 0;
+    }
+    for (seq = searchargs->uidsequence; seq; seq = seq->next) {
+	if (!index_insequence(UID(msgno), seq, 1)) return 0;
     }
 
     if (searchargs->from || searchargs->to || searchargs->cc ||
@@ -3270,7 +3286,8 @@
 {
     int partsleft = 1;
     int subparts;
-    int start, len, charset, encoding;
+    unsigned long start;
+    int len, charset, encoding;
     char *p, *q;
     
     /* Won't find anything in a truncated file */
@@ -3359,7 +3376,7 @@
     char *q;
     static struct strlist header;
     static char *buf;
-    static int bufsize;
+    static unsigned bufsize;
     const char *cacheitem;
     unsigned size;
     int r;
@@ -3406,7 +3423,8 @@
   struct mapfile msgfile;
   int partsleft = 1;
   int subparts;
-  int start, len, charset, encoding;
+  unsigned long start;
+  int len, charset, encoding;
   int partcount = 0;
   char *p, *q;
   int format = mailbox->format;
@@ -3470,17 +3488,13 @@
   mailbox_unmap_message(mailbox, uid, &msgfile.base, &msgfile.size);
 }
 
-void index_getsearchtext(struct mailbox* mailbox,
+void index_getsearchtext_single(struct mailbox* mailbox, unsigned msgno,
                          index_search_text_receiver_t receiver,
                          void* rock) {
-  int i;
-
-  /* Send the converted text of every message out to the receiver. */
-  for (i = 1; i <= imapd_exists; i++) {
     const char *cacheitem;
-    int uid = UID(i);
-
-    cacheitem = cache_base + CACHE_OFFSET(i);
+    int uid = UID(msgno);
+
+    cacheitem = cache_base + CACHE_OFFSET(msgno);
     cacheitem = CACHE_ITEM_NEXT(cacheitem); /* skip envelope */
     cacheitem = CACHE_ITEM_NEXT(cacheitem); /* skip bodystructure */
     cacheitem = CACHE_ITEM_NEXT(cacheitem); /* skip body */
@@ -3509,7 +3523,17 @@
     receiver(uid, SEARCHINDEX_PART_SUBJECT, SEARCHINDEX_CMD_STUFFPART,
              cacheitem + 4, CACHE_ITEM_LEN(cacheitem), rock);
     cacheitem = CACHE_ITEM_NEXT(cacheitem); /* skip subject */
-  }
+}
+
+void index_getsearchtext(struct mailbox* mailbox,
+                         index_search_text_receiver_t receiver,
+                         void* rock)
+{
+    int i;
+
+    /* Send the converted text of every message out to the receiver. */
+    for (i = 1; i <= imapd_exists; i++)
+        index_getsearchtext_single(mailbox, i, receiver, rock);
 }
 
 /*
@@ -3542,15 +3566,15 @@
     copyargs->copymsg[copyargs->nummsg].content_lines = CONTENT_LINES(msgno);
     copyargs->copymsg[copyargs->nummsg].cache_version = CACHE_VERSION(msgno);
     copyargs->copymsg[copyargs->nummsg].cache_begin = cache_base + CACHE_OFFSET(msgno);
-    message_uuid_unpack(&copyargs->copymsg[copyargs->nummsg].uuid,
+    message_guid_import(&copyargs->copymsg[copyargs->nummsg].guid,
                         (unsigned char *) /* YYY */
-                        INDEC_OFFSET(msgno)+OFFSET_MESSAGE_UUID);
+                        INDEC_OFFSET(msgno)+OFFSET_MESSAGE_GUID);
 
     if (mailbox->format != MAILBOX_FORMAT_NORMAL) {
 	/* Force copy and re-parse of message */
 	copyargs->copymsg[copyargs->nummsg].cache_len = 0;
     }
-    else if (msgno < imapd_exists) {
+    else if (msgno < (unsigned) imapd_exists) {
 	copyargs->copymsg[copyargs->nummsg].cache_len =
 	  CACHE_OFFSET(msgno+1) - CACHE_OFFSET(msgno);
     }
@@ -3700,7 +3724,8 @@
  		cur->nannot++;
  		break;
 	    case LOAD_IDS:
-		index_get_ids(cur, envtokens, headers + CACHE_ITEM_SIZE_SKIP);
+		index_get_ids(cur, envtokens, headers + CACHE_ITEM_SIZE_SKIP,
+			      CACHE_ITEM_LEN(headers));
 		break;
 	    }
 	}
@@ -4077,27 +4102,42 @@
 }
 
 /* Get message-id, and references/in-reply-to */
-#define REFGROWSIZE 10
-
-void index_get_ids(MsgData *msgdata, char *envtokens[], const char *headers)
-{
+#define REFGROWSIZE 20
+
+void index_get_ids(MsgData *msgdata, char *envtokens[], const char *headers,
+		   unsigned size)
+{
+    static char *buf;
+    static unsigned bufsize;
+    static struct strlist refhdr;
     char *refstr, *ref, *in_reply_to;
     int refsize = REFGROWSIZE;
-    char buf[100];
+
+    if (bufsize < size+2) {
+	bufsize = size+100;
+	buf = xrealloc(buf, bufsize);
+    }
 
     /* get msgid */
     msgdata->msgid = find_msgid(envtokens[ENV_MSGID], NULL);
      /* if we don't have one, create one */
     if (!msgdata->msgid) {
-	snprintf(buf, sizeof(buf), "<Empty-ID: %u>", msgdata->msgno);
+	snprintf(buf, bufsize, "<Empty-ID: %u>", msgdata->msgno);
 	msgdata->msgid = xstrdup(buf);
     }
 
+    /* Copy headers to the buffer */
+    memcpy(buf, headers, size);
+    buf[size] = '\0';
+
     /* grab the References header */
-    if ((refstr = stristr(headers, "references:"))) {
+    refhdr.s = "references";
+    index_pruneheader(buf, &refhdr, 0);
+    if (*buf) {
 	/* allocate some space for refs */
 	msgdata->ref = (char **) xmalloc(refsize * sizeof(char *));
 	/* find references */
+	refstr = buf;
 	while ((ref = find_msgid(refstr, &refstr)) != NULL) {
 	    /* reallocate space for this msgid if necessary */
 	    if (msgdata->nref == refsize) {
@@ -4169,8 +4209,8 @@
 	    ret = strcmp(md1->cc, md2->cc);
 	    break;
 	case SORT_DATE: {
-	    time_t d1 = md1->date ? md1->date : INTERNALDATE(md1->msgno);
-	    time_t d2 = md2->date ? md2->date : INTERNALDATE(md2->msgno);
+	    time_t d1 = md1->date ? md1->date : (time_t) INTERNALDATE(md1->msgno);
+	    time_t d2 = md2->date ? md2->date : (time_t) INTERNALDATE(md2->msgno);
 	    ret = numcmp(d1, d2);
 	    break;
 	}
@@ -5154,6 +5194,7 @@
     int size;
     char *envtokens[NUMENVTOKENS];
     struct address addr = { NULL, NULL, NULL, NULL, NULL, NULL };
+    static struct strlist refhdr;
 
     cacheitem = cache_base + CACHE_OFFSET(msgno); /* envelope */
 
@@ -5174,13 +5215,13 @@
     cacheitem = CACHE_ITEM_NEXT(cacheitem); /* cacheheaders */
 
     /* make a working copy of headers */
-    /* +1 -> leave space for NUL */
-    size = CACHE_ITEM_LEN(cacheitem) + 1;
-    if (hdrsize < size) {
-	hdrsize = size;
+    size = CACHE_ITEM_LEN(cacheitem);
+    if (hdrsize < size+2) {
+	hdrsize = size+100;
 	hdr = xrealloc(hdr, hdrsize);
     }
-    strlcpy(hdr, cacheitem + CACHE_ITEM_SIZE_SKIP, size);
+    memcpy(hdr, cacheitem + CACHE_ITEM_SIZE_SKIP, size);
+    hdr[size] = '\0';
 
     parse_cached_envelope(env, envtokens, VECTOR_SIZE(envtokens));
 
@@ -5218,8 +5259,10 @@
 	over.from = NULL;
 
     /* massage references */
-    if ((over.ref = stristr(hdr, "references:"))) {
-	over.ref += 11; /* skip over header name */
+    refhdr.s = "references";
+    index_pruneheader(hdr, &refhdr, 0);
+    if (*hdr) {
+	over.ref = hdr + 11; /* skip over header name */
 	massage_header(over.ref);
     }
 
@@ -5233,7 +5276,7 @@
     static unsigned long msg_size = 0;
     struct strlist headers = { NULL, NULL, NULL, NULL };
     static char *alloc = NULL;
-    static int allocsize = 0;
+    static unsigned allocsize = 0;
     const char *cacheitem;
     unsigned size;
     char *buf;
@@ -5349,3 +5392,151 @@
 
     return lines;
 }
+
+#define MAX(x, y) (x > y ? x : y)
+
+/* Comparator function that sorts ranges by the low value,
+   and coalesces intersecting ranges to have the same high value */
+static int comp_coalesce(const void *v1, const void *v2)
+{
+    struct seq_range *r1 = (struct seq_range *) v1;
+    struct seq_range *r2 = (struct seq_range *) v2;
+
+    /* If ranges don't intersect, we're done */
+    if (r1->high < r2->low) return -1;
+    if (r1->low > r2->high) return 1;
+
+    /* Ranges intersect, coalesce them */
+    r1->high = r2->high = MAX(r1->high, r2->high);
+
+    return r1->low - r2->low;;
+}
+
+#define SETGROWSIZE 100
+
+/*
+ * Parse a sequence into an array of sorted & merged ranges.
+ */
+struct seq_set *index_parse_sequence(const char *sequence, int usinguid,
+				     struct seq_set *set)
+{
+    unsigned i, j, start, end, *num;
+
+    if (!set) set = xzmalloc(sizeof(struct seq_set));
+
+    start = end = 0;
+    num = &start;
+    for (;;) {
+	if (cyrus_isdigit((int) *sequence)) {
+	    *num = (*num)*10 + *sequence - '0';
+	}
+	else if (*sequence == '*') {
+	    *num = usinguid ? UID(imapd_exists) : (unsigned) imapd_exists;
+	}
+	else if (*sequence == ':') {
+	    num = &end;
+	}
+	else {
+	    if (!end) end = start;
+	    else if (start > end) {
+		i = end;
+		end = start;
+		start = i;
+	    }
+
+	    if (set->len == set->alloc) {
+		set->alloc += SETGROWSIZE;
+		set->set =
+		    xrealloc(set->set, set->alloc * sizeof(struct seq_range));
+	    }
+	    set->set[set->len].low = start;
+	    set->set[set->len].high = end;
+	    set->len++;
+
+	    start = end = 0;
+	    num = &start;
+
+	    if (!*sequence) break;
+	}
+	sequence++;
+    }
+
+    /* Sort the ranges using our special comparator */
+    qsort(set->set, set->len, sizeof(struct seq_range), comp_coalesce);
+
+    /* Merge intersecting/adjacent ranges */
+    for (i = 0, j = 1; j < set->len; j++) {
+	if ((int)(set->set[j].low - set->set[i].high) <= 1) {
+	    set->set[i].high = set->set[j].high;
+	} else {
+	    i++;
+	    set->set[i].low = set->set[j].low;
+	    set->set[i].high = set->set[j].high;
+	}
+    }
+    set->len = i+1;
+
+    return set;
+}
+
+/* Comparator function that checks if r1 is a subset of r2 */
+static int comp_subset(const void *v1, const void *v2)
+{
+    struct seq_range *r1 = (struct seq_range *) v1;
+    struct seq_range *r2 = (struct seq_range *) v2;
+
+    if (r1->low < r2->low) return -1;
+    if (r1->high > r2->high) return 1;
+    return 0;
+}
+
+/*
+ * Return nonzero iff 'num' is included in 'sequence'
+ */
+static int index_insequence(unsigned num, struct seq_set *set, int use_mark)
+{
+    if (!use_mark) set->mark = 0;
+
+    /* Short circuit if we're outside all ranges */
+    if ((num < set->set[set->mark].low) || (num > set->set[set->len-1].high)) {
+	return 0;
+    }
+    else {
+	/* Otherwise create a dummy range from our data point,
+	   and see if it intersects with our set */
+	struct seq_range key = { num, num };
+	struct seq_range *found = bsearch(&key, set->set + set->mark,
+					  set->len - set->mark,
+					  sizeof(struct seq_range),
+					  comp_subset);
+
+	if (found) {
+	    /* Set the mark to the index of the inclusive range */
+	    set->mark = found - set->set;
+	    return 1;
+	}
+
+	return 0;
+    }
+}
+
+void appendsequencelist(struct seq_set **l, char *sequence, int usinguid)
+{
+    struct seq_set **tail = l;
+
+    while (*tail) tail = &(*tail)->next;
+
+    *tail = index_parse_sequence(sequence, usinguid, NULL);
+}
+
+void freesequencelist(struct seq_set *l)
+{
+    struct seq_set *n;
+
+    while(l) {
+	n = l->next;
+	free(l->set);
+	free(l);
+	l = n;
+    }
+}

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/index.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/index.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/index.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/index.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* index.c -- Routines for dealing with the index file in the imapd
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
- */
-/*
- * $Id: index.h,v 1.11 2006/11/30 17:11:18 murch Exp $
+ * $Id: index.h,v 1.16 2008/03/24 17:09:17 murch Exp $
  */
 
 /* Header for internal usage of index.c + programs that make raw access
@@ -64,6 +62,7 @@
 
 #include "annotate.h" /* for strlist functionality */
 #include "mailbox.h" /* for bit32 */
+#include "message_guid.h"
 
 /* Access macros for the memory-mapped index file data */
 #define INDEC_OFFSET(msgno) (index_base+start_offset+(((msgno)-1)*record_size))
@@ -84,6 +83,7 @@
 #else
 #define MODSEQ(msgno) ntohl(*((bit32 *)(INDEC_OFFSET(msgno)+OFFSET_MODSEQ)))
 #endif
+#define GUID(msgno) message_guid_import(NULL, (unsigned char *)(INDEC_OFFSET(msgno)+OFFSET_MESSAGE_GUID))
 
 /* Access assistance macros for memory-mapped cache file data */
 /* CACHE_ITEM_BIT32: Convert to host byte order */
@@ -178,9 +178,22 @@
     unsigned long lines;
 };
 
+struct seq_range {
+    unsigned low;
+    unsigned high;
+};
+
+struct seq_set {
+    struct seq_range *set;
+    unsigned len;
+    unsigned alloc;
+    unsigned mark;
+    struct seq_set *next;
+};
+
 extern void index_operatemailbox(struct mailbox *mailbox);
-extern int index_finduid(unsigned uid);
-extern int index_getuid(unsigned msgno);
+extern unsigned index_finduid(unsigned uid);
+extern unsigned index_getuid(unsigned msgno);
 extern int index_urlfetch(struct mailbox *mailbox, unsigned msgno,
 			  const char *section,
 			  unsigned long start_octet, unsigned long octet_count,
@@ -195,4 +208,10 @@
 extern int index_copy_remote(struct mailbox *mailbox, char *sequence, 
 			     int usinguid, struct protstream *pout);
 
+void appendsequencelist(struct seq_set **l, char *sequence, int usinguid);
+void freesequencelist(struct seq_set *l);
+
+extern struct seq_set *index_parse_sequence(const char *sequence, int usinguid,
+					    struct seq_set *set);
+
 #endif /* INDEX_H */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ipurge.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ipurge.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ipurge.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/ipurge.c Mon Feb  9 12:49:22 2009
@@ -1,13 +1,9 @@
-/*
- * ipurge
- *
- * delete mail from cyrus imap mailbox or partition
+/* ipurge.c - delete mail from cyrus imap mailbox or partition
  * based on date (or size?)
  *
  * includes support for ISPN virtual host extensions
  *
- * $Id: ipurge.c,v 1.26 2006/11/30 17:11:18 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -23,14 +19,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -45,7 +42,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: ipurge.c,v 1.31 2008/03/24 17:09:17 murch Exp $
  */
 
 #include <config.h>
@@ -67,6 +64,8 @@
 #include "mailbox.h"
 #include "xmalloc.h"
 #include "mboxlist.h"
+#include "util.h"
+#include "sync_log.h"
 
 /* config.c stuff */
 const int config_need_data = CONFIG_NEED_PARTITION_DATA;
@@ -103,7 +102,7 @@
 int forceall = 0;
 
 int purge_me(char *, int, int);
-int purge_check(struct mailbox *, void *, char *, int);
+unsigned purge_check(struct mailbox *, void *, unsigned char *, int);
 int usage(char *name);
 void print_stats(mbox_stats_t *stats);
 
@@ -113,7 +112,9 @@
   char *alt_config = NULL;
   int r;
 
-  if (geteuid() == 0) fatal("must run as the Cyrus user", EX_USAGE);
+  if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+      fatal("must run as the Cyrus user", EC_USAGE);
+  }
 
   while ((option = getopt(argc, argv, "C:hxd:b:k:m:fsXi")) != EOF) {
     switch (option) {
@@ -182,6 +183,8 @@
   /* open the quota db, we'll need it for expunge */
   quotadb_init(0);
   quotadb_open(NULL);
+
+  sync_log_init();
 
   if (optind == argc) { /* do the whole partition */
     strcpy(buf, "*");
@@ -266,6 +269,8 @@
   the_box.index_lock_count = 1;
 
   mailbox_expunge(&the_box, purge_check, &stats, EXPUNGE_FORCE);
+
+  sync_log_mailbox(the_box.name);
   mailbox_close(&the_box);
 
   print_stats(&stats);
@@ -281,8 +286,9 @@
 
 /* thumbs up routine, checks date & size and returns yes or no for deletion */
 /* 0 = no, 1 = yes */
-int purge_check(struct mailbox *mailbox __attribute__((unused)),
-		void *deciderock, char *buf,
+unsigned purge_check(struct mailbox *mailbox __attribute__((unused)),
+		     void *deciderock,
+		     unsigned char *buf,
 		int expunge_flags __attribute__((unused)))
 {
   time_t my_time;
@@ -317,7 +323,7 @@
     }
     if (size >= 0) {
       /* check size */
-      if (msgsize == size) {
+	if ((int) msgsize == size) {
 	  if (invertmatch) return 0;
 	  deleteit(msgsize, stats);
 	  return 1;
@@ -343,11 +349,11 @@
     }
     if (size >= 0) {
       /* check size */
-      if (!invertmatch && (msgsize > size)) {
-	  deleteit(msgsize, stats);
-	  return 1;
-      }
-      if (invertmatch && (msgsize < size)) {
+	if (!invertmatch && ((int) msgsize > size)) {
+	  deleteit(msgsize, stats);
+	  return 1;
+      }
+	if (invertmatch && ((int) msgsize < size)) {
 	  deleteit(msgsize, stats);
 	  return 1;
       }

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtp_sieve.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtp_sieve.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtp_sieve.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtp_sieve.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* lmtp_sieve.c -- Sieve implementation for lmtpd
  *
- * $Id: lmtp_sieve.c,v 1.14 2007/02/05 18:41:47 jeaton Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: lmtp_sieve.c,v 1.17 2008/03/24 17:09:17 murch Exp $
  */
 
 #include <config.h>
@@ -403,10 +403,10 @@
 
 static int sieve_discard(void *ac __attribute__((unused)), 
 			 void *ic __attribute__((unused)), 
-			 void *sc, void *mc, 
+			 void *sc __attribute__((unused)), 
+			 void *mc, 
 			 const char **errmsg __attribute__((unused)))
 {
-    script_data_t *sd = (script_data_t *) sc;
     message_data_t *md = ((deliver_data_t *) mc)->m;
 
     snmp_increment(SIEVE_DISCARD, 1);
@@ -501,7 +501,6 @@
     sieve_keep_context_t *kc = (sieve_keep_context_t *) ac;
     script_data_t *sd = (script_data_t *) sc;
     deliver_data_t *mydata = (deliver_data_t *) mc;
-    message_data_t *md = mydata->m;
     int ret;
 
     ret = deliver_local(mydata, kc->imapflags->flag, kc->imapflags->nflags,
@@ -833,7 +832,7 @@
 	size_t len = strlcpy(fname, sieve_dir, size);
 
 	if (domain) {
-	    char dhash = (char) dir_hash_c(domain);
+	    char dhash = (char) dir_hash_c(domain, config_fulldirhash);
 	    len += snprintf(fname+len, size-len, "%s%c/%s",
 			    FNAME_DOMAINDIR, dhash, domain);
 	}
@@ -842,7 +841,7 @@
 	    len = strlcat(fname, "/global/", size);
 	}
 	else {
-	    char hash = (char) dir_hash_c(user);
+	    char hash = (char) dir_hash_c(user, config_fulldirhash);
 	    len += snprintf(fname+len, size-len, "/%c/%s/", hash, user);
 
 	    if (!script) { /* default script */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtp_sieve.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtp_sieve.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtp_sieve.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtp_sieve.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* lmtp_sieve.h -- Sieve implementation for lmtpd
  *
- * $Id: lmtp_sieve.h,v 1.4 2006/11/30 17:11:18 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: lmtp_sieve.h,v 1.5 2008/03/24 17:09:17 murch Exp $
  */
 
 #ifndef LMTP_SIEVE_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpd.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpd.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpd.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpd.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* lmtpd.c -- Program to deliver mail to a mailbox
  *
- * $Id: lmtpd.c,v 1.147 2007/02/05 18:41:47 jeaton Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: lmtpd.c,v 1.161 2008/04/22 13:11:18 murch Exp $
  */
 
 #include <config.h>
@@ -145,6 +145,21 @@
 mupdate_handle *mhandle = NULL;
 struct backend **backend_cached = NULL;
 
+static struct protocol_t lmtp_protocol =
+{ "lmtp", "lmtp",
+  { 0, "220 " },
+  { "LHLO", "lmtpproxyd", "250 ", NULL,
+    { { "AUTH ", CAPA_AUTH },
+      { "STARTTLS", CAPA_STARTTLS },
+      { "PIPELINING", CAPA_PIPELINING },
+      { "IGNOREQUOTA", CAPA_IGNOREQUOTA },
+      { NULL, 0 } } },
+  { "STARTTLS", "220", "454", 0 },
+  { "AUTH", 512, 0, "235", "5", "334 ", "*", NULL, 0 },
+  { "NOOP", NULL, "250" },
+  { "QUIT", NULL, "221" }
+};
+
 static struct sasl_callback mysasl_cb[] = {
     { SASL_CB_GETOPT, &mysasl_config, NULL },
     { SASL_CB_PROXY_POLICY, &mysasl_proxy_policy, NULL },
@@ -226,9 +241,6 @@
     snmp_connect(); /* ignore return code */
     snmp_set_str(SERVER_NAME_VERSION, CYRUS_VERSION);
 
-    /* YYY Sanity checks possible here? */
-    message_uuid_client_init(getenv("CYRUS_UUID_PREFIX"));
-
     return 0;
 }
 
@@ -288,8 +300,13 @@
     } else {
 	syslog(LOG_ERR, "couldn't connect to %s: %s", config_mupdate_server,
 	       error_message(r));
-	prot_printf(deliver_out, "451 %s LMTP Cyrus %s %s\r\n",
-		    config_servername, CYRUS_VERSION, error_message(r));
+	prot_printf(deliver_out, "451");
+	if (config_serverinfo) prot_printf(deliver_out, " %s", config_servername);
+	if (config_serverinfo == IMAP_ENUM_SERVERINFO_ON) {
+	    prot_printf(deliver_out, " Cyrus LMTP%s %s",
+			config_mupdate_server ? " Murder" : "", CYRUS_VERSION);
+	}
+	prot_printf(deliver_out, " %s\r\n", error_message(r));
     }
 
     /* free session state */
@@ -337,7 +354,7 @@
 			  void *rock)
 {
     struct fuzz_rock *frock = (struct fuzz_rock *) rock;
-    int i;
+    unsigned i;
 
     for (i = frock->prefixlen; name[i] && frock->pat[i]; i++) {
 	if (tolower((int) name[i]) != frock->pat[i] &&
@@ -476,17 +493,19 @@
     unsigned long uid;
     const char *notifier;
 
-    if (dupelim && id && 
-	duplicate_check(id, strlen(id), mailboxname, strlen(mailboxname))) {
-	/* duplicate message */
-	duplicate_log(id, mailboxname, "delivery");
-	return 0;
-    }
-
     r = append_setup(&as, mailboxname, MAILBOX_FORMAT_NORMAL,
 		     authuser, authstate, acloverride ? 0 : ACL_POST, 
-		     quotaoverride ? -1 :
-		     config_getswitch(IMAPOPT_LMTP_STRICT_QUOTA) ? size : 0);
+		     quotaoverride ? (long) -1 :
+		     config_getswitch(IMAPOPT_LMTP_STRICT_QUOTA) ?
+		     (long) size : 0);
+
+    /* check for duplicate message */
+    if (!r && id && dupelim && !(as.m.options & OPT_IMAP_DUPDELIVER) &&
+	duplicate_check(id, strlen(id), mailboxname, strlen(mailboxname))) {
+	duplicate_log(id, mailboxname, "delivery");
+	append_abort(&as);
+	return 0;
+    }
 
     if (!r && !content->body) {
 	/* parse the message body if we haven't already,
@@ -497,8 +516,10 @@
     if (!r) {
 	r = append_fromstage(&as, &content->body, stage, now,
 			     (const char **) flag, nflags, !singleinstance);
+
+	/* check for duplicate again in case of delivery during setup */
 	if (r ||
-	    (dupelim && id && 
+	    (id && dupelim && !(as.m.options & OPT_IMAP_DUPDELIVER) &&
 	     duplicate_check(id, strlen(id), mailboxname, strlen(mailboxname)))) {
 	    append_abort(&as);
                     
@@ -508,12 +529,16 @@
 		return 0;
 	    }         
 	} else {
-	    if (dupelim && id) 
-		duplicate_mark(id, strlen(id), mailboxname, 
-			       strlen(mailboxname), now, uid);
-
-	    append_commit(&as, quotaoverride ? -1 : 0, NULL, &uid, NULL);
+	    int sharedseen = (as.m.options & OPT_IMAP_SHAREDSEEN);
+
+	    r = append_commit(&as, quotaoverride ? -1 : 0, NULL, &uid, NULL);
+	    if (!r) {
 	    syslog(LOG_INFO, "Delivered: %s to mailbox: %s", id, mailboxname);
+
+		if (dupelim && id) {
+		    duplicate_mark(id, strlen(id), mailboxname, 
+				   strlen(mailboxname), now, uid);
+		}
 
 	    sync_log_append(mailboxname);
 
@@ -521,12 +546,14 @@
 		/* check if the \Seen flag has been set on this message */
 		while (nflags) {
 		    if (!strcmp(flag[--nflags], "\\seen")) {
-			sync_log_seen(user, mailboxname);
+			    sync_log_seen(sharedseen ? "anyone" : user,
+					  mailboxname);
 			break;
 		    }
 		}
 	    }
 	}
+    }
     }
 
     if (!r && user && (notifier = config_getstring(IMAPOPT_MAILNOTIFIER))) {
@@ -539,7 +566,7 @@
 	/* translate user.foo to INBOX */
 	if (!(*lmtpd_namespace.mboxname_tointernal)(&lmtpd_namespace,
 						    "INBOX", user, inbox)) {
-	    int inboxlen = strlen(inbox);
+	    size_t inboxlen = strlen(inbox);
 	    if (strlen(mailboxname) >= inboxlen &&
 		!strncmp(mailboxname, inbox, inboxlen) &&
 		(!mailboxname[inboxlen] || mailboxname[inboxlen] == '.')) {
@@ -606,7 +633,7 @@
 	}
 	assert(i == d->rnum);
 
-	remote = proxy_findserver(d->server, &protocol[PROTOCOL_LMTP], "",
+	remote = proxy_findserver(d->server, &lmtp_protocol, "",
 				  &backend_cached, NULL, NULL, NULL);
 	if (remote) {
 	    r = lmtp_runtxn(remote, lt);
@@ -1106,7 +1133,7 @@
 
     if (!f) {
 	/* we only have remote mailboxes, so use a tempfile */
-	int fd = create_tempfile();
+	int fd = create_tempfile(config_getstring(IMAPOPT_TEMP_PATH));
 
 	if (fd != -1) f = fdopen(fd, "w+");
     }

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpd.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpd.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpd.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpd.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* lmtpd.h -- Program to deliver mail to a mailbox
  *
- * $Id: lmtpd.h,v 1.4 2006/11/30 17:11:18 murch Exp $
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: lmtpd.h,v 1.5 2008/03/24 17:09:17 murch Exp $
  */
 
 #ifndef LMTPD_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpengine.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpengine.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpengine.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpengine.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* lmtpengine.c: LMTP protocol engine
- * $Id: lmtpengine.c,v 1.118 2007/02/05 18:41:47 jeaton Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: lmtpengine.c,v 1.129 2008/10/08 15:47:08 murch Exp $
  */
 
 #include <config.h>
@@ -114,6 +116,7 @@
     sasl_conn_t *conn;
 
     enum {
+	TLSCERT_AUTHED = -2,  /* -2: TLS cert auth'd, but no AUTH issued */
 	EXTERNAL_AUTHED = -1, /* -1: external auth'd, but no AUTH issued */
 	NOAUTH = 0,
 	DIDAUTH = 1
@@ -672,17 +675,20 @@
     p += sprintf(p, "from %s (%s)", cd->lhlo_param, cd->clienthost);
     fold[nfold++] = p;
     if (m->authuser) {
-	const int *ssfp;
-	sasl_getprop(cd->conn, SASL_SSF, (const void **) &ssfp);
-	p += sprintf(p, " (authenticated user=%s bits=%d)",
-		     m->authuser, *ssfp);
+	const void *ssfp;
+	sasl_ssf_t ssf;
+	sasl_getprop(cd->conn, SASL_SSF, &ssfp);
+	ssf = *((sasl_ssf_t *) ssfp);
+	p += sprintf(p, " (authenticated user=%s bits=%d)", m->authuser, ssf);
 	fold[nfold++] = p;
     }
 
     /* We are always atleast "with LMTPA" -- no unauth delivery */
-    p += sprintf(p, " by %s (Cyrus %s) with LMTP%s%s",
-		 config_servername,
-		 CYRUS_VERSION,
+    p += sprintf(p, " by %s", config_servername);
+    if (config_serverinfo == IMAP_ENUM_SERVERINFO_ON) {
+	p += sprintf(p, " (Cyrus %s)", CYRUS_VERSION);
+    }
+    p += sprintf(p, " with LMTP%s%s",
 		 cd->starttls_done ? "S" : "",
 		 cd->authenticated != NOAUTH ? "A" : "");
 
@@ -697,7 +703,7 @@
  
     fprintf(f, "Received: ");
     for (i = 0, p = addbody; i < nfold; p = fold[i], i++) {
-	fprintf(f, "%.*s\r\n\t", fold[i] - p, p);
+	fprintf(f, "%.*s\r\n\t", (int) (fold[i] - p), p);
     }
     fprintf(f, "%s\r\n", p);
     spool_cache_header(xstrdup("Received"), addbody, m->hdrcache);
@@ -936,7 +942,7 @@
 /* Reset the given sasl_conn_t to a sane state */
 static int reset_saslconn(sasl_conn_t **conn) 
 {
-    int ret, secflags;
+    int ret;
     sasl_security_properties_t *secprops = NULL;
 
     sasl_dispose(conn);
@@ -956,12 +962,7 @@
                           saslprops.iplocalport);
     if(ret != SASL_OK) return ret;
     
-    secflags = SASL_SEC_NOANONYMOUS;
-    if (!config_getswitch(IMAPOPT_ALLOWPLAINTEXT)) {
-	secflags |= SASL_SEC_NOPLAINTEXT;
-    }
-
-    secprops = mysasl_secprops(secflags);
+    secprops = mysasl_secprops(SASL_SEC_NOANONYMOUS);
     ret = sasl_setprop(*conn, SASL_SEC_PROPS, secprops);
     if(ret != SASL_OK) return ret;
     /* end of service_main initialization excepting SSF */
@@ -1003,7 +1004,6 @@
     sasl_ssf_t ssf;
     char *auth_id;
 
-    int secflags = 0;
     sasl_security_properties_t *secprops = NULL;
 
     /* setup the clientdata structure */
@@ -1098,12 +1098,7 @@
 
     /* set my allowable security properties */
     /* ANONYMOUS is silly because we allow that anyway */
-    secflags = SASL_SEC_NOANONYMOUS;
-    if (!config_getswitch(IMAPOPT_ALLOWPLAINTEXT)) {
-	secflags |= SASL_SEC_NOPLAINTEXT;
-    }
-
-    secprops = mysasl_secprops(secflags);
+    secprops = mysasl_secprops(SASL_SEC_NOANONYMOUS);
     sasl_setprop(cd.conn, SASL_SEC_PROPS, secprops);
 
     if (func->preauth) {
@@ -1121,9 +1116,12 @@
 	if(haveremote) sasl_setprop(cd.conn, SASL_IPREMOTEPORT, &remoteip);  
     }
 
-    prot_printf(pout, "220 %s LMTP Cyrus %s ready\r\n", 
-		config_servername,
-		CYRUS_VERSION);
+    prot_printf(pout, "220 %s", config_servername);
+    if (config_serverinfo == IMAP_ENUM_SERVERINFO_ON) {
+	prot_printf(pout, " Cyrus LMTP%s %s",
+		    config_mupdate_server ? " Murder" : "", CYRUS_VERSION);
+    }
+    prot_printf(pout, " server ready\r\n");
 
     for (;;) {
     nextcmd:
@@ -1158,6 +1156,7 @@
 	  if (!strncasecmp(buf, "auth ", 5)) {
 	      char mech[128];
 	      int sasl_result;
+	      const void *val;
 	      const char *user;
 	      
 	      if (cd.authenticated > 0) {
@@ -1242,12 +1241,21 @@
 		  reset_saslconn(&cd.conn);
 		  continue;
 	      }
-	      r = sasl_getprop(cd.conn, SASL_USERNAME, (const void **) &user);
+	      r = sasl_getprop(cd.conn, SASL_USERNAME, &val);
 	      if (r != SASL_OK) {
 		  prot_printf(pout, "501 5.5.4 SASL Error\r\n");
 		  reset_saslconn(&cd.conn);
 		  goto nextcmd;
 	      }
+	      user = (const char *) val;
+
+	      r = sasl_getprop(cd.conn, SASL_SSF, &val);
+	      if (r != SASL_OK) {
+		  prot_printf(pout, "501 5.5.4 SASL Error\r\n");
+		  reset_saslconn(&cd.conn);
+		  goto nextcmd;
+	      }
+	      saslprops.ssf = *((sasl_ssf_t *) val);
 
 	      /* Create telemetry log */
 	      deliver_logfd = telemetry_log(user, pin, pout, 0);
@@ -1327,10 +1335,11 @@
 		  prot_printf(pout, "250-SIZE %d\r\n", max_msgsize);
 	      else
 		  prot_printf(pout, "250-SIZE\r\n");
-	      if (tls_enabled() && !cd.starttls_done && !cd.authenticated) {
+	      if (tls_enabled() && !cd.starttls_done &&
+		  cd.authenticated <= NOAUTH) {
 		  prot_printf(pout, "250-STARTTLS\r\n");
 	      }
-	      if (cd.authenticated <= NOAUTH &&
+	      if ((cd.authenticated <= NOAUTH || saslprops.ssf) &&
 		  sasl_listmech(cd.conn, NULL, "AUTH ", " ", "", &mechs, 
 				NULL, &mechcount) == SASL_OK && 
 		  mechcount > 0) {
@@ -1587,6 +1596,7 @@
   
 		r=tls_start_servertls(0, /* read */
 				      1, /* write */
+				      360, /* 6 minutes */
 				      layerp,
 				      &auth_id,
 				      &(cd.tls_conn));
@@ -1613,8 +1623,10 @@
 		    free(saslprops.authid);
 		    saslprops.authid = NULL;
 		}
-		if(auth_id)
+		if(auth_id) {
 		    saslprops.authid = xstrdup(auth_id);		
+		    cd.authenticated = TLSCERT_AUTHED;
+		}
 
 		/* tell the prot layer about our new layers */
 		prot_settls(pin, cd.tls_conn);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpengine.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpengine.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpengine.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpengine.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* lmtpengine.h: lmtp protocol engine interface
- * $Id: lmtpengine.h,v 1.23 2006/11/30 17:11:18 murch Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: lmtpengine.h,v 1.25 2008/04/03 21:09:52 murch Exp $
  */
 
 #ifndef LMTPENGINE_H
@@ -133,6 +135,12 @@
 
 #include "backend.h"
 
+enum {
+    /* LMTP capabilities */
+    CAPA_PIPELINING	= (1 << 2),
+    CAPA_IGNOREQUOTA	= (1 << 3)
+};
+
 struct lmtp_txn {
     const char *from;
     const char *auth;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpstats.snmp
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpstats.snmp?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpstats.snmp (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/lmtpstats.snmp Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -36,8 +37,11 @@
 # 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. 
+#
+# $Id: lmtpstats.snmp,v 1.7 2008/04/04 12:46:35 murch Exp $
+
 # Count number of times command was executed
-#
+
 
 define mgmt 1.3.6.1.2
 define mib2 [mgmt].1

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mailbox.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mailbox.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mailbox.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mailbox.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* mailbox.c -- Mailbox manipulation routines
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,8 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: mailbox.c,v 1.164 2007/02/05 18:41:47 jeaton Exp $
- *
+ * $Id: mailbox.c,v 1.184 2008/10/15 17:40:37 wescraig Exp $
  */
 
 #include <config.h>
@@ -236,7 +236,7 @@
  *  Assume cache entry version 1, unless other data is found
  *  in the table.
  */
-static inline int is_cached_header(const char *hdr) 
+static inline unsigned is_cached_header(const char *hdr) 
 {
     int i;
     
@@ -258,7 +258,7 @@
  *   Returns minimum version required for lookup to succeed
  *   or BIT32_MAX if header not cached
  */
-int mailbox_cached_header(const char *s) 
+unsigned mailbox_cached_header(const char *s) 
 {
     char hdr[MAX_CACHED_HEADER_SIZE];
     int i;
@@ -278,7 +278,7 @@
 /* Same as mailbox_cached_header, but for use on a header
  * as it appears in the message (i.e. :-terminated, not NUL-terminated)
  */
-int mailbox_cached_header_inline(const char *text)
+unsigned mailbox_cached_header_inline(const char *text)
 {
     char buf[MAX_CACHED_HEADER_SIZE];
     int i;
@@ -297,8 +297,7 @@
     return BIT32_MAX;
 }
 
-unsigned long
-mailbox_cache_size(struct mailbox *mailbox, unsigned msgno)
+unsigned long mailbox_cache_size(struct mailbox *mailbox, unsigned msgno)
 {
     const char *p;
     unsigned long cache_offset;
@@ -311,13 +310,22 @@
          ((msgno-1) * mailbox->record_size));
     
     cache_offset = ntohl(*((bit32 *)(p+OFFSET_CACHE_OFFSET)));
+    if (cache_offset > mailbox->cache_size) {
+	return 0;
+    }
 
     /* Compute size of this record */
     cacheitembegin = cacheitem = mailbox->cache_base + cache_offset;
+    if (cache_offset >= mailbox->cache_size)
+	return 0;
     for (cache_ent = 0; cache_ent < NUM_CACHE_FIELDS; cache_ent++) {
         cacheitem = CACHE_ITEM_NEXT(cacheitem);
-    }
-    return(cacheitem - cacheitembegin);
+	if (cacheitem < cacheitembegin ||
+	    cacheitem > cacheitembegin + mailbox->cache_size) {
+	    return 0; /* clearly bogus */
+	}
+    }
+    return (cacheitem - cacheitembegin);
 }
 
 /* function to be used for notification of mailbox changes/updates */
@@ -945,7 +953,7 @@
 	ntohl(*((bit32 *)(mailbox->index_base+OFFSET_LEAKED_CACHE)));
 #ifdef HAVE_LONG_LONG_INT
     mailbox->highestmodseq =
-	ntohll(*((bit64 *)(mailbox->index_base+OFFSET_HIGHESTMODSEQ_64)));
+	align_ntohll(mailbox->index_base+OFFSET_HIGHESTMODSEQ_64);
 #else
     mailbox->highestmodseq =
 	ntohl(*((bit32 *)(mailbox->index_base+OFFSET_HIGHESTMODSEQ)));
@@ -962,27 +970,27 @@
 }
 
 /*
- * Read an index record from a mailbox
- */
-int
-mailbox_read_index_record(mailbox, msgno, record)
-struct mailbox *mailbox;
-unsigned msgno;
-struct index_record *record;
+ * Read an index record from a mapped index file
+ */
+int mailbox_read_index_record_from_mapped(struct mailbox *mailbox,
+					  const char *index_base,
+					  unsigned long index_len,
+					  unsigned msgno,
+					  struct index_record *record)
 {
     unsigned long offset;
     unsigned const char *buf;
     int n;
 
     offset = mailbox->start_offset + (msgno-1) * mailbox->record_size;
-    if (offset + INDEX_RECORD_SIZE > mailbox->index_len) {
+    if (offset + INDEX_RECORD_SIZE > index_len) {
 	syslog(LOG_ERR,
 	       "IOERROR: index record %u for %s past end of file",
 	       msgno, mailbox->name);
 	return IMAP_IOERROR;
     }
 
-    buf = (unsigned char*) mailbox->index_base + offset;
+    buf = (unsigned char*) index_base + offset;
 
     record->uid = ntohl(*((bit32 *)(buf+OFFSET_UID)));
     record->internaldate = ntohl(*((bit32 *)(buf+OFFSET_INTERNALDATE)));
@@ -998,13 +1006,27 @@
     }
     record->content_lines = ntohl(*((bit32 *)(buf+OFFSET_CONTENT_LINES)));
     record->cache_version = ntohl(*((bit32 *)(buf+OFFSET_CACHE_VERSION)));
-    message_uuid_unpack(&record->uuid, buf+OFFSET_MESSAGE_UUID);
+    message_guid_import(&record->guid, buf+OFFSET_MESSAGE_GUID);
 #ifdef HAVE_LONG_LONG_INT
     record->modseq = ntohll(*((bit64 *)(buf+OFFSET_MODSEQ_64)));
 #else
     record->modseq = ntohl(*((bit32 *)(buf+OFFSET_MODSEQ)));
 #endif
     return 0;
+}
+
+/*
+ * Read an index record from a mailbox
+ */
+int mailbox_read_index_record(struct mailbox *mailbox,
+			      unsigned msgno,
+			      struct index_record *record)
+{
+    return mailbox_read_index_record_from_mapped(mailbox,
+						 mailbox->index_base,
+						 mailbox->index_len,
+						 msgno,
+						 record);
 }
 
 /*
@@ -1124,6 +1146,10 @@
 {
     int r = -1;
 
+    /* we don't have a cache_fd in reconstruct mode, so we can't lock
+     * pop */
+    if (mailbox_doing_reconstruct) return 0;
+
     if (mailbox->pop_lock_count++) return 0;
 
     r = lock_nonblocking(mailbox->cache_fd);
@@ -1176,6 +1202,10 @@
 mailbox_unlock_pop(mailbox)
 struct mailbox *mailbox;
 {
+    /* we don't have a cache_fd in reconstruct mode, so we can't lock
+     * pop */
+    if (mailbox_doing_reconstruct) return;
+
     assert(mailbox->pop_lock_count != 0);
 
     if (--mailbox->pop_lock_count == 0) {
@@ -1283,8 +1313,9 @@
  */
 int mailbox_write_index_header(struct mailbox *mailbox)
 {
-    char buf[INDEX_HEADER_SIZE];
-    unsigned long header_size = sizeof(buf);
+    indexbuffer_t ibuf;
+    unsigned char *buf = ibuf.buf;
+    unsigned long header_size = INDEX_HEADER_SIZE;
     int n;
     
     assert(mailbox->index_lock_count != 0);
@@ -1318,7 +1349,7 @@
     *((bit32 *)(buf+OFFSET_LEAKED_CACHE)) =
 	htonl(mailbox->leaked_cache_records);
 #ifdef HAVE_LONG_LONG_INT
-    *((bit64 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonll(mailbox->highestmodseq);
+    align_htonll(buf+OFFSET_HIGHESTMODSEQ_64, mailbox->highestmodseq);
 #else
     /* zero the unused 32bits */
     *((bit32 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonl(0);
@@ -1341,7 +1372,7 @@
 	return IMAP_IOERROR;
     }
 
-    if (updatenotifier) updatenotifier(mailbox);
+    if (updatenotifier) updatenotifier(mailbox->name);
 
     return 0;
 }
@@ -1349,7 +1380,8 @@
 /*
  * Put an index record into a buffer suitable for writing to a file.
  */
-void mailbox_index_record_to_buf(struct index_record *record, char *buf)
+void mailbox_index_record_to_buf(struct index_record *record,
+				 unsigned char *buf)
 {
     int n;
 
@@ -1367,7 +1399,7 @@
     }
     *((bit32 *)(buf+OFFSET_CONTENT_LINES)) = htonl(record->content_lines);
     *((bit32 *)(buf+OFFSET_CACHE_VERSION)) = htonl(record->cache_version);
-    message_uuid_pack(&record->uuid, buf+OFFSET_MESSAGE_UUID);
+    message_guid_export(&record->guid, buf+OFFSET_MESSAGE_GUID);
 #ifdef HAVE_LONG_LONG_INT
     *((bit64 *)(buf+OFFSET_MODSEQ_64)) = htonll(record->modseq);
 #else
@@ -1388,7 +1420,8 @@
 			   int sync)
 {
     int n;
-    char buf[INDEX_RECORD_SIZE];
+    indexbuffer_t ibuf;
+    unsigned char *buf = ibuf.buf;
 
     mailbox_index_record_to_buf(record, buf);
 
@@ -1423,7 +1456,7 @@
 {
     unsigned i;
     int len, n;
-    char *buf, *p;
+    unsigned char *buf, *p;
     long last_offset;
     time_t now = time(NULL);
 
@@ -1517,26 +1550,29 @@
 static void mailbox_upgrade_index_work(struct mailbox *mailbox,
 				       FILE *newindex,
 				       const char *index_base,
-				       unsigned long index_len)
+				       unsigned long index_len __attribute__((unused)))
 {
     unsigned long exists;
     unsigned msgno;
-    bit32 oldstart_offset, oldrecord_size, recsize_diff;
-    char buf[INDEX_HEADER_SIZE > INDEX_RECORD_SIZE ?
-	     INDEX_HEADER_SIZE : INDEX_RECORD_SIZE];
-    char *bufp;
+    bit32 oldstart_offset, oldrecord_size;
+    indexbuffer_t ibuf;
+    unsigned char *buf = ibuf.buf, *bufp;
     int quota_offset = 0;
     int calculate_flagcounts = 0;
     bit32 numansweredflag = 0;
     bit32 numdeletedflag = 0;
     bit32 numflaggedflag = 0;
+    int old_minor_version = 0;
 
     /* Copy existing header so we can upgrade it */ 
     memcpy(buf, index_base, INDEX_HEADER_SIZE);
 
     exists = ntohl(*((bit32 *)(buf+OFFSET_EXISTS)));
 
-    if (ntohl(*((bit32 *)(buf+OFFSET_MINOR_VERSION))) <= 5) {
+    old_minor_version = ntohl(*((bit32 *)(buf+OFFSET_MINOR_VERSION)));
+
+    /* QUOTA_MAILBOX_USED64 added with minor version 6 */
+    if (old_minor_version < 6) {
 	quota_offset = sizeof(bit32);
 	/* upgrade quota to 64-bits (bump existing fields) */
 	memmove(buf+OFFSET_QUOTA_MAILBOX_USED, buf+OFFSET_QUOTA_MAILBOX_USED64,
@@ -1545,9 +1581,11 @@
 	*((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonl(0);
     }
 
-    if (ntohl(*((bit32 *)(buf+OFFSET_MINOR_VERSION))) < 8) {
+    /* HIGHESTMODSEQ[_64] added with minor version 8 */
+    if (old_minor_version < 8) {
+	/* Set the initial highestmodseq to 1 */
 #ifdef HAVE_LONG_LONG_INT
-	*((bit64 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonll(1);
+	align_htonll(buf+OFFSET_HIGHESTMODSEQ_64, 1);
 #else
 	*((bit32 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonl(0);
 	*((bit32 *)(buf+OFFSET_HIGHESTMODSEQ)) = htonl(1);
@@ -1564,9 +1602,20 @@
     /* save old record_size; change record_size */
     oldrecord_size = ntohl(*((bit32 *)(buf+OFFSET_RECORD_SIZE)));
     *((bit32 *)(buf+OFFSET_RECORD_SIZE)) = htonl(INDEX_RECORD_SIZE);
-    recsize_diff = INDEX_RECORD_SIZE - oldrecord_size;
-
-    /* upgrade other fields as necessary */
+
+    /* sanity check the record size */
+    if (oldrecord_size > INDEX_RECORD_SIZE) {
+        char *err = xmalloc(MAX_MAILBOX_NAME+128);
+        snprintf(err, MAX_MAILBOX_NAME+128,
+                 "Mailbox %s needs reconstruct: Record size %d > %d",
+                 mailbox->name, (int) oldrecord_size, INDEX_RECORD_SIZE);
+        fatal(err, EC_SOFTWARE);
+    }
+
+    /* upgrade other fields as necessary
+     *
+     * minor version wasn't updated religiously in the early days,
+     * so we need to use the old offset instead */
     if (oldstart_offset < OFFSET_POP3_LAST_LOGIN-quota_offset+sizeof(bit32)) {
 	*((bit32 *)(buf+OFFSET_POP3_LAST_LOGIN)) = htonl(0);
     }
@@ -1591,12 +1640,7 @@
 	unsigned long options = !exists ? OPT_POP3_NEW_UIDL : 0;
 	*((bit32 *)(buf+OFFSET_MAILBOX_OPTIONS)) = htonl(options);
     }
-#if 0
-    if (oldstart_offset < OFFSET_HIGHESTMODSEQ-quota_offset+sizeof(bit32) ||
-	!ntohll(*((bit64 *)(buf+OFFSET_HIGHESTMODSEQ_64)))) {
-	*((bit64 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonll(1);
-    }
-#endif
+
     *((bit32 *)(buf+OFFSET_SPARE0)) = htonl(0); /* RESERVED */
     *((bit32 *)(buf+OFFSET_SPARE1)) = htonl(0); /* RESERVED */
     *((bit32 *)(buf+OFFSET_SPARE2)) = htonl(0); /* RESERVED */
@@ -1607,10 +1651,8 @@
     fwrite(buf, 1, INDEX_HEADER_SIZE, newindex);
 
     /* Write the rest of new index */
-    memset(buf, 0, INDEX_RECORD_SIZE);
     for (msgno = 1; msgno <= exists; msgno++) {
-	/* Write the existing (old) part of the index record */
-	bufp = (char *) (index_base + oldstart_offset +
+	bufp = (unsigned char *) (index_base + oldstart_offset +
 			 (msgno - 1)*oldrecord_size);
 
 	if (calculate_flagcounts) {
@@ -1621,41 +1663,72 @@
 	    if (sysflags & FLAG_FLAGGED) numflaggedflag++;
 	}
 
-	fwrite(bufp, oldrecord_size, 1, newindex);
-
-	if (recsize_diff) {
+	if (old_minor_version == MAILBOX_MINOR_VERSION) {
+            /* Just copy the original data as is */
+            fwrite(bufp, INDEX_RECORD_SIZE, 1, newindex);
+            continue;
+        }
+
 	    /* We need to upgrade the index record to include new fields. */
-
-	    /* Currently, this means adding a content_lines placeholder.
-	     * We use BIT32_MAX rather than 0, since a message body can
-	     * be empty.  We'll calculate the actual value on demand.
-	     */
-	    if (oldrecord_size < OFFSET_CONTENT_LINES+sizeof(bit32)) {
+        memset(buf, 0, INDEX_RECORD_SIZE);
+        memcpy(buf, bufp, oldrecord_size);
+
+        /* CONTENT_LINES added with minor version 5 */
+        if (old_minor_version < 5) {
+	    /* Set the initial content lines to BIT32_MAX rather than 0,
+	     * since a message body can be empty.
+	     * We'll calculate the actual value on demand. */
 		*((bit32 *)(buf+OFFSET_CONTENT_LINES)) = htonl(BIT32_MAX);
 	    }
 
+        /* CACHE_VERSION added with minor version 6 */
+        if (old_minor_version < 6) {
 	    /* Set the initial cache version to 0, that is, with the old
 	     * format of the cached headers */
-	    if (oldrecord_size < OFFSET_CACHE_VERSION+sizeof(bit32)) {
 		*((bit32 *)(buf+OFFSET_CACHE_VERSION)) = htonl(0);
 	    }
 
-            /* Reset undefined MessageUUIDs to NULL value (slow copy) */
-            if (oldrecord_size < OFFSET_MESSAGE_UUID+MESSAGE_UUID_PACKED_SIZE)
-                memset(buf+OFFSET_MESSAGE_UUID, 0, MESSAGE_UUID_PACKED_SIZE);
-
+        if (old_minor_version < 7) {
+            /* 12-byte GUIDs added with minor version 7.
+	     * Set to NIL GUID */
+            memset(buf+OFFSET_MESSAGE_GUID, 0, MESSAGE_GUID_SIZE);
+        } else if (old_minor_version < 10) {
+            /* GUIDs extended from 12 to 20 bytes with minor version 10 */
+            void *src = (buf+OFFSET_MESSAGE_GUID)+12;
+            void *dst = (buf+OFFSET_MESSAGE_GUID)+20;
+            size_t len = INDEX_RECORD_SIZE - (OFFSET_MESSAGE_GUID+20);
+                         
+            /* Bump everything after MESSAGE_GUID down by 8 bytes */
+            memmove(dst, src, len);
+
+            /* Pad existing GUID with zeros */
+            memset(buf+OFFSET_MESSAGE_GUID+12, 0, 8);
+        }
+
+        /* MODSEQ added with minor version 8 */
+        if (old_minor_version < 8) {
 	    /* Set the initial modseq to 1 */
-	    if (oldrecord_size < OFFSET_MODSEQ+4) {
 #ifdef HAVE_LONG_LONG_INT
 		*((bit64 *)(buf+OFFSET_MODSEQ_64)) = htonll(1);
 #else
 		*((bit32 *)(buf+OFFSET_MODSEQ_64)) = htonl(0);
 		*((bit32 *)(buf+OFFSET_MODSEQ)) = htonl(1);
 #endif
+	} else {
+	    /* Older versions may have incorrectly allowed modseq to be 0 */
+#ifdef HAVE_LONG_LONG_INT
+	    if ( *((bit64 *)(buf+OFFSET_MODSEQ_64)) == 0 ) {
+		*((bit64 *)(buf+OFFSET_MODSEQ_64)) = htonll(1);
 	    }
-
-	    fwrite(buf+oldrecord_size, recsize_diff, 1, newindex);
-	}
+#else
+	    if ( *((bit32 *)(buf+OFFSET_MODSEQ)) == 0 ) {
+		*((bit32 *)(buf+OFFSET_MODSEQ_64)) = htonl(0);
+		*((bit32 *)(buf+OFFSET_MODSEQ)) = htonl(1);
+	}
+#endif
+	}
+
+        fwrite(buf, INDEX_RECORD_SIZE, 1, newindex);
     }
 
     if (calculate_flagcounts) {
@@ -1820,9 +1893,9 @@
  * Expunge decision proc used by mailbox_expunge() (in cleanup mode) 
  * to avoid expunging any messages from cyrus.index
  */
-static int expungenone(struct mailbox *mailbox __attribute__((unused)),
+static unsigned expungenone(struct mailbox *mailbox __attribute__((unused)),
 		       void *rock __attribute__((unused)),
-		       char *index __attribute__((unused)),
+			    unsigned char *index __attribute__((unused)),
 		       int expunge_flags __attribute__((unused)))
 {
     return 0;
@@ -1833,9 +1906,9 @@
  * to expunge all messages in cyrus.expunge
  * Also used by mailbox_rename() to expunge all messages in INBOX
  */
-static int expungeall(struct mailbox *mailbox __attribute__((unused)),
+static unsigned expungeall(struct mailbox *mailbox __attribute__((unused)),
 		      void *rock __attribute__((unused)),
-		      char *indexbuf __attribute__((unused)),
+			   unsigned char *indexbuf __attribute__((unused)),
 		      int expunge_flags __attribute__((unused)))
 {
     return 1;
@@ -1851,8 +1924,8 @@
 			   mailbox_decideproc_t *decideproc, void *deciderock,
 			   int expunge_flags)
 {
-    char buf[INDEX_HEADER_SIZE > INDEX_RECORD_SIZE ?
-	     INDEX_HEADER_SIZE : INDEX_RECORD_SIZE];
+    indexbuffer_t ibuf;
+    unsigned char *buf = ibuf.buf;
     unsigned msgno;
     unsigned newexpunged;
     unsigned newexists;
@@ -1860,7 +1933,7 @@
     unsigned newanswered;
     unsigned newflagged; 
     time_t now = time(NULL);
-    int n;
+    unsigned n;
 
     /* Copy over records for nondeleted messages */
     for (msgno = 1; msgno <= exists; msgno++) {
@@ -1928,8 +2001,27 @@
 
 	    /* Compute size of this record */
 	    cacheitembegin = cacheitem = mailbox->cache_base + cache_offset;
+            if (cache_offset >= mailbox->cache_size) {
+		syslog(LOG_ERR,
+		       "IOERROR: reading cache record for %s:"
+		       " got bogus offset %d for %u/%lu; try reconstruct",
+		       mailbox->name,
+		       (int) (cacheitem - (mailbox->cache_base + cache_offset)),
+		       msgno, mailbox->exists);
+		return IMAP_IOERROR;
+            }
 	    for (cache_ent = 0; cache_ent < NUM_CACHE_FIELDS; cache_ent++) {
 		cacheitem = CACHE_ITEM_NEXT(cacheitem);
+		if ((cacheitem < (mailbox->cache_base + cache_offset)) || 
+		    (cacheitem > (mailbox->cache_base + mailbox->cache_size))) {
+		    syslog(LOG_ERR,
+			   "IOERROR: reading cache record for %s:"
+			   " got bogus offset %d for %u/%lu; try reconstruct",
+			   mailbox->name,
+			   (int) (cacheitem - (mailbox->cache_base + cache_offset)),
+			   msgno, mailbox->exists);
+		    return IMAP_IOERROR;
+		}
 	    }
 	    cache_record_size = (cacheitem - cacheitembegin);
 	    *new_cache_total_size += cache_record_size;
@@ -2018,7 +2110,8 @@
 		    int flags)
 {
     enum enum_value config_expunge_mode = config_getenum(IMAPOPT_EXPUNGE_MODE);
-    int r, n;
+    int r;
+    unsigned n;
     struct fnamepath fpath;
     struct fnamebuf *fname;
     char fnamebufnew[MAX_MAILBOX_PATH+1];
@@ -2034,8 +2127,8 @@
     unsigned newanswered;
     unsigned newflagged; 
     
-    char buf[INDEX_HEADER_SIZE > INDEX_RECORD_SIZE ?
-	     INDEX_HEADER_SIZE : INDEX_RECORD_SIZE];
+    indexbuffer_t ibuf;
+    unsigned char *buf = ibuf.buf;
     unsigned msgno;
     struct stat sbuf;
     struct txn *tid = NULL;
@@ -2434,7 +2527,7 @@
 	}
     }
     else if (numdeleted) {
-	if (updatenotifier) updatenotifier(mailbox);
+	if (updatenotifier) updatenotifier(mailbox->name);
     }
 
     mailbox_unlock_pop(mailbox);
@@ -2718,7 +2811,7 @@
 }
 
 /* Callback for use by cmd_delete */
-static int chkchildren(char *name,
+static int chkchildren(char *name __attribute__((unused)),
 		       int matchlen __attribute__((unused)),
 		       int maycreate __attribute__((unused)),
 		       void *rock __attribute__((unused)))
@@ -2781,6 +2874,12 @@
 
     strlcpy(nbuf, mailbox->name, sizeof(nbuf));
     ntail = nbuf + strlen(nbuf);
+
+    syslog(LOG_NOTICE, "Deleted mailbox %s", mailbox->name);
+    if (updatenotifier) updatenotifier(mailbox->name);
+    mailbox_close(mailbox);
+
+
     do {
 	/* Check if the mailbox has children */
 	strcpy(ntail, ".*");
@@ -2822,12 +2921,22 @@
 	r = mboxlist_lookup(nbuf, NULL, NULL);
     } while(r == IMAP_MAILBOX_NONEXISTENT);
 
-    syslog(LOG_NOTICE, "Deleted mailbox %s", mailbox->name);
-    mailbox_close(mailbox);
     return 0;
 }
 
-/* if 'isinbox' is set, we perform the funky RENAME INBOX INBOX.old
+struct data_file {
+    unsigned long metaflag;
+    int optional;
+};
+
+static struct data_file data_files[] = {
+    { IMAP_ENUM_METAPARTITION_FILES_INDEX, 0 },
+    { IMAP_ENUM_METAPARTITION_FILES_CACHE, 0 },
+    { IMAP_ENUM_METAPARTITION_FILES_EXPUNGE, 1 },
+    { 0, 0 }
+};
+
+/* if 'userid' is set, we perform the funky RENAME INBOX INBOX.old
    semantics, regardless of whether or not the name of the mailbox is
    'user.foo'.*/
 /* requires a LOCKED oldmailbox pointer */
@@ -2835,21 +2944,23 @@
 			const char *newname,
 			char *newpartition,
 			bit32 *olduidvalidityp, bit32 *newuidvalidityp,
-			struct mailbox *newmailbox)
+			struct mailbox *newmailbox, char *userid)
 {
     int r;
-    unsigned int flag, msgno;
-    struct index_record record;
+    unsigned int flag;
     struct fnamepath oldfpath, newfpath;
     struct fnamebuf *oldfname, *newfname;
     struct txn *tid = NULL;
+    struct data_file *df;
+    DIR *mbdir;
+    struct dirent *next;
 
     assert(oldmailbox->header_lock_count > 0
 	   && oldmailbox->index_lock_count > 0);
 
     /* Create new mailbox */
     r = mailbox_create(newname, newpartition,
-		       oldmailbox->acl, oldmailbox->uniqueid,
+		       oldmailbox->acl, (userid ? NULL : oldmailbox->uniqueid),
 		       oldmailbox->format, newmailbox);
 
     if (r) return r;
@@ -2895,11 +3006,12 @@
     mailbox_meta_get_fname(&oldfpath, oldmailbox, 0);
     mailbox_meta_get_fname(&newfpath, newmailbox, 0);
 
-    /* Copy over index/cache files */
-    oldfname = mailbox_meta_get_fname(&oldfpath, oldmailbox,
-				      IMAP_ENUM_METAPARTITION_FILES_INDEX);
-    newfname = mailbox_meta_get_fname(&newfpath, newmailbox,
-				      IMAP_ENUM_METAPARTITION_FILES_INDEX);
+    /* Copy over index/cache/expunge files */
+    for (df = data_files; !r && df->metaflag; df++) {
+	struct stat sbuf;
+
+	oldfname = mailbox_meta_get_fname(&oldfpath, oldmailbox, df->metaflag);
+	newfname = mailbox_meta_get_fname(&newfpath, newmailbox, df->metaflag);
 
     /* Check to see if we're going to be over-long */
     if (!oldfname) {
@@ -2915,34 +3027,15 @@
 
     unlink(newfname->buf);		/* Make link() possible */
 
+	if (!df->optional || !stat(oldfname->buf, &sbuf)) {
     r = mailbox_copyfile(oldfname->buf, newfname->buf, 0);
-
-    oldfname = mailbox_meta_get_fname(&oldfpath, oldmailbox,
-				      IMAP_ENUM_METAPARTITION_FILES_CACHE);
-    newfname = mailbox_meta_get_fname(&newfpath, newmailbox,
-				      IMAP_ENUM_METAPARTITION_FILES_CACHE);
-
-    /* Check to see if we're going to be over-long */
-    if (!oldfname) {
-	syslog(LOG_ERR, "IOERROR: Path too long (%s + %s)",
-	       oldfname->buf, FNAME_CACHE);
-	fatal("Path Too Long", EC_OSFILE);
-    }
-    if (!newfname) {
-	syslog(LOG_ERR, "IOERROR: Path too long (%s + %s)",
-	       newfname->buf, FNAME_CACHE);
-	fatal("Path Too Long", EC_OSFILE);
-    }
-
-    unlink(newfname->buf);
-
-    if (!r) r = mailbox_copyfile(oldfname->buf, newfname->buf, 0);
+    }
+    }
+
     if (r) {
 	mailbox_close(newmailbox);
 	return r;
     }
-
-    /* XXX For two-phase expunge, we also need to copy cyrus.expunge */
 
     /* Re-open index file and store new uidvalidity  */
     close(newmailbox->index_fd);
@@ -2952,6 +3045,12 @@
     (void) mailbox_write_index_header(newmailbox);
 
     /* Copy over message files */
+    mbdir = opendir(oldmailbox->path);
+    if (!mbdir) {
+	syslog(LOG_ERR, "error opening %s: %m", oldmailbox->path);
+	r = IMAP_SYS_ERROR;
+    }
+
     oldfname = &oldfpath.data;
     *(oldfname->tail)++ = '/';
     oldfname->len++;
@@ -2959,27 +3058,31 @@
     *(newfname->tail)++ = '/';
     newfname->len++;
 
-    for (msgno = 1; msgno <= oldmailbox->exists; msgno++) {
-	r = mailbox_read_index_record(oldmailbox, msgno, &record);
-	if (r) break;
-	mailbox_message_get_fname(oldmailbox, record.uid, oldfname->tail,
-				  sizeof(oldfname->buf) - oldfname->len);
-
-	if(newfname->len + strlen(oldfname->tail) >= sizeof(newfname->buf)) {
+    while (!r && (next = readdir(mbdir))) {
+	char *name = next->d_name;  /* Alias */
+	char *p = name;
+
+	/* special case for '.' (well, it gets '..' too) */
+	if (name[0] == '.') continue;
+
+	/* skip non-message files */
+	while (*p && isdigit((int)(*p))) p++;
+	if (p[0] != '.' || p[1] != '\0') continue;
+
+	if(newfname->len + strlen(name) >= sizeof(newfname->buf)) {
 	    syslog(LOG_ERR, "IOERROR: Path too long (%s + %s)",
-		   newfname->buf, oldfname->tail);
+		   newfname->buf, name);
 	    fatal("Path too long", EC_OSFILE);
 	}
 
-	strcpy(newfname->tail, oldfname->tail);
+	strcpy(oldfname->tail, name);
+	strcpy(newfname->tail, name);
 
 	r = mailbox_copyfile(oldfname->buf, newfname->buf, 0);
-	if (r) break;
-    }
-    if (!r) r = seen_copy(oldmailbox, newmailbox);
-
-    /* XXX For two-phase expunge, we also need to copy message files
-       referenced by cyrus.expunge */
+    }
+    closedir(mbdir);
+
+    if (!r) r = seen_copy(oldmailbox, newmailbox, userid);
 
     /* Record new quota usage */
     if (!r && newmailbox->quota.root) {
@@ -2989,13 +3092,8 @@
     }
     if (r) {
 	/* failure and back out */
-	for (msgno = 1; msgno <= oldmailbox->exists; msgno++) {
-	    if (mailbox_read_index_record(oldmailbox, msgno, &record))
-		continue;
-	    mailbox_message_get_fname(oldmailbox, record.uid, newfname->tail,
-				      sizeof(newfname->buf) - newfname->len);
-	    (void) unlink(newfname->buf);
-	}
+	mailbox_delete_files(newmailbox->path);
+	if (newmailbox->mpath) mailbox_delete_files(newmailbox->mpath);
     }
 
     return r;
@@ -3174,7 +3272,7 @@
 	    if (r) break;
 	}
     }
-    if (!r) r = seen_copy(&oldmailbox, &newmailbox);
+    if (!r) r = seen_copy(&oldmailbox, &newmailbox, NULL);
 
     if (!r) {
 	/* Copy over index/cache files */
@@ -3360,7 +3458,7 @@
     if (config_virtdomains && (p = strchr(name, '!'))) {
 	*p = '\0';  /* split domain!user */
 	if (config_hashimapspool) {
-	    c = (char) dir_hash_c(name);
+	    c = (char) dir_hash_c(name, config_fulldirhash);
 	    snprintf(buf, buf_len, "%s%c/%s", FNAME_DOMAINDIR, c, name);
 	}
 	else {
@@ -3379,7 +3477,7 @@
 	} else {
 	    idx++;
 	}
-	c = (char) dir_hash_c(idx);
+	c = (char) dir_hash_c(idx, config_fulldirhash);
 	
 	snprintf(buf, buf_len, "/%c/%s", c, name);
     } else {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mailbox.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mailbox.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mailbox.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mailbox.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mailbox.h -- Mailbox format definitions
- * $Id: mailbox.h,v 1.82 2006/11/30 17:11:19 murch Exp $
- *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +38,10 @@
  * 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.
+ *
+ * $Id: mailbox.h,v 1.91 2008/03/24 17:09:17 murch Exp $
  */
+
 #ifndef INCLUDED_MAILBOX_H
 #define INCLUDED_MAILBOX_H
 
@@ -49,7 +52,7 @@
 
 #include "auth.h"
 #include "quota.h"
-#include "message_uuid.h"
+#include "message_guid.h"
 #include "byteorder64.h"
 
 
@@ -86,7 +89,7 @@
 #define MAILBOX_FORMAT_NORMAL	0
 #define MAILBOX_FORMAT_NETNEWS	1
 
-#define MAILBOX_MINOR_VERSION	9
+#define MAILBOX_MINOR_VERSION	10
 #define MAILBOX_CACHE_MINOR_VERSION 2
 
 #define FNAME_HEADER "/cyrus.header"
@@ -186,7 +189,7 @@
     bit32 user_flags[MAX_USER_FLAGS/32];
     unsigned long content_lines;
     unsigned long cache_version;
-    struct message_uuid uuid;
+    struct message_guid guid;
     modseq_t modseq;
 };
 
@@ -238,8 +241,8 @@
 #define OFFSET_USER_FLAGS 36
 #define OFFSET_CONTENT_LINES (OFFSET_USER_FLAGS+MAX_USER_FLAGS/8) /* added for nntpd */
 #define OFFSET_CACHE_VERSION OFFSET_CONTENT_LINES+sizeof(bit32)
-#define OFFSET_MESSAGE_UUID OFFSET_CACHE_VERSION+sizeof(bit32)
-#define OFFSET_MODSEQ_64 (OFFSET_MESSAGE_UUID+MESSAGE_UUID_PACKED_SIZE) /* CONDSTORE (64-bit modseq) */
+#define OFFSET_MESSAGE_GUID OFFSET_CACHE_VERSION+sizeof(bit32)
+#define OFFSET_MODSEQ_64 (OFFSET_MESSAGE_GUID+MESSAGE_GUID_SIZE) /* CONDSTORE (64-bit modseq) */
 #define OFFSET_MODSEQ (OFFSET_MODSEQ_64+sizeof(bit32)) /* CONDSTORE (32-bit modseq) */
 
 #define INDEX_HEADER_SIZE (OFFSET_SPARE4+sizeof(bit32))
@@ -255,6 +258,8 @@
 
 #define OPT_POP3_NEW_UIDL (1<<0)	/* added for Outlook stupidity */
 #define OPT_IMAP_CONDSTORE (1<<1)	/* added for CONDSTORE extension */
+#define OPT_IMAP_SHAREDSEEN (1<<2)	/* added for shared \Seen flag */
+#define OPT_IMAP_DUPDELIVER (1<<3)	/* added to allow duplicate delivery */
 
 
 struct mailbox_header_cache {
@@ -265,6 +270,17 @@
 #define MAX_CACHED_HEADER_SIZE 32 /* Max size of a cached header name */
 extern const struct mailbox_header_cache mailbox_cache_headers[];
 extern const int MAILBOX_NUM_CACHE_HEADERS;
+
+/* Aligned buffer for manipulating index header/record fields */
+typedef union {
+    unsigned char buf[INDEX_HEADER_SIZE > INDEX_RECORD_SIZE ?
+		      INDEX_HEADER_SIZE : INDEX_RECORD_SIZE];
+#ifdef HAVE_LONG_LONG_INT
+    bit64 align8; /* align on 8-byte boundary */
+#else
+    bit32 align4; /* align on 4-byte boundary */
+#endif
+} indexbuffer_t;
 
 /* Bitmasks for expunging */
 enum {
@@ -272,15 +288,16 @@
     EXPUNGE_CLEANUP =		(1<<1)
 };
 
-int mailbox_cached_header(const char *s);
-int mailbox_cached_header_inline(const char *text);
+unsigned mailbox_cached_header(const char *s);
+unsigned mailbox_cached_header_inline(const char *text);
 
 unsigned long mailbox_cache_size(struct mailbox *mailbox, unsigned msgno);
 
-typedef int mailbox_decideproc_t(struct mailbox *mailbox, void *rock,
-				 char *indexbuf, int expunge_flags);
-
-typedef void mailbox_notifyproc_t(struct mailbox *mailbox);
+typedef unsigned mailbox_decideproc_t(struct mailbox *mailbox, void *rock,
+				      unsigned char *indexbuf,
+				      int expunge_flags);
+
+typedef void mailbox_notifyproc_t(const char *mboxname);
 
 extern void mailbox_set_updatenotifier(mailbox_notifyproc_t *notifyproc);
 extern mailbox_notifyproc_t *mailbox_get_updatenotifier(void);
@@ -329,6 +346,11 @@
 extern int mailbox_read_acl(struct mailbox *mailbox, 
 			    struct auth_state *auth_state);
 extern int mailbox_read_index_header(struct mailbox *mailbox);
+extern int mailbox_read_index_record_from_mapped(struct mailbox *mailbox,
+						 const char *index_base,
+						 unsigned long index_len,
+						 unsigned msgno,
+						 struct index_record *record);
 extern int mailbox_read_index_record(struct mailbox *mailbox,
 				     unsigned msgno,
 				     struct index_record *record);
@@ -342,7 +364,8 @@
 
 extern int mailbox_write_header(struct mailbox *mailbox);
 extern int mailbox_write_index_header(struct mailbox *mailbox);
-extern void mailbox_index_record_to_buf(struct index_record *record, char *buf);
+extern void mailbox_index_record_to_buf(struct index_record *record,
+					unsigned char *buf);
 extern int mailbox_write_index_record(struct mailbox *mailbox,
 				      unsigned msgno,
 				      struct index_record *record, int sync);
@@ -367,7 +390,7 @@
 extern int mailbox_rename_copy(struct mailbox *oldmailbox, 
 			       const char *newname, char *newpartition,
 			       bit32 *olduidvalidityp, bit32 *newuidvalidityp,
-			       struct mailbox *mailboxp);
+			       struct mailbox *mailboxp, char *userid);
 extern int mailbox_rename_cleanup(struct mailbox *oldmailbox, int isinbox);
 
 extern int mailbox_sync(const char *oldname, const char *oldpath, 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/make_md5.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/make_md5.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/make_md5.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/make_md5.c Mon Feb  9 12:49:22 2009
@@ -1,3 +1,46 @@
+/*
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: make_md5.c,v 1.8 2008/10/02 14:05:44 murch Exp $
+ */
+
 #include <config.h>
 
 #ifdef HAVE_UNISTD_H
@@ -21,6 +64,7 @@
 #include "exitcodes.h"
 #include "imap_err.h"
 #include "mailbox.h"
+#include "util.h"
 #include "xmalloc.h"
 #include "acl.h"
 #include "seen.h"
@@ -28,7 +72,6 @@
 #include "map.h"
 #include "md5global.h"
 #include "md5.h"
-/*#include "cdb.h"*/
 
 /* global state */
 const int config_need_data = 0;
@@ -42,12 +85,12 @@
 struct auth_state *imapd_authstate = NULL;
 char *imapd_userid = NULL;
 
-void printastring(const char *s)
+void printastring(const char *s __attribute__((unused)))
 {
     fatal("not implemented", EC_SOFTWARE);
 }
 
-void printstring(const char *s)
+void printstring(const char *s __attribute__((unused)))
 {
     fatal("not implemented", EC_SOFTWARE);
 }
@@ -64,6 +107,7 @@
     quotadb_done();
     mboxlist_close();
     mboxlist_done();
+    cyrus_done();
     exit(code);
 }
 
@@ -334,7 +378,7 @@
 {
     struct md5_mailbox *current = NULL;
     FILE *file;
-    char buf[MAX_MAILBOX_NAME+2];
+    char buf[MAX_MAILBOX_NAME+18]; /* mboxname + uniqueid(16) + SP + CR */
     unsigned char md5_msg[16];
     unsigned char md5_cache[16];
     int len;
@@ -459,7 +503,9 @@
 }
 
 static int
-md5_single(char *name, int matchlen, int maycreate, void *rock)
+md5_single(char *name, int matchlen __attribute__((unused)),
+	   int maycreate __attribute__((unused)),
+	   void *rock)
 {
     struct mailbox m;
     int    r = 0;
@@ -596,30 +642,25 @@
  * but given tranche of users. That tranche gets regenerated from scratch */
 
 static int
-use_existing_data(char *user, int uid_set, int uid_modulo, int uid_fd)
-{
-    char buf[64];
-    unsigned long len;
-    int  uid;
-
-    if ((uid_modulo == 0) || (uid_fd < 0))
+use_existing_data(char *s, unsigned uid_set, int uid_modulo)
+{
+    unsigned long total;
+
+    if (uid_modulo == 0)
         return(1);
-#if 0 /* XXX  make sure we're not the replica */
-    if (cdb_seek(uid_fd, (unsigned char *)user, strlen(user), &len) != 1)
-        return(1);
-#endif
-    if ((len >= sizeof(buf)) || (read(uid_fd, buf, len) != len))
-        return(1);
-
-    if ((uid = atoi(buf)) == 0)
-        return(1);
-
-    return ((uid_set == (uid % uid_modulo)) ? 0 : 1);
+
+    total = 0;
+    while (*s) {
+        total += (unsigned long)*s;
+        s++;
+    }
+
+    return ((uid_set == (total % uid_modulo)) ? 0 : 1);
 }
 
 static int
 do_user(const char *md5_dir, char *user, struct namespace *namespacep,
-        int uid_set, int uid_modulo, int uid_fd)
+        unsigned uid_set, int uid_modulo)
 {
     char  buf[MAX_MAILBOX_PATH+1];
     char  buf2[MAX_MAILBOX_PATH+1];
@@ -630,7 +671,7 @@
     imapd_userid    = user;
     imapd_authstate = auth_newstate(imapd_userid);
 
-    if (use_existing_data(user, uid_set, uid_modulo, uid_fd)) {
+    if (use_existing_data(user, uid_set, uid_modulo)) {
         snprintf(buf, sizeof(buf)-1, "%s/%c/%s", md5_dir, user[0], user);
         r = md5_mailbox_list_read(md5_mailbox_list, buf);
 
@@ -734,21 +775,20 @@
     char *alt_config = NULL;
     char *input_file = NULL;
     const char *md5_dir  = NULL;
-    const char *uid_file = NULL;
-    int   uid_fd     = (-1);
-    int   uid_set    = 0;
+    unsigned uid_set    = 0;
     int   uid_modulo = 0;
     int   r = 0;
     int   i;
-    int   max_children = 0;
+    unsigned max_children = 0;
     pid_t pid;
     struct namespace md5_namespace;
     char buf[512];
     FILE *file;
     int len;
 
-    if(geteuid() == 0)
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
         fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     setbuf(stdout, NULL);
 
@@ -818,12 +858,6 @@
 
     if (!md5_dir)
         md5_dir = xstrdup("/var/imap/md5");
-
-    if (((uid_file = config_getstring(IMAPOPT_MD5_USER_MAP)) != NULL) &&
-        ((uid_fd=open(uid_file, O_RDONLY)) < 0)) {
-        syslog(LOG_NOTICE, "Failed to open uid file %s: %m\n", uid_file);
-        shut_down(1);
-    }
 
     if (max_children == 0) {
         /* Simple case */
@@ -842,7 +876,7 @@
                     continue;
 
                 if (do_user(md5_dir, buf, &md5_namespace,
-                            uid_set, uid_modulo, uid_fd)) {
+                            uid_set, uid_modulo)) {
                     syslog(LOG_NOTICE, "Error make_md5 %s: %m", buf);
                     shut_down(1);
                 }
@@ -850,7 +884,7 @@
             fclose(file);
         } else for (i = optind; i < argc; i++) {
             if (do_user(md5_dir, argv[i], &md5_namespace,
-                        uid_set, uid_modulo, uid_fd)) {
+                        uid_set, uid_modulo)) {
                 syslog(LOG_NOTICE, "Error make_md5 %s: %m", argv[i]);
                 shut_down(1);
             }
@@ -890,7 +924,7 @@
             if (pid == 0) {
                 /* Child process */
                 do_user(md5_dir, buf, &md5_namespace,
-                        uid_set, uid_modulo, uid_fd);
+                        uid_set, uid_modulo);
                 _exit(0);
             }
             md5_children++;   /* Parent process */
@@ -907,7 +941,7 @@
         if (pid == 0) {
             /* Child process */
             do_user(md5_dir, argv[i], &md5_namespace,
-                    uid_set, uid_modulo, uid_fd);
+                    uid_set, uid_modulo);
             _exit(0);
         }
         md5_children++;   /* Parent process */

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/make_sha1.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/make_sha1.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/make_sha1.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/make_sha1.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,960 @@
+/*
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: make_sha1.c,v 1.4 2008/10/02 14:05:44 murch Exp $
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#ifdef HAVE_SSL
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+#include <time.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <syslog.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <signal.h>
+
+#include "global.h"
+#include "assert.h"
+#include "mboxlist.h"
+#include "exitcodes.h"
+#include "imap_err.h"
+#include "mailbox.h"
+#include "xmalloc.h"
+#include "acl.h"
+#include "seen.h"
+#include "mboxname.h"
+#include "map.h"
+#include "util.h"
+
+#include <openssl/sha.h>
+
+/* global state */
+const int config_need_data = 0;
+
+extern char *optarg;
+extern int optind;
+
+/* Stuff to make index.c link */
+int imapd_exists;
+struct protstream *imapd_out = NULL;
+struct auth_state *imapd_authstate = NULL;
+char *imapd_userid = NULL;
+
+void printastring(const char *s __attribute__((unused)))
+{
+    fatal("not implemented", EC_SOFTWARE);
+}
+
+void printstring(const char *s __attribute__((unused)))
+{
+    fatal("not implemented", EC_SOFTWARE);
+}
+
+/* end stuff to make index.c link */
+
+static int verbose = 0;
+
+static void shut_down(int code) __attribute__((noreturn));
+static void shut_down(int code)
+{
+    seen_done();
+    quotadb_close();
+    quotadb_done();
+    mboxlist_close();
+    mboxlist_done();
+    cyrus_done();
+    exit(code);
+}
+
+static int usage(const char *name)
+{
+    fprintf(stderr,
+            "usage: %s [-C <alt_config>] [-d] [-k <count>] [-v]"
+            " [-m <offset>] [-M <modulo>] user...\n",
+            name);
+ 
+    exit(EC_USAGE);
+}
+
+void fatal(const char* s, int code)
+{
+    fprintf(stderr, "make_sha1: %s\n", s);
+    exit(code);
+}
+
+/* ====================================================================== */
+
+struct sha1_node {
+    struct sha1_node *next;
+    int           active;
+    unsigned long uid;
+    unsigned char sha1_msg[20];
+    unsigned char sha1_cache[20];
+};
+
+struct sha1_mailbox {
+    struct sha1_mailbox *next;
+    char *name;
+    char *uniqueid;
+    struct sha1_node *head;
+    struct sha1_node *tail;
+    unsigned long count;
+    int active;
+};
+
+struct sha1_mailbox_list {
+    struct sha1_mailbox *head;
+    struct sha1_mailbox *tail;
+    unsigned long count;
+    int dirty;
+};
+
+static void
+sha1_mailbox_free(struct sha1_mailbox *list)
+{
+    struct sha1_node *current, *next;
+
+    for (current = list->head; current ; current = next) {
+        next = current->next;
+        free(current);
+    }
+    free(list->name);
+    free(list->uniqueid);
+    free(list);
+}
+
+static void
+sha1_mailbox_rename(struct sha1_mailbox *mailbox, char *name)
+{
+    free(mailbox->name);
+    mailbox->name = xstrdup(name);
+}
+
+static struct sha1_node *
+sha1_mailbox_add(struct sha1_mailbox *list,
+                unsigned long uid,
+                unsigned char sha1_msg[20],
+                unsigned char sha1_cache[20],
+                int active)
+{
+    struct sha1_node *new = xmalloc(sizeof(struct sha1_node));
+    struct sha1_node *current, *last;
+
+    new->next = NULL;
+    new->uid  = uid;
+    new->active = active;
+    memcpy(&new->sha1_msg, sha1_msg, 20);
+    memcpy(&new->sha1_cache, sha1_cache, 20);
+
+    list->count++;
+
+    if (list->head == NULL) {
+        /* Add to empty list */
+        list->head = list->tail = new;
+        return(new);
+    }
+
+    assert(list->tail != NULL);
+    if (list->tail->uid < uid) {
+        /* Add to end of list */
+        /* This is the common case as UIDs assigned in ascending order */
+        list->tail = list->tail->next = new;
+        return(new);
+    }
+
+    assert(list->head != NULL);
+    if (uid < list->head->uid) {
+        new->next = list->head;  /* Add to start of list */
+        list->head = new;
+        return(new);
+    }
+
+    current = list->head;
+    do {
+        last    = current;
+        current = current->next;
+    } while (current && (uid > current->uid));
+
+    if (current && (uid < current->uid)) {
+        new->next  = current;  /* Insert between last and current */
+        last->next = new;
+        return(new);
+    }
+    return(current);
+}
+
+static struct sha1_mailbox_list *
+sha1_mailbox_list_create(void)
+{
+    struct sha1_mailbox_list *list = xmalloc(sizeof(struct sha1_mailbox_list));
+
+    list->head  = NULL;
+    list->tail  = NULL;
+    list->count = 0;
+    list->dirty = 0;
+
+    return(list);
+}
+
+static void
+sha1_mailbox_list_free(struct sha1_mailbox_list *list)
+{
+    struct sha1_mailbox *current, *next;
+
+    for (current = list->head; current ; current = next) {
+        next = current->next;
+        sha1_mailbox_free(current);
+    }
+    free(list);
+}
+
+static struct sha1_mailbox *
+sha1_mailbox_list_add(struct sha1_mailbox_list *list, char *name, char *uniqueid)
+{
+    struct sha1_mailbox *new = xzmalloc(sizeof(struct sha1_mailbox));
+    struct sha1_mailbox *current, *last;
+
+    list->count++;
+    new->next = NULL;
+    new->name = xstrdup(name);
+    new->uniqueid = xstrdup(uniqueid);
+    new->head = NULL;
+    new->tail = NULL;
+    new->count = 0;
+    new->active = 0;
+
+    if (list->head == NULL) {
+        /* Add to empty list */
+        list->head = list->tail = new;
+        return(new);
+    }
+
+    assert(list->tail != NULL);
+    if (strcmp(list->tail->uniqueid, uniqueid) < 0) {
+        /* Add to end of list */
+        /* This is the common case as folders sorted in ascending order */
+        list->tail = list->tail->next = new;
+        return(new);
+    }
+    
+    assert(list->head != NULL);
+    if (strcmp(list->head->uniqueid, uniqueid) > 0) {
+        new->next = list->head;  /* Add to start of list */
+        list->head = new;
+        return(new);
+    }
+
+    current = list->head;
+    do {
+        last    = current;
+        current = current->next;
+    } while (current && (strcmp(uniqueid, current->uniqueid) > 0));
+
+    if (!current)
+        return(NULL);
+
+    if (!strcmp(uniqueid, current->uniqueid)) {
+        if (strcmp(current->name, name) != 0) {
+            free(current->name);
+            current->name = xstrdup(name);
+        }
+        return(current);
+    }
+
+    /* Insert between last and current */
+    new->next  = current;  
+    last->next = new;
+    return(new);
+}
+
+static struct sha1_mailbox *
+sha1_mailbox_list_find(struct sha1_mailbox_list *list, char *uniqueid)
+{
+    struct sha1_mailbox *mailbox;
+
+    for (mailbox = list->head ; mailbox ; mailbox = mailbox->next) {
+        if (!strcmp(mailbox->uniqueid, uniqueid))
+            return(mailbox);
+    }
+    return(NULL);
+}
+
+static int
+sha1_mailbox_list_check_deleted(struct sha1_mailbox_list *list)
+{
+    struct sha1_mailbox *mailbox;
+
+    for (mailbox = list->head ; mailbox ; mailbox = mailbox->next) {
+        if (!mailbox->active) {
+            list->dirty = 1;
+            return(1);
+        }
+    }
+    return(0);
+}
+
+static int
+sha1_parse(unsigned char sha1[20], char *s)
+{
+    int i;
+    char c;
+
+    if (strlen(s) != 40)
+        return(0);
+
+    for (i = 0 ; i < 20 ; i++) {
+        c = *s++;
+
+        if ((c >= '0') && (c <= '9'))
+            sha1[i] = (c - '0') * 16;
+        else if ((c >= 'a') && (c <= 'z'))
+            sha1[i] = (c - 'a' + 10) * 16;
+        else if ((c >= 'A') && (c <= 'Z'))
+            sha1[i] = (c - 'A' + 10) * 16;
+        else
+            return(0);
+
+        c = *s++;
+
+        if ((c >= '0') && (c <= '9'))
+            sha1[i] += (c - '0');
+        else if ((c >= 'a') && (c <= 'z'))
+            sha1[i] += (c - 'a' + 10);
+        else if ((c >= 'A') && (c <= 'Z'))
+            sha1[i] += (c - 'A' + 10);
+        else
+            return(0);
+    }
+    return(1);
+}
+
+static int
+sha1_mailbox_list_read(struct sha1_mailbox_list *list, char *name)
+{
+    struct sha1_mailbox *current = NULL;
+    FILE *file;
+    char buf[MAX_MAILBOX_NAME+18]; /* mboxname + uniqueid(16) + SP + CR */
+    unsigned char sha1_msg[20];
+    unsigned char sha1_cache[20];
+    int len;
+    int lineno = 0;
+    unsigned long uid;
+    char *mboxname, *uniqueid, *s;
+
+    if ((file=fopen(name, "r")) == NULL)
+        return(0);
+
+    while (fgets(buf, sizeof(buf), file)) {
+        ++lineno;
+
+        if (((len=strlen(buf)) > 0) && (buf[len-1] == '\n'))
+            buf[--len] = '\0';
+
+        if ((buf[0] == '#') || (buf[0] == '\0'))
+            continue;
+
+        if (buf[0] != ' ') {
+            /* "%s %s", mboxname, uniqueid. mboxname may contain spaces */
+            mboxname = buf;
+            uniqueid = strrchr(buf, ' ');
+
+            if ((uniqueid == NULL) || ((uniqueid - mboxname) < 6))
+                goto parse_err;
+            *uniqueid++ = '\0';
+
+            current = sha1_mailbox_list_add(list, mboxname, uniqueid);
+        } else {
+            if (!(current && (s = strtok(buf, "\t ")) && (uid = atoi(s)) &&
+                  (s = strtok(NULL, "\t ")) && sha1_parse(sha1_msg, s) &&
+                  (s = strtok(NULL, "\t ")) && sha1_parse(sha1_cache, s)))
+                goto parse_err;
+
+            sha1_mailbox_add(current, uid, sha1_msg, sha1_cache, 0);
+        }
+    }
+    fclose(file);
+    return(0);
+
+ parse_err:
+    syslog(LOG_ERR, "Invalid format input file %s at line %d",
+           name, lineno);
+    fclose(file);
+    return(IMAP_IOERROR);
+}
+
+static int
+sha1_mailbox_list_write(struct sha1_mailbox_list *list, char *name)
+{
+    struct sha1_mailbox *mailbox;
+    struct sha1_node    *node;
+    FILE *file;
+    int i;
+
+    file = fopen(name, "w");
+    if (file == NULL && errno == ENOENT) {
+	if (cyrus_mkdir(name, 0750) == 0) {
+	    file = fopen(name, "w");
+	}
+    }
+    if (file == NULL)
+        return(IMAP_IOERROR);
+
+    for (mailbox = list->head ; mailbox ; mailbox = mailbox->next) {
+        if (!mailbox->active)
+            continue;
+
+        fprintf(file, "%s %s\n", mailbox->name, mailbox->uniqueid);
+
+        for (node = mailbox->head ; node ; node = node->next) {
+            if (!node->active)
+                continue;
+
+            fprintf(file, " %lu: ", node->uid);
+            for (i = 0 ; i < 20 ; i++)
+                fprintf(file, "%-2.2x", node->sha1_msg[i]);
+            fprintf(file, " ");
+            for (i = 0 ; i < 20 ; i++)
+                fprintf(file, "%-2.2x", node->sha1_cache[i]);
+            fprintf(file, "\n");
+        }
+    }
+    fclose(file);
+    return(0);
+}
+
+/* ====================================================================== */
+
+/* Compute SHA1 message digest for LEN bytes beginning at BUFFER.  The
+   resulting message digest number will be written into the 20 bytes
+   beginning at RESBLOCK.  */
+static void *
+sha1_buffer (const char *buffer, size_t len, void *resblock)
+{
+    SHA1((const unsigned char *) buffer, len, resblock);
+
+    return resblock;
+}
+
+/* Compute SHA1 message digest for bytes read from STREAM.  The
+   resulting message digest number will be written into the 20 bytes
+   beginning at RESBLOCK.  */
+static int
+sha1_stream (FILE *stream, void *resblock)
+{
+    const char *base = NULL;
+    unsigned long len = 0;
+
+    map_refresh(fileno(stream), 1, &base, &len, MAP_UNKNOWN_LEN, "msg", NULL);
+
+    sha1_buffer(base, len, resblock);
+
+    map_free(&base, &len);
+
+    return 0;
+}
+
+static int
+sha1_single(char *name, int matchlen __attribute__((unused)),
+	    int maycreate __attribute__((unused)),
+	    void *rock)
+{
+    struct mailbox m;
+    int    r = 0;
+    unsigned long msgno;
+    struct index_record record;
+    unsigned char sha1_msg[20], sha1_cache[20];
+    char buf[MAX_MAILBOX_PATH+1];
+    FILE *file;
+    struct sha1_mailbox_list *sha1_mailbox_list;
+    struct sha1_mailbox *sha1_mailbox;
+    struct sha1_node *sha1_node;
+    unsigned long cache_offset;
+    unsigned long cache_size;
+
+    if (verbose > 1)
+        printf("   %s\n", name);
+
+    sha1_mailbox_list = (struct sha1_mailbox_list *)rock;
+
+    /* First we have to jump through hoops to open the mailbox and its
+       Cyrus index. */
+    memset(&m, 0, sizeof(struct mailbox));
+
+    /* Garbage collect live cache file */
+    if (!r) r = mailbox_open_header(name, 0, &m);
+    if (r) {
+        syslog(LOG_NOTICE, "error opening %s: %s\n", name, error_message(r));
+        return(r);
+    }
+
+    if (!r) r = mailbox_open_index(&m);
+
+    if (r) {
+        syslog(LOG_NOTICE, "error opening %s: %s\n", name, error_message(r));
+        goto bail;
+    }
+
+    if (!(sha1_mailbox=sha1_mailbox_list_find(sha1_mailbox_list,m.uniqueid))) {
+        /* New mailbox */
+        sha1_mailbox = sha1_mailbox_list_add(sha1_mailbox_list,
+                                             name, m.uniqueid);
+        sha1_mailbox_list->dirty = 1;
+    }
+
+    if (!sha1_mailbox) {
+        syslog(LOG_NOTICE, "Failed to create sha1_mailbox_list for %s", name);
+        goto bail;
+    }
+
+    if (strcmp(sha1_mailbox->name, m.name) != 0) {
+        /* Renamed mailbox */
+        sha1_mailbox_rename(sha1_mailbox, m.name);
+        sha1_mailbox_list->dirty = 1;
+    }
+
+    sha1_mailbox->active = 1;
+    sha1_node = sha1_mailbox->head;
+
+    for (msgno = 1 ; msgno <= m.exists ; msgno++) {
+        if ((r=mailbox_read_index_record(&m, msgno, &record))) {
+            syslog(LOG_ERR, "IOERROR: %s failed to read index record %lu/%lu",
+                   m.name, msgno, m.exists);
+            r = IMAP_IOERROR;
+            goto bail;
+        }
+
+        if (record.uid == 0) {
+            syslog(LOG_ERR, "IOERROR: %s zero index record %lu/%lu",
+                   m.name, msgno, m.exists);
+            r = IMAP_IOERROR;
+            goto bail;
+        }
+
+        /* Skip over UIDs in sha1_mailbox which have now been deleted
+         * (but record fact that sha1 list should be updated for this user) */
+        while (sha1_node && (sha1_node->uid < record.uid)) {
+            sha1_mailbox_list->dirty = 1; /* Need to write out new SHA1 list */
+            sha1_node->active = 0;
+            sha1_node = sha1_node->next;
+        }
+
+        /* Check whether SHA1 value already exists for this UID */
+        if (sha1_node && (sha1_node->uid == record.uid)) {
+            sha1_node->active = 1;
+            sha1_node = sha1_node->next;
+            continue;
+        }
+
+        snprintf(buf, sizeof(buf), "%s/%lu.", m.path, record.uid);
+
+        if (!(file=fopen(buf, "r"))) {
+            syslog(LOG_ERR, "IOERROR: %s failed to open msg UID %lu",
+                   m.name, record.uid);
+            r = IMAP_IOERROR;
+            goto bail;
+        }
+
+        if (sha1_stream(file, sha1_msg) != 0) {
+            syslog(LOG_ERR, "IOERROR: %s failed to sha1 msg UID %lu",
+                   m.name, record.uid);
+            r = IMAP_IOERROR;
+            fclose(file);
+            goto bail;
+        }
+
+        cache_offset = record.cache_offset;
+        cache_size = mailbox_cache_size(&m, msgno);
+
+        if (!sha1_buffer(m.cache_base+cache_offset, cache_size, sha1_cache)) {
+            syslog(LOG_ERR, "IOERROR: %s failed to sha1 msg cache UID %lu",
+                   m.name, record.uid);
+            r = IMAP_IOERROR;
+            goto bail;
+        }
+
+        sha1_mailbox_add(sha1_mailbox, record.uid, sha1_msg, sha1_cache, 1);
+        sha1_mailbox_list->dirty = 1; /* Need to write out new SHA1 list */
+        fclose(file);
+    }
+    /* Check for deletions at end of the folder */
+    if (sha1_node)
+        sha1_mailbox_list->dirty = 1; /* Need to write out new SHA1 list */
+
+ bail:
+#if 0
+    mailbox_unlock_expire(&m);
+#endif
+    mailbox_close(&m);
+    return(r);
+}
+
+/* ====================================================================== */
+
+/* If uid_set and uid_modulo non-zero, use existing database entry for all
+ * but given tranche of users. That tranche gets regenerated from scratch */
+
+static int use_existing_data(char *s, unsigned uid_set, int uid_modulo)
+{
+    unsigned long total;
+
+    if (uid_modulo == 0)
+        return(1);
+
+    total = 0;
+    while (*s) {
+        total += (unsigned long)*s;
+        s++;
+    }
+    
+    return ((uid_set == (total % uid_modulo)) ? 0 : 1);
+}
+
+static int
+do_user(const char *sha1_dir, char *user, struct namespace *namespacep,
+        int uid_set, int uid_modulo)
+{
+    char  buf[MAX_MAILBOX_PATH+1];
+    char  buf2[MAX_MAILBOX_PATH+1];
+    int   r = 0;
+    int   regenerate = 0;
+    struct sha1_mailbox_list *sha1_mailbox_list = sha1_mailbox_list_create();
+
+    imapd_userid    = user;
+    imapd_authstate = auth_newstate(imapd_userid);
+
+    if (use_existing_data(user, uid_set, uid_modulo)) {
+        snprintf(buf, sizeof(buf)-1, "%s/%c/%s", sha1_dir, user[0], user);
+        r = sha1_mailbox_list_read(sha1_mailbox_list, buf);
+
+        if (r) {
+            syslog(LOG_NOTICE, "Failed to read mailbox list for %s", user);
+            sha1_mailbox_list_free(sha1_mailbox_list);
+            return(r);
+        }
+
+        if (verbose > 0)
+            printf("Make_SHA1: %s\n", user);
+
+    } else {
+        regenerate = 1;
+        if (verbose > 0)
+            printf("Make_SHA1: %s (regenerating)\n", user);
+    }
+
+    /* Index inbox */
+    snprintf(buf, sizeof(buf)-1, "user.%s", user);
+    sha1_single(buf, 0, 0, sha1_mailbox_list);
+    
+    /* And then all folders */
+    snprintf(buf, sizeof(buf)-1, "user.%s.*", user);
+    r = (namespacep->mboxlist_findall)(namespacep, buf, 0,
+                                       imapd_userid, imapd_authstate,
+                                       sha1_single, sha1_mailbox_list);
+    if (r) {
+        syslog(LOG_NOTICE, "Failed to enumerate mailboxes for %s", user);
+        sha1_mailbox_list_free(sha1_mailbox_list);
+        return(r);
+    }
+
+    auth_freestate(imapd_authstate);
+
+    /* If mailbox have been deleted, we need to rewrite */
+    if (sha1_mailbox_list->dirty ||
+        sha1_mailbox_list_check_deleted(sha1_mailbox_list)) {
+        snprintf(buf, sizeof(buf)-1, "%s/%c/%s-NEW", sha1_dir, user[0], user);
+        sha1_mailbox_list_write(sha1_mailbox_list, buf);
+
+        snprintf(buf, sizeof(buf)-1, "%s/%c/%s-NEW", sha1_dir, user[0], user);
+        snprintf(buf2, sizeof(buf2)-1, "%s/%c/%s", sha1_dir, user[0], user);
+
+        if (rename(buf, buf2) < 0) {
+            syslog(LOG_NOTICE, "Failed to rename %s -> %s", buf, buf2);
+            sha1_mailbox_list_free(sha1_mailbox_list);
+            return(IMAP_IOERROR);
+        }
+    }
+
+    if (regenerate)
+        syslog(LOG_NOTICE, "Done make_sha1 for %s (regenerated)", user);
+    else
+        syslog(LOG_NOTICE, "Done make_sha1 for %s", user);
+
+    sha1_mailbox_list_free(sha1_mailbox_list);
+    return(0);
+}
+
+/* ====================================================================== */
+
+static unsigned long sha1_children = 0;
+
+static void
+sha1_child_reaper()
+{
+    int              status;
+    pid_t            child;
+
+    do {
+        child = waitpid(0, &status, WNOHANG);
+        if ((child > 0) && (sha1_children > 0))
+            sha1_children--;
+    } while (child > 0);
+}
+
+static int
+sha1_signal_child_init(void (*fn)())
+{
+    struct sigaction act, oact;
+
+    sigemptyset(&act.sa_mask);
+    act.sa_handler = fn;
+    act.sa_flags   = 0;
+  
+    if (sigaction(SIGCHLD, &act, &oact) == 0)
+        return(1);
+  
+    fprintf(stderr, "[os_signal_child_init()] sigaction() failed: %s",
+            strerror(errno));
+    return(0);
+}
+
+/* ====================================================================== */
+
+int main(int argc, char **argv)
+{
+    int   opt;
+    char *alt_config = NULL;
+    char *input_file = NULL;
+    const char *sha1_dir  = NULL;
+    unsigned   uid_set    = 0;
+    int   uid_modulo = 0;
+    int   r = 0;
+    int   i;
+    unsigned   max_children = 0;
+    pid_t pid;
+    struct namespace sha1_namespace;
+    char buf[512];
+    FILE *file;
+    int len;
+
+    if(geteuid() == 0)
+        fatal("must run as the Cyrus user", EC_USAGE);
+
+    setbuf(stdout, NULL);
+
+    while ((opt = getopt(argc, argv, "C:D:k:f:m:M:v")) != EOF) {
+        switch (opt) {
+        case 'C': /* alt config file */
+            alt_config = optarg;
+            break;
+
+        case 'D': /* SHA1 directory */
+            sha1_dir = optarg;
+            break;
+
+        case 'f': /* Input file */
+            input_file = optarg;
+            break;
+
+        case 'k': /* Concurrent threads */
+            max_children = atoi(optarg);
+            break;
+
+        case 'm': /* Together with -M process fraction of users */
+            uid_set = atoi(optarg);
+            break;
+
+        case 'M': /* Together with -m process fraction of users */
+            uid_modulo = atoi(optarg);
+            break;
+
+        case 'v': /* verbose */
+            verbose++;
+            break;
+
+        default:
+            usage("make_sha1");
+        }
+    }
+
+    /* Set up default bounds if no command line options provided */
+
+    cyrus_init(alt_config, "make_sha1", 0);
+
+    syslog(LOG_NOTICE, "Generating SHA1 checksums for mailboxes");
+
+    /* Set namespace -- force standard (internal) */
+    if ((r = mboxname_init_namespace(&sha1_namespace, 1)) != 0) {
+        fatal(error_message(r), EC_CONFIG);
+    }
+
+    mboxlist_init(0);
+    mboxlist_open(NULL);
+    mailbox_initialize();
+
+    /* open the quota db, we'll need it for real work */
+    quotadb_init(0);
+    quotadb_open(NULL);
+
+    signals_set_shutdown(&shut_down);
+    signals_add_handlers(0);
+
+    if (!input_file && (optind == argc)) {
+        fprintf(stderr, "please specify user to SHA1\n");
+        shut_down(1);
+    }
+
+    if (!sha1_dir) sha1_dir = config_getstring(IMAPOPT_SHA1_DIR);
+
+    if (!sha1_dir)
+        sha1_dir = xstrdup("/var/imap/sha1");
+
+    if (max_children == 0) {
+        /* Simple case */
+
+        if (input_file) {
+            if ((file=fopen(input_file, "r")) == NULL) {
+                syslog(LOG_NOTICE, "Unable to open %s: %m", input_file);
+                shut_down(1);
+            }
+            while (fgets(buf, sizeof(buf), file)) {
+                /* Chomp, then ignore empty/comment lines. */
+                if (((len=strlen(buf)) > 0) && (buf[len-1] == '\n'))
+                    buf[--len] = '\0';
+
+                if ((len == 0) || (buf[0] == '#'))
+                    continue;
+
+                if (do_user(sha1_dir, buf, &sha1_namespace,
+                            uid_set, uid_modulo)) {
+                    syslog(LOG_NOTICE, "Error make_sha1 %s: %m", buf);
+                    shut_down(1);
+                }
+            }
+            fclose(file);
+        } else for (i = optind; i < argc; i++) {
+            if (do_user(sha1_dir, argv[i], &sha1_namespace,
+                        uid_set, uid_modulo)) {
+                syslog(LOG_NOTICE, "Error make_sha1 %s: %m", argv[i]);
+                shut_down(1);
+            }
+        }
+
+        syslog(LOG_NOTICE, "Done SHA1 checksums for mailboxes");
+        shut_down(0);
+    }
+
+    /* Enable child handler */
+    if (!sha1_signal_child_init(sha1_child_reaper)) {
+        fprintf(stderr, "Couldn't initialise child reaper\n");
+        exit(1);
+    }
+
+    if (input_file) {
+        if ((file=fopen(input_file, "r")) == NULL) {
+            syslog(LOG_NOTICE, "Unable to open %s: %m", input_file);
+            shut_down(1);
+        }
+        while (fgets(buf, sizeof(buf), file)) {
+            /* Chomp, then ignore empty/comment lines. */
+            if (((len=strlen(buf)) > 0) && (buf[len-1] == '\n'))
+                buf[--len] = '\0';
+            
+            if ((len == 0) || (buf[0] == '#'))
+                continue;
+
+
+            while (sha1_children == max_children)   /* Concurrency limit */
+                pause();
+    
+            if ((pid = fork()) < 0) {
+                fprintf(stderr, "Fork failed.\n");
+                shut_down(1);
+            }
+            if (pid == 0) {
+                /* Child process */
+                do_user(sha1_dir, buf, &sha1_namespace,
+                        uid_set, uid_modulo);
+                _exit(0);
+            }
+            sha1_children++;   /* Parent process */
+        }
+        fclose(file);
+    } else for (i = optind; i < argc; i++) {
+        while (sha1_children == max_children)   /* Concurrency limit */
+            pause();
+    
+        if ((pid = fork()) < 0) {
+            fprintf(stderr, "Fork failed.\n");
+            shut_down(1);
+        }
+        if (pid == 0) {
+            /* Child process */
+            do_user(sha1_dir, argv[i], &sha1_namespace,
+                    uid_set, uid_modulo);
+            _exit(0);
+        }
+        sha1_children++;   /* Parent process */
+    }
+  
+    /* Wait forall children to finish */
+    while (sha1_children > 0)
+        pause();
+
+    syslog(LOG_NOTICE, "Finished generating SHA1 checksums for mailboxes");
+    shut_down(0);
+}
+#else
+int main(int argc, char **argv)
+{
+    fprintf(stderr, "make_sha1: not implemented due to missing OpenSSL\n");
+    exit(code);
+}
+#endif /* !HAVE_SSL */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbdump.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbdump.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbdump.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbdump.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* mbdump.c -- Mailbox dump routines
- * $Id: mbdump.c,v 1.33 2007/02/05 18:41:47 jeaton Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: mbdump.c,v 1.41 2008/10/08 15:47:08 murch Exp $
  */
 
 #include <config.h>
@@ -58,8 +60,8 @@
 #include <ctype.h>
 #include <unistd.h>
 #include <dirent.h>
-#include <assert.h>
-
+
+#include "assert.h"
 #include "annotate.h"
 #include "exitcodes.h"
 #include "global.h"
@@ -77,6 +79,7 @@
 #include "xstrlcpy.h"
 #include "xstrlcat.h"
 #include "util.h"
+#include "index.h"
 
 /* is this the active script? */
 static int sieve_isactive(char *sievepath, char *name)
@@ -134,7 +137,8 @@
     /* Transfer all attributes for this annotation, don't transfer size
      * separately since that can be implicitly determined */
     prot_printf(ctx->pout,
-		" {%ld%s}\r\nA-%s%s (%ld {%d%s}\r\n%s {%d%s}\r\n%s)",
+		" {%ld%s}\r\nA-%s%s (%ld {" SIZE_T_FMT "%s}\r\n%s"
+		" {" SIZE_T_FMT "%s}\r\n%s)",
 		ename_size, (!ctx->tag ? "+" : ""),
 		userid, entry,
 		attrib->modifiedsince,
@@ -178,7 +182,7 @@
 
     /* send: name, size, and contents */
     if (first) {
-	prot_printf(pout, " {%d}\r\n", strlen(ftag));
+	prot_printf(pout, " {" SIZE_T_FMT "}\r\n", strlen(ftag));
 
 	if (sync) {
 	    /* synchronize */
@@ -194,7 +198,7 @@
 	prot_printf(pout, "%s {%lu%s}\r\n",
 		    ftag, len, (sync ? "+" : ""));
     } else {
-	prot_printf(pout, " {%d%s}\r\n%s {%lu%s}\r\n",
+	prot_printf(pout, " {" SIZE_T_FMT "%s}\r\n%s {%lu%s}\r\n",
 		    strlen(ftag), (sync ? "+" : ""),
 		    ftag, len, (sync ? "+" : ""));
     }
@@ -360,7 +364,7 @@
     if (userid) {
 	char sieve_path[MAX_MAILBOX_PATH];
 	int sieve_usehomedir = config_getswitch(IMAPOPT_SIEVEUSEHOMEDIR);
-	char *fname, *ftag;
+	char *fname = NULL, *ftag = NULL;
 
 	/* Dump seen and subs files */
 	for (i = 0; i< NUM_USER_DATA_FILES; i++) {
@@ -405,20 +409,21 @@
 		*p = '\0'; /* separate domain!mboxname */
 		snprintf(sieve_path, sizeof(sieve_path), "%s%s%c/%s/%c/%s",
 			 config_getstring(IMAPOPT_SIEVEDIR),
-			 FNAME_DOMAINDIR, (char) dir_hash_c(mbname), mbname, 
-			 (char) dir_hash_c(p+6), p+6); /* unqualified userid */
+			 FNAME_DOMAINDIR,
+			 (char) dir_hash_c(mbname, config_fulldirhash), mbname, 
+			 (char) dir_hash_c(p+6, config_fulldirhash), p+6); /* unqualified userid */
 		*p = '!'; /* reassemble domain!mboxname */
 	    }
 	    else {
 		snprintf(sieve_path, sizeof(sieve_path), "%s/%c/%s",
 			 config_getstring(IMAPOPT_SIEVEDIR),
-			 (char) dir_hash_c(userid), userid);
+			 (char) dir_hash_c(userid, config_fulldirhash), userid);
 	    }
 	    mbdir = opendir(sieve_path);
 
 	    if (!mbdir) {
 		syslog(LOG_ERR,
-		       "could not dump sieve scripts in %s: %m)", mbpath);
+		       "could not dump sieve scripts in %s: %m)", sieve_path);
 	    } else {
 		char tag_fname[2048];
 	    
@@ -439,6 +444,10 @@
 				     "SIEVE-%s", next->d_name);
 			}
 
+			/* construct path/filename */
+			snprintf(filename, sizeof(filename), "%s/%s",
+				 sieve_path, next->d_name);
+
 			/* dump file */
 			r = dump_file(0, !tag, pin, pout, filename, tag_fname);
 			if (r) goto done;
@@ -499,14 +508,15 @@
 		*p = '\0'; /* separate domain!mboxname */
 		snprintf(sieve_path, sizeof(sieve_path), "%s%s%c/%s/%c/%s",
 			 config_getstring(IMAPOPT_SIEVEDIR),
-			 FNAME_DOMAINDIR, (char) dir_hash_c(mbname), mbname, 
-			 (char) dir_hash_c(p+6), p+6); /* unqualified userid */
+			 FNAME_DOMAINDIR,
+			 (char) dir_hash_c(mbname, config_fulldirhash), mbname, 
+			 (char) dir_hash_c(p+6, config_fulldirhash), p+6); /* unqualified userid */
 		*p = '!'; /* reassemble domain!mboxname */
 	    }
 	    else {
 		snprintf(sieve_path, sizeof(sieve_path), "%s/%c/%s",
 			 config_getstring(IMAPOPT_SIEVEDIR),
-			 (char) dir_hash_c(userid), userid);
+			 (char) dir_hash_c(userid, config_fulldirhash), userid);
 	    }
 	}
     }
@@ -849,5 +859,42 @@
     if(curfile >= 0) close(curfile);
     mailbox_close(&mb);
     
+    if ( r || quotaused == 0 ) {
+	return r;
+    }
+
+    /*
+     * Set mtimes of message files to INTERNALDATE.  This allows later
+     * reconstructs to recover INTERNALDATE from the filesystem.
+     */
+    r = mailbox_open_locked(mbname, mbpath, metapath, mbacl, auth_state, &mb, 0);
+    if (!r) {
+	struct timeval times[ 2 ];
+        char fname[MAX_MAILBOX_PATH+1];
+	const char *index_base;
+	long int start_offset, record_size;
+	size_t offset;
+	unsigned long i;
+ 
+        strlcpy(fname, mb.path, sizeof(fname));
+        strlcat(fname, "/", sizeof(fname));
+	offset = strlen( fname );
+
+	index_base = mb.index_base;
+	start_offset = mb.start_offset;
+	record_size = mb.record_size;
+
+	for ( i = 1; i <= mb.exists; i++ ) {
+	    mailbox_message_get_fname( &mb, UID(i),
+		    fname + offset, sizeof( fname ) - offset);
+	    times[ 0 ].tv_sec = INTERNALDATE( i );
+	    times[ 0 ].tv_usec = 0;
+	    times[ 1 ].tv_sec = INTERNALDATE( i );
+	    times[ 1 ].tv_usec = 0;
+	    (void)utimes( fname, times );
+	}
+    }
+    mailbox_close( &mb );
+    
     return r;
 }

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbdump.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbdump.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbdump.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbdump.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mbdump.h -- Mailbox dump routine definitions
- * $Id: mbdump.h,v 1.5 2006/11/30 17:11:19 murch Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +38,10 @@
  * 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.
+ *
+ * $Id: mbdump.h,v 1.6 2008/03/24 17:09:17 murch Exp $
  */
+
 #ifndef INCLUDED_MBDUMP_H
 #define INCLUDED_MBDUMP_H
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbexamine.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbexamine.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbexamine.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbexamine.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* mbexamine.c -- examine the contents of a mailbox index and cache
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: mbexamine.c,v 1.20 2008/09/19 01:03:20 wescraig Exp $
  */
-
-/* $Id: mbexamine.c,v 1.13 2007/02/05 18:41:47 jeaton Exp $ */
 
 #include <config.h>
 
@@ -86,6 +87,7 @@
 #include "imparse.h"
 #include "mailbox.h"
 #include "message.h"
+#include "message_guid.h"
 #include "mboxname.h"
 #include "mboxlist.h"
 #include "seen.h"
@@ -106,27 +108,31 @@
 
 /* forward declarations */
 int do_examine(char *name, int matchlen, int maycreate, void *rock);
+int do_quota(char *name, int matchlen, int maycreate, void *rock);
 void usage(void);
 void shut_down(int code);
 
 int code = 0;
 
-int wantuid = 0;
-int wantvalue = 0;
+unsigned wantuid = 0;
+unsigned wantvalue = 0;
 
 int main(int argc, char **argv)
 {
     int opt, i, r;
     char buf[MAX_MAILBOX_PATH+1];
     char *alt_config = NULL;
-
-/*    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE); */
+    int quotachk = 0;
+
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     /* Ensure we're up-to-date on the index file format */
     assert(INDEX_HEADER_SIZE == (OFFSET_SPARE4+4));
     assert(INDEX_RECORD_SIZE == (OFFSET_MODSEQ+4));
 
-    while ((opt = getopt(argc, argv, "C:u:s:")) != EOF) {
+    while ((opt = getopt(argc, argv, "C:u:s:q")) != EOF) {
 	switch (opt) {
 	case 'C': /* alt config file */
 	    alt_config = optarg;
@@ -143,6 +149,10 @@
 	    wantvalue = atoi(optarg);
 	    break;
 	    
+	case 'q':
+	    quotachk = 1;
+	    break;
+	    
 	default:
 	    usage();
 	}
@@ -165,15 +175,17 @@
     if (optind == argc) {
 	strlcpy(buf, "*", sizeof(buf));
 	(*recon_namespace.mboxlist_findall)(&recon_namespace, buf, 1, 0, 0,
-					    do_examine, NULL);
+					    quotachk ? do_quota : do_examine,
+					    NULL);
     }
 
     for (i = optind; i < argc; i++) {
 	/* Handle virtdomains and separators in mailboxname */
 	(*recon_namespace.mboxname_tointernal)(&recon_namespace, argv[i],
 					       NULL, buf);
-	(*recon_namespace.mboxlist_findall)(&recon_namespace, buf, 1, 0,
-					    0, do_examine, NULL);
+	(*recon_namespace.mboxlist_findall)(&recon_namespace, buf, 1, 0, 0,
+					    quotachk ? do_quota : do_examine,
+					    NULL);
     }
 
     mboxlist_close();
@@ -186,7 +198,8 @@
 {
     fprintf(stderr,
 	    "usage: mbexamine [-C <alt_config>] [-s seqnum] mailbox...\n"
-	    "       mbexamine [-C <alt_config>] [-u uid] mailbox...\n");
+	    "       mbexamine [-C <alt_config>] [-u uid] mailbox...\n"
+	    "       mbexamine [-C <alt_config>] -q mailbox...\n");
     exit(EC_USAGE);
 }    
 
@@ -198,7 +211,8 @@
 	       int maycreate __attribute__((unused)),
 	       void *rock __attribute__((unused)))
 {
-    int i,r = 0;
+    unsigned i;
+    int r = 0;
     int flag = 0;
     char ext_name_buf[MAX_MAILBOX_PATH+1];
     struct mailbox mailbox;
@@ -287,6 +301,12 @@
 	    if (mailbox.options & OPT_IMAP_CONDSTORE) {
 		printf(" IMAP_CONDSTORE");
 	    }
+	    if (mailbox.options & OPT_IMAP_SHAREDSEEN) {
+		printf(" IMAP_SHAREDSEEN");
+	    }
+	    if (mailbox.options & OPT_IMAP_DUPDELIVER) {
+		printf(" IMAP_DUPDELIVER");
+	    }
 	}
 	printf("\n");
     }
@@ -322,10 +342,14 @@
 	printf("      > HDRSIZE:%-6d LASTUPD :%ld SYSFLAGS:%08X",
 	       HEADER_SIZE(i), LAST_UPDATED(i), SYSTEM_FLAGS(i));
 	if (mailbox.minor_version >= 5)
-	    printf("   LINES:%-6d", CONTENT_LINES(i));
+	    printf("   LINES:%-6d\n", CONTENT_LINES(i));
 
 	if (mailbox.minor_version >= 6)
-	    printf(" CACHEVER:%-6d", CACHE_VERSION(i));
+	    printf("      > CACHEVER:%-2d", CACHE_VERSION(i));
+
+	if (mailbox.minor_version >= 7) {
+	    printf(" GUID: %s", message_guid_encode(GUID(i)));
+	}
 
 	if (mailbox.minor_version >= 8) {
 	    printf(" MODSEQ:" MODSEQ_FMT, MODSEQ(i));
@@ -341,13 +365,13 @@
 
 	cacheitem = mailbox.cache_base + CACHE_OFFSET(i);
 	
-	printf(" Envel>{%d}%s\n", CACHE_ITEM_LEN(cacheitem),
-	       cacheitem + CACHE_ITEM_SIZE_SKIP);
-	cacheitem = CACHE_ITEM_NEXT(cacheitem);
-	printf("BdyStr>{%d}%s\n", CACHE_ITEM_LEN(cacheitem),
-	       cacheitem + CACHE_ITEM_SIZE_SKIP);
-	cacheitem = CACHE_ITEM_NEXT(cacheitem);
-	printf("  Body>{%d}%s\n", CACHE_ITEM_LEN(cacheitem),
+	printf(" Envel>{%d}%.*s\n", CACHE_ITEM_LEN(cacheitem), CACHE_ITEM_LEN(cacheitem),
+	       cacheitem + CACHE_ITEM_SIZE_SKIP);
+	cacheitem = CACHE_ITEM_NEXT(cacheitem);
+	printf("BdyStr>{%d}%.*s\n", CACHE_ITEM_LEN(cacheitem), CACHE_ITEM_LEN(cacheitem),
+	       cacheitem + CACHE_ITEM_SIZE_SKIP);
+	cacheitem = CACHE_ITEM_NEXT(cacheitem);
+	printf("  Body>{%d}%.*s\n", CACHE_ITEM_LEN(cacheitem), CACHE_ITEM_LEN(cacheitem),
 	       cacheitem + CACHE_ITEM_SIZE_SKIP);
 	cacheitem = CACHE_ITEM_NEXT(cacheitem);
 
@@ -357,22 +381,22 @@
 #endif
 
 	cacheitem = CACHE_ITEM_NEXT(cacheitem);
-	printf("CacHdr>{%d}%s\n", CACHE_ITEM_LEN(cacheitem),
-	       cacheitem + CACHE_ITEM_SIZE_SKIP);
-	cacheitem = CACHE_ITEM_NEXT(cacheitem);
-	printf("  From>{%d}%s\n", CACHE_ITEM_LEN(cacheitem),
-	       cacheitem + CACHE_ITEM_SIZE_SKIP);
-	cacheitem = CACHE_ITEM_NEXT(cacheitem);
-	printf("    To>{%d}%s\n", CACHE_ITEM_LEN(cacheitem),
-	       cacheitem + CACHE_ITEM_SIZE_SKIP);
-	cacheitem = CACHE_ITEM_NEXT(cacheitem);
-	printf("    Cc>{%d}%s\n", CACHE_ITEM_LEN(cacheitem),
-	       cacheitem + CACHE_ITEM_SIZE_SKIP);
-	cacheitem = CACHE_ITEM_NEXT(cacheitem);
-	printf("   Bcc>{%d}%s\n", CACHE_ITEM_LEN(cacheitem),
-	       cacheitem + CACHE_ITEM_SIZE_SKIP);
-	cacheitem = CACHE_ITEM_NEXT(cacheitem);
-	printf("Subjct>{%d}%s\n", CACHE_ITEM_LEN(cacheitem),
+	printf("CacHdr>{%d}%.*s\n", CACHE_ITEM_LEN(cacheitem), CACHE_ITEM_LEN(cacheitem),
+	       cacheitem + CACHE_ITEM_SIZE_SKIP);
+	cacheitem = CACHE_ITEM_NEXT(cacheitem);
+	printf("  From>{%d}%.*s\n", CACHE_ITEM_LEN(cacheitem), CACHE_ITEM_LEN(cacheitem),
+	       cacheitem + CACHE_ITEM_SIZE_SKIP);
+	cacheitem = CACHE_ITEM_NEXT(cacheitem);
+	printf("    To>{%d}%.*s\n", CACHE_ITEM_LEN(cacheitem), CACHE_ITEM_LEN(cacheitem),
+	       cacheitem + CACHE_ITEM_SIZE_SKIP);
+	cacheitem = CACHE_ITEM_NEXT(cacheitem);
+	printf("    Cc>{%d}%.*s\n", CACHE_ITEM_LEN(cacheitem), CACHE_ITEM_LEN(cacheitem),
+	       cacheitem + CACHE_ITEM_SIZE_SKIP);
+	cacheitem = CACHE_ITEM_NEXT(cacheitem);
+	printf("   Bcc>{%d}%.*s\n", CACHE_ITEM_LEN(cacheitem), CACHE_ITEM_LEN(cacheitem),
+	       cacheitem + CACHE_ITEM_SIZE_SKIP);
+	cacheitem = CACHE_ITEM_NEXT(cacheitem);
+	printf("Subjct>{%d}%.*s\n", CACHE_ITEM_LEN(cacheitem), CACHE_ITEM_LEN(cacheitem),
 	       cacheitem + CACHE_ITEM_SIZE_SKIP);
 
 	if(flag) break;
@@ -380,6 +404,95 @@
 
     if(wantvalue && !flag) {
 	printf("Desired message not found\n");
+    }
+
+ done:
+    mailbox_close(&mailbox);
+
+    return r;
+}
+
+/*
+ * mboxlist_findall() callback function to examine a mailbox quota usage
+ */
+int do_quota(char *name,
+	       int matchlen __attribute__((unused)),
+	       int maycreate __attribute__((unused)),
+	       void *rock __attribute__((unused)))
+{
+    unsigned i;
+    int r = 0;
+    char ext_name_buf[MAX_MAILBOX_PATH+1];
+    struct mailbox mailbox;
+    const char *index_base;
+    long int start_offset, record_size;
+    uquota_t total = 0;
+    
+    signals_poll();
+
+    /* Convert internal name to external */
+    (*recon_namespace.mboxname_toexternal)(&recon_namespace, name,
+					   "cyrus", ext_name_buf);
+    printf("Examining %s...", ext_name_buf);
+
+    /* Open/lock header */
+    r = mailbox_open_header(name, 0, &mailbox);
+    if (r) {
+	return r;
+    }
+    if (mailbox.header_fd != -1) {
+	(void) mailbox_lock_header(&mailbox);
+    }
+    mailbox.header_lock_count = 1;
+
+    if (chdir(mailbox.path) == -1) {
+	r = IMAP_IOERROR;
+	goto done;
+    }
+
+    /* Attempt to open/lock index */
+    r = mailbox_open_index(&mailbox);
+    if (r) {
+	goto done;
+    } else {
+	(void) mailbox_lock_index(&mailbox);
+    }
+    mailbox.index_lock_count = 1;
+
+    index_base = mailbox.index_base;
+    start_offset = mailbox.start_offset;
+    record_size = mailbox.record_size;
+    
+    for(i=1; i<=mailbox.exists; i++) {
+	char fnamebuf[MAILBOX_FNAME_LEN];
+	struct stat sbuf;
+
+	strlcpy(fnamebuf, mailbox.path, sizeof(fnamebuf));
+	strlcat(fnamebuf, "/", sizeof(fnamebuf));
+	mailbox_message_get_fname(&mailbox, UID(i),
+				  fnamebuf + strlen(fnamebuf),
+				  sizeof(fnamebuf) - strlen(fnamebuf));
+
+	if (stat(fnamebuf, &sbuf) != 0) {
+	    syslog(LOG_WARNING,
+		   "Can not open message file %s -- skipping\n", fnamebuf);
+	    continue;
+	}
+
+	if (SIZE(i) != (unsigned) sbuf.st_size) {
+	    printf("  Message %u has INCORRECT size in index record\n", UID(i));
+	    r = 0;
+	    goto done;
+	}
+
+	total += sbuf.st_size;
+    }
+
+    if (mailbox.quota_mailbox_used != total) {
+	printf("  Mailbox has INCORRECT total quota usage\n");
+    }
+    else {
+	printf("  Mailbox has CORRECT total quota usage\n");
     }
 
  done:

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxkey.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxkey.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxkey.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxkey.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mboxkey.c -- implementation of URLAUTH mailbox keys
- * $Id: mboxkey.c,v 1.2 2006/11/30 17:11:19 murch Exp $
  * 
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,12 +39,12 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: mboxkey.c,v 1.7 2008/08/27 08:28:47 selsky Exp $
  */
 
 #include <config.h>
 
 #include <stdlib.h>
-#include <assert.h>
 #include <syslog.h>
 #include <string.h>
 #include <ctype.h>
@@ -58,6 +58,7 @@
 #include <sys/stat.h>
 #include <sys/uio.h>
 
+#include "assert.h"
 #include "cyrusdb.h"
 #include "map.h"
 #include "util.h"
@@ -106,15 +107,15 @@
     char c, *domain;
 
     if (config_virtdomains && (domain = strchr(userid, '@'))) {
-	char d = (char) dir_hash_c(domain+1);
+	char d = (char) dir_hash_c(domain+1, config_fulldirhash);
 	*domain = '\0';  /* split user at domain */
-	c = (char) dir_hash_c(userid);
+	c = (char) dir_hash_c(userid, config_fulldirhash);
 	sprintf(fname, "%s%s%c/%s%s%c/%s%s", config_dir, FNAME_DOMAINDIR, d,
 		domain+1, FNAME_USERDIR, c, userid, FNAME_MBOXKEYSUFFIX);
 	*domain = '@';  /* reassemble user at domain */
     }
     else {
-	c = (char) dir_hash_c(userid);
+	c = (char) dir_hash_c(userid, config_fulldirhash);
 	sprintf(fname, "%s%s%c/%s%s", config_dir, FNAME_USERDIR, c, userid,
 		FNAME_MBOXKEYSUFFIX);
     }
@@ -150,7 +151,7 @@
     /* otherwise, close the existing database */
     if (mboxkeydb) {
 	abortcurrent(mboxkeydb);
-	r = DB->close(mboxkeydb->db);
+	r = (DB->close)(mboxkeydb->db);
 	if (r) {
 	    syslog(LOG_ERR, "DBERROR: error closing mboxkeydb: %s", 
 		   cyrusdb_strerror(r));
@@ -164,7 +165,7 @@
 
     /* open the mboxkeydb corresponding to user */
     fname = mboxkey_getpath(user);
-    r = DB->open(fname, (flags & MBOXKEY_CREATE) ? CYRUSDB_CREATE : 0,
+    r = (DB->open)(fname, (flags & MBOXKEY_CREATE) ? CYRUSDB_CREATE : 0,
 		 &mboxkeydb->db);
     if (r != 0) {
 	int level = (flags & MBOXKEY_CREATE) ? LOG_ERR : LOG_DEBUG;
@@ -325,7 +326,7 @@
 
 	/* free the old database hanging around */
 	abortcurrent(lastmboxkey);
-	r = DB->close(lastmboxkey->db);
+	r = (DB->close)(lastmboxkey->db);
 	if (r != CYRUSDB_OK) {
 	    syslog(LOG_ERR, "DBERROR: error closing lastmboxkey: %s",
 		   cyrusdb_strerror(r));
@@ -356,7 +357,7 @@
     /* erp! */
     r = unlink(fname);
     if (r < 0 && errno == ENOENT) {
-	syslog(LOG_DEBUG, "can not unlink %s: %m", fname);
+	syslog(LOG_DEBUG, "cannot unlink %s: %m", fname);
 	/* but maybe the user just never read anything? */
 	r = 0;
     }
@@ -409,7 +410,7 @@
 
     if (lastmboxkey) {
 	abortcurrent(lastmboxkey);
-	r = DB->close(lastmboxkey->db);
+	r = (DB->close)(lastmboxkey->db);
 	if (r) {
 	    syslog(LOG_ERR, "DBERROR: error closing lastmboxkey: %s",
 		   cyrusdb_strerror(r));
@@ -482,10 +483,10 @@
     struct mboxkey_merge_rock rock;
 
     /* xxx does this need to be CYRUSDB_CREATE? */
-    r = DB->open(tmpfile, CYRUSDB_CREATE, &tmp);
+    r = (DB->open)(tmpfile, CYRUSDB_CREATE, &tmp);
     if(r) goto done;
 	    
-    r = DB->open(tgtfile, CYRUSDB_CREATE, &tgt);
+    r = (DB->open)(tgtfile, CYRUSDB_CREATE, &tgt);
     if(r) goto done;
 
     rock.db = tgt;
@@ -498,8 +499,8 @@
 
  done:
 
-    if(tgt) DB->close(tgt);
-    if(tmp) DB->close(tmp);
+    if(tgt) (DB->close)(tgt);
+    if(tmp) (DB->close)(tmp);
     
     return r;
 }

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxkey.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxkey.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxkey.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxkey.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* mboxkey.h -- abstract interface for URLAUTH mailbox keys
- * $Id: mboxkey.h,v 1.2 2006/11/30 17:11:19 murch Exp $
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,8 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: mboxkey.h,v 1.3 2008/03/24 17:09:18 murch Exp $
  */
-
 
 #ifndef MBOXKEY_H
 #define MBOXKEY_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxlist.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxlist.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxlist.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxlist.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* mboxlist.c -- Mailbox list manipulation routines
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: mboxlist.c,v 1.245 2007/02/05 18:41:47 jeaton Exp $
+ * $Id: mboxlist.c,v 1.260 2008/10/08 15:47:08 murch Exp $
  */
 
 #include <config.h>
@@ -82,6 +81,7 @@
 
 #include "mboxlist.h"
 #include "quota.h"
+#include "sync_log.h"
 
 #define DB config_mboxlist_db
 #define SUBDB config_subscription_db
@@ -314,7 +314,7 @@
 	r = mupdate_connect(config_mupdate_server, NULL, &mupdate_h, NULL);
 	if(r) {
 	    syslog(LOG_ERR,
-		   "can not connect to mupdate server for update of '%s'",
+		   "cannot connect to mupdate server for update of '%s'",
 		   name);
 	} else {
 	    r = mupdate_activate(mupdate_h, name, buf, acl);
@@ -387,7 +387,7 @@
     if(!isadmin && force_user_create) return IMAP_PERMISSION_DENIED;
 
     /* User has admin rights over their own mailbox namespace */
-    if (mboxname_userownsmailbox(userid, name) && strchr(name+5, '.') &&
+    if (mboxname_userownsmailbox(userid, name) && strchr(mbox+5, '.') &&
 	(config_implicitrights & ACL_ADMIN)) {
 	isadmin = 1;
     }
@@ -505,7 +505,7 @@
 	    if (mbox != name) {
 		/* add domain to identifier */
 		sprintf(identifier+strlen(identifier),
-			"@%.*s", mbox - name - 1, name);
+			"@%.*s", (int) (mbox - name - 1), name);
 	    }
 	    cyrus_acl_set(&acl, identifier, ACL_MODE_SET, ACL_ALL,
 		    (cyrus_acl_canonproc_t *)0, (void *)0);
@@ -638,7 +638,7 @@
 	r = mupdate_connect(config_mupdate_server, NULL, &mupdate_h, NULL);
 	if(r) {
 	    syslog(LOG_ERR,
-		   "can not connect to mupdate server for reservation on '%s'",
+		   "cannot connect to mupdate server for reservation on '%s'",
 		   name);
 	    goto done;
 	}
@@ -766,7 +766,7 @@
 
     if ((p = strchr(host, '!'))) {
       /* remote mailbox */
-      int len = (p - host);
+      size_t len = (p - host);
       if (config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_UNIFIED &&
 	  len == strlen(config_servername) &&
 	  !strncasecmp(host, config_servername, len)) {
@@ -874,6 +874,101 @@
     return r;
 }
 	
+/*
+ * Delayed Delete a mailbox: translate delete into rename
+ *
+ * XXX local_only?
+ */
+int
+mboxlist_delayed_deletemailbox(const char *name, int isadmin, char *userid, 
+                               struct auth_state *auth_state, int checkacl,
+                               int local_only __attribute__((unused)),
+			       int force)
+{
+    char newname[MAX_MAILBOX_PATH+1];
+    char *path, *mpath;
+    char *acl;
+    char *partition;
+    int r;
+    long access;
+    int isremote = 0;
+    int mbtype;
+    const char *p;
+    const char *deletedprefix = config_getstring(IMAPOPT_DELETEDPREFIX);
+    size_t domainlen = 0;
+    struct timeval tv;
+
+    if(!isadmin && force) return IMAP_PERMISSION_DENIED;
+
+    /* Check for request to delete a user:
+       user.<x> with no dots after it */
+    if ((p = mboxname_isusermailbox(name, 1))) {
+	/* Can't DELETE INBOX (your own inbox) */
+	if (userid) {
+	    size_t len = config_virtdomains ?
+                strcspn(userid, "@") : strlen(userid);
+	    if ((len == strlen(p)) && !strncmp(p, userid, len)) {
+		return(IMAP_MAILBOX_NOTSUPPORTED);
+	    }
+	}
+
+	/* Only admins may delete user */
+	if (!isadmin) return(IMAP_PERMISSION_DENIED);
+    }
+
+    do {
+        r = mboxlist_mylookup(name, &mbtype,
+                              &path, &mpath, &partition, &acl, NULL, 1);
+    } while (r == IMAP_AGAIN);
+
+    if (r) return(r);
+
+    isremote = mbtype & MBTYPE_REMOTE;
+
+    /* are we reserved? (but for remote mailboxes this is okay, since
+     * we don't touch their data files at all) */
+    if(!isremote && (mbtype & MBTYPE_RESERVE) && !force) {
+	return(IMAP_MAILBOX_RESERVED);
+    }
+
+    /* check if user has Delete right (we've already excluded non-admins
+     * from deleting a user mailbox) */
+    if (checkacl) {
+	access = cyrus_acl_myrights(auth_state, acl);
+	if(!(access & ACL_DELETEMBOX)) {
+	    /* User has admin rights over their own mailbox namespace */
+	    if (mboxname_userownsmailbox(userid, name) &&
+		(config_implicitrights & ACL_ADMIN)) {
+		isadmin = 1;
+	    }
+	    
+	    /* Lie about error if privacy demands */
+	    r = (isadmin || (access & ACL_LOOKUP)) ?
+		IMAP_PERMISSION_DENIED : IMAP_MAILBOX_NONEXISTENT;
+	    return(r);
+	}
+    }
+
+    if (config_virtdomains && (p = strchr(name, '!')))
+        domainlen = p - name + 1;    
+
+    gettimeofday( &tv, NULL );
+
+    if (domainlen && domainlen < sizeof(newname))
+	strncpy(newname, name, domainlen);
+    snprintf(newname+domainlen, sizeof(newname)-domainlen, "%s.%s.%X",
+             deletedprefix, name+domainlen, (unsigned) tv.tv_sec);
+
+    /* Get mboxlist_renamemailbox to do the hard work. No ACL checks needed */
+    r = mboxlist_renamemailbox((char *)name, newname, partition,
+                               1 /* isadmin */, userid,
+                               auth_state, force);
+
+    /* don't forget to log the rename! */
+    sync_log_mailbox_double((char *)name, newname);
+    return r;
+}
+
 /*
  * Delete a mailbox.
  * Deleting the mailbox user.FOO may only be performed by an admin.
@@ -911,7 +1006,7 @@
     if ((p = mboxname_isusermailbox(name, 1))) {
 	/* Can't DELETE INBOX (your own inbox) */
 	if (userid) {
-	    int len = config_virtdomains ? strcspn(userid, "@") : strlen(userid);
+	    size_t len = config_virtdomains ? strcspn(userid, "@") : strlen(userid);
 	    if ((len == strlen(p)) && !strncmp(p, userid, len)) {
 		r = IMAP_MAILBOX_NOTSUPPORTED;
 		goto done;
@@ -1000,7 +1095,7 @@
 	r = mupdate_connect(config_mupdate_server, NULL, &mupdate_h, NULL);
 	if(r) {
 	    syslog(LOG_ERR,
-		   "can not connect to mupdate server for delete of '%s'",
+		   "cannot connect to mupdate server for delete of '%s'",
 		   name);
 	    goto done;
 	}
@@ -1125,8 +1220,9 @@
 	      goto done;
 	    }
 	    isusermbox = 1;
-	} else if (config_getswitch(IMAPOPT_ALLOWUSERMOVES) &&
-		   mboxname_isusermailbox(newname, 1)) {
+	} else if ((config_getswitch(IMAPOPT_ALLOWUSERMOVES) &&
+		    mboxname_isusermailbox(newname, 1)) ||
+		   mboxname_isdeletedmailbox(newname)) {
 	    /* Special case of renaming a user */
 	    access = cyrus_acl_myrights(auth_state, oldacl);
 	    if (!(access & ACL_DELETEMBOX) && !isadmin) {
@@ -1157,8 +1253,9 @@
     /* Check ability to create new mailbox */
     if (!partitionmove) {
 	if (mboxname_isusermailbox(newname, 1)) {
-	    if (config_getswitch(IMAPOPT_ALLOWUSERMOVES) &&
-		mboxname_isusermailbox(oldname, 1)) {
+	    if ((config_getswitch(IMAPOPT_ALLOWUSERMOVES) &&
+		 mboxname_isusermailbox(oldname, 1)) ||
+		mboxname_isdeletedmailbox(oldname)) {
 		if (!isadmin) {
 		    /* Only admins can rename users (INBOX to INBOX) */
 		    r = IMAP_MAILBOX_NOTSUPPORTED;
@@ -1214,7 +1311,7 @@
 	r = mupdate_connect(config_mupdate_server, NULL, &mupdate_h, NULL);
 	if(r) {
 	    syslog(LOG_ERR,
-		   "can not connect to mupdate server for rename of '%s'",
+		   "cannot connect to mupdate server for rename of '%s'",
 		   newname);
 	    goto done;
 	}
@@ -1241,14 +1338,19 @@
     if(!r) {
 	r = mailbox_open_locked(oldname, oldpath, oldmpath, oldacl, auth_state,
 				&oldmailbox, 0);
+	if (r) {
+	    goto done;
+	} else {
 	oldopen = 1;
     }
+    }
 
     /* 6. Copy mailbox */
-    if (!r && !(mbtype & MBTYPE_REMOTE)) {
+    if (!(mbtype & MBTYPE_REMOTE)) {
 	/* Rename the actual mailbox */
 	r = mailbox_rename_copy(&oldmailbox, newname, newpartition,
-				NULL, NULL, &newmailbox);
+				NULL, NULL, &newmailbox,
+				isusermbox ? userid : NULL);
 	if (r) {
 	    goto done;
 	} else {
@@ -1269,7 +1371,7 @@
 	    syslog(LOG_ERR, "DBERROR: error deleting %s: %s",
 		   oldname, cyrusdb_strerror(r));
 	    r = IMAP_IOERROR;
-	    mailbox_close(&newmailbox);
+	    if (newopen) mailbox_close(&newmailbox);
 	    goto done;
 	    break;
 	}
@@ -1471,7 +1573,7 @@
 		!strcmp(identifier, "anonymous") ||
 		!strcmp(identifier, "anyone")) {
 		snprintf(ident, sizeof(ident),
-			 "%.*s", cp - identifier, identifier);
+			 "%.*s", (int) (cp - identifier), identifier);
 	    } else {
 		strlcpy(ident, identifier, sizeof(ident));
 	    }
@@ -1555,7 +1657,8 @@
     if(!r) {
 	/* Make change to ACL */
 	newacl = xstrdup(acl);
-	if (rights) {
+	if (rights && *rights) {
+	    /* rights are present and non-empty */
 	    mode = ACL_MODE_SET;
 	    if (*rights == '+') {
 		rights++;
@@ -1626,7 +1729,7 @@
 	r = mupdate_connect(config_mupdate_server, NULL, &mupdate_h, NULL);
 	if(r) {
 	    syslog(LOG_ERR,
-		   "can not connect to mupdate server for reservation on '%s'",
+		   "cannot connect to mupdate server for reservation on '%s'",
 		   name);
 	} else {
 	    r = mupdate_activate(mupdate_h, name, buf, newacl);
@@ -1761,7 +1864,7 @@
 	r = mupdate_connect(config_mupdate_server, NULL, &mupdate_h, NULL);
 	if(r) {
 	    syslog(LOG_ERR,
-		   "can not connect to mupdate server for reservation on '%s'",
+		   "cannot connect to mupdate server for reservation on '%s'",
 		   name);
 	} else {
 	    r = mupdate_activate(mupdate_h, name, buf, newacl);
@@ -1824,7 +1927,7 @@
     if (rock->inboxoffset) {
 	char namebuf[MAX_MAILBOX_NAME+1];
 
-	if(keylen >= sizeof(namebuf)) {
+	if(keylen >= (int) sizeof(namebuf)) {
 	    syslog(LOG_ERR, "oversize keylen in mboxlist.c:find_p()");
 	    return 0;
 	}
@@ -1866,6 +1969,18 @@
 	return 0;
     }
 
+    /* Suppress deleted hierarchy unless admin: overrides ACL_LOOKUP test */
+    if (!rock->isadmin) {
+	char namebuf[MAX_MAILBOX_NAME+1];
+
+	memcpy(namebuf, key, keylen);
+	namebuf[keylen] = '\0';
+	if (mboxlist_delayed_delete_isenabled() && 
+	    mboxname_isdeletedmailbox(namebuf))
+	    return 0;
+    }
+
+
     /* check acl */
     if (!rock->isadmin) {
 	/* check the acls */
@@ -1922,7 +2037,7 @@
     while (minmatch >= 0) {
 	long matchlen;
 	
-	if(keylen >= sizeof(namebuf)) {
+	if(keylen >= (int) sizeof(namebuf)) {
 	    syslog(LOG_ERR, "oversize keylen in mboxlist.c:find_cb()");
 	    return 0;
 	}
@@ -2057,7 +2172,7 @@
 		domainlen = strlen(p);
 	    }
 	    snprintf(domainpat+domainlen, sizeof(domainpat)-domainlen,
-		     "%.*s", p - pattern, pattern);
+		     "%.*s", (int) (p - pattern), pattern);
 	}
     }
 
@@ -2722,7 +2837,7 @@
 	flags |= CYRUSDB_MBOXSORT;
     }
 
-    ret = DB->open(fname, flags, &mbdb);
+    ret = (DB->open)(fname, flags, &mbdb);
     if (ret != 0) {
 	syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
 	       cyrusdb_strerror(ret));
@@ -2741,7 +2856,7 @@
     int r;
 
     if (mboxlist_dbopen) {
-	r = DB->close(mbdb);
+	r = (DB->close)(mbdb);
 	if (r) {
 	    syslog(LOG_ERR, "DBERROR: error closing mailboxes: %s",
 		   cyrusdb_strerror(r));
@@ -2764,15 +2879,15 @@
     char c, *domain;
 
     if (config_virtdomains && (domain = strchr(userid, '@'))) {
-	char d = (char) dir_hash_c(domain+1);
+	char d = (char) dir_hash_c(domain+1, config_fulldirhash);
 	*domain = '\0';  /* split user at domain */
-	c = (char) dir_hash_c(userid);
+	c = (char) dir_hash_c(userid, config_fulldirhash);
 	sprintf(fname, "%s%s%c/%s%s%c/%s%s", config_dir, FNAME_DOMAINDIR, d,
 		domain+1, FNAME_USERDIR, c, userid, FNAME_SUBSSUFFIX);
 	*domain = '@';  /* replace '@' */
     }
     else {
-	c = (char) dir_hash_c(userid);
+	c = (char) dir_hash_c(userid, config_fulldirhash);
 	sprintf(fname, "%s%s%c/%s%s", config_dir, FNAME_USERDIR, c, userid,
 		FNAME_SUBSSUFFIX);
     }
@@ -2801,7 +2916,7 @@
 	flags |= CYRUSDB_MBOXSORT;
     }
 
-    r = SUBDB->open(subsfname, flags, ret);
+    r = (SUBDB->open)(subsfname, flags, ret);
     if (r != CYRUSDB_OK) {
 	r = IMAP_IOERROR;
     }
@@ -2815,7 +2930,7 @@
  */
 static void mboxlist_closesubs(struct db *sub)
 {
-    SUBDB->close(sub);
+    (SUBDB->close)(sub);
 }
 
 /*
@@ -3261,3 +3376,10 @@
 
     return DB->abort(mbdb, tid);
 }
+
+int mboxlist_delayed_delete_isenabled(void)
+{
+    enum enum_value config_delete_mode = config_getenum(IMAPOPT_DELETE_MODE);
+
+    return(config_delete_mode == IMAP_ENUM_DELETE_MODE_DELAYED);
+}

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxlist.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxlist.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxlist.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxlist.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* mboxlist.h -- Mailbox list manipulation routines
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  * 
- * $Id: mboxlist.h,v 1.40 2006/11/30 17:11:19 murch Exp $
+ * $Id: mboxlist.h,v 1.43 2008/03/24 17:09:18 murch Exp $
  */
 
 #ifndef INCLUDED_MBOXLIST_H
@@ -118,6 +119,12 @@
 			   struct auth_state *auth_state,
 			   int localonly, int forceuser, int dbonly);
 
+/* delated delete */
+/* Translate delete into rename */
+int
+mboxlist_delayed_deletemailbox(const char *name, int isadmin, char *userid, 
+                               struct auth_state *auth_state, int checkacl,
+                               int local_only, int force);
 /* Delete a mailbox. */
 /* setting local_only disables any communication with the mupdate server
  * and deletes the mailbox from the filesystem regardless of if it is
@@ -204,4 +211,5 @@
 int mboxlist_commit(struct txn *tid);
 int mboxlist_abort(struct txn *tid);
 
+int mboxlist_delayed_delete_isenabled(void);
 #endif

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxname.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxname.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxname.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxname.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* mboxname.c -- Mailbox list manipulation routines
- * $Id: mboxname.c,v 1.37 2006/11/30 17:11:19 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: mboxname.c,v 1.45 2008/10/08 15:47:08 murch Exp $
  */
 
 #include <config.h>
@@ -376,7 +377,7 @@
 	    return IMAP_MAILBOX_BADNAME;
 
 	snprintf(result+resultlen, MAX_MAILBOX_NAME+1-resultlen, 
-		 "@%.*s", domainlen, domain);
+		 "@%.*s", (int) domainlen, domain);
     }
 
     return 0;
@@ -439,7 +440,7 @@
 	    return IMAP_MAILBOX_BADNAME;
 
 	sprintf(result, "%.*s",
-		prefixlen-1, namespace->prefix[NAMESPACE_USER]);
+		(int) (prefixlen-1), namespace->prefix[NAMESPACE_USER]);
 	resultlen = strlen(result);
 	if (name[4] == '.') {
 	    sprintf(result+resultlen, "%c%s", namespace->hier_sep, name+5);
@@ -599,13 +600,76 @@
 char *mboxname_isusermailbox(const char *name, int isinbox)
 {
     const char *p;
-
-    if (((!strncmp(name, "user.", 5) && (p = name+5)) ||
-	 ((p = strstr(name, "!user.")) && (p += 6))) &&
-	(!isinbox || !strchr(p, '.')))
-	return (char*) p;
+    const char *start = name;
+
+    /* step past the domain part */
+    if (config_virtdomains && (p = strchr(start, '!')))
+	start = p + 1;
+
+    /* starts with "user." AND
+     * we don't care if it's an inbox OR
+     * there's no dots after the username 
+     */
+    if (!strncmp(start, "user.", 5) && (!isinbox || !strchr(start+5, '.')))
+	return (char*) start+5;
     else
 	return NULL;
+}
+
+/*
+ * If (internal) mailbox 'name' is a DELETED mailbox
+ * returns boolean
+ */
+int mboxname_isdeletedmailbox(const char *name)
+{
+    static const char *deletedprefix = NULL;
+    static int deletedprefix_len = 0;
+    int domainlen = 0;
+    char *p;
+
+    if (!mboxlist_delayed_delete_isenabled()) return(0);
+
+    if (!deletedprefix) {
+	deletedprefix = config_getstring(IMAPOPT_DELETEDPREFIX);
+  deletedprefix_len = strlen(deletedprefix);
+    }
+
+    if (config_virtdomains && (p = strchr(name, '!')))
+	domainlen = p - name + 1;
+
+    return ((!strncmp(name + domainlen, deletedprefix, deletedprefix_len) &&
+	     name[domainlen + deletedprefix_len] == '.') ? 1 : 0);
+}
+
+/*
+ * Translate (internal) inboxname into corresponding userid.
+ */
+char *mboxname_inbox_touserid(const char *inboxname)
+{
+    static char userid[MAX_MAILBOX_NAME+1];
+    const char *domain = NULL, *cp;
+    int domainlen = 0;
+
+    if (config_virtdomains && (cp = strchr(inboxname, '!'))) {
+	/* locate, save, and skip domain */
+	domain = inboxname;
+	domainlen = cp++ - inboxname;
+    } else {
+	cp = inboxname;
+    }
+
+    cp += 5; /* skip "user." */
+
+    /* copy localpart of userid */
+    strcpy(userid, cp);
+
+    if (domain) {
+	/* append domain */
+	sprintf(userid+strlen(userid), "@%.*s",
+		domainlen, domain);
+    }
+
+    return(userid);
 }
 
 /*
@@ -650,7 +714,7 @@
  * Apply site policy restrictions on mailbox names.
  * Restrictions are hardwired for now.
  */
-#define GOODCHARS " +,-.0123456789:=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~"
+#define GOODCHARS " #$'+,-.0123456789:=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~"
 int mboxname_policycheck(char *name)
 {
     unsigned i;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxname.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxname.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxname.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mboxname.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mboxname.h -- Mailbox list manipulation routines
- * $Id: mboxname.h,v 1.14 2006/11/30 17:11:19 murch Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: mboxname.h,v 1.17 2008/03/24 17:09:18 murch Exp $
  */
 
 #ifndef INCLUDED_MBOXNAME_H
@@ -109,6 +110,17 @@
 char *mboxname_isusermailbox(const char *name, int isinbox);
 
 /*
+ * If (internal) mailbox 'name' is in the DELETED namespace
+ * returns boolean
+ */
+int mboxname_isdeletedmailbox(const char *name);
+
+/*
+ * Translate (internal) inboxname into corresponding userid.
+ */
+char *mboxname_inbox_touserid(const char *inboxname);
+
+/*
  * Return nonzero if (internal) mailbox 'name' consists of legal characters.
  * If using the unixhierarchysep '/', DOTCHAR ('.' placeholder) is allowed.
  */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbpath.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbpath.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbpath.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mbpath.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* mbpath.c -- help the sysadmin to find the path matching the mailbox
  *
- * $Id: mbpath.c,v 1.20 2006/11/30 17:11:19 murch Exp $
- * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,9 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: mbpath.c,v 1.22 2008/03/24 17:09:18 murch Exp $
  */
-
-/* static char _rcsid[] = "$Id: mbpath.c,v 1.20 2006/11/30 17:11:19 murch Exp $"; */
 
 #include <config.h>
 
@@ -98,7 +96,9 @@
   char *alt_config = NULL;
   char buf[MAX_MAILBOX_PATH+1];
 
-  if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+  if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+      fatal("must run as the Cyrus user", EC_USAGE);
+  }
 
   while ((opt = getopt(argc, argv, "C:qsm")) != EOF) {
     switch(opt) {
@@ -161,5 +161,5 @@
   return 0;
 }
 
-/* $Header: /cvs/src/cyrus/imap/mbpath.c,v 1.20 2006/11/30 17:11:19 murch Exp $ */
+/* $Header: /cvs/src/cyrus/imap/mbpath.c,v 1.22 2008/03/24 17:09:18 murch Exp $ */
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* message.c -- Message manipulation/parsing
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-
-/*
- * $Id: message.c,v 1.102 2007/02/05 18:41:47 jeaton Exp $
+ * $Id: message.c,v 1.112 2008/10/08 15:47:08 murch Exp $
  */
 
 #include <config.h>
@@ -65,6 +63,7 @@
 #include "map.h"
 #include "mailbox.h"
 #include "message.h"
+#include "message_guid.h"
 #include "parseaddr.h"
 #include "charset.h"
 #include "stristr.h"
@@ -103,6 +102,7 @@
     char *disposition;
     struct param *disposition_params;
     struct param *language;
+    char *location;
 
     /* Location/size information */
     long header_offset;
@@ -137,6 +137,9 @@
      * Cached headers.  Only filled in at top-level
      */
     struct ibuf cacheheaders;
+
+    /* Message GUID. Only filled in at top level */
+    struct message_guid guid;
 };
 
 /* List of Content-type parameters */
@@ -201,6 +204,7 @@
 				     struct address *addrlist));
 static void message_write_nstring P((struct ibuf *ibuf, char *s));
 static void message_write_text P((struct ibuf *ibuf, char *s));
+static void message_write_text_lcase P((struct ibuf *ibuf, char *s));
 static void message_write_number P((struct ibuf *ibuf, unsigned n));
 static void message_write_section P((struct ibuf *ibuf, struct body *body));
 static void message_write_charset P((struct ibuf *ibuf, struct body *body));
@@ -230,7 +234,7 @@
     char buf[4096+1];
     unsigned char *p, *endp;
     int r = 0;
-    int n;
+    size_t n;
     int sawcr = 0, sawnl;
     int reject8bit = config_getswitch(IMAPOPT_REJECT8BIT);
     int munge8bit = config_getswitch(IMAPOPT_MUNGE8BIT);
@@ -326,12 +330,10 @@
 }
 
 /*
- * Parse the message 'infile' in 'mailbox'.  Appends the message's
- * cache information to the mailbox's cache file and fills in
- * appropriate information in the index record pointed to by
- * 'message_index'.
+ * Parse the message 'infile'.
  *
  * The caller MUST free the allocated body struct.
+ *
  * If msg_base/msg_len are non-NULL, the file will remain memory-mapped
  * and returned to the caller.  The caller MUST unmap the file.
  */
@@ -370,10 +372,7 @@
 
 
 /*
- * Parse the message 'infile' in 'mailbox'.  Appends the message's
- * cache information to the mailbox's cache file and fills in
- * appropriate information in the index record pointed to by
- * 'message_index'.
+ * Parse the message 'infile'.
  *
  * The caller MUST free the allocated body struct.
  *
@@ -389,7 +388,7 @@
     int fd = fileno(infile);
     struct stat sbuf;
     struct msg msg;
-    int n;
+    size_t n;
 
     if (fstat(fd, &sbuf) == -1) {
 	syslog(LOG_ERR, "IOERROR: fstat on new message in spool: %m");
@@ -427,10 +426,7 @@
 
 
 /*
- * Parse the message at 'msg_base' of length 'msg_len' in 'mailbox'.
- * Appends the message's cache information to the mailbox's cache file
- * and fills in appropriate information in the index record pointed to
- * by 'message_index'.
+ * Parse the message at 'msg_base' of length 'msg_len'.
  */
 int message_parse_mapped(const char *msg_base, unsigned long msg_len,
 			 struct body *body)
@@ -445,6 +441,8 @@
     message_parse_body(&msg, MAILBOX_FORMAT_NORMAL, body,
 		       DEFAULT_CONTENT_TYPE, (struct boundary *)0);
 
+    message_guid_generate(&body->guid, msg_base, msg_len);
+
     return 0;
 }
 
@@ -459,7 +457,7 @@
 
     for (match = 0, type = content_types; !match && *type; type++) {
 	const char *subtype = strchr(*type, '/');
-	size_t tlen = subtype ? (subtype++ - *type) : strlen(*type);
+	size_t tlen = subtype ? (size_t) (subtype++ - *type) : strlen(*type);
 
 	if ((!(*type)[0] || (tlen == strlen(body->type) &&
 			     !strncasecmp(body->type, *type, tlen))) &&
@@ -470,7 +468,7 @@
 
     if (match) {
 	/* matching part, sanity check the size against the mmap'd file */
-	if (body->content_offset + body->content_size > msg_len) {
+	if ((unsigned long) body->content_offset + body->content_size > msg_len) {
 	    syslog(LOG_ERR, "IOERROR: body part exceeds size of message file");
 	    fatal("body part exceeds size of message file", EC_OSFILE);
 	}
@@ -519,17 +517,19 @@
 }
 
 /*
- * Appends the message's cache information to the mailbox's cache file
+ * Appends the message's cache information to the cache file
  * and fills in appropriate information in the index record pointed to
  * by 'message_index'.
  */
 int
-message_create_record(mailbox, message_index, body)
-struct mailbox *mailbox;
+message_create_record(cache_name, cache_fd, message_index, body)
+const char *cache_name;
+int cache_fd;
 struct index_record *message_index;
 struct body *body;
 {
     int n;
+    enum enum_value config_guidmode = config_getenum(IMAPOPT_GUID_MODE);
 
     message_index->sentdate = message_parse_date(body->date, 0);
     message_index->size = body->header_size + body->content_size;
@@ -537,60 +537,22 @@
     message_index->content_offset = body->content_offset;
     message_index->content_lines = body->content_lines;
 
-    message_index->cache_offset = lseek(mailbox->cache_fd, 0, SEEK_CUR);
+    message_index->cache_offset = lseek(cache_fd, 0, SEEK_CUR);
 
     message_index->cache_version = MAILBOX_CACHE_MINOR_VERSION;
 
-    n = message_write_cache(mailbox->cache_fd, body);
+    n = message_write_cache(cache_fd, body);
 
     if (n == -1) {
-	syslog(LOG_ERR, "IOERROR: appending cache for %s: %m", mailbox->name);
+	syslog(LOG_ERR, "IOERROR: appending cache for %s: %m", cache_name);
 	return IMAP_IOERROR;
     }
 
-    return 0;
-}
-
-/* YYY Following used by sync_support.c. Should use message_create_record()
- *     instead now that is available?
- *
- * Parse the message at 'msg_base' of length 'msg_len' in 'mailbox'.
- * Appends the message's cache information to the mailbox's cache file
- * and fills in appropriate information in the index record pointed to
- * by 'message_index'.
- */
-int
-message_parse_mapped_async(msg_base, msg_len, format, cache_fd, message_index)
-const char *msg_base;
-unsigned long msg_len;
-int format;
-int cache_fd;
-struct index_record *message_index;
-{
-    struct body body;
-    struct msg msg;
-    int n;
-
-    msg.base = msg_base;
-    msg.len = msg_len;
-    msg.offset = 0;
-    msg.encode = 0;
-
-    message_parse_body(&msg, format, &body,
-		       DEFAULT_CONTENT_TYPE, (struct boundary *)0);
-    
-    message_index->sentdate = message_parse_date(body.date, 0);
-    message_index->size = body.header_size + body.content_size;
-    message_index->header_size = body.header_size;
-    message_index->content_offset = body.content_offset;
-
-    message_index->cache_offset = lseek(cache_fd, 0, SEEK_CUR);
-    n = message_write_cache(cache_fd, &body);
-    message_free_body(&body);
-
-    if (n == -1) {
-	syslog(LOG_ERR, "IOERROR: appending cache for sync_server: %m");
-	return IMAP_IOERROR;
+    /* Copy in GUID unless GUID already assigned to the message
+     * (allows parent to decide which source of GUIDs to use)
+ */
+    if (config_guidmode && message_guid_isnull(&message_index->guid)) {
+	message_guid_copy(&message_index->guid, &body->guid);
     }
 
     return 0;
@@ -782,6 +744,9 @@
 		    case 'L':
 			if (!strncasecmp(next+10, "anguage:", 8)) {
 			    message_parse_language(next+18, &body->language);
+			}
+			else if (!strncasecmp(next+10, "ocation:", 8)) {
+			    message_parse_string(next+18, &body->location);
 			}
 			break;
 
@@ -2166,6 +2131,8 @@
 		PUTIBUF(ibuf, ')');
 	    }
 	    else message_write_nstring(ibuf, (char *)0);
+	    PUTIBUF(ibuf, ' ');
+	    message_write_nstring(ibuf, body->location);
 	}
 
 	PUTIBUF(ibuf, ')');
@@ -2256,6 +2223,8 @@
 	    PUTIBUF(ibuf, ')');
 	}
 	else message_write_nstring(ibuf, (char *)0);
+	PUTIBUF(ibuf, ' ');
+	message_write_nstring(ibuf, body->location);
     }
 
     PUTIBUF(ibuf, ')');
@@ -2323,7 +2292,7 @@
     if (*p || len >= 1024) {
 	/* Write out as literal */
 	char buf[100];
-	snprintf(buf, sizeof(buf), "{%u}\r\n", strlen(s));
+	snprintf(buf, sizeof(buf), "{" SIZE_T_FMT "}\r\n", strlen(s));
 	message_ibuf_ensure(ibuf, strlen(s)+strlen(buf));
 	for (p = buf; *p; p++) *(ibuf->end)++ = *p;
 	for (p = s; *p; p++) *(ibuf->end)++ = *p;
@@ -2349,6 +2318,20 @@
 
     message_ibuf_ensure(ibuf, strlen(s));
     for (p = s; *p; p++) *(ibuf->end)++ = *p;
+}
+
+/*
+ * Write the text 's' to 'ibuf', converting to lower case as we go.
+ */
+static void
+message_write_text_lcase(ibuf, s)
+struct ibuf *ibuf;
+char *s;
+{
+    char *p;
+
+    message_ibuf_ensure(ibuf, strlen(s));
+    for (p = s; *p; p++) *(ibuf->end)++ = TOLOWER(*p);
 }
 
 /*
@@ -2544,7 +2527,7 @@
 bit32 val;
 {
     bit32 buf;
-    int i;
+    unsigned i;
     char *p = (char *)&buf;
     
     message_ibuf_ensure(ibuf, sizeof(bit32));
@@ -2599,17 +2582,14 @@
 
 	    PUTIBUF(ibuf, '<');
 	    if (addrlist->route) {
-		lcase(addrlist->route);
-		message_write_text(ibuf, addrlist->route);
+		message_write_text_lcase(ibuf, addrlist->route);
 		PUTIBUF(ibuf, ':');
 	    }
 
-	    lcase(addrlist->mailbox);
-	    message_write_text(ibuf, addrlist->mailbox);
+	    message_write_text_lcase(ibuf, addrlist->mailbox);
 	    PUTIBUF(ibuf, '@');
 
-	    lcase(addrlist->domain);
-	    message_write_text(ibuf, addrlist->domain);
+	    message_write_text_lcase(ibuf, addrlist->domain);
 	    PUTIBUF(ibuf, '>');
 	    prevaddr = 1;
 	}
@@ -2642,7 +2622,7 @@
     char *s;
     int size;
 
-    if (ibuf->last - ibuf->end >= len) return 0;
+    if ((unsigned) (ibuf->last - ibuf->end) >= len) return 0;
     if (len < IBUFGROWSIZE) len = IBUFGROWSIZE;
 
     s = ibuf->start - sizeof(bit32);
@@ -2729,6 +2709,7 @@
 	free(param->value);
 	free(param);
     }
+    if (body->location) free(body->location);
     if (body->date) free(body->date);
     if (body->subject) free(body->subject);
     if (body->from) parseaddr_free(body->from);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* message.h -- Message parsing
- $Id: message.h,v 1.8 2006/12/19 18:56:27 murch Exp $
-
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: message.h,v 1.10 2008/03/24 17:09:18 murch Exp $
+ */
 
- */
 #ifndef INCLUDED_MESSAGE_H
 #define INCLUDED_MESSAGE_H
 
@@ -92,14 +93,10 @@
 extern void message_fetch_part P((struct message_content *msg,
 				  const char **content_types,
 				  struct bodypart ***parts));
-extern int message_create_record P((struct mailbox *mailbox,
+extern int message_create_record P((const char *cache_name,
+				    int cache_fd,
 				    struct index_record *message_index,
 				    struct body *body));
 extern void message_free_body P((struct body *body));
 
-extern int
-message_parse_mapped_async P((const char *msg_base, unsigned long msg_len,
-                              int format, int cache_fd,
-                              struct index_record *message_index));
-
 #endif /* INCLUDED_MESSAGE_H */

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message_guid.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message_guid.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message_guid.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message_guid.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,310 @@
+/* message_guid.c -- GUID manipulation
+ *
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: message_guid.c,v 1.7 2008/03/24 17:09:18 murch Exp $
+ */
+
+#include <config.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "assert.h"
+#include "global.h"
+#include "message_guid.h"
+
+#ifdef HAVE_SSL
+#include <openssl/sha.h>
+#endif
+
+/* Four possible forms of Message GUID:
+ *
+ * Private:
+ *   Used for internal manipulation.  Not visible to clients.
+ *
+ * Public:
+ *   Opaque handle to GUID that Cyrus can pass around.
+ *
+ *   OR
+ *
+ *   Byte sequence of known length (MESSAGE_GUID_SIZE) which can
+ *   be stored on disk.
+ *
+ * Textual:
+ *   Textual represenatation for Message GUID for passing over the wire
+ *   Currently BASE64 string + '\0'.
+ *
+ */
+
+/* ====================================================================== */
+
+
+/* Public interface */
+
+/* message_guid_generate() ***********************************************
+ *
+ * Generate GUID from message
+ *
+ ************************************************************************/
+
+void message_guid_generate(struct message_guid *guid,
+			   const char *msg_base, unsigned long msg_len)
+{
+    enum enum_value config_guidmode = config_getenum(IMAPOPT_GUID_MODE);
+
+    guid->status = GUID_NULL;
+    memset(guid->value, 0, MESSAGE_GUID_SIZE);
+
+    switch (config_guidmode) {
+    case IMAP_ENUM_GUID_MODE_SHA1:
+#ifdef HAVE_SSL
+	guid->status = GUID_NONNULL;
+	SHA1((const unsigned char *) msg_base, msg_len, guid->value);
+#endif /* HAVE_SSL */
+	break;
+    default:
+	break;
+    }
+}
+
+/* message_guid_copy() ***************************************************
+ *
+ * Copy GUID
+ *
+ ************************************************************************/
+
+void message_guid_copy(struct message_guid *dst, struct message_guid *src)
+{
+    memcpy(dst, src, sizeof(struct message_guid));
+}
+
+/* _message_guid_compare() ***********************************************
+ *
+ * Compare a pair of GUIDs: Returns 1 => match.
+ *
+ * If allownull is 1, match if either GUID is NULL (trust caller knows
+ * what they are doing).
+ * Otherwise, refuse to match NULL GUIDs (message could be anything).
+ *
+ ************************************************************************/
+
+static int _message_guid_compare(struct message_guid *g1,
+				 struct message_guid *g2,
+				 int allownull)
+{
+    if (message_guid_isnull(g1) || message_guid_isnull(g2)) return(allownull);
+
+    return (memcmp(g1->value, g2->value, MESSAGE_GUID_SIZE) == 0);
+}
+
+/* message_guid_compare() ************************************************
+ *
+ * Compare a pair of GUIDs: Returns 1 => match.  NULL GUIDs do not match.
+ *
+ ************************************************************************/
+
+int message_guid_compare(struct message_guid *guid1,
+			 struct message_guid *guid2)
+{
+    return _message_guid_compare(guid1, guid2, 0);
+}
+
+/* message_guid_compare_allow_null() *************************************
+ *
+ * Compare a pair of GUIDs: Returns 1 => match.  NULL GUIDs match anything.
+ *
+ ************************************************************************/
+
+int message_guid_compare_allow_null(struct message_guid *guid1,
+				    struct message_guid *guid2)
+{
+    return _message_guid_compare(guid1, guid2, 1);
+}
+
+/* message_guid_hash() ***************************************************
+ *
+ * Convert GUID into hash value for hash table lookup
+ * Returns: positive int in range [0, hash_size-1]
+ *
+ ************************************************************************/
+
+unsigned long message_guid_hash(struct message_guid *guid, int hash_size)
+{
+    int i;
+    unsigned long result = 0;
+    unsigned char *s = &guid->value[0];
+
+    assert(hash_size > 1);
+
+    if (hash_size > 1024) {
+        /* Pair up chars to get 16 bit values */
+        for (i = 0; i < MESSAGE_GUID_SIZE; i+=2) {
+            if ((i+1) < MESSAGE_GUID_SIZE)
+                result += (s[i] << 8) + s[i+1];
+            else
+                result += s[i] << 8;   /* Should never happen */  
+        }
+    } else for (i = 0; i < MESSAGE_GUID_SIZE; i++)
+        result += s[i];
+
+    return(result % hash_size);
+}
+
+/* message_guid_set_null() ***********************************************
+ *
+ * Create NULL GUID
+ *
+ ************************************************************************/
+
+void message_guid_set_null(struct message_guid *guid)
+{
+    guid->status = GUID_NULL;
+    memset(guid->value, 0, MESSAGE_GUID_SIZE);
+}
+
+/* message_guid_isnull() ************************************************
+ *
+ * Returns: 1 if GUID is NULL value
+ *
+ ************************************************************************/
+
+int message_guid_isnull(struct message_guid *guid)
+{
+    if (guid->status == GUID_UNKNOWN) {
+	unsigned char *p = guid->value;
+	int i;
+
+	for (i = 0; (i < MESSAGE_GUID_SIZE) && !*p++; i++);
+	guid->status = (i == MESSAGE_GUID_SIZE) ? GUID_NULL : GUID_NONNULL;
+    }
+
+    return(guid->status == GUID_NULL);
+}
+
+/* message_guid_export() *************************************************
+ *
+ * Export Message GUID as byte sequence (MESSAGE_GUID_SIZE)
+ * (Wrapper for memcpy() with current implementation)
+ *
+ ************************************************************************/
+
+void message_guid_export(struct message_guid *guid, unsigned char *buf)
+{
+    memcpy(buf, guid->value, MESSAGE_GUID_SIZE);
+}
+
+/* message_guid_import() *************************************************
+ *
+ * Import Message GUID from byte sequence (MESSAGE_GUID_SIZE)
+ * (Wrapper for memcpy() with current implementation)
+ *
+ ************************************************************************/
+
+struct message_guid *message_guid_import(struct message_guid *guid,
+					 const unsigned char *buf)
+{
+    static struct message_guid tmp;
+
+    if (!guid) guid = &tmp;
+
+    guid->status = GUID_UNKNOWN;
+    memcpy(guid->value, buf, MESSAGE_GUID_SIZE);
+
+    return(guid);
+}
+
+
+/* Routines for manipulating text value (ASCII hex encoding) */
+
+/* message_guid_encode() *************************************************
+ *
+ * Returns ptr to '\0' terminated static char * which can be strdup()ed
+ * NULL => error. Should be impossible as entire range covered
+ *
+ ************************************************************************/
+
+static char XDIGIT[] = "0123456789abcdef";
+
+char *message_guid_encode(struct message_guid *guid)
+{
+    static char text[2*MESSAGE_GUID_SIZE+1];
+    unsigned char *v = guid->value;
+    char *p = text;
+    int i;
+
+    for (i = 0; i < MESSAGE_GUID_SIZE; i++, v++) {
+        *p++ = XDIGIT[(*v >> 4) & 0xf];
+        *p++ = XDIGIT[*v & 0xf];
+    }
+    *p = '\0';
+
+    return(text);
+}
+
+/* message_guid_decode() *************************************************
+ *
+ * Sets Message GUID from text form. Returns 1 if valid
+ * Returns: boolean success
+ * 
+ ************************************************************************/
+
+int message_guid_decode(struct message_guid *guid, const char *text)
+{
+    unsigned char *v = guid->value, msn, lsn;
+    const char *p = text;
+    int i;
+
+    guid->status = GUID_NULL;
+
+    for (i = 0; i < MESSAGE_GUID_SIZE; i++, v++) {
+	if (!isxdigit((int) *p)) return(0);
+	msn = (*p > '9') ? tolower((int) *p) - 'a' + 10 : *p - '0';
+	p++;
+
+	if (!isxdigit((int) *p)) return(0);
+	lsn = (*p > '9') ? tolower((int) *p) - 'a' + 10 : *p - '0';
+	p++;
+	
+	*v = (unsigned char) (msn << 4) | lsn;
+	if (*v) guid->status = GUID_NONNULL;
+    }
+
+    return(*p == '\0');
+}

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message_guid.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message_guid.h?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message_guid.h (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/message_guid.h Mon Feb  9 12:49:22 2009
@@ -1,0 +1,113 @@
+/* message_guid.h -- GUID manipulation
+ *
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: message_guid.h,v 1.6 2008/03/24 17:09:18 murch Exp $
+ */
+
+#ifndef MESSAGE_GUID_H
+#define MESSAGE_GUID_H
+
+/* Public interface */
+
+#define MESSAGE_GUID_SIZE         (20)    /* Size of GUID byte sequence */
+
+enum guid_status {
+    GUID_UNKNOWN = -1, /* Unknown if GUID is [non-]NULL (not yet tested) */
+    GUID_NULL =	    0, /* GUID is NULL */
+    GUID_NONNULL =  1, /* GUID is non-NULL */
+};
+
+struct message_guid {
+    enum guid_status status;
+    unsigned char value[MESSAGE_GUID_SIZE];
+};
+
+/* Generate GUID from message */
+void message_guid_generate(struct message_guid *guid,
+			   const char *msg_base, unsigned long msg_len);
+
+/* Copy a GUID */
+void message_guid_copy(struct message_guid *dst, struct message_guid *src);
+
+/* Compare a pair of GUIDs: Returns 1 => match.  NULL GUIDs do not match. */
+int message_guid_compare(struct message_guid *guid1,
+			 struct message_guid *guid2);
+
+/* Compare a pair of GUIDs: Returns 1 => match.  NULL GUIDs match anything. */
+int message_guid_compare_allow_null(struct message_guid *guid1,
+				    struct message_guid *guid2);
+
+/* Convert GUID into hash value for hash table lookup
+ * Returns: positive int in range [0, hash_size-1]
+ */
+unsigned long message_guid_hash(struct message_guid *guid, int hash_size);
+
+  /* Create a NULL GUID */
+void message_guid_set_null(struct message_guid *guid);
+
+/* Returns 1 if GUID is NULL value */
+int message_guid_isnull(struct message_guid *guid);
+
+/* Export Message GUID as byte sequence (MESSAGE_GUID_SIZE)
+ * (Wrapper for memcpy() with current implementation)
+ */
+void message_guid_export(struct message_guid *guid, unsigned char *buf);
+
+/* Import Message GUID from packed sequence (MESSAGE_GUID_SIZE)
+ * (Wrapper for memcpy() with current implementation)
+ */
+struct message_guid *message_guid_import(struct message_guid *guid,
+					 const unsigned char *buf);
+
+
+/* Routines for manipulating text value */
+
+/* Returns ptr to '\0' terminated static char * which can be strdup()ed
+ * NULL => error. Should be impossible as entire range covered
+ */
+char *message_guid_encode(struct message_guid *guid);
+
+/* Sets Message GUID from text form. Returns 1 if valid
+ * Returns: Cyrus error code, 0 on sucess
+ */
+int message_guid_decode(struct message_guid *guid, const char *text);
+
+#endif /* MESSAGE_GUID_H */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-client.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-client.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-client.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-client.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mupdate-client.c -- cyrus murder database clients
  *
- * $Id: mupdate-client.c,v 1.49 2007/02/05 18:41:47 jeaton Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: mupdate-client.c,v 1.59 2008/10/08 15:47:08 murch Exp $
  */
 
 #include <config.h>
@@ -81,24 +83,27 @@
 
 const char service_name[] = "mupdate";
 
-static sasl_security_properties_t *make_secprops(void)
-{
-  sasl_security_properties_t *ret =
-      (sasl_security_properties_t *) xzmalloc(sizeof(sasl_security_properties_t));
-
-  ret->maxbufsize = PROT_BUFSIZE;
-  ret->min_ssf = config_getint(IMAPOPT_SASL_MINIMUM_LAYER);	
-  ret->max_ssf = config_getint(IMAPOPT_SASL_MAXIMUM_LAYER);
-
-  return ret;
-}
-
-int mupdate_connect(const char *server, const char *port,
+static struct protocol_t mupdate_protocol =
+{ "mupdate", "mupdate",
+  { 1, "* OK" },
+  { NULL, NULL, "* OK", NULL,
+    { { "* AUTH ", CAPA_AUTH },
+      { "* STARTTLS", CAPA_STARTTLS },
+      { NULL, 0 } } },
+  { "S01 STARTTLS", "S01 OK", "S01 NO", 0 },
+  { "A01 AUTHENTICATE", INT_MAX, 1, "A01 OK", "A01 NO", "", "*", NULL, 0 },
+  { "N01 NOOP", NULL, "N01 OK" },
+  { "Q01 LOGOUT", NULL, "Q01 " }
+};
+
+int mupdate_connect(const char *server,
+		    const char *port __attribute__((unused)),
 		    mupdate_handle **handle,
 		    sasl_callback_t *cbs)
 {
     mupdate_handle *h = NULL;
     int local_cbs = 0;
+    const char *status = NULL;
     
     if(!handle)
 	return MUPDATE_BADPARAM;
@@ -122,13 +127,14 @@
 			       config_getstring(IMAPOPT_MUPDATE_PASSWORD));
     }
 
-    h->conn = backend_connect(NULL, server, &protocol[PROTOCOL_MUPDATE],
-			      "", cbs, NULL);
+    h->conn = backend_connect(NULL, server, &mupdate_protocol,
+			      "", cbs, &status);
 
     /* xxx unclear that this is correct, but it prevents a memory leak */
     if (local_cbs) free_callbacks(cbs);
 
     if (!h->conn) {
+        syslog(LOG_ERR, "mupdate_connect failed: %s", status ? status : "unknown error");
 	return MUPDATE_NOCONN;
     }
     
@@ -177,20 +183,23 @@
 {
     int ret;
     enum mupdate_cmd_response response;
+    const char *p;
     
     if (!handle) return MUPDATE_BADPARAM;
     if (!mailbox || !server || !acl) return MUPDATE_BADPARAM;
     if (!handle->saslcompleted) return MUPDATE_NOAUTH;
 
+    /* make sure we don't have a double server!partition */
+    if ((p = strchr(server, '!')) && strchr(p+1, '!')) return MUPDATE_BADPARAM;
+
     if (config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_REPLICATED) {
 	/* we don't care about the server part, everything is local */
-	const char *part = strchr(server, '!');
-
-	if (part) server = part + 1;
+	if (p) server = p + 1;
     }
 
     prot_printf(handle->conn->out,
-		"X%u ACTIVATE {%d+}\r\n%s {%d+}\r\n%s {%d+}\r\n%s\r\n", 
+		"X%u ACTIVATE {" SIZE_T_FMT "+}\r\n%s"
+		" {" SIZE_T_FMT "+}\r\n%s {" SIZE_T_FMT "+}\r\n%s\r\n", 
 		handle->tagn++, strlen(mailbox), mailbox, 
 		strlen(server), server, strlen(acl), acl);
 
@@ -209,20 +218,22 @@
 {
     int ret;
     enum mupdate_cmd_response response;
+    const char *p;
     
     if (!handle) return MUPDATE_BADPARAM;
     if (!mailbox || !server) return MUPDATE_BADPARAM;
     if (!handle->saslcompleted) return MUPDATE_NOAUTH;
 
+    /* make sure we don't have a double server!partition */
+    if ((p = strchr(server, '!')) && strchr(p+1, '!')) return MUPDATE_BADPARAM;
+
     if (config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_REPLICATED) {
 	/* we don't care about the server part, everything is local */
-	const char *part = strchr(server, '!');
-
-	if (part) server = part + 1;
+	if (p) server = p + 1;
     }
 
     prot_printf(handle->conn->out,
-		"X%u RESERVE {%d+}\r\n%s {%d+}\r\n%s\r\n",
+		"X%u RESERVE {" SIZE_T_FMT "+}\r\n%s {" SIZE_T_FMT "+}\r\n%s\r\n",
 		handle->tagn++, strlen(mailbox), mailbox, 
 		strlen(server), server);
 
@@ -241,20 +252,22 @@
 {
     int ret;
     enum mupdate_cmd_response response;
+    const char *p;
     
     if (!handle) return MUPDATE_BADPARAM;
     if (!mailbox || !server) return MUPDATE_BADPARAM;
     if (!handle->saslcompleted) return MUPDATE_NOAUTH;
 
+    /* make sure we don't have a double server!partition */
+    if ((p = strchr(server, '!')) && strchr(p+1, '!')) return MUPDATE_BADPARAM;
+
     if (config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_REPLICATED) {
 	/* we don't care about the server part, everything is local */
-	const char *part = strchr(server, '!');
-
-	if (part) server = part + 1;
+	if (p) server = p + 1;
     }
 
     prot_printf(handle->conn->out,
-		"X%u DEACTIVATE {%d+}\r\n%s {%d+}\r\n%s\r\n",
+		"X%u DEACTIVATE {" SIZE_T_FMT "+}\r\n%s {" SIZE_T_FMT "+}\r\n%s\r\n",
 		handle->tagn++, strlen(mailbox), mailbox, 
 		strlen(server), server);
 
@@ -279,7 +292,7 @@
     if (!handle->saslcompleted) return MUPDATE_NOAUTH;
 
     prot_printf(handle->conn->out,
-		"X%u DELETE {%d+}\r\n%s\r\n", handle->tagn++, 
+		"X%u DELETE {" SIZE_T_FMT "+}\r\n%s\r\n", handle->tagn++, 
 		strlen(mailbox), mailbox);
 
     ret = mupdate_scarf(handle, mupdate_scarf_one, NULL, 1, &response);
@@ -306,7 +319,7 @@
     strlcpy(h->server_buf, mdata->server, sizeof(h->server_buf));
 
     if(!strncmp(cmd, "MAILBOX", 7)) {
-	int len = strlen(mdata->acl) + 1;
+	size_t len = strlen(mdata->acl) + 1;
 	
 	h->mailboxdata_buf.t = ACTIVE;
 	
@@ -348,7 +361,7 @@
     if(!handle || !mailbox || !target) return MUPDATE_BADPARAM;
 
     prot_printf(handle->conn->out,
-		"X%u FIND {%d+}\r\n%s\r\n", handle->tagn++, 
+		"X%u FIND {" SIZE_T_FMT "+}\r\n%s\r\n", handle->tagn++, 
 		strlen(mailbox), mailbox);
 
     memset(&(handle->mailboxdata_buf), 0, sizeof(handle->mailboxdata_buf));
@@ -381,7 +394,7 @@
 
     if(prefix) {
 	prot_printf(handle->conn->out,
-		    "X%u LIST {%d+}\r\n%s\r\n", handle->tagn++,
+		    "X%u LIST {" SIZE_T_FMT "+}\r\n%s\r\n", handle->tagn++,
 		    strlen(prefix), prefix);
     } else {
 	prot_printf(handle->conn->out,

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-client.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-client.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-client.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-client.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mupdate-client.h -- cyrus murder database clients
  *
- * $Id: mupdate-client.h,v 1.16 2006/11/30 17:11:19 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: mupdate-client.h,v 1.17 2008/03/24 17:09:18 murch Exp $
  */
 
 #ifndef INCLUDED_MUPDATE_CLIENT_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-slave.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-slave.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-slave.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate-slave.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mupdate-slave.c -- cyrus murder database clients
  *
- * $Id: mupdate-slave.c,v 1.29 2007/02/05 18:41:47 jeaton Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: mupdate-slave.c,v 1.30 2008/03/24 17:09:18 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mupdate.c -- cyrus murder database master 
  *
- * $Id: mupdate.c,v 1.94 2007/01/31 14:10:05 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: mupdate.c,v 1.106 2008/10/08 15:47:08 murch Exp $
  */
 
 #include <config.h>
@@ -51,7 +53,6 @@
 #include <ctype.h>
 #include <signal.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <syslog.h>
 #include <errno.h>
 
@@ -74,6 +75,7 @@
 #include "mupdate-client.h"
 #include "telemetry.h"
 
+#include "assert.h"
 #include "exitcodes.h"
 #include "global.h"
 #include "imap_err.h"
@@ -87,6 +89,8 @@
 #include "util.h"
 #include "version.h"
 #include "xmalloc.h"
+#include "xstrlcat.h"
+#include "xstrlcpy.h"
 
 /* Sent to clients that we can't accept a connection for. */
 static const char SERVER_UNABLE_STRING[] = "* BYE \"Server Unable\"\r\n";
@@ -152,8 +156,8 @@
 
     /* pending changes to send, in reverse order */
     pthread_mutex_t m;
-    pthread_cond_t cond;
     struct pending *plist;
+    struct pending *ptail;
     struct conn *updatelist_next;
     struct prot_waitevent *ev; /* invoked every 'update_wait' seconds
 				  to send out updates */
@@ -251,8 +255,7 @@
     struct sockaddr_storage localaddr, remoteaddr;
     int r;    
     int haveaddr = 0;
-    int salen;
-    int secflags;
+    socklen_t salen;
     char hbuf[NI_MAXHOST];
     int niflags;
 
@@ -337,11 +340,7 @@
     }
 
     /* set my allowable security properties */
-    secflags = SASL_SEC_NOANONYMOUS;
-    if (!config_getswitch(IMAPOPT_ALLOWPLAINTEXT)) {
-	secflags |= SASL_SEC_NOPLAINTEXT;
-    }
-    sasl_setprop(C->saslconn, SASL_SEC_PROPS, mysasl_secprops(secflags));
+    sasl_setprop(C->saslconn, SASL_SEC_PROPS, mysasl_secprops(SASL_SEC_NOANONYMOUS));
 
     /* Clear Buffers */
     memset(&(C->tag), 0, sizeof(struct buf));
@@ -625,7 +624,7 @@
 	 * to the slave.  We can probably fix this by prepending
 	 * config_servername onto the entries before updating the slaves.
 	 */
-	fatal("can not run mupdate master on a unified server", EC_USAGE);
+	fatal("cannot run mupdate master on a unified server", EC_USAGE);
     }
 
     if(pipe(conn_pipe) == -1) {
@@ -1079,7 +1078,7 @@
 {
     char slavebuf[4096];
     const char *mechs;
-    unsigned int mechcount;
+    int mechcount;
     int ret;
 
     /* send initial the banner + flush pout */
@@ -1477,6 +1476,7 @@
 		      const char *clientstart)
 {
     int r, sasl_result;
+    const void *val;
 
     r = saslserver(C->saslconn, mech, clientstart, "", "", "",
 		   C->pin, C->pout, &sasl_result, NULL);
@@ -1513,13 +1513,14 @@
     }
 
     /* Successful Authentication */
-    r = sasl_getprop(C->saslconn, SASL_USERNAME, (const void **)&C->userid);
+    r = sasl_getprop(C->saslconn, SASL_USERNAME, &val);
     if(r != SASL_OK) {
 	prot_printf(C->pout, "%s NO \"SASL Error\"\r\n", tag);
 	reset_saslconn(C);
 	return;
     }
 
+    C->userid = (char *) val;
     syslog(LOG_NOTICE, "login: %s %s %s%s %s", C->clienthost, C->userid,
 	   mech, C->tlsconn ? "+TLS" : "", "User logged in");
 
@@ -1546,6 +1547,7 @@
     for (upc = updatelist; upc != NULL; upc = upc->updatelist_next) {
 	/* for each connection, add to pending list */
 	struct pending *p = (struct pending *) xmalloc(sizeof(struct pending));
+	p->next = NULL;
 	strlcpy(p->mailbox, mailbox, sizeof(p->mailbox));
 	
 	/* this might need to be inside the mutex, but I doubt it */
@@ -1559,10 +1561,14 @@
 	}
 	
 	pthread_mutex_lock(&upc->m);
-	p->next = upc->plist;
-	upc->plist = p;
-	
-	pthread_cond_signal(&upc->cond);
+	
+	if ( upc->plist == NULL ) {
+	    upc->plist = upc->ptail = p;
+	} else {
+	    upc->ptail->next = p;
+	    upc->ptail = p;
+	}
+
 	pthread_mutex_unlock(&upc->m);
     }
 }
@@ -1712,19 +1718,21 @@
     pthread_mutex_unlock(&mailboxes_mutex); /* UNLOCK */
 
     if (m && m->t == SET_ACTIVE) {
-	prot_printf(C->pout, "%s MAILBOX {%d+}\r\n%s {%d+}\r\n%s {%d+}\r\n%s\r\n",
+	prot_printf(C->pout, "%s MAILBOX {" SIZE_T_FMT "+}\r\n%s"
+		    " {" SIZE_T_FMT "+}\r\n%s {" SIZE_T_FMT "+}\r\n%s\r\n",
 		    tag,
 		    strlen(m->mailbox), m->mailbox,
 		    strlen(m->server), m->server,
 		    strlen(m->acl), m->acl);
     } else if (m && m->t == SET_RESERVE) {
-	prot_printf(C->pout, "%s RESERVE {%d+}\r\n%s {%d+}\r\n%s\r\n",
+	prot_printf(C->pout, "%s RESERVE {" SIZE_T_FMT "+}\r\n%s"
+		    " {" SIZE_T_FMT "+}\r\n%s\r\n",
 		    tag,
 		    strlen(m->mailbox), m->mailbox,
 		    strlen(m->server), m->server);
     } else if (send_delete) {
 	/* not found, if needed, send a delete */
-	prot_printf(C->pout, "%s DELETE {%d+}\r\n%s\r\n",
+	prot_printf(C->pout, "%s DELETE {" SIZE_T_FMT "+}\r\n%s\r\n",
 		    tag, strlen(mailbox), mailbox);
     }
     
@@ -1767,14 +1775,16 @@
 	    switch (m->t) {
 	    case SET_ACTIVE:
 		prot_printf(C->pout,
-			    "%s MAILBOX {%d+}\r\n%s {%d+}\r\n%s {%d+}\r\n%s\r\n",
+			    "%s MAILBOX {" SIZE_T_FMT "+}\r\n%s"
+			    " {" SIZE_T_FMT "+}\r\n%s {" SIZE_T_FMT "+}\r\n%s\r\n",
 			    C->streaming,
 			    strlen(m->mailbox), m->mailbox,
 			    strlen(m->server), m->server,
 			    strlen(m->acl), m->acl);
 		break;
 	    case SET_RESERVE:
-		prot_printf(C->pout, "%s RESERVE {%d+}\r\n%s {%d+}\r\n%s\r\n",
+		prot_printf(C->pout, "%s RESERVE {" SIZE_T_FMT "+}\r\n%s"
+			    " {" SIZE_T_FMT "+}\r\n%s\r\n",
 			    C->streaming,
 			    strlen(m->mailbox), m->mailbox,
 			    strlen(m->server), m->server);
@@ -1847,7 +1857,6 @@
     char pattern[2] = {'*','\0'};
 
     /* initialize my condition variable */
-    pthread_cond_init(&C->cond, NULL);
 
     /* The inital dump of the database can result in a lot of data,
      * let's do this nonblocking */
@@ -1888,6 +1897,7 @@
     /* just grab the update list and release the lock */
     p = C->plist;
     C->plist = NULL;
+    C->ptail = NULL;
     pthread_mutex_unlock(&C->m);
 
     while (p != NULL) {
@@ -1942,6 +1952,7 @@
   
     result=tls_start_servertls(C->pin->fd, /* read */
 			       C->pout->fd, /* write */
+			       180, /* 3 minutes */
 			       layerp,
 			       &auth_id,
 			       &C->tlsconn);
@@ -1999,7 +2010,7 @@
 /* Reset the given sasl_conn_t to a sane state */
 static int reset_saslconn(struct conn *c)
 {
-    int ret, secflags;
+    int ret;
     sasl_security_properties_t *secprops = NULL;
 
     sasl_dispose(&c->saslconn);
@@ -2019,11 +2030,7 @@
                           c->saslprops.iplocalport);
     if(ret != SASL_OK) return ret;
     
-    secflags = SASL_SEC_NOANONYMOUS;
-    if (!config_getswitch(IMAPOPT_ALLOWPLAINTEXT)) {
-	secflags |= SASL_SEC_NOPLAINTEXT;
-    }
-    secprops = mysasl_secprops(secflags);
+    secprops = mysasl_secprops(SASL_SEC_NOANONYMOUS);
     ret = sasl_setprop(c->saslconn, SASL_SEC_PROPS, secprops);
     if(ret != SASL_OK) return ret;
     /* end of service_main initialization excepting SSF */
@@ -2244,7 +2251,9 @@
     struct mpool *pool;
     struct sync_rock rock;
     char pattern[] = { '*', '\0' };
+    struct txn *tid = NULL;
     int ret = 0;    
+    int err = 0;
 
     if(!handle || !handle->saslcompleted) return 1;
 
@@ -2303,24 +2312,54 @@
 	       strcmp(l->server, r->server) ||
 	       strcmp(l->acl,r->acl)) {
 		/* Something didn't match, replace it */
+		/*
+		 * If this is a locally hosted mailbox, don't make a
+		 * change, just warn.
+		 */
+		if ((config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_UNIFIED) &&
+			(strchr( l->server, '!' ) == NULL )) {
+		    syslog(LOG_ERR, "local mailbox %s wrong in mailbox list",
+			    l->mailbox );
+		    err++;
+		} else {
 		mboxlist_insertremote(r->mailbox, 
 				     (r->t == SET_RESERVE ?
 				        MBTYPE_RESERVE : 0),
-				      r->server, r->acl, NULL);
+					  r->server, r->acl, &tid);
+		}
 	    }
 	    /* Okay, dump these two */
 	    local_boxes.head = l->next;
 	    remote_boxes.head = r->next;
 	} else if (ret < 0) {
 	    /* Local without corresponding remote, delete it */
-	    mboxlist_deletemailbox(l->mailbox, 1, "", NULL, 0, 0, 0);
+		/*
+		 * In a unified murder, we don't want to delete locally
+		 * hosted mailboxes during mupdate's resync process.
+		 * If that sort of operation appears necessary, it
+		 * probably requires an operator to review it --
+		 * ctl_mboxlist is the right place to fix the kind
+		 * of configuration error implied.
+		 * 
+		 * A similar problem exists when the server thinks
+		 * it is locally hosting a mailbox, but mupdate master
+		 * thinks it's somewhere else.
+		 */
+	    if ((config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_UNIFIED) &&
+		    (strchr( l->server, '!' ) == NULL )) {
+		syslog(LOG_ERR, "local mailbox %s not in mailbox list",
+			l->mailbox );
+		err++;
+	    } else {
+		mboxlist_deleteremote(l->mailbox, &tid);
+	    }
 	    local_boxes.head = l->next;
 	} else /* (ret > 0) */ {
 	    /* Remote without corresponding local, insert it */
 	    mboxlist_insertremote(r->mailbox, 
 				  (r->t == SET_RESERVE ?
 				   MBTYPE_RESERVE : 0),
-				  r->server, r->acl, NULL);
+				  r->server, r->acl, &tid);
 	    remote_boxes.head = r->next;
 	}
     }
@@ -2328,7 +2367,14 @@
     if(l && !r) {
 	/* we have more deletes to do */
 	while(l) {
-	    mboxlist_deletemailbox(l->mailbox, 1, "", NULL, 0, 0, 0);
+	    if ((config_mupdate_config == IMAP_ENUM_MUPDATE_CONFIG_UNIFIED) &&
+		    (strchr( l->server, '!' ) == NULL )) {
+		syslog(LOG_ERR, "local mailbox %s not in mailbox list",
+			l->mailbox );
+		err++;
+	    } else {
+		mboxlist_deleteremote(l->mailbox, &tid);
+	    }
 	    local_boxes.head = l->next;
 	    l = local_boxes.head;
 	}
@@ -2338,14 +2384,21 @@
 	    mboxlist_insertremote(r->mailbox, 
 				  (r->t == SET_RESERVE ?
 				   MBTYPE_RESERVE : 0),
-				  r->server, r->acl, NULL);
+				  r->server, r->acl, &tid);
 	    remote_boxes.head = r->next;
 	    r = remote_boxes.head;
 	}
     }
 
+    if (tid) mboxlist_commit(tid);
+
     /* All up to date! */
+    if ( err ) {
+	syslog(LOG_ERR, "mailbox list synchronization NOT complete (%d) errors",
+		err);
+    } else {
     syslog(LOG_NOTICE, "mailbox list synchronization complete");
+    }
 
  done:
     pthread_mutex_unlock(&mailboxes_mutex); /* UNLOCK */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mupdate.h - private mupdate header file
  *
- * $Id: mupdate.h,v 1.17 2006/11/30 17:11:19 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: mupdate.h,v 1.18 2008/03/24 17:09:18 murch Exp $
  */
 
 #ifndef INCLUDED_MUPDATE_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate_err.et
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate_err.et?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate_err.et (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mupdate_err.et Mon Feb  9 12:49:22 2009
@@ -1,30 +1,46 @@
 # mupdate_err.et -- Error codes for the mupdate API
-# $Id: mupdate_err.et,v 1.5 2002/03/20 23:03:06 rjs3 Exp $
 #
-# Copyright 2001 Carnegie Mellon University
+# Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
 # 
-# No warranties, either expressed or implied, are made regarding the
-# operation, use, or results of the software.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
 #
-# Permission to use, copy, modify and distribute this software and its
-# documentation is hereby granted for non-commercial purposes only
-# provided that this copyright notice appears in all copies and in
-# supporting documentation.
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
 #
-# Permission is also granted to Internet Service Providers and others
-# entities to use the software for internal purposes.
+# 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.
 #
-# The distribution, modification or sale of a product which uses or is
-# based on the software, in whole or in part, for commercial purposes or
-# benefits requires specific, additional permission from:
+# 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 legal
+#    details, please contact
+#  Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
-#  Office of Technology Transfer
-#  Carnegie Mellon University
-#  5000 Forbes Avenue
-#  Pittsburgh, PA  15213-3890
-#  (412) 268-4387, fax: (412) 268-7395
-#  tech-transfer at 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.
 # 
+# $Id: mupdate_err.et,v 1.6 2008/03/24 17:09:18 murch Exp $
+
 error_table mupd
 
 ec MUPDATE_FAIL,

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* mutex.h - header for mutex functions
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: mutex.h,v 1.3 2008/03/24 17:09:18 murch Exp $
  */
-
-/* $Id: mutex.h,v 1.2 2003/10/22 18:02:58 rjs3 Exp $ */
 
 #ifndef CYRUS_MUTEX_H
 #define CYRUS_MUTEX_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex_fake.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex_fake.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex_fake.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex_fake.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* mutex_fake.c - fake mutex new/lock/unlock/destroy functions (for SASL)
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: mutex_fake.c,v 1.3 2008/03/24 17:09:18 murch Exp $
  */
-
-/* $Id: mutex_fake.c,v 1.2 2003/10/22 18:02:58 rjs3 Exp $ */
 
 #include <config.h>
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex_pthread.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex_pthread.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex_pthread.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/mutex_pthread.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* mutex_fake.c - fake mutex new/lock/unlock/destroy functions (for SASL)
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: mutex_pthread.c,v 1.3 2008/03/24 17:09:18 murch Exp $
  */
-
-/* $Id: mutex_pthread.c,v 1.2 2003/10/22 18:02:58 rjs3 Exp $ */
 
 #include <config.h>
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/nntp_err.et
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/nntp_err.et?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/nntp_err.et (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/nntp_err.et Mon Feb  9 12:49:22 2009
@@ -1,30 +1,46 @@
 # nntp_err.et -- Error codes for the Cyrus NNTP server
-# $Id: nntp_err.et,v 1.2 2003/10/22 18:02:58 rjs3 Exp $
 #
-# Copyright 2002 Carnegie Mellon University
+# Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
 # 
-# No warranties, either expressed or implied, are made regarding the
-# operation, use, or results of the software.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
 #
-# Permission to use, copy, modify and distribute this software and its
-# documentation is hereby granted for non-commercial purposes only
-# provided that this copyright notice appears in all copies and in
-# supporting documentation.
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
 #
-# Permission is also granted to Internet Service Providers and others
-# entities to use the software for internal purposes.
+# 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.
 #
-# The distribution, modification or sale of a product which uses or is
-# based on the software, in whole or in part, for commercial purposes or
-# benefits requires specific, additional permission from:
+# 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 legal
+#    details, please contact
+#  Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
-#  Office of Technology Transfer
-#  Carnegie Mellon University
-#  5000 Forbes Avenue
-#  Pittsburgh, PA  15213-3890
-#  (412) 268-4387, fax: (412) 268-7395
-#  tech-transfer at 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.
 # 
+# $Id: nntp_err.et,v 1.3 2008/03/24 17:09:18 murch Exp $
+
 error_table nntp
 
 ec NNTP_NO_NEWSGROUPS,

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/nntpd.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/nntpd.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/nntpd.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/nntpd.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* nntpd.c -- NNTP server
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: nntpd.c,v 1.54 2007/02/05 18:49:56 jeaton Exp $
+ * $Id: nntpd.c,v 1.69 2008/10/08 15:47:08 murch Exp $
  */
 
 /*
@@ -59,7 +60,6 @@
 #include <string.h>
 #include <fcntl.h>
 #include <signal.h>
-#include <assert.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/param.h>
@@ -74,6 +74,7 @@
 #include <sasl/sasl.h>
 #include <sasl/saslutil.h>
 
+#include "assert.h"
 #include "acl.h"
 #include "annotate.h"
 #include "append.h"
@@ -142,6 +143,7 @@
 
 sasl_conn_t *nntp_saslconn; /* the sasl connection context */
 
+int nntp_timeout;
 char newsprefix[100] = "";
 char *nntp_userid = 0, *newsmaster;
 struct auth_state *nntp_authstate = 0, *newsmaster_authstate;
@@ -269,6 +271,31 @@
     { SASL_CB_LIST_END, NULL, NULL }
 };
 
+static char *nntp_parsesuccess(char *str, const char **status)
+{
+    char *success = NULL;
+
+    if (!strncmp(str, "283 ", 4)) {
+	success = str+4;
+    }
+
+    if (status) *status = NULL;
+    return success;
+}
+
+static struct protocol_t nntp_protocol =
+{ "nntp", "nntp",
+  { 0, "20" },
+  { "CAPABILITIES", NULL, ".", NULL,
+    { { "SASL ", CAPA_AUTH },
+      { "STARTTLS", CAPA_STARTTLS },
+      { NULL, 0 } } },
+  { "STARTTLS", "382", "580", 0 },
+  { "AUTHINFO SASL", 512, 0, "28", "48", "383 ", "*", &nntp_parsesuccess, 0 },
+  { "DATE", NULL, "111" },
+  { "QUIT", NULL, "205" }
+};
+
 /* proxy mboxlist_lookup; on misses, it asks the listener for this
    machine to make a roundtrip to the master mailbox server to make
    sure it's up to date */
@@ -523,8 +550,8 @@
     char localip[60], remoteip[60];
     char hbuf[NI_MAXHOST];
     int niflags;
-    int timeout;
     sasl_security_properties_t *secprops=NULL;
+    int shutdown;
     char unavail[1024];
 
     signals_poll();
@@ -571,7 +598,7 @@
 	fatal("SASL failed initializing: sasl_server_new()",EC_TEMPFAIL); 
 
     /* will always return something valid */
-    secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
+    secprops = mysasl_secprops(0);
     sasl_setprop(nntp_saslconn, SASL_SEC_PROPS, secprops);
     sasl_setprop(nntp_saslconn, SASL_SSF_EXTERNAL, &extprops_ssf);
     
@@ -590,30 +617,34 @@
     proc_register("nntpd", nntp_clienthost, NULL, NULL);
 
     /* Set inactivity timer */
-    timeout = config_getint(IMAPOPT_NNTPTIMEOUT);
-    if (timeout < 3) timeout = 3;
-    prot_settimeout(nntp_in, timeout*60);
+    nntp_timeout = config_getint(IMAPOPT_NNTPTIMEOUT);
+    if (nntp_timeout < 3) nntp_timeout = 3;
+    nntp_timeout *= 60;
+    prot_settimeout(nntp_in, nntp_timeout);
     prot_setflushonread(nntp_in, nntp_out);
 
     /* we were connected on nntps port so we should do 
        TLS negotiation immediatly */
     if (nntps == 1) cmd_starttls(1);
 
-    if (shutdown_file(unavail, sizeof(unavail))) {
-	prot_printf(nntp_out,
-		    "400 %s Cyrus NNTP%s %s server unavailable, %s\r\n",
-		    config_servername, config_mupdate_server ? " Murder" : "",
-		    CYRUS_VERSION, unavail);
-
+    if ((shutdown = shutdown_file(unavail, sizeof(unavail)))) {
+	prot_printf(nntp_out, "%u", 400);
+    } else {
+	prot_printf(nntp_out, "%u", (nntp_capa & MODE_READ) ? 200 : 201);
+    }
+    if (config_serverinfo) prot_printf(nntp_out, " %s", config_servername);
+    if (config_serverinfo == IMAP_ENUM_SERVERINFO_ON) {
+	prot_printf(nntp_out, " Cyrus NNTP%s %s",
+		    config_mupdate_server ? " Murder" : "", CYRUS_VERSION);
+    }
+    if (shutdown) {
+	prot_printf(nntp_out, "server unavailable, %s\r\n", unavail);
 	shut_down(0);
     }
-
-    prot_printf(nntp_out,
-		"%u %s Cyrus NNTP%s %s server ready, posting %s\r\n",
-		(nntp_capa & MODE_READ) ? 200 : 201,
-		config_servername, config_mupdate_server ? " Murder" : "",
-		CYRUS_VERSION,
+    else {
+	prot_printf(nntp_out, " server ready, posting %s\r\n",
 		(nntp_capa & MODE_READ) ? "allowed" : "prohibited");
+    }
 
     cmdloop();
 
@@ -736,7 +767,7 @@
        ret = sasl_setprop(*conn, SASL_IPLOCALPORT,
                           saslprops.iplocalport);
     if(ret != SASL_OK) return ret;
-    secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
+    secprops = mysasl_secprops(0);
     ret = sasl_setprop(*conn, SASL_SEC_PROPS, secprops);
     if(ret != SASL_OK) return ret;
     /* end of service_main initialization excepting SSF */
@@ -1506,10 +1537,6 @@
       nocurrent:
 	prot_printf(nntp_out, "420 Current article number is invalid\r\n");
 	continue;
-
-      noarticle:
-	prot_printf(nntp_out, "423 No such article(s) in this newsgroup\r\n");
-	continue;
     }
 }
 
@@ -1751,7 +1778,7 @@
 
     if (newserver) {
 	/* remote group */
-	backend_next = proxy_findserver(newserver, &protocol[PROTOCOL_NNTP],
+	backend_next = proxy_findserver(newserver, &nntp_protocol,
 					nntp_userid ? nntp_userid : "anonymous",
 					&backend_cached, &backend_current,
 					NULL, nntp_in);
@@ -1794,9 +1821,11 @@
 
     prot_printf(nntp_out, "101 Capability list follows:\r\n");
     prot_printf(nntp_out, "VERSION 2\r\n");
+    if (nntp_authstate || (config_serverinfo == IMAP_ENUM_SERVERINFO_ON)) {
     prot_printf(nntp_out,
-		"IMPLEMENTATION Cyrus NNTP%s server %s\r\n",
+		    "IMPLEMENTATION Cyrus NNTP%s %s\r\n",
 		config_mupdate_server ? " Murder" : "", CYRUS_VERSION);
+    }
 
     /* add STARTTLS */
     if (tls_enabled() && !nntp_starttls_done && !nntp_authstate)
@@ -1809,7 +1838,7 @@
     /* add the AUTHINFO variants */
     if (!nntp_authstate) {
 	prot_printf(nntp_out, "AUTHINFO%s%s\r\n",
-		    (nntp_starttls_done ||
+		    (nntp_starttls_done || (extprops_ssf > 1) ||
 		     config_getswitch(IMAPOPT_ALLOWPLAINTEXT)) ?
 		    " USER" : "", mechcount ? " SASL" : "");
     }
@@ -1974,7 +2003,8 @@
     }
 
     /* possibly disallow USER */
-    if (!(nntp_starttls_done || config_getswitch(IMAPOPT_ALLOWPLAINTEXT))) {
+    if (!(nntp_starttls_done || (extprops_ssf > 1) ||
+	  config_getswitch(IMAPOPT_ALLOWPLAINTEXT))) {
 	prot_printf(nntp_out,
 		    "483 AUTHINFO USER command only available under a layer\r\n");
 	return;
@@ -2055,9 +2085,9 @@
 {
     int r, sasl_result;
     char *success_data;
-    const int *ssfp;
+    sasl_ssf_t ssf;
     char *ssfmsg = NULL;
-    const char *canon_user;
+    const void *val;
 
     if (nntp_userid) {
 	prot_printf(nntp_out, "502 Already authenticated\r\n");
@@ -2151,9 +2181,7 @@
     /* get the userid from SASL --- already canonicalized from
      * mysasl_proxy_policy()
      */
-    sasl_result = sasl_getprop(nntp_saslconn, SASL_USERNAME,
-			       (const void **) &canon_user);
-    nntp_userid = xstrdup(canon_user);
+    sasl_result = sasl_getprop(nntp_saslconn, SASL_USERNAME, &val);
     if (sasl_result != SASL_OK) {
 	prot_printf(nntp_out, "481 weird SASL error %d SASL_USERNAME\r\n", 
 		    sasl_result);
@@ -2162,24 +2190,26 @@
 	reset_saslconn(&nntp_saslconn);
 	return;
     }
+    nntp_userid = xstrdup((const char *) val);
 
     proc_register("nntpd", nntp_clienthost, nntp_userid, (char *)0);
 
     syslog(LOG_NOTICE, "login: %s %s %s%s %s", nntp_clienthost, nntp_userid,
 	   mech, nntp_starttls_done ? "+TLS" : "", "User logged in");
 
-    sasl_getprop(nntp_saslconn, SASL_SSF, (const void **) &ssfp);
+    sasl_getprop(nntp_saslconn, SASL_SSF, &val);
+    ssf = *((sasl_ssf_t *) val);
 
     /* really, we should be doing a sasl_getprop on SASL_SSF_EXTERNAL,
        but the current libsasl doesn't allow that. */
     if (nntp_starttls_done) {
-	switch(*ssfp) {
+	switch(ssf) {
 	case 0: ssfmsg = "tls protection"; break;
 	case 1: ssfmsg = "tls plus integrity protection"; break;
 	default: ssfmsg = "tls plus privacy protection"; break;
 	}
     } else {
-	switch(*ssfp) {
+	switch(ssf) {
 	case 0: ssfmsg = "no protection"; break;
 	case 1: ssfmsg = "integrity protection"; break;
 	default: ssfmsg = "privacy protection"; break;
@@ -2234,11 +2264,11 @@
 			    size + strlen(xref) + 2); /* +2 for \r\n */
 	    }
 	    else if (!strcasecmp(":lines", hdr))
-		prot_printf(nntp_out, "%lu %lu\r\n",
+		prot_printf(nntp_out, "%u %lu\r\n",
 			    by_msgid ? 0 : index_getuid(msgno),
 			    index_getlines(nntp_group, msgno));
 	    else
-		prot_printf(nntp_out, "%lu \r\n",
+		prot_printf(nntp_out, "%u \r\n",
 			    by_msgid ? 0 : index_getuid(msgno));
 	}
 	else if (!strcmp(hdr, "xref") && !pat /* [X]HDR only */) {
@@ -2248,13 +2278,13 @@
 	    build_xref(msgid, xref, sizeof(xref), 1);
 	    if (!by_msgid) free(msgid);
 
-	    prot_printf(nntp_out, "%lu %s\r\n",
+	    prot_printf(nntp_out, "%u %s\r\n",
 			by_msgid ? 0 : index_getuid(msgno), xref);
 	}
 	else if ((body = index_getheader(nntp_group, msgno, hdr)) &&
 		 (!pat ||			/* [X]HDR */
 		  wildmat(body, pat))) {	/* XPAT with match */
-		prot_printf(nntp_out, "%lu %s\r\n",
+		prot_printf(nntp_out, "%u %s\r\n",
 			    by_msgid ? 0 : index_getuid(msgno), body);
 	}
     }
@@ -2388,7 +2418,7 @@
 	return 0;
 
     /* don't repeat */
-    if (matchlen == strlen(lastname) &&
+    if (matchlen == (int) strlen(lastname) &&
 	!strncmp(name, lastname, matchlen)) return 0;
 
     strncpy(lastname, name, matchlen);
@@ -2419,7 +2449,7 @@
     int r;
     char *result;
 
-    be = proxy_findserver(server, &protocol[PROTOCOL_NNTP],
+    be = proxy_findserver(server, &nntp_protocol,
 			  nntp_userid ? nntp_userid : "anonymous",
 			  &backend_cached, &backend_current, NULL, nntp_in);
     if (!be) return;
@@ -2677,11 +2707,15 @@
     lcase(arg);
 
     if (!strcmp(arg, "reader")) {
-	prot_printf(nntp_out,
-		    "%u %s Cyrus NNTP%s %s server ready, posting %s\r\n",
-		    (nntp_capa & MODE_READ) ? 200 : 201,
-		    config_servername, config_mupdate_server ? " Murder" : "",
-		    CYRUS_VERSION,
+	prot_printf(nntp_out, "%u", (nntp_capa & MODE_READ) ? 200 : 201);
+	if (config_serverinfo || nntp_authstate) {
+	    prot_printf(nntp_out, " %s", config_servername);
+	}
+	if (nntp_authstate || (config_serverinfo == IMAP_ENUM_SERVERINFO_ON)) {
+	    prot_printf(nntp_out, " Cyrus NNTP%s %s",
+			config_mupdate_server ? " Murder" : "", CYRUS_VERSION);
+	}
+	prot_printf(nntp_out, " server ready, posting %s\r\n",
 		    (nntp_capa & MODE_READ) ? "allowed" : "prohibited");
     }
     else if (!strcmp(arg, "stream")) {
@@ -2772,7 +2806,7 @@
 
 static void cmd_over(char *msgid, unsigned long uid, unsigned long last)
 {
-    int msgno, last_msgno;
+    unsigned msgno, last_msgno;
     struct nntp_overview *over;
     int found = 0;
 
@@ -2903,7 +2937,7 @@
 	if (!rcpt) return -1;
 
 	/* construct the mailbox name */
-	sprintf(rcpt, "%s%.*s", newsprefix, n, p);
+	sprintf(rcpt, "%s%.*s", newsprefix, (int) n, p);
 	
 	/* Only add mailboxes that exist */
 	if (!mlookup(rcpt, NULL, NULL, NULL)) {
@@ -2999,7 +3033,7 @@
 
     /* get control */
     if ((body = spool_getheader(m->hdrcache, "control")) != NULL) {
-	int len;
+	size_t len;
 
 	m->control = xstrdup(body[0]);
 
@@ -3008,7 +3042,7 @@
 	m->rcpt = (char **) xmalloc(sizeof(char *));
 	len = strcspn(m->control, " \t\r\n");
 	m->rcpt[0] = xmalloc(strlen(newsprefix) + 8 + len + 1);
-	sprintf(m->rcpt[0], "%scontrol.%.*s", newsprefix, len, m->control);
+	sprintf(m->rcpt[0], "%scontrol.%.*s", newsprefix, (int) len, m->control);
     } else {
 	m->control = NULL;	/* no control */
 
@@ -3072,7 +3106,7 @@
 
 			    /* add the post address */
 			    r += sprintf(r, "%s%s+%.*s",
-					 sep, newspostuser, n, p);
+					 sep, newspostuser, (int) n, p);
 
 			    sep = ", ";
 			}
@@ -3091,7 +3125,7 @@
 		    fprintf(f, "Reply-To: ");
 		    r = replyto;
 		    if (fold) {
-			fprintf(f, "%.*s\r\n\t", fold - r, r);
+			fprintf(f, "%.*s\r\n\t", (int) (fold - r), r);
 			r = fold;
 		    }
 		    fprintf(f, "%s\r\n", r);
@@ -3176,7 +3210,7 @@
 	struct backend *be;
 	char buf[4096];
 
-	be = proxy_findserver(d->server, &protocol[PROTOCOL_NNTP],
+	be = proxy_findserver(d->server, &nntp_protocol,
 			      nntp_userid ? nntp_userid : "anonymous",
 			      &backend_cached, &backend_current,
 			      NULL, nntp_in);
@@ -3322,7 +3356,6 @@
     int r;
     char *group;
     char mailboxname[MAX_MAILBOX_NAME+1];
-    int sync_lockfd = (-1);
 
     /* isolate newsgroup */
     group = msg->control + 8; /* skip "newgroup" */
@@ -3346,7 +3379,6 @@
     int r;
     char *group;
     char mailboxname[MAX_MAILBOX_NAME+1];
-    int sync_lockfd = (-1);
 
     /* isolate newsgroup */
     group = msg->control + 7; /* skip "rmgroup" */
@@ -3367,17 +3399,17 @@
 
 static int mvgroup(message_data_t *msg)
 {
-    int r, len;
+    int r;
+    size_t len;
     char *group;
     char oldmailboxname[MAX_MAILBOX_NAME+1];
     char newmailboxname[MAX_MAILBOX_NAME+1];
-    int sync_lockfd = (-1);
 
     /* isolate old newsgroup */
     group = msg->control + 7; /* skip "mvgroup" */
     while (isspace((int) *group)) group++;
 
-    len = (int) strcspn(group, " \t\r\n");
+    len = strcspn(group, " \t\r\n");
     snprintf(oldmailboxname, sizeof(oldmailboxname), "%s%.*s",
 	     newsprefix, len, group);
 
@@ -3385,9 +3417,9 @@
     group += len; /* skip old newsgroup */
     while (isspace((int) *group)) group++;
 
-    len = (int) strcspn(group, " \t\r\n");
+    len = strcspn(group, " \t\r\n");
     snprintf(newmailboxname, sizeof(newmailboxname), "%s%.*s",
-	     newsprefix, len, group);
+	     newsprefix, (int) len, group);
 
     r = mboxlist_renamemailbox(oldmailboxname, newmailboxname, NULL, 0,
 			       newsmaster, newsmaster_authstate, 0);
@@ -3402,11 +3434,12 @@
 /*
  * mailbox_exchange() callback function to delete cancelled articles
  */
-static int expunge_cancelled(struct mailbox *mailbox __attribute__((unused)),
-			     void *rock, char *index,
+static unsigned expunge_cancelled(struct mailbox *mailbox __attribute__((unused)),
+				  void *rock,
+				  unsigned char *index,
 			     int expunge_flags __attribute__((unused)))
 {
-    int uid = ntohl(*((bit32 *)(index+OFFSET_UID)));
+    unsigned uid = ntohl(*((bit32 *)(index+OFFSET_UID)));
 
     /* only expunge the UID that we obtained from the msgid */
     return (uid == *((unsigned long *) rock));
@@ -4031,6 +4064,7 @@
   
     result=tls_start_servertls(0, /* read */
 			       1, /* write */
+			       nntps ? 180 : nntp_timeout,
 			       layerp,
 			       &auth_id,
 			       &tls_conn);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/notify.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/notify.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/notify.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/notify.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* notify.c -- Module to notify of new mail
- * $Id: notify.c,v 1.15 2007/02/05 18:41:47 jeaton Exp $ 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: notify.c,v 1.16 2008/03/24 17:09:18 murch Exp $
  */
 
 #ifdef HAVE_CONFIG_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/notify.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/notify.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/notify.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/notify.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* notify.h -- abstract interface for notifications
  *
- * $Id: notify.h,v 1.7 2003/10/22 18:50:08 rjs3 Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: notify.h,v 1.8 2008/03/24 17:09:18 murch Exp $
  */
 
 #ifndef NOTIFY_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/pop3d.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/pop3d.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/pop3d.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/pop3d.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* pop3d.c -- POP3 server protocol parsing
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,11 +38,10 @@
  * 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.
+ *
+ * $Id: pop3d.c,v 1.189 2008/04/22 13:11:18 murch Exp $
  */
 
-/*
- * $Id: pop3d.c,v 1.171 2007/02/05 18:41:48 jeaton Exp $
- */
 #include <config.h>
 
 
@@ -53,7 +53,6 @@
 #include <string.h>
 #include <fcntl.h>
 #include <signal.h>
-#include <assert.h>
 #include <sys/types.h>
 #include <sys/param.h>
 #include <syslog.h>
@@ -67,6 +66,7 @@
 #include <sasl/sasl.h>
 #include <sasl/saslutil.h>
 
+#include "assert.h"
 #include "acl.h"
 #include "util.h"
 #include "auth.h"
@@ -112,6 +112,7 @@
 
 sasl_conn_t *popd_saslconn; /* the sasl connection context */
 
+int popd_timeout;
 char *popd_userid = 0, *popd_subfolder = 0;
 struct mailbox *popd_mailbox = 0;
 struct auth_state *popd_authstate = 0;
@@ -152,6 +153,19 @@
 /* PROXY stuff */
 struct backend *backend = NULL;
 
+static struct protocol_t pop3_protocol =
+{ "pop3", "pop",
+  { 0, "+OK " },
+  { "CAPA", NULL, ".", NULL,
+    { { "SASL ", CAPA_AUTH },
+      { "STLS", CAPA_STARTTLS },
+      { NULL, 0 } } },
+  { "STLS", "+OK", "-ERR", 0 },
+  { "AUTH", 255, 0, "+OK", "-ERR", "+ ", "*", NULL, 0 },
+  { "NOOP", NULL, "+OK" },
+  { "QUIT", NULL, "+OK" }
+};
+
 static void bitpipe(void);
 /* end PROXY stuff */
 
@@ -453,7 +467,6 @@
     char hbuf[NI_MAXHOST];
     char localip[60], remoteip[60];
     int niflags;
-    int timeout;
     sasl_security_properties_t *secprops=NULL;
 
     signals_poll();
@@ -498,7 +511,7 @@
 	fatal("SASL failed initializing: sasl_server_new()",EC_TEMPFAIL); 
 
     /* will always return something valid */
-    secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
+    secprops = mysasl_secprops(0);
     sasl_setprop(popd_saslconn, SASL_SEC_PROPS, secprops);
     sasl_setprop(popd_saslconn, SASL_SSF_EXTERNAL, &extprops_ssf);
     
@@ -517,9 +530,10 @@
     proc_register("pop3d", popd_clienthost, NULL, NULL);
 
     /* Set inactivity timer */
-    timeout = config_getint(IMAPOPT_POPTIMEOUT);
-    if (timeout < 10) timeout = 10;
-    prot_settimeout(popd_in, timeout*60);
+    popd_timeout = config_getint(IMAPOPT_POPTIMEOUT);
+    if (popd_timeout < 10) popd_timeout = 10;
+    popd_timeout *= 60;
+    prot_settimeout(popd_in, popd_timeout);
     prot_setflushonread(popd_in, popd_out);
 
     if (kflag) kpop();
@@ -537,9 +551,14 @@
 	syslog(LOG_WARNING, "APOP disabled: can't create challenge");
     }
 
-    prot_printf(popd_out, "+OK %s Cyrus POP3%s %s server ready %s\r\n",
-		config_servername, config_mupdate_server ? " Murder" : "",
-		CYRUS_VERSION, popd_apop_chal);
+    prot_printf(popd_out, "+OK %s", popd_apop_chal);
+    if (config_serverinfo) prot_printf(popd_out, " %s", config_servername);
+    if (config_serverinfo == IMAP_ENUM_SERVERINFO_ON) {
+	prot_printf(popd_out, " Cyrus POP3%s %s",
+		    config_mupdate_server ? " Murder" : "", CYRUS_VERSION);
+    }
+    prot_printf(popd_out, " server ready\r\n");
+
     cmdloop();
 
     /* QUIT executed */
@@ -803,7 +822,7 @@
 		        int pollpadding =config_getint(IMAPOPT_POPPOLLPADDING);
 			int minpollsec = config_getint(IMAPOPT_POPMINPOLL)*60;
 		        if ((minpollsec > 0) && (pollpadding > 1)) { 
-			    int mintime = popd_login_time - (minpollsec*(pollpadding));
+			    unsigned mintime = popd_login_time - (minpollsec*(pollpadding));
 			    if (popd_mailbox->pop3_last_login < mintime) {
 			        popd_mailbox->pop3_last_login = mintime + minpollsec; 
 			    } else {
@@ -1075,6 +1094,7 @@
   
     result=tls_start_servertls(0, /* read */
 			       1, /* write */
+			       pop3s ? 180 : popd_timeout,
 			       layerp,
 			       &auth_id,
 			       &tls_conn);
@@ -1125,7 +1145,7 @@
 static void cmd_apop(char *response)
 {
     int sasl_result;
-    char *canon_user;
+    const void *canon_user;
 
     assert(response != NULL);
 
@@ -1168,9 +1188,7 @@
      * get the userid from SASL --- already canonicalized from
      * mysasl_proxy_policy()
      */
-    sasl_result = sasl_getprop(popd_saslconn, SASL_USERNAME,
-			       (const void **) &canon_user);
-    popd_userid = xstrdup(canon_user);
+    sasl_result = sasl_getprop(popd_saslconn, SASL_USERNAME, &canon_user);
     if (sasl_result != SASL_OK) {
 	prot_printf(popd_out, 
 		    "-ERR [AUTH] weird SASL error %d getting SASL_USERNAME\r\n", 
@@ -1181,6 +1199,7 @@
 	}
 	return;
     }
+    popd_userid = xstrdup((const char *) canon_user);
     
     syslog(LOG_NOTICE, "login: %s %s%s APOP%s %s", popd_clienthost,
 	   popd_userid, popd_subfolder ? popd_subfolder : "",
@@ -1197,7 +1216,7 @@
     unsigned userlen;
 
     /* possibly disallow USER */
-    if (!(kflag || popd_starttls_done ||
+    if (!(kflag || popd_starttls_done || (extprops_ssf > 1) ||
 	  config_getswitch(IMAPOPT_ALLOWPLAINTEXT))) {
 	prot_printf(popd_out,
 		    "-ERR [AUTH] USER command only available under a layer\r\n");
@@ -1230,8 +1249,6 @@
 
 void cmd_pass(char *pass)
 {
-    int plaintextloginpause;
-
     if (!popd_userid) {
 	prot_printf(popd_out, "-ERR [AUTH] Must give USER command\r\n");
 	return;
@@ -1251,7 +1268,9 @@
 	    return;
 	}
 
-	syslog(LOG_NOTICE, "login: %s %s kpop", popd_clienthost, popd_userid);
+	syslog(LOG_NOTICE, "login: %s %s%s KPOP%s %s", popd_clienthost,
+	       popd_userid, popd_subfolder ? popd_subfolder : "",
+	       popd_starttls_done ? "+TLS" : "", "User logged in");
 
 	openinbox();
 	return;
@@ -1290,6 +1309,29 @@
 	return;
     }
     else {
+	/* successful authentication */
+	int sasl_result, plaintextloginpause;
+	const void *val;
+
+	free(popd_userid);
+	popd_userid = 0;
+
+	/* get the userid from SASL --- already canonicalized from
+	 * mysasl_proxy_policy()
+	 */
+	sasl_result = sasl_getprop(popd_saslconn, SASL_USERNAME, &val);
+	if (sasl_result != SASL_OK) {
+	    prot_printf(popd_out, 
+			"-ERR [AUTH] weird SASL error %d getting SASL_USERNAME\r\n", 
+			sasl_result);
+	    if (popd_subfolder) {
+		free(popd_subfolder);
+		popd_subfolder = 0;
+	    }
+	    return;
+	}
+	popd_userid = xstrdup((const char *) val);
+
 	syslog(LOG_NOTICE, "login: %s %s%s plaintext%s %s", popd_clienthost,
 	       popd_userid, popd_subfolder ? popd_subfolder : "",
 	       popd_starttls_done ? "+TLS" : "", "User logged in");
@@ -1317,7 +1359,7 @@
     prot_printf(popd_out, "+OK List of capabilities follows\r\n");
 
     /* SASL special case: print SASL, then a list of supported capabilities */
-    if (!popd_mailbox && !backend &&
+    if ((!popd_authstate || saslprops.ssf) &&
 	sasl_listmech(popd_saslconn,
 		      NULL, /* should be id string */
 		      "SASL ", " ", "\r\n",
@@ -1326,7 +1368,7 @@
 	prot_write(popd_out, mechlist, strlen(mechlist));
     }
 
-    if (tls_enabled() && !popd_starttls_done && !popd_mailbox && !backend) {
+    if (tls_enabled() && !popd_starttls_done && !popd_authstate) {
 	prot_printf(popd_out, "STLS\r\n");
     }
     if (expire < 0) {
@@ -1342,15 +1384,17 @@
     prot_printf(popd_out, "RESP-CODES\r\n");
     prot_printf(popd_out, "AUTH-RESP-CODE\r\n");
 
-    if (!popd_mailbox && !backend &&
-	(kflag || popd_starttls_done
+    if (!popd_authstate &&
+	(kflag || popd_starttls_done || (extprops_ssf > 1)
 	 || config_getswitch(IMAPOPT_ALLOWPLAINTEXT))) {
 	prot_printf(popd_out, "USER\r\n");
     }
     
+    if (popd_authstate || (config_serverinfo == IMAP_ENUM_SERVERINFO_ON)) {
     prot_printf(popd_out,
-		"IMPLEMENTATION Cyrus POP3%s server %s\r\n",
+		    "IMPLEMENTATION Cyrus POP3%s %s\r\n",
 		config_mupdate_server ? " Murder" : "", CYRUS_VERSION);
+    }
 
     prot_printf(popd_out, ".\r\n");
     prot_flush(popd_out);
@@ -1361,7 +1405,8 @@
 {
     int r, sasl_result;
     char *authtype;
-    char *canon_user;
+    const void *val;
+    const char *canon_user;
 
     /* if client didn't specify an argument we give them the list
      *
@@ -1457,14 +1502,14 @@
     /* get the userid from SASL --- already canonicalized from
      * mysasl_proxy_policy()
      */
-    sasl_result = sasl_getprop(popd_saslconn, SASL_USERNAME,
-			       (const void **) &canon_user);
+    sasl_result = sasl_getprop(popd_saslconn, SASL_USERNAME, &val);
     if (sasl_result != SASL_OK) {
 	prot_printf(popd_out, 
 		    "-ERR [AUTH] weird SASL error %d getting SASL_USERNAME\r\n", 
 		    sasl_result);
 	return;
     }
+    canon_user = (const char *) val;
 
     /* If we're proxying, the authzid may contain a subfolder,
        so re-canonify it */
@@ -1490,6 +1535,9 @@
 	   popd_userid, popd_subfolder ? popd_subfolder : "",
 	   authtype, popd_starttls_done ? "+TLS" : "", "User logged in");
 
+    sasl_getprop(popd_saslconn, SASL_SSF, &val);
+    saslprops.ssf = *((sasl_ssf_t *) val);
+
     if (!openinbox()) {
 	prot_setsasl(popd_in,  popd_saslconn);
 	prot_setsasl(popd_out, popd_saslconn);
@@ -1567,7 +1615,7 @@
 	    memcpy(p, popd_subfolder, n);
 	}
 
-	backend = backend_connect(NULL, server, &protocol[PROTOCOL_POP3],
+	backend = backend_connect(NULL, server, &pop3_protocol,
 				  userid, NULL, &statusline);
 
 	if (!backend) {
@@ -1582,7 +1630,7 @@
     }
     else {
 	/* local mailbox */
-	int msg;
+	unsigned msg;
 	struct index_record record;
 	int minpoll;
 	int doclose = 0;
@@ -1743,12 +1791,13 @@
     return result;
 }
 
-static int expungedeleted(struct mailbox *mailbox __attribute__((unused)),
-			  void *rock __attribute__((unused)), char *index,
+static unsigned expungedeleted(struct mailbox *mailbox __attribute__((unused)),
+			       void *rock __attribute__((unused)),
+			       unsigned char *index,
 			  int expunge_flags __attribute__((unused)))
 {
-    int msg;
-    int uid = ntohl(*((bit32 *)(index+OFFSET_UID)));
+    unsigned msg;
+    unsigned uid = ntohl(*((bit32 *)(index+OFFSET_UID)));
 
     for (msg = 1; msg <= popd_exists; msg++) {
 	if (popd_msg[msg].uid == uid) {
@@ -1780,7 +1829,7 @@
        ret = sasl_setprop(*conn, SASL_IPLOCALPORT,
                           saslprops.iplocalport);
     if(ret != SASL_OK) return ret;
-    secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
+    secprops = mysasl_secprops(0);
     ret = sasl_setprop(*conn, SASL_SEC_PROPS, secprops);
     if(ret != SASL_OK) return ret;
     /* end of service_main initialization excepting SSF */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proc.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proc.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proc.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proc.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* proc.c -- Server process registry
- $Id: proc.c,v 1.25 2003/10/22 18:50:08 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: proc.c,v 1.26 2008/03/24 17:09:18 murch Exp $
  */
+
 #include <config.h>
 
 #include <stdlib.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/protocol.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/protocol.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/protocol.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/protocol.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* protocol.h -- client-side protocol abstraction
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,37 +38,26 @@
  * 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.
+ *
+ * $Id: protocol.h,v 1.10 2008/04/21 15:55:01 murch Exp $
  */
-
-/* $Id: protocol.h,v 1.7 2006/11/30 17:11:19 murch Exp $ */
 
 #ifndef _INCLUDED_PROTOCOL_H
 #define _INCLUDED_PROTOCOL_H
 
 #include "saslclient.h"
 
+#define MAX_CAPA 8
+
 enum {
     /* generic capabilities */
     CAPA_AUTH		= (1 << 0),
     CAPA_STARTTLS	= (1 << 1),
 
-    /* IMAP capabilities */
-    CAPA_IDLE		= (1 << 2),
-    CAPA_MUPDATE	= (1 << 3),
-    CAPA_MULTIAPPEND	= (1 << 4),
-    CAPA_LISTSUBSCRIBED	= (1 << 5),
-    CAPA_ACLRIGHTS	= (1 << 6),
-
-    /* LMTP capabilities */
-    CAPA_PIPELINING	= (1 << 2),
-    CAPA_IGNOREQUOTA	= (1 << 3)
-};
-
-#define MAX_CAPA 7
-
-struct capa_t {
-    const char *str;
-    unsigned long flag;
+    /*
+      protocol specific capabilites MUST be in the range
+      (1 << 2) .. (1 << MAX_CAPA)
+    */
 };
 
 struct protocol_t;
@@ -77,8 +67,14 @@
     char *resp;			/* end of banner response */
 };
 
+struct capa_t {
+    const char *str;
+    unsigned long flag;
+};
+
 struct capa_cmd_t {
     const char *cmd;		/* [OPTIONAL] capability command string */
+    const char *arg;		/* [OPTIONAL] capability command argument */
     const char *resp;		/* end of capability response */
     char *(*parse_mechlist)(const char *str, struct protocol_t *prot);
 				/* [OPTIONAL] parse capability string,
@@ -91,6 +87,8 @@
     const char *cmd;		/* tls command string */
     const char *ok;		/* start tls prompt */
     const char *fail;		/* failure response */
+    int auto_capa;		/* capability response sent automatically
+				   after TLS */
 };
 
 struct simple_cmd_t {
@@ -110,16 +108,4 @@
     struct simple_cmd_t logout_cmd;
 };
 
-extern struct protocol_t protocol[];
-
-enum {
-    PROTOCOL_IMAP = 0,
-    PROTOCOL_POP3,
-    PROTOCOL_NNTP,
-    PROTOCOL_LMTP,
-    PROTOCOL_MUPDATE,
-    PROTOCOL_SIEVE,
-    PROTOCOL_CSYNC
-};
-
 #endif /* _INCLUDED_PROTOCOL_H */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proxy.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proxy.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proxy.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proxy.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
-/*
- * proxy.c - proxy support functions
- *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* proxy.c - proxy support functions
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,18 +16,19 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
  *    "This product includes software developed by Computing Services
- *    acknowledgment:
  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
  *
  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
@@ -39,12 +39,11 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: proxy.c,v 1.5 2007/02/05 18:41:48 jeaton Exp $
+ * $Id: proxy.c,v 1.8 2008/09/26 13:30:00 murch Exp $
  */
 
 #include <config.h>
 
-#include <assert.h>
 #include <errno.h>
 #include <signal.h>
 #include <stdio.h>
@@ -52,6 +51,7 @@
 #include <syslog.h>
 #include <sys/un.h>
 
+#include "assert.h"
 #include "backend.h"
 #include "exitcodes.h"
 #include "global.h"
@@ -260,15 +260,14 @@
 
 	    if (pout) {
 		const char *err;
-		char buf[4096];
-		int c;
 
 		do {
-		    c = prot_read(pin, buf, sizeof(buf));
+		    char buf[4096];
+		    int c = prot_read(pin, buf, sizeof(buf));
 
 		    if (c == 0 || c < 0) break;
 		    prot_write(pout, buf, c);
-		} while (c == sizeof(buf));
+		} while (pin->cnt > 0);
 
 		if ((err = prot_error(pin)) != NULL) {
 		    if (serverout && !strcmp(err, PROT_EOF_STRING)) {
@@ -281,6 +280,9 @@
 			      EC_UNAVAILABLE);
 		    }
 		}
+		else {
+		    return 0;
+		}
 	    }
 	}
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proxy.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proxy.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proxy.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/proxy.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
-/*
- * proxy.h - proxy support functions
+/* proxy.h - proxy support functions
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,18 +16,19 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
  *    "This product includes software developed by Computing Services
- *    acknowledgment:
  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
  *
  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: proxy.h,v 1.2 2006/11/30 17:11:19 murch Exp $
+ * $Id: proxy.h,v 1.3 2008/03/24 17:09:19 murch Exp $
  */
 
 #ifndef _PROXY_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/pushstats.snmp
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/pushstats.snmp?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/pushstats.snmp (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/pushstats.snmp Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -36,6 +37,9 @@
 # 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.
+# 
+# $Id: pushstats.snmp,v 1.12 2008/04/04 12:46:35 murch Exp $
+
 # 
 # Count number of times command was executed
 #
@@ -116,6 +120,7 @@
 C,NAMESPACE_COUNT,"Number of namespace", auto
 C,PARTIAL_COUNT,"Number of partial", auto
 C,RENAME_COUNT,"Number of rename", auto
+C,SCAN_COUNT,"Number of list", auto
 C,STARTTLS_COUNT,"Number of starttls", auto
 C,STORE_COUNT,"Number of store", auto
 C,SELECT_COUNT,"Number of select", auto

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* quota.c -- program to report/reconstruct quotas
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-
-/* $Id: quota.c,v 1.67 2007/02/05 18:41:48 jeaton Exp $ */
-
+ * $Id: quota.c,v 1.70 2008/03/24 17:09:19 murch Exp $
+ */
 
 #include <config.h>
 
@@ -140,7 +139,9 @@
     struct fix_rock frock;
     struct txn *tid = NULL;
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     while ((opt = getopt(argc, argv, "C:d:f")) != EOF) {
 	switch (opt) {
@@ -217,7 +218,7 @@
 void errmsg(const char *fmt, const char *arg, int err)
 {
     char buf[1024];
-    int len;
+    size_t len;
 
     len = snprintf(buf, sizeof(buf), fmt, arg);
     if (len < sizeof(buf))
@@ -346,7 +347,7 @@
 
     /* make sure the domains match */
     if (domain &&
-	(!(p = strchr(name, '!')) || (p - name) != strlen(domain) ||
+	(!(p = strchr(name, '!')) || (p - name) != (int) strlen(domain) ||
 	 strncmp(name, domain, p - name))) {
 	return 0;
     }

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* quota.h -- Quota format definitions
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: quota.h,v 1.3 2006/11/30 17:11:20 murch Exp $
+ * $Id: quota.h,v 1.4 2008/03/24 17:09:19 murch Exp $
  */
 
 #ifndef INCLUDED_QUOTA_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota_db.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota_db.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota_db.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/quota_db.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* quota_db.c -- quota manipulation routines
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,8 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: quota_db.c,v 1.4 2007/02/05 18:41:48 jeaton Exp $
- *
+ * $Id: quota_db.c,v 1.8 2008/03/24 17:09:19 murch Exp $
  */
 
 #include <config.h>
@@ -91,7 +91,11 @@
 
     switch (r) {
     case CYRUSDB_OK:
-	sscanf(data, UQUOTA_T_FMT " %d", &quota->used, &quota->limit);
+	if (!data ||
+	    sscanf(data, UQUOTA_T_FMT " %d",
+		   &quota->used, &quota->limit) != 2) {
+	    r = CYRUSDB_IOERROR;
+	}
 	break;
 
     case CYRUSDB_AGAIN:
@@ -101,12 +105,12 @@
     case CYRUSDB_NOTFOUND:
 	return IMAP_QUOTAROOT_NONEXISTENT;
 	break;
-
-    default:
+    }
+
+    if (r) {
 	syslog(LOG_ERR, "DBERROR: error fetching %s: %s",
 	       quota->root, cyrusdb_strerror(r));
 	return IMAP_IOERROR;
-	break;
     }
 
     return 0;
@@ -247,7 +251,7 @@
 	strlcat(fname, FNAME_QUOTADB, fname_len);
     }
 
-    ret = QDB->open(fname, CYRUSDB_CREATE, &qdb);
+    ret = (QDB->open)(fname, CYRUSDB_CREATE, &qdb);
     if (ret != 0) {
 	syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
 	       cyrusdb_strerror(ret));
@@ -266,7 +270,7 @@
     int r;
 
     if (quota_dbopen) {
-	r = QDB->close(qdb);
+	r = (QDB->close)(qdb);
 	if (r) {
 	    syslog(LOG_ERR, "DBERROR: error closing quotas: %s",
 		   cyrusdb_strerror(r));

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/reconstruct.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/reconstruct.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/reconstruct.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/reconstruct.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* reconstruct.c -- program to reconstruct a mailbox 
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: reconstruct.c,v 1.106 2008/04/10 14:19:51 murch Exp $
  */
-
-/* $Id: reconstruct.c,v 1.90 2007/02/05 18:41:48 jeaton Exp $ */
 
 #include <config.h>
 
@@ -85,6 +86,7 @@
 #include "mailbox.h"
 #include "map.h"
 #include "message.h"
+#include "message_guid.h"
 #include "xmalloc.h"
 #include "xstrlcpy.h"
 #include "xstrlcat.h"
@@ -97,6 +99,7 @@
 #include "convert_code.h"
 #include "util.h"
 #include "sync_log.h"
+#include "lock.h"
 
 extern int optind;
 extern char *optarg;
@@ -133,6 +136,8 @@
 int code = 0;
 int keepflag = 0;
 int syncflag = 0;
+int guid_clear = 0;
+int guid_set   = 0;
 
 int main(int argc, char **argv)
 {
@@ -150,13 +155,15 @@
 
     memset(&head, 0, sizeof(head));
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     /* Ensure we're up-to-date on the index file format */
     assert(INDEX_HEADER_SIZE == (OFFSET_SPARE4+4));
     assert(INDEX_RECORD_SIZE == (OFFSET_MODSEQ+4));
 
-    while ((opt = getopt(argc, argv, "C:kp:rmfsx")) != EOF) {
+    while ((opt = getopt(argc, argv, "C:kp:rmfsxgG")) != EOF) {
 	switch (opt) {
 	case 'C': /* alt config file */
 	    alt_config = optarg;
@@ -188,6 +195,14 @@
 	    
 	case 'x':
 	    xflag = 1;
+	    break;
+	    
+	case 'g':
+	    guid_clear = 1;
+	    break;
+	    
+	case 'G':
+	    guid_set = 1;
 	    break;
 	    
 	default:
@@ -326,7 +341,8 @@
 					    fflag ? &head : NULL);
 	if (rflag) {
 	    /* build a pattern for submailboxes */
-	    /* XXX mboxlist_findall() is destructive and removes domain */
+	    char *p = strchr(buf, '@');
+	    if (p) *p = '\0';
 	    strlcat(buf, ".*", sizeof(buf));
 
 	    /* append the domain */
@@ -406,10 +422,10 @@
     signals_poll();
 
     /* don't repeat */
-    if (matchlen == strlen(lastname) &&
+    if (matchlen == (int) strlen(lastname) &&
 	!strncmp(name, lastname, matchlen)) return 0;
 
-    if(matchlen >= sizeof(lastname))
+    if(matchlen >= (int) sizeof(lastname))
 	matchlen = sizeof(lastname) - 1;
     
     strncpy(lastname, name, matchlen);
@@ -417,7 +433,8 @@
 
     r = reconstruct(lastname, rock);
     if (r) {
-	com_err(name, r, (r == IMAP_IOERROR) ? error_message(errno) : NULL);
+	com_err(lastname, r,
+		(r == IMAP_IOERROR) ? error_message(errno) : NULL);
 	code = convert_code(r);
     } else {
 	/* Convert internal name to external */
@@ -429,218 +446,10 @@
     return 0;
 }
 
-int 
-reconstruct_expunge (char * path, struct mailbox * mailbox, 
-			unsigned long **expuid, int *expuid_num)
-{
-    char fnamebuf[MAX_MAILBOX_PATH+1];
-    char newfnamebuf[MAX_MAILBOX_PATH+1];
-    struct stat sbuf;
-
-    char buf[((INDEX_HEADER_SIZE > INDEX_RECORD_SIZE) ?
-             INDEX_HEADER_SIZE : INDEX_RECORD_SIZE)];
-
-    int expunge_fd;
-    FILE *fexpunge;
-
-    const char *index_base = NULL;
-    unsigned long index_len = 0;	/* mapped size */
-    int format;
-    int  minor_version;
-    unsigned long start_offset;
-    unsigned long record_size;
-    unsigned long  exists;
-
-    unsigned long uid;
-    char msgfname[MAILBOX_FNAME_LEN+1];
-
-    unsigned msgno;
-    const char *p;
-    int   n;
-
-    unsigned long *expuid_array = NULL;
-    int expuid_idx = 0;
-    int expuid_alloc = 0;
-    int expmsg;
-
-    *expuid = NULL;
-    *expuid_num = 0;
-
-    /* Open and validate the cyrus.expunge file */
-
-    strlcpy(fnamebuf, path, sizeof(fnamebuf));
-    strlcat(fnamebuf, FNAME_EXPUNGE_INDEX, sizeof(fnamebuf));
-
-    if (stat(fnamebuf, &sbuf) == -1 ||
-	sbuf.st_size <= OFFSET_LEAKED_CACHE ||
-	(expunge_fd = open(fnamebuf, O_RDONLY, 0666)) == -1) {
-	unlink(fnamebuf);
-        return (0);
-    } 
-
-    /* Map the file */
-    map_refresh(expunge_fd, 1, &index_base,
-		    &index_len, sbuf.st_size, "expunge", mailbox->name);
-
-    format = ntohl(*((bit32 *)(index_base+OFFSET_FORMAT)));
-    minor_version = ntohl(*((bit32 *)(index_base+OFFSET_MINOR_VERSION)));
-    start_offset = ntohl(*((bit32 *)(index_base+OFFSET_START_OFFSET)));
-    record_size = ntohl(*((bit32 *)(index_base+OFFSET_RECORD_SIZE)));
-    exists = ntohl(*((bit32 *)(index_base+OFFSET_EXISTS)));
-
-    /* Sanity check the header as best we can */
-    if ((format != 0)        || (exists == 0) ||  
-	(minor_version == 0) || (minor_version > MAILBOX_MINOR_VERSION) || 
-	(start_offset == 0)  ||  (start_offset > INDEX_HEADER_SIZE) ||
-	(record_size  == 0)  || (record_size > INDEX_RECORD_SIZE) ||
-	(sbuf.st_size < (start_offset + exists * record_size))) {
-
-	syslog(LOG_ERR, "Unable to verify header - deleting: %s", fnamebuf);
-	close (expunge_fd);
-	map_free(&index_base, &index_len);
-	unlink(fnamebuf);
-	return (0);
-    }
-
-    /* 
-     * verify the message files exist - 
-     * optionally deleting message files 
-     */
-    p = index_base + start_offset;
-    for (msgno = 1; msgno <= exists; msgno++, p += record_size) {
-	uid = ntohl(*((bit32 *)(p + OFFSET_UID)));
-
-	/* Sanity check UID */
-	if (uid == 0) {
-	    syslog(LOG_ERR, "IOERROR: %s zero expunge record %u/%lu",
-			   fnamebuf, msgno, exists);
-	    break;
-	}
-	mailbox_message_get_fname(mailbox, uid, msgfname, sizeof(msgfname));
-
-	if (keepflag == 0) {
-	    unlink(msgfname);
-	    continue;
-	}
-
-	if ( (stat (msgfname, &sbuf)) != 0) {
-	    syslog (LOG_ERR, "IOERROR: %m while stat\'ing message %s", msgfname);
-	    continue;
-	}
-	if (sbuf.st_size == 0) {
-	    /* Zero-length message file--blow it away */
-	    unlink(msgfname);
-	    continue;
-        }
-
-	if (expuid_idx == expuid_alloc) {
-	    expuid_alloc += UIDGROW;
-	    expuid_array = (unsigned long *) xrealloc((char *)*expuid,
-	    			expuid_alloc * sizeof(unsigned long));
-	}
-	expuid_array[expuid_idx] = uid;
-	expuid_idx++;
-    }
-    *expuid = expuid_array;
-    *expuid_num = expuid_idx;
-
-    if (keepflag == 0) {
-	map_free(&index_base, &index_len);
-	close (expunge_fd);
-	unlink(fnamebuf);
-	return (0);
-    }
-
-    /*
-     * If the number of message files in the old expunge file
-     * is not equal to what we just counted,
-     * we'll rewrite the expunge file.
-     * If we found no message files -- blow away cyrus.expunge
-     */
-    if (exists == expuid_idx) {
-	close(expunge_fd);
-	map_free(&index_base, &index_len);
-    } else if ( expuid_idx == 0) {
-	close(expunge_fd);
-	map_free(&index_base, &index_len);
-	unlink (fnamebuf);
-    } else {
-	/* we must rewrite the cyrus.expunge file */
-
-	strcpy (newfnamebuf, fnamebuf);
-	strcat (newfnamebuf,  ".NEW");
-	fexpunge = fopen(newfnamebuf, "w+");
-	if (fexpunge == NULL) {
-	    syslog (LOG_ERR, "IOERROR: %m while creating: %s", newfnamebuf);
-	    close(expunge_fd);
-	    map_free(&index_base, &index_len);
-	    free(expuid);
-	    return IMAP_IOERROR;
-   	}
-	unsigned msgno;
-	const char *p = index_base + start_offset;
-
-	/* 
-	* verify the message files exist - 
-	* optionally deleting message files 
-	*/
-	for (msgno = 1; msgno <= exists; msgno++, p += record_size) {
-	    unsigned long fileuid = ntohl(*((bit32 *)(p + OFFSET_UID)));
-
-	    for (expmsg = 0; expmsg < expuid_idx; expmsg++) {
-		if (fileuid == expuid_array [expmsg]) {
-
-		    n = fwrite(buf, 1, INDEX_RECORD_SIZE, fexpunge);
-		    if (n != INDEX_RECORD_SIZE) {
-	    		syslog (LOG_ERR, 
-		"IOERROR: %m writing cyrus.expunge record: %s", newfnamebuf);
-			close(expunge_fd);
-			map_free(&index_base, &index_len);
-			free(expuid);
-			fclose(fexpunge);
-			
-			return IMAP_IOERROR;
-		    }
-		    break;
-		}
-	    }
-	}
-	rewind (fexpunge);
-	*((bit32 *)(buf+OFFSET_EXISTS)) = htonl(*expuid_num);	
-	n = fwrite(buf, 1, INDEX_HEADER_SIZE, fexpunge);
-	if (n != INDEX_HEADER_SIZE || ferror(fexpunge) ) {
-	    syslog (LOG_ERR, "IOERROR: %m writing expunge header: %s", newfnamebuf);
-	    close(expunge_fd);
-	    map_free(&index_base, &index_len);
-	    free(expuid);
-	    fclose(fexpunge);
-	    return IMAP_IOERROR;
-	}
-
-	close(expunge_fd);
-	map_free(&index_base, &index_len);
-	unlink(fnamebuf);
-	fchmod (fileno (fexpunge), 
-		S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |S_IWOTH);
-	fclose(fexpunge);
-	if (rename(newfnamebuf, fnamebuf)) {
-	    free(expuid);
-            return IMAP_IOERROR;
-	}
-    }
-    
-    if (expuid_idx > 0) {
-	qsort((char *)expuid_array, expuid_idx, sizeof(expuid_array), compare_uid);
-    }
-
-    return (0);
-}	
-
 char * 
 getmailname (char * mailboxname) 
 {
     static char   namebuf[MAX_MAILBOX_PATH + 1];
-    static int    namebuflen;
 
     char * pname;
 
@@ -687,58 +496,323 @@
 
     return (puniq);
 }
+
+/* ---------------------------------------------------------------------- */
+
+/* Code which is typically reused for index,expunge and cache files */
+
+static void reconstruct_make_path(char *buf, int size,
+                                  struct mailbox *mailbox,
+                                  int mask, char *name, char *suffix)
+{
+    char *path = (mailbox->mpath && (config_metapartition_files & mask))
+	? mailbox->mpath : mailbox->path;
+
+    strlcpy(buf, path, size);
+    strlcat(buf, name, size);
+
+    if (suffix && suffix[0])
+        strlcat(buf, suffix, size);
+}
+
+static int reconstruct_open_expunge(struct mailbox *mailbox, int *fdp,
+                                    unsigned long *lenp)
+{
+    char fnamebuf[MAX_MAILBOX_PATH+1];
+    struct stat sbuf;
+    const char *lockfailaction;
+    int r;
+
+    reconstruct_make_path(fnamebuf, sizeof(fnamebuf), mailbox,
+                          IMAP_ENUM_METAPARTITION_FILES_EXPUNGE,
+                          FNAME_EXPUNGE_INDEX, NULL);
+    *fdp = -1;
+    if ((stat(fnamebuf, &sbuf) < 0) ||
+        (sbuf.st_size < (int) INDEX_HEADER_SIZE) ||
+        ((*fdp = open(fnamebuf, O_RDWR, 0666)) < 0)) {
+	unlink(fnamebuf);
+        return(0);
+    }
+    *lenp = sbuf.st_size;
+
+    if ((r = lock_reopen(*fdp, fnamebuf, &sbuf, &lockfailaction)))
+         syslog(LOG_ERR, "IOERROR: %s expunge index for %s: %m",
+                lockfailaction, mailbox->name);
+    return(r);
+}
+
+/* Commit a single index/expunge/cache file */
+static int reconstruct_rename_single(struct mailbox *mailbox,
+                                     int mask, char *filename)
+{
+    char fnamebuf[MAX_MAILBOX_PATH+1], fnamebufnew[MAX_MAILBOX_PATH+1];
+
+    reconstruct_make_path(fnamebuf, sizeof(fnamebuf),
+                          mailbox, mask, filename, NULL);
+    strlcpy(fnamebufnew, fnamebuf, sizeof(fnamebufnew));
+    strlcat(fnamebufnew, ".NEW", sizeof(fnamebufnew));
+
+    if (rename(fnamebufnew, fnamebuf)) {
+        syslog(LOG_ERR, "IOERROR: renaming %s for %s: %m",
+               filename, mailbox->name);
+        return(IMAP_IOERROR);
+    }
+    return(0);
+}
+
+/* Delete a single index/expunge/cache file */
+static int reconstruct_delete_single(struct mailbox *mailbox, int mask,
+                                     char *filename, char *suffix)
+{
+    char fnamebuf[MAX_MAILBOX_PATH+1];
+
+    reconstruct_make_path(fnamebuf, sizeof(fnamebuf), mailbox, mask,
+                          filename, suffix);
+    return ((unlink(fnamebuf) < 0) ? IMAP_IOERROR : 0);
+}
+
+/* ---------------------------------------------------------------------- */
+
+/* uiditem used to generate list of msgnos sorted by ascending UID */
+struct uiditem {
+    unsigned long msgno;
+    unsigned long uid;
+};
+
+static int compare_uiditem(const void *a0, const void *b0)
+{
+    struct uiditem *a = (struct uiditem *) a0;
+    struct uiditem *b = (struct uiditem *) b0;
+
+    /* If duplicate UIDs appear list lowest msgnos first */
+    if (a->uid == b->uid)
+        return((a->msgno) - (b->msgno));
+
+    return ((a->uid) - (b->uid));
+}
+
+/* ---------------------------------------------------------------------- */
+
+/* Running counts which will go into the index and expunge headers */
+struct reconstruct_counts {
+    unsigned long newexists;
+    unsigned long newanswered;
+    unsigned long newflagged;
+    unsigned long newdeleted;
+    uquota_t      newquota_used;
+};
+
+static void reconstruct_counts_clear(struct reconstruct_counts *c)
+{
+    memset(c, 0, sizeof(struct reconstruct_counts));
+}
+
+
+static void reconstruct_counts_update(struct reconstruct_counts *c,
+                                      struct index_record *p)
+{
+    c->newexists++;
+    c->newquota_used += p->size;
+
+    if (p->system_flags & FLAG_ANSWERED) c->newanswered++;
+    if (p->system_flags & FLAG_DELETED)  c->newdeleted++;
+    if (p->system_flags & FLAG_FLAGGED)  c->newflagged++;
+}
+
+static void reconstruct_counts_tobuf(unsigned char *buf,
+                                     struct mailbox *mailbox,
+                                     struct reconstruct_counts *c)
+{
+    *((bit32 *)(buf+OFFSET_GENERATION_NO)) = htonl(mailbox->generation_no + 1);
+    *((bit32 *)(buf+OFFSET_FORMAT)) = htonl(mailbox->format);
+    *((bit32 *)(buf+OFFSET_MINOR_VERSION)) = htonl(MAILBOX_MINOR_VERSION);
+    *((bit32 *)(buf+OFFSET_START_OFFSET)) = htonl(INDEX_HEADER_SIZE);
+    *((bit32 *)(buf+OFFSET_RECORD_SIZE)) = htonl(INDEX_RECORD_SIZE);
+    *((bit32 *)(buf+OFFSET_EXISTS)) = htonl(c->newexists);
+    *((bit32 *)(buf+OFFSET_LAST_APPENDDATE)) = htonl(mailbox->last_appenddate);
+    *((bit32 *)(buf+OFFSET_LAST_UID)) = htonl(mailbox->last_uid);
+
+    /* quotas may be 64bit now */
+#ifdef HAVE_LONG_LONG_INT
+    *((bit64 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonll(c->newquota_used);
+#else
+    /* zero the unused 32bits */
+    *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonl(0);
+    *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED)) = htonl(c->newquota_used);
+#endif
+
+    *((bit32 *)(buf+OFFSET_POP3_LAST_LOGIN)) = htonl(mailbox->pop3_last_login);
+    *((bit32 *)(buf+OFFSET_UIDVALIDITY)) = htonl(mailbox->uidvalidity);
+    *((bit32 *)(buf+OFFSET_DELETED)) = htonl(c->newdeleted);
+    *((bit32 *)(buf+OFFSET_ANSWERED)) = htonl(c->newanswered);
+    *((bit32 *)(buf+OFFSET_FLAGGED)) = htonl(c->newflagged);
+    *((bit32 *)(buf+OFFSET_MAILBOX_OPTIONS)) = htonl(mailbox->options);
+    *((bit32 *)(buf+OFFSET_LEAKED_CACHE)) = htonl(0);
+#ifdef HAVE_LONG_LONG_INT
+    align_htonll(buf+OFFSET_HIGHESTMODSEQ_64, mailbox->highestmodseq);
+#else
+    /* zero the unused 32bits */
+    *((bit32 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonl(0);
+    *((bit32 *)(buf+OFFSET_HIGHESTMODSEQ)) = htonl(mailbox->highestmodseq);
+#endif
+    *((bit32 *)(buf+OFFSET_SPARE0)) = htonl(0); /* RESERVED */
+    *((bit32 *)(buf+OFFSET_SPARE1)) = htonl(0); /* RESERVED */
+    *((bit32 *)(buf+OFFSET_SPARE2)) = htonl(0); /* RESERVED */
+    *((bit32 *)(buf+OFFSET_SPARE3)) = htonl(0); /* RESERVED */
+    *((bit32 *)(buf+OFFSET_SPARE4)) = htonl(0); /* RESERVED */
+}
+
+/* ---------------------------------------------------------------------- */
+
+static int reconstruct_header_isvalid(const char *index_base,
+                                      unsigned long index_len)
+{
+    int format;
+    int  minor_version;
+    unsigned long start_offset;
+    unsigned long record_size;
+    unsigned long  exists;
+
+    if ((index_base == NULL) || (index_len < INDEX_HEADER_SIZE))
+        return(0);
+
+    format        = ntohl(*((bit32 *)(index_base+OFFSET_FORMAT)));
+    minor_version = ntohl(*((bit32 *)(index_base+OFFSET_MINOR_VERSION)));
+    start_offset  = ntohl(*((bit32 *)(index_base+OFFSET_START_OFFSET)));
+    record_size   = ntohl(*((bit32 *)(index_base+OFFSET_RECORD_SIZE)));
+    exists        = ntohl(*((bit32 *)(index_base+OFFSET_EXISTS)));
+
+    if ((format != 0)        ||
+        (minor_version == 0) || (minor_version > MAILBOX_MINOR_VERSION) || 
+        (start_offset == 0)  || (start_offset > INDEX_HEADER_SIZE) ||
+        (record_size  == 0)  || (record_size > INDEX_RECORD_SIZE) ||
+        ((unsigned) index_len < (start_offset + exists * record_size)))
+        return(0);
+
+    return(1);
+}
+
+static void reconstruct_clear_expunged(struct mailbox *mailbox,
+                                       struct uiditem *expunge_uidmap,
+                                       unsigned expunge_exists)
+{
+    char msgfname[MAILBOX_FNAME_LEN+1];
+    unsigned long uid;
+    unsigned msgno;
+
+    for (msgno = 1; msgno <= expunge_exists; msgno++) {
+        if ((uid = expunge_uidmap[msgno-1].uid) > 0) {
+            mailbox_message_get_fname(mailbox, uid, msgfname, sizeof(msgfname));
+            unlink(msgfname);
+        }
+    }
+}
+
+/*  Read an index record from a mapped index file without struct mailbox */
+int reconstruct_read_index_record(const char *name,
+                                  const char *index_base,
+                                  unsigned long index_len,
+                                  unsigned msgno,
+                                  struct index_record *record)
+{
+    unsigned long start_offset;
+    unsigned long record_size;
+    unsigned long exists;
+    unsigned long offset;
+    unsigned const char *buf;
+    int n;
+
+    /* Following would normally come from struct mailbox */
+    start_offset = ntohl(*((bit32 *)(index_base+OFFSET_START_OFFSET)));
+    record_size  = ntohl(*((bit32 *)(index_base+OFFSET_RECORD_SIZE)));
+    exists       = ntohl(*((bit32 *)(index_base+OFFSET_EXISTS)));
+
+    offset = start_offset + (msgno-1) * record_size;
+    if (offset + INDEX_RECORD_SIZE > index_len) {
+	syslog(LOG_ERR,
+	       "IOERROR: index record %u for %s past end of file",
+	       msgno, name);
+	return IMAP_IOERROR;
+    }
+
+    buf = (unsigned char*) index_base + offset;
+
+    record->uid = ntohl(*((bit32 *)(buf+OFFSET_UID)));
+    record->internaldate = ntohl(*((bit32 *)(buf+OFFSET_INTERNALDATE)));
+    record->sentdate = ntohl(*((bit32 *)(buf+OFFSET_SENTDATE)));
+    record->size = ntohl(*((bit32 *)(buf+OFFSET_SIZE)));
+    record->header_size = ntohl(*((bit32 *)(buf+OFFSET_HEADER_SIZE)));
+    record->content_offset = ntohl(*((bit32 *)(buf+OFFSET_CONTENT_OFFSET)));
+    record->cache_offset = ntohl(*((bit32 *)(buf+OFFSET_CACHE_OFFSET)));
+    record->last_updated = ntohl(*((bit32 *)(buf+OFFSET_LAST_UPDATED)));
+    record->system_flags = ntohl(*((bit32 *)(buf+OFFSET_SYSTEM_FLAGS)));
+    for (n = 0; n < MAX_USER_FLAGS/32; n++) {
+	record->user_flags[n] = ntohl(*((bit32 *)(buf+OFFSET_USER_FLAGS+4*n)));
+    }
+    record->content_lines = ntohl(*((bit32 *)(buf+OFFSET_CONTENT_LINES)));
+    record->cache_version = ntohl(*((bit32 *)(buf+OFFSET_CACHE_VERSION)));
+    message_guid_import(&record->guid, buf+OFFSET_MESSAGE_GUID);
+#ifdef HAVE_LONG_LONG_INT
+    record->modseq = ntohll(*((bit64 *)(buf+OFFSET_MODSEQ_64)));
+#else
+    record->modseq = ntohl(*((bit32 *)(buf+OFFSET_MODSEQ)));
+#endif
+    return 0;
+}
+
+/* ---------------------------------------------------------------------- */
+
 /*
  * Reconstruct the single mailbox named 'name'
  */
 int reconstruct(char *name, struct discovered *found)
 {
-    char buf[((INDEX_HEADER_SIZE > INDEX_RECORD_SIZE) ?
-	     INDEX_HEADER_SIZE : INDEX_RECORD_SIZE)];
+    indexbuffer_t ibuf;
+    unsigned char *buf = ibuf.buf;
     char quota_root[MAX_MAILBOX_PATH+1];
     bit32 valid_user_flags[MAX_USER_FLAGS/32];
 
     struct mailbox mailbox;
 
+    int expunge_fd = -1;
+    const char *expunge_base = NULL;
+    unsigned long expunge_len = 0;
+    unsigned long expunge_exists = 0;
+    struct uiditem *expunge_uidmap = NULL;
+    unsigned long expunge_size = 0;
+    unsigned expmsg;
+    
     int r = 0;
     int i, n, hasquota, flag;
     int format = MAILBOX_FORMAT_NORMAL;
 
     char *p;
 
-    char fnamebuf[MAX_MAILBOX_PATH+1], newfnamebuf[MAX_MAILBOX_PATH+1];
-    FILE *newindex, *msgfile;
+    char fnamebuf[MAX_MAILBOX_PATH+1];
+    FILE *newindex = NULL, *newexpunge = NULL, *msgfile = NULL;
     DIR *dirp;
     struct dirent *dirent;
     struct stat sbuf;
-    int newcache_fd;
-
-    unsigned long *uid;
-    int uid_num, uid_alloc;
-
-    unsigned long *expuid;
-    int expuid_num;
-    int expmsg;
-
-    int msg, old_msg = 0;
-    int new_exists = 0, 
-	new_answered = 0,
-	new_flagged = 0,
-	new_deleted = 0;
+    int newcache_fd = -1;
+
+    unsigned long *uid = NULL;
+    unsigned uid_num, uid_alloc;
+    unsigned msg, oldmsg;
+
+    struct reconstruct_counts index_counts;
+    struct reconstruct_counts expunge_counts;
 
     char *list_acl, *list_part;
     int list_type;
 
-    uquota_t new_quota = 0;
-
-    struct index_record message_index, old_index;
-    static struct index_record zero_index;
+    struct index_record message_index, tmp_index, old_index;
     struct body *body = NULL;
 
     char *mypath, *mympath, *mypart, *myacl;
     int mytype;
     char mbpath[MAX_MAILBOX_PATH+1], *path;
     
-    int expunge_found;
+    int expunge_found, index_found;
     char unique_buf[32];
 
     /* Start by looking up current data in mailbox list */
@@ -773,6 +847,7 @@
     mailbox.header_lock_count = 1;
     
     if (chdir(mailbox.path) == -1) {
+        mailbox_close(&mailbox);
 	return IMAP_IOERROR;
     }
     
@@ -802,16 +877,25 @@
 
     /* Verify ACL and update mboxlist if needed */
     r = mailbox_read_header_acl(&mailbox);
-    if (r) return r;
+    if (r) {
+        mailbox_close(&mailbox);
+        return r;
+    }
 
     r = mboxlist_detail(name, &list_type, NULL, NULL,
 			&list_part, &list_acl, NULL);
-    if (r) return r;
+    if (r) {
+        mailbox_close(&mailbox);
+        return r;
+    }
 
     if(strcmp(list_acl, mailbox.acl)) {
 	r = mboxlist_update(name, list_type, list_part, mailbox.acl, 0);
     }
-    if(r) return r;
+    if (r) {
+        mailbox_close(&mailbox);
+        return r;
+    }
 
     /* Attempt to open/lock index */
     r = mailbox_open_index(&mailbox);
@@ -831,57 +915,92 @@
     mailbox.index_lock_count = 1;
     mailbox.pop3_last_login = 0;
 
-    /* Create new index/cache files */
-    path = (mailbox.mpath &&
-	    (config_metapartition_files &
-	     IMAP_ENUM_METAPARTITION_FILES_INDEX)) ?
-	mailbox.mpath : mailbox.path;
-    strlcpy(fnamebuf, path, sizeof(fnamebuf));
-    strlcat(fnamebuf, FNAME_INDEX, sizeof(fnamebuf));
-    strlcat(fnamebuf, ".NEW", sizeof(fnamebuf));
-    newindex = fopen(fnamebuf, "w+");
-    if (!newindex) {
+    /* Open, lock and then map cyrus.expunge file if it exists */
+    r = reconstruct_open_expunge(&mailbox, &expunge_fd, &expunge_size);
+    if (r) {
 	mailbox_close(&mailbox);
 	return IMAP_IOERROR;
     }
-
-    path = (mailbox.mpath &&
-	    (config_metapartition_files &
-	     IMAP_ENUM_METAPARTITION_FILES_CACHE)) ?
-	mailbox.mpath : mailbox.path;
-    strlcpy(fnamebuf, path, sizeof(fnamebuf));
-    strlcat(fnamebuf, FNAME_CACHE, sizeof(fnamebuf));
-    strlcat(fnamebuf, ".NEW", sizeof(fnamebuf));
-    newcache_fd = open(fnamebuf, O_RDWR|O_TRUNC|O_CREAT, 0666);
-    if (newcache_fd == -1) {
-	fclose(newindex);
-	mailbox_close(&mailbox);
-	return IMAP_IOERROR;
+    if (expunge_fd != -1) {
+        map_refresh(expunge_fd, 1, &expunge_base, &expunge_len, expunge_size,
+                    "expunge", mailbox.name);
+        if (!reconstruct_header_isvalid(expunge_base, expunge_len)) {
+            map_free(&expunge_base, &expunge_len);
+            close(expunge_fd);
+            expunge_fd = -1;
+            syslog(LOG_ERR, "Unable to verify expunge header - deleting: %s",
+                   mailbox.name);
+            reconstruct_delete_single(&mailbox,
+                                      IMAP_ENUM_METAPARTITION_FILES_EXPUNGE,
+                                      FNAME_EXPUNGE_INDEX, NULL);
+        }
+    }
+    if (expunge_base && (expunge_len >= INDEX_HEADER_SIZE))
+        expunge_exists = ntohl(*((bit32 *)(expunge_base+OFFSET_EXISTS)));
+
+    /* expunge_uidmap is list of msgnos sorted in ascending UID */
+    if (expunge_exists > 0) {
+        unsigned msgno;
+
+        expunge_uidmap = xmalloc(expunge_exists * sizeof(struct uiditem));
+        
+        for (msgno = 1 ; msgno <= expunge_exists; msgno++) {
+            /* Can't use mailbox_read_index_record_from_mapped() safely */
+            r = reconstruct_read_index_record(mailbox.name,
+                                              expunge_base, expunge_len,
+                                              msgno, &message_index);
+            if (r) {
+                r = IMAP_IOERROR;
+                goto bail;
+            }
+            expunge_uidmap[msgno-1].msgno = msgno;
+            expunge_uidmap[msgno-1].uid   = message_index.uid;
+        }
+        qsort(expunge_uidmap, expunge_exists,
+              sizeof(struct uiditem), compare_uiditem);
+    }
+
+    if (!keepflag && (expunge_exists > 0))
+        reconstruct_clear_expunged(&mailbox, expunge_uidmap, expunge_exists);
+
+    /* Create new index/cache/expunge files */
+    reconstruct_make_path(fnamebuf, sizeof(fnamebuf), &mailbox,
+                          IMAP_ENUM_METAPARTITION_FILES_INDEX,
+                          FNAME_INDEX, ".NEW");
+    if ((newindex = fopen(fnamebuf, "w+")) == NULL) {
+        r = IMAP_IOERROR;
+        goto bail;
+    }
+    reconstruct_make_path(fnamebuf, sizeof(fnamebuf), &mailbox,
+                          IMAP_ENUM_METAPARTITION_FILES_CACHE,
+                          FNAME_CACHE, ".NEW");
+    if ((newcache_fd = open(fnamebuf, O_RDWR|O_TRUNC|O_CREAT, 0666)) == -1) {
+        r = IMAP_IOERROR;
+        goto bail;
+    }
+    reconstruct_make_path(fnamebuf, sizeof(fnamebuf), &mailbox,
+                          IMAP_ENUM_METAPARTITION_FILES_EXPUNGE,
+                          FNAME_EXPUNGE_INDEX, ".NEW");
+    if ((newexpunge = fopen(fnamebuf, "w+")) == NULL) {
+        r = IMAP_IOERROR;
+        goto bail;
     }
     
+    /* Create placeholder space for index/cache/expunge headers */
     memset(buf, 0, sizeof(buf));
     *((bit32 *)(buf+OFFSET_GENERATION_NO)) = htonl(mailbox.generation_no + 1);
     fwrite(buf, 1, INDEX_HEADER_SIZE, newindex);
+    fwrite(buf, 1, INDEX_HEADER_SIZE, newexpunge);
     retry_write(newcache_fd, buf, sizeof(bit32));
-
-    if (reconstruct_expunge ( path,  &mailbox, &expuid, &expuid_num) !=3D 0) {
-	fclose(newindex);
-	mailbox_close(&mailbox);
-	return IMAP_IOERROR;
-    }
 
     /* Find all message files in directory */
     uid = (unsigned long *) xmalloc(UIDGROW * sizeof(unsigned long));
     uid_num = 0;
     uid_alloc = UIDGROW;
     dirp = opendir(".");
-
     if (!dirp) {
-	fclose(newindex);
-	close(newcache_fd);
-	mailbox_close(&mailbox);
-	free(uid);
-	return IMAP_IOERROR;
+        r = IMAP_IOERROR;
+        goto bail;
     } 
 	while ((dirent = readdir(dirp))!=NULL) {
 	if (!isdigit((int) (dirent->d_name[0])) || dirent->d_name[0] == '0')
@@ -906,24 +1025,31 @@
 
 	qsort((char *)uid, uid_num, sizeof(*uid), compare_uid);
 
-    /* Put each message file in the new index/cache */
-    old_msg = 0;
-    old_index.uid = 0;
+    /* Put each message file in new index/cache or expunge/cache */
     mailbox.format = format;
-    if (mailbox.cache_fd) close(mailbox.cache_fd);
-    mailbox.cache_fd = newcache_fd;
-
+    reconstruct_counts_clear(&index_counts);
+    reconstruct_counts_clear(&expunge_counts);
+
+    memset(&tmp_index, 0, sizeof(struct index_record));
+    memset(&old_index, 0, sizeof(struct index_record));
+
+    old_index.uid  = 0;      /* Only valid after mailbox_read_index_record() */
+
+    oldmsg = 0;
+    expmsg = 0;
     for (msg = 0; msg < uid_num; msg++) {
 	char msgfname[MAILBOX_FNAME_LEN+1];
 
-	message_index = zero_index;
+        memset(&message_index, 0, sizeof(struct index_record));
 	message_index.uid = uid[msg];
 	
-	mailbox_message_get_fname(&mailbox, uid[msg], msgfname, sizeof(msgfname));
+	mailbox_message_get_fname(&mailbox, uid[msg],
+                                  msgfname, sizeof(msgfname));
 	msgfile = fopen(msgfname, "r");
 	if (!msgfile) {
-	    fprintf(stderr, "reconstruct: fopen() failed for '%s' [error=%d] -- skipping.\n",
-		    msgfname, errno);
+	    fprintf(stderr,
+                    ("reconstruct: fopen() failed for '%s' "
+                     "[error=%d] -- skipping.\n"), msgfname, errno);
 	    continue;
 	}
 
@@ -938,161 +1064,157 @@
 	    continue;
 	}
 
-        /* Check if this message is on the expunge list */
+        /* Was this message expunged? */
+        while ((expmsg < expunge_exists) &&
+               (expunge_uidmap[expmsg].uid < uid[msg]))
+            expmsg++;
+
         expunge_found = 0;
-        for (expmsg = 0; expmsg < expuid_num; expmsg++) {
-            if (uid[msg] == expuid [expmsg]) {
+        if ((expmsg < expunge_exists) &&
+            (expunge_uidmap[expmsg].uid == uid[msg])) {
                 expunge_found = 1;
-                break;
-            }
-            if (uid[msg] > expuid [expmsg]) {
-                break;
+        }
+            
+        /* Does this message have index record in cyrus.index or expunge? */
+        index_found = 0;
+	if (expunge_found) {
+            unsigned msgno = expunge_uidmap[expmsg].msgno;
+            
+            if ((msgno > 0) && !reconstruct_read_index_record
+                (mailbox.name, expunge_base, expunge_len, msgno, &tmp_index))
+                index_found = 1;
+            expmsg++;
+        } else {
+	    while (oldmsg < mailbox.exists && old_index.uid < uid[msg]) {
+		if (mailbox_read_index_record(&mailbox, ++oldmsg,
+                                              &old_index)) {
+		old_index.uid = 0;
+	    }
+	}
+	if (old_index.uid == uid[msg]) {
+                memcpy(&tmp_index, &old_index, sizeof(struct index_record));
+                index_found = 1;
             }
         }
-        if ( expunge_found == 0 ) {
-            
-
-	/* Find old index record, if it exists */
-	while (old_msg < mailbox.exists && old_index.uid < uid[msg]) {
-	    if (mailbox_read_index_record(&mailbox, ++old_msg, &old_index)) {
-		old_index.uid = 0;
-	    }
-	}
-
-	if (old_index.uid == uid[msg]) {
+
+        if (index_found) {
 	    /* Use data in old index file, subject to validity checks */
-	    message_index.internaldate = old_index.internaldate;
-	    message_index.modseq = old_index.modseq;
+            message_index.internaldate = tmp_index.internaldate;
+            message_index.last_updated = tmp_index.last_updated;
+
+            message_index.modseq = tmp_index.modseq;
 	    /* This should never happen, but bugs in 2.3.4 and 2.3.5
 	     * could have left modseq blank.  If so, update it */
 	    if (!message_index.modseq) message_index.modseq = 1;
-	    message_index.system_flags = old_index.system_flags &
+            message_index.system_flags = tmp_index.system_flags &
 	      (FLAG_ANSWERED|FLAG_FLAGGED|FLAG_DELETED|FLAG_DRAFT);
 	    for (i = 0; i < MAX_USER_FLAGS/32; i++) {
 		message_index.user_flags[i] =
-		  old_index.user_flags[i] & valid_user_flags[i];
-	    }
-            /* Copy across MessageUUID if confident that data on disk */
-            message_uuid_copy(&message_index.uuid, &old_index.uuid);
-	}
-	else {
+                    tmp_index.user_flags[i] & valid_user_flags[i];
+	}
+            /* Copy across MessageGUID if confident that data on disk */
+            message_guid_copy(&message_index.guid, &tmp_index.guid);
+        } else {
 	    /* Message file write time is good estimate of internaldate */
 	    message_index.internaldate = sbuf.st_mtime;
+            message_index.last_updated = time(0);
 	    /* If we are recovering a message, assume new UIDL
 	       so that stupid clients will retrieve this message */
 	    mailbox.options |= OPT_POP3_NEW_UIDL;
-            /* Wipe the Message UUID */
-            message_uuid_set_null(&message_index.uuid);
+            /* Wipe the Message GUID */
+            message_guid_set_null(&message_index.guid);
 	    /* If we are recovering a message, reset MODSEQ */
 	    message_index.modseq = 1;
 	}
 
-	message_index.last_updated = time(0);
 	if (message_index.modseq > mailbox.highestmodseq) {
 	    mailbox.highestmodseq = message_index.modseq;
 	}
 	
-	}	
+	/* Force rebuild from message_create_record() */
+	if (guid_set) message_guid_set_null(&message_index.guid);
+
+	/* NB: message_create_record() will reconstruct GUID if NULL */
 	if (((r = message_parse_file(msgfile, NULL, NULL, &body)) != 0) ||
-	    ((r = message_create_record(&mailbox, &message_index, body)) !=
3D 0)) {
-	    fclose(msgfile);
-	    fclose(newindex);
-	    mailbox_close(&mailbox);
-	    free(uid);
-	    if (expuid_num) { 
-		free(expuid);
-	    }
-	    return r;
+	    ((r = message_create_record(mailbox.name, newcache_fd,
+					&message_index, body)) != 0)) {
+            r = IMAP_IOERROR;
+            goto bail;
 	}
 	fclose(msgfile);
 	if (body) message_free_body(body);
 	
-	if (expunge_found == 0) {	
+        /* Clear out existing or regenerated GUID */
+        if (guid_clear) message_guid_set_null(&message_index.guid);
+
+	if (expunge_found && keepflag) {
+            /* Write out new entry in expunge file */
+            reconstruct_counts_update(&expunge_counts, &message_index);
+            mailbox_index_record_to_buf(&message_index, buf);
+            n = fwrite(buf, 1, INDEX_RECORD_SIZE, newexpunge);
+        } else {
 	/* Write out new entry in index file */
+            reconstruct_counts_update(&index_counts, &message_index);
 	mailbox_index_record_to_buf(&message_index, buf);
-
 	n = fwrite(buf, 1, INDEX_RECORD_SIZE, newindex);
-	if (n != INDEX_RECORD_SIZE) {
-	    fclose(newindex);
-	    mailbox_close(&mailbox);
-	    free(uid);
-		if (expuid_num) { 
-		    free(expuid);
-		}
-	    return IMAP_IOERROR;
-	}
-	new_exists++;
-	if (message_index.system_flags & FLAG_ANSWERED) new_answered++;
-	if (message_index.system_flags & FLAG_FLAGGED) new_flagged++;
-	if (message_index.system_flags & FLAG_DELETED) new_deleted++;
-	new_quota += message_index.size;
-    }
-    }
-    if (expuid_num) {
-	free (expuid);
-    }
-
+    }
+
+        if (n != INDEX_RECORD_SIZE) {
+            r = IMAP_IOERROR;
+            goto bail;
+    }
+    }
+
+    /* Write out new index and expunge file headers */
+    if (uid_num && mailbox.last_uid < uid[uid_num-1])
+	mailbox.last_uid = uid[uid_num-1] + 100;
+    if (mailbox.last_appenddate == 0 || mailbox.last_appenddate > time(0))
+	mailbox.last_appenddate = time(0);
+    if (mailbox.uidvalidity == 0 || mailbox.uidvalidity > (unsigned) time(0))
+	mailbox.uidvalidity = time(0);
+
+    rewind(newindex);
+    reconstruct_counts_tobuf(buf, &mailbox, &index_counts);
+    n = fwrite(buf, 1, INDEX_HEADER_SIZE, newindex);
+    if (n != INDEX_HEADER_SIZE) {
+        r = IMAP_IOERROR;
+        goto bail;
+    }
+    rewind(newexpunge);
+    reconstruct_counts_tobuf(buf, &mailbox, &expunge_counts);
+    n = fwrite(buf, 1, INDEX_HEADER_SIZE, newexpunge);
+    if (n != INDEX_HEADER_SIZE) {
+        r = IMAP_IOERROR;
+        goto bail;
+    }
+
+    fflush(newindex);
+    fflush(newexpunge);
+    if (ferror(newindex) || ferror(newexpunge) || fsync(newcache_fd) ||
+        fsync(fileno(newindex)) || fsync(fileno(newexpunge))) {
+        r = IMAP_IOERROR;
+        goto bail;
+    }
+
+    /* Free temporary resources now that the index/expunge update is done */
+    close(newcache_fd);
+    fclose(newexpunge);
+    fclose(newindex);
+
+    if (expunge_base)    map_free(&expunge_base, &expunge_len);
+    if (expunge_fd >= 0) close(expunge_fd);
+    if (expunge_uidmap)  free(expunge_uidmap);
+    if (uid)  free(uid);
     if (body) free(body);
-    
-    /* Write out new index file header */
-    rewind(newindex);
-    if (uid_num && mailbox.last_uid < uid[uid_num-1]) {
-	mailbox.last_uid = uid[uid_num-1] + 100;
-    }
-    if (mailbox.last_appenddate == 0 || mailbox.last_appenddate > time(0)) {
-	mailbox.last_appenddate = time(0);
-    }
-    if (mailbox.uidvalidity == 0 || mailbox.uidvalidity > time(0)) {
-	mailbox.uidvalidity = time(0);
-    }
-
-    free(uid);
-    *((bit32 *)(buf+OFFSET_GENERATION_NO)) = htonl(mailbox.generation_no + 1);
-    *((bit32 *)(buf+OFFSET_FORMAT)) = htonl(mailbox.format);
-    *((bit32 *)(buf+OFFSET_MINOR_VERSION)) = htonl(MAILBOX_MINOR_VERSION);
-    *((bit32 *)(buf+OFFSET_START_OFFSET)) = htonl(INDEX_HEADER_SIZE);
-    *((bit32 *)(buf+OFFSET_RECORD_SIZE)) = htonl(INDEX_RECORD_SIZE);
-    *((bit32 *)(buf+OFFSET_EXISTS)) = htonl(new_exists);
-    *((bit32 *)(buf+OFFSET_LAST_APPENDDATE)) = htonl(mailbox.last_appenddate);
-    *((bit32 *)(buf+OFFSET_LAST_UID)) = htonl(mailbox.last_uid);
-
-    /* quotas may be 64bit now */
-#ifdef HAVE_LONG_LONG_INT
-    *((bit64 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonll(new_quota);
-#else
-    /* zero the unused 32bits */
-    *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonl(0);
-    *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED)) = htonl(new_quota);
-#endif
-
-    *((bit32 *)(buf+OFFSET_POP3_LAST_LOGIN)) = htonl(mailbox.pop3_last_login);
-    *((bit32 *)(buf+OFFSET_UIDVALIDITY)) = htonl(mailbox.uidvalidity);
-    *((bit32 *)(buf+OFFSET_DELETED)) = htonl(new_deleted);
-    *((bit32 *)(buf+OFFSET_ANSWERED)) = htonl(new_answered);
-    *((bit32 *)(buf+OFFSET_FLAGGED)) = htonl(new_flagged);
-    *((bit32 *)(buf+OFFSET_MAILBOX_OPTIONS)) = htonl(mailbox.options);
-    *((bit32 *)(buf+OFFSET_LEAKED_CACHE)) = htonl(0);
-#ifdef HAVE_LONG_LONG_INT
-    *((bit64 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonll(mailbox.highestmodseq);
-#else
-    /* zero the unused 32bits */
-    *((bit32 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonl(0);
-    *((bit32 *)(buf+OFFSET_HIGHESTMODSEQ)) = htonl(mailbox.highestmodseq);
-#endif
-    *((bit32 *)(buf+OFFSET_SPARE0)) = htonl(0); /* RESERVED */
-    *((bit32 *)(buf+OFFSET_SPARE1)) = htonl(0); /* RESERVED */
-    *((bit32 *)(buf+OFFSET_SPARE2)) = htonl(0); /* RESERVED */
-    *((bit32 *)(buf+OFFSET_SPARE3)) = htonl(0); /* RESERVED */
-    *((bit32 *)(buf+OFFSET_SPARE4)) = htonl(0); /* RESERVED */
-
-    n = fwrite(buf, 1, INDEX_HEADER_SIZE, newindex);
-    fflush(newindex);
-    if (n != INDEX_HEADER_SIZE || ferror(newindex) 
-	|| fsync(fileno(newindex)) || fsync(newcache_fd)) {
-	fclose(newindex);
-	mailbox_close(&mailbox);
-	return IMAP_IOERROR;
-    }
+
+    expunge_base = NULL;
+    expunge_len = 0;
+    newexpunge = newindex = NULL;
+    uid = NULL;
+    body = NULL;
+    expunge_uidmap = NULL;
+    expunge_fd = -1;
+    newcache_fd = -1;
 
     /* validate uniqueid */
     if (!mailbox.uniqueid) {
@@ -1105,8 +1227,8 @@
     } else {
 	if (find_uniqid (mailbox.name, mailbox.uniqueid) != NULL ) {
     
-	    mailbox_make_uniqueid(mailbox.name, mailbox.uidvalidity, unique_buf,
-			      sizeof(unique_buf));
+	    mailbox_make_uniqueid(mailbox.name, mailbox.uidvalidity,
+                                  unique_buf, sizeof(unique_buf));
 	    free (mailbox.uniqueid);
 	    mailbox.uniqueid = xstrdup(unique_buf);
 	}
@@ -1116,53 +1238,46 @@
 			 mailbox.name, mailbox.uniqueid );
     }
     
-    
-    /* Write header */
+    /* Write header and commit replacement index/cache files.
+     *
+     * Do cyrus.index last as this blows away the index lock. In contrast
+     * mailbox_write_header() locks the new header file before it commits.
+     * That lock is only released on mailbox_close().
+     */
     r = mailbox_write_header(&mailbox);
+    if (!r)
+        r = reconstruct_rename_single(&mailbox,
+                                      IMAP_ENUM_METAPARTITION_FILES_CACHE,
+                                      FNAME_CACHE);
+    if (!r)
+        r = reconstruct_rename_single(&mailbox,
+                                      IMAP_ENUM_METAPARTITION_FILES_EXPUNGE,
+                                      FNAME_EXPUNGE_INDEX);
+    if (expunge_counts.newexists == 0) {
+        reconstruct_delete_single(&mailbox,
+                                  IMAP_ENUM_METAPARTITION_FILES_EXPUNGE,
+                                  FNAME_EXPUNGE_INDEX, NULL);
+    }
+    if (!r)
+        r = reconstruct_rename_single(&mailbox,
+                                      IMAP_ENUM_METAPARTITION_FILES_INDEX,
+                                      FNAME_INDEX);
     if (r) {
 	mailbox_close(&mailbox);
-	return r;
-    }
-
-    /* Rename new index/cache file in place */
-    path = (mailbox.mpath &&
-	    (config_metapartition_files &
-	     IMAP_ENUM_METAPARTITION_FILES_INDEX)) ?
-	mailbox.mpath : mailbox.path;
-    strlcpy(fnamebuf, path, sizeof(fnamebuf));
-    strlcat(fnamebuf, FNAME_INDEX, sizeof(fnamebuf));
-    strlcpy(newfnamebuf, fnamebuf, sizeof(newfnamebuf));
-    strlcat(newfnamebuf, ".NEW", sizeof(fnamebuf));
-    if (rename(newfnamebuf, fnamebuf)) {
-	fclose(newindex);
-	mailbox_close(&mailbox);
-	return IMAP_IOERROR;
-    }
-    path = (mailbox.mpath &&
-	    (config_metapartition_files &
-	     IMAP_ENUM_METAPARTITION_FILES_CACHE)) ?
-	mailbox.mpath : mailbox.path;
-    strlcpy(fnamebuf, path, sizeof(fnamebuf));
-    strlcat(fnamebuf, FNAME_CACHE, sizeof(fnamebuf));
-    strlcpy(newfnamebuf, fnamebuf, sizeof(newfnamebuf));
-    strlcat(newfnamebuf, ".NEW", sizeof(newfnamebuf));
-    if (rename(newfnamebuf, fnamebuf)) {
-	fclose(newindex);
-	mailbox_close(&mailbox);
-	return IMAP_IOERROR;
-    }
-    
-    fclose(newindex);
-    r = seen_reconstruct(&mailbox, (time_t)0, (time_t)0, (int (*)())0, (void *)0);
+	return (r);
+    }
+
+    r = seen_reconstruct(&mailbox,
+                         (time_t)0, (time_t)0, (int (*)())0, (void *)0);
     if (syncflag) {
 	sync_log_mailbox(mailbox.name);
     }
-
     mailbox_close(&mailbox);
 
     if (found) {
 	if (mympath &&
-	    (config_metapartition_files & IMAP_ENUM_METAPARTITION_FILES_HEADER) &&
+	    (config_metapartition_files &
+             IMAP_ENUM_METAPARTITION_FILES_HEADER) &&
 	    chdir(mympath) == -1) {
 	    return IMAP_IOERROR;
 	}
@@ -1209,100 +1324,19 @@
     }
 
     return r;
-}
-
-/* XXX  What is the stuff below used for?  Do we need to metadata-ize it? */
-
-/* List of directories to scan for mailboxes */
-struct todo {
-    char *name;
-    char *path;
-    char *partition;
-    struct todo *next;
-} *todo_head = 0, **todo_tail = &todo_head;
-
-void
-todo_append(name, path, partition)
-char *name;
-char *path;
-char *partition;
-{
-    struct todo *newentry;
-
-    newentry = (struct todo *)xmalloc(sizeof(struct todo));
-    newentry->name = name;
-    newentry->path = path;
-    newentry->partition = partition;
-    newentry->next = 0;
-    *todo_tail = newentry;
-    todo_tail = &newentry->next;
-}
-
-void
-todo_append_hashed(char *name, char *path, char *partition)
-{
-    DIR *dirp;
-    struct dirent *dirent;
-
-    dirp = opendir(path);
-    if (!dirp) {
-	fprintf(stderr, "reconstruct: couldn't open partition %s: %s\n", 
-		partition, strerror(errno));
-    } else while ((dirent = readdir(dirp))!=NULL) {
-	struct todo *newentry;
-
-	if (strchr(dirent->d_name, '.')) {
-	    continue;
-	}
-
-	newentry = (struct todo *)xmalloc(sizeof(struct todo));
-	newentry->name = xstrdup(name);
-	newentry->path = xmalloc(strlen(path) +
-				 strlen(dirent->d_name) + 2);
-	sprintf(newentry->path, "%s/%s", path, dirent->d_name);
-	newentry->partition = partition;
-	newentry->next = 0;
-	*todo_tail = newentry;
-	todo_tail = &newentry->next;
-    }
-}
-
-char *cleanacl(char *acl, char *mboxname)
-{
-    char owner[MAX_MAILBOX_NAME+1];
-    cyrus_acl_canonproc_t *aclcanonproc = 0;
-    char *p;
-    char *newacl;
-    char *identifier;
-    char *rights;
-
-    /* Rebuild ACL */
-    if ((p = mboxname_isusermailbox(mboxname, 0))) {
-	strlcpy(owner, p, sizeof(owner));
-	p = strchr(owner, '.');
-	if (p) *p = '\0';
-	aclcanonproc = mboxlist_ensureOwnerRights;
-    }
-    newacl = xstrdup("");
-    if (aclcanonproc) {
-	cyrus_acl_set(&newacl, owner, ACL_MODE_SET, ACL_ALL,
-		      (cyrus_acl_canonproc_t *)0, (void *)0);
-    }
-    for (;;) {
-	identifier = acl;
-	rights = strchr(acl, '\t');
-	if (!rights) break;
-	*rights++ = '\0';
-	acl = strchr(rights, '\t');
-	if (!acl) break;
-	*acl++ = '\0';
-
-	cyrus_acl_set(&newacl, identifier, ACL_MODE_SET,
-		      cyrus_acl_strtomask(rights), aclcanonproc,
-		      (void *)owner);
-    }
-
-    return newacl;
+
+ bail:
+    if (msgfile)          fclose(msgfile);
+    if (newindex)         fclose(newindex);
+    if (newexpunge)       fclose(newexpunge);
+    if (expunge_fd >= 0)  close(expunge_fd);
+    if (newcache_fd >= 0) close(newcache_fd);
+    if (uid)              free(uid);
+    if (expunge_uidmap)   free(expunge_uidmap);
+    if (expunge_base)     map_free(&expunge_base, &expunge_len);
+
+    mailbox_close(&mailbox);
+    return r;
 }
 
 /*

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslclient.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslclient.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslclient.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslclient.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* saslclient.c -- shared SASL code for server-server authentication
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: saslclient.c,v 1.19 2008/10/08 15:47:08 murch Exp $
  */
-
-/* $Id: saslclient.c,v 1.15 2006/11/30 17:11:20 murch Exp $ */
 
 #include <config.h>
 
@@ -226,7 +227,7 @@
 	clientout = NULL;
     }
     else if (!sendliteral &&
-	     ((strlen(cmdbuf) + clientoutlen + 3) > sasl_cmd->maxlen)) {
+	     ((int) (strlen(cmdbuf) + clientoutlen + 3) > sasl_cmd->maxlen)) {
 	/* initial response is too long for auth command,
 	   so wait for a server challenge before sending it */
 	goto noinitresp;
@@ -251,7 +252,7 @@
 
 	/* send to server */
 	if (sendliteral) {
-	    prot_printf(pout, "{%d+}\r\n", strlen(base64));
+	    prot_printf(pout, "{" SIZE_T_FMT "+}\r\n", strlen(base64));
 	    prot_flush(pout);
 	}
 	prot_printf(pout, "%s", base64);
@@ -291,15 +292,22 @@
 	    base64 = buf + strlen(sasl_cmd->cont);
 	}
 	else if (!sasl_cmd->cont && buf[0] == '{') {
-	    unsigned int litsize = atoi(buf+1);
+	    unsigned int n, litsize = atoi(buf+1);
 
 	    /* get actual literal data */
-	    if (!prot_fgets(buf, AUTH_BUF_SIZE, pin)) {
+	    litsize += 2; /* +2 for \r\n */
+	    p = buf;
+	    while (litsize) {
+		if (!(n = prot_read(pin, p, litsize))) {
 		if (sasl_result) *sasl_result = SASL_FAIL;
 		if (status) *status = "EOF from server";
 		return IMAP_SASL_PROTERR;
 	    }
-
+		litsize -= n;
+		p += n;
+	    }
+
+	    *p = '\0';
 	    base64 = buf;
 	}
 	else {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslclient.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslclient.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslclient.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslclient.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* saslclient.c -- shared SASL code for server-server authentication
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: saslclient.h,v 1.4 2008/04/22 13:11:18 murch Exp $
  */
-
-/* $Id: saslclient.h,v 1.2 2003/10/22 18:02:59 rjs3 Exp $ */
 
 #ifndef SASLCLIENT_H
 #define SASLCLIENT_H
@@ -60,6 +61,8 @@
     const char *cancel;	/* cancel auth string */
     char *(*parse_success)(char *str, const char **status);
 			/* [OPTIONAL] parse response for success data */
+    int auto_capa;      /* capability response sent automatically
+			   after AUTH with SASL security layer */
 };
 
 sasl_callback_t *mysasl_callbacks(const char *username,

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslserver.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslserver.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslserver.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/saslserver.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* saslserver.c -- shared SASL code for server-side authentication
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: saslserver.c,v 1.11 2008/03/24 17:09:19 murch Exp $
  */
-
-/* $Id: saslserver.c,v 1.10 2006/11/30 17:11:20 murch Exp $ */
 
 #include <config.h>
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/search_engines.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/search_engines.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/search_engines.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/search_engines.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* search_engines.c -- Prefiltering routines for SEARCH
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: search_engines.c,v 1.7 2007/02/05 18:41:48 jeaton Exp $
+ * $Id: search_engines.c,v 1.10 2008/03/24 17:09:19 murch Exp $
  */
 
 #include <config.h>
@@ -90,7 +91,7 @@
   int doc_UID, index;
 
   if (ch == 'v' && strncmp(doc_name, "validity.", 9) == 0) {
-    if (atoi(doc_name + 9) == r->mailbox->uidvalidity) {
+      if ((unsigned) atoi(doc_name + 9) == r->mailbox->uidvalidity) {
       r->found_validity = 1;
     }
     return -1;
@@ -115,7 +116,7 @@
   
   /* now we need to convert the UID to the message sequence number */
   index = index_finduid(doc_UID);
-  if (index < 1 || index > imapd_exists || doc_UID != index_getuid(index)) {
+  if (index < 1 || index > imapd_exists || doc_UID != (int) index_getuid(index)) {
     return -1;
   }
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/search_engines.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/search_engines.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/search_engines.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/search_engines.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* search_engines.h --  Prefiltering routines for SEARCH
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: search_engines.h,v 1.2 2003/02/13 20:15:30 rjs3 Exp $
+ * $Id: search_engines.h,v 1.3 2008/03/24 17:09:19 murch Exp $
  */
 
 #ifndef INCLUDED_SEARCH_ENGINES_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* seen.h -- abstract interface for /Recent and /Seen information
- * $Id: seen.h,v 1.14 2003/10/22 18:50:08 rjs3 Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,8 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: seen.h,v 1.16 2008/03/24 17:09:19 murch Exp $
  */
-
 
 #ifndef SEEN_H
 #define SEEN_H
@@ -79,7 +80,8 @@
 /* called on mailbox operations */
 int seen_create_mailbox(struct mailbox *mailbox);
 int seen_delete_mailbox(struct mailbox *mailbox);
-int seen_copy(struct mailbox *oldmailbox,struct mailbox *newmailbox);
+int seen_copy(struct mailbox *oldmailbox, struct mailbox *newmailbox,
+	      char *userid);
 
 /* called on user operations */
 int seen_create_user(const char *user);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_bigdb.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_bigdb.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_bigdb.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_bigdb.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* seen_bigdb.c -- implementation of seen database using one big cyrusdb
- * $Id: seen_bigdb.c,v 1.11 2006/11/30 17:11:20 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,12 +39,12 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: seen_bigdb.c,v 1.14 2008/03/24 17:09:19 murch Exp $
  */
 
 #include <config.h>
 
 #include <stdlib.h>
-#include <assert.h>
 #include <syslog.h>
 #include <string.h>
 #include <ctype.h>
@@ -58,6 +59,7 @@
 #include <sys/uio.h>
 #include "cyrusdb.h"
 
+#include "assert.h"
 #include "global.h"
 #include "xmalloc.h"
 #include "mailbox.h"
@@ -104,7 +106,7 @@
     strcpy(fname, config_dir);
     strcat(fname, FNAME_SEENDB);
 
-    r = DB->open(fname, CYRUSDB_CREATE, &bigdb);
+    r = (DB->open)(fname, CYRUSDB_CREATE, &bigdb);
     if (r != 0) {
 	syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
 	       cyrusdb_strerror(r));
@@ -385,7 +387,7 @@
     int r;
 
     if (seen_inited) {
-	r = DB->close(bigdb);
+	r = (DB->close)(bigdb);
 	if (r != 0) {
 	    syslog(LOG_ERR, "DBERROR: closing seen database: %s",
 		   cyrusdb_strerror(r));

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_db.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_db.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_db.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_db.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* seen_db.c -- implementation of seen database using per-user berkeley db
- * $Id: seen_db.c,v 1.51 2007/02/05 18:41:48 jeaton Exp $
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,12 +39,12 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: seen_db.c,v 1.60 2008/08/27 08:28:47 selsky Exp $
  */
 
 #include <config.h>
 
 #include <stdlib.h>
-#include <assert.h>
 #include <syslog.h>
 #include <string.h>
 #include <ctype.h>
@@ -62,12 +62,14 @@
 #include "bsearch.h"
 #include "util.h"
 
+#include "assert.h"
 #include "global.h"
 #include "xmalloc.h"
 #include "xstrlcpy.h"
 #include "xstrlcat.h"
 #include "mailbox.h"
 #include "imap_err.h"
+#include "statuscache.h"
 #include "seen.h"
 
 #define FNAME_SEENSUFFIX ".seen" /* per user seen state extension */
@@ -80,6 +82,7 @@
 
 struct seen {
     char *user;			/* what user is this for? */
+    const char *mboxname;	/* what mailbox name? */
     const char *uniqueid;	/* what mailbox? */
     const char *path;		/* where is this mailbox? */
     struct db *db;
@@ -111,15 +114,15 @@
     char c, *domain;
 
     if (config_virtdomains && (domain = strchr(userid, '@'))) {
-	char d = (char) dir_hash_c(domain+1);
+	char d = (char) dir_hash_c(domain+1, config_fulldirhash);
 	*domain = '\0';  /* split user at domain */
-	c = (char) dir_hash_c(userid);
+	c = (char) dir_hash_c(userid, config_fulldirhash);
 	sprintf(fname, "%s%s%c/%s%s%c/%s%s", config_dir, FNAME_DOMAINDIR, d,
 		domain+1, FNAME_USERDIR, c, userid, FNAME_SEENSUFFIX);
 	*domain = '@';  /* reassemble user at domain */
     }
     else {
-	c = (char) dir_hash_c(userid);
+	c = (char) dir_hash_c(userid, config_fulldirhash);
 	sprintf(fname, "%s%s%c/%s%s", config_dir, FNAME_USERDIR, c, userid,
 		FNAME_SEENSUFFIX);
     }
@@ -147,6 +150,7 @@
     /* if this is the db we've already opened, return it */
     if (seendb && !strcmp(seendb->user, user)) {
 	abortcurrent(seendb);
+	seendb->mboxname = mailbox->name;
 	seendb->uniqueid = mailbox->uniqueid;
 	seendb->path = mailbox->path;
 	*seendbptr = seendb;
@@ -157,7 +161,7 @@
     /* otherwise, close the existing database */
     if (seendb) {
 	abortcurrent(seendb);
-	r = DB->close(seendb->db);
+	r = (DB->close)(seendb->db);
 	if (r) {
 	    syslog(LOG_ERR, "DBERROR: error closing seendb: %s", 
 		   cyrusdb_strerror(r));
@@ -170,7 +174,7 @@
 
     /* open the seendb corresponding to user */
     fname = seen_getpath(user);
-    r = DB->open(fname, (flags & SEEN_CREATE) ? CYRUSDB_CREATE : 0,
+    r = (DB->open)(fname, (flags & SEEN_CREATE) ? CYRUSDB_CREATE : 0,
 		 &seendb->db);
     if (r != 0) {
 	int level = (flags & SEEN_CREATE) ? LOG_ERR : LOG_DEBUG;
@@ -185,6 +189,7 @@
     free(fname);
 
     seendb->tid = NULL;
+    seendb->mboxname = mailbox->name;
     seendb->uniqueid = mailbox->uniqueid;
     seendb->path = mailbox->path;
     seendb->user = xstrdup(user);
@@ -386,6 +391,9 @@
 	break;
     }
 
+    /* Something changed, kill our status cache for this mailbox */
+    statuscache_invalidate(seendb->mboxname, seendb->user);
+
     free(data);
     return r;
 }
@@ -408,6 +416,7 @@
 	seendb->tid = NULL;
     }
 
+    seendb->mboxname = NULL;
     seendb->uniqueid = NULL;
     seendb->path = NULL;
 
@@ -416,7 +425,7 @@
 
 	/* free the old database hanging around */
 	abortcurrent(lastseen);
-	r = DB->close(lastseen->db);
+	r = (DB->close)(lastseen->db);
 	if (r != CYRUSDB_OK) {
 	    syslog(LOG_ERR, "DBERROR: error closing lastseen: %s",
 		   cyrusdb_strerror(r));
@@ -479,7 +488,7 @@
     /* erp! */
     r = unlink(fname);
     if (r < 0 && errno == ENOENT) {
-	syslog(LOG_DEBUG, "can not unlink %s: %m", fname);
+	syslog(LOG_DEBUG, "cannot unlink %s: %m", fname);
 	/* but maybe the user just never read anything? */
 	r = 0;
     }
@@ -511,11 +520,35 @@
     return r;
 }
 
-int seen_copy(struct mailbox *oldmailbox, struct mailbox *newmailbox)
-{
-    if (SEEN_DEBUG) {
-	syslog(LOG_DEBUG, "seen_db: seen_copy(%s, %s)",
-	       oldmailbox->uniqueid, newmailbox->uniqueid);
+int seen_copy(struct mailbox *oldmailbox, struct mailbox *newmailbox,
+	      char *userid)
+{
+    if (SEEN_DEBUG) {
+	syslog(LOG_DEBUG, "seen_db: seen_copy(%s, %s, %s)",
+	       oldmailbox->uniqueid, newmailbox->uniqueid,
+	       userid ? userid : "");
+    }
+
+    if (userid && strcmp(oldmailbox->uniqueid, newmailbox->uniqueid)) {
+	int r;
+	struct seen *seendb;
+	time_t last_read, last_change;
+	unsigned last_uid;
+	char *seenuids = NULL;
+
+	r = seen_open(oldmailbox, userid, 0, &seendb);
+	if (r) return r;
+    
+	r = seen_lockread(seendb, &last_read, &last_uid, &last_change, &seenuids);
+	if (r) goto done;
+
+	seendb->uniqueid = newmailbox->uniqueid;
+	r = seen_write(seendb, last_read, last_uid, last_change, seenuids);
+
+      done:
+	if (seenuids) free(seenuids);
+	seen_close(seendb);
+	return r;
     }
 
     /* noop */
@@ -555,7 +588,7 @@
 
     if (lastseen) {
 	abortcurrent(lastseen);
-	r = DB->close(lastseen->db);
+	r = (DB->close)(lastseen->db);
 	if (r) {
 	    syslog(LOG_ERR, "DBERROR: error closing lastseen: %s",
 		   cyrusdb_strerror(r));
@@ -653,24 +686,26 @@
     struct seen_merge_rock rock;
 
     /* xxx does this need to be CYRUSDB_CREATE? */
-    r = DB->open(tmpfile, CYRUSDB_CREATE, &tmp);
+    r = (DB->open)(tmpfile, CYRUSDB_CREATE, &tmp);
     if(r) goto done;
 	    
-    r = DB->open(tgtfile, CYRUSDB_CREATE, &tgt);
+    r = (DB->open)(tgtfile, CYRUSDB_CREATE, &tgt);
     if(r) goto done;
 
     rock.db = tgt;
     rock.tid = NULL;
     
-    r = DB->foreach(tmp, "", 0, NULL, seen_merge_cb, &rock, &rock.tid);
-
+    r = DB->foreach(tmp, "", 0, NULL, seen_merge_cb, &rock, NULL);
+
+    if (rock.tid) {
     if(r) DB->abort(rock.db, rock.tid);
     else DB->commit(rock.db, rock.tid);
+    }
 
  done:
 
-    if(tgt) DB->close(tgt);
-    if(tmp) DB->close(tmp);
+    if(tgt) (DB->close)(tgt);
+    if(tmp) (DB->close)(tmp);
     
     return r;
 }

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_local.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_local.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_local.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/seen_local.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* seen_local.c -- Storage for /Recent and /Seen state on local filesystem
- * $Id: seen_local.c,v 1.44 2006/11/30 17:11:20 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: seen_local.c,v 1.45 2008/03/24 17:09:19 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/setproctitle.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/setproctitle.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/setproctitle.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/setproctitle.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* setproctitle -- set process title shown by ps(1)
- $Id: setproctitle.c,v 1.16 2003/02/13 20:15:30 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: setproctitle.c,v 1.17 2008/03/24 17:09:19 murch Exp $
  */
 /*
  * Copyright (c) 1983, 1995 Eric P. Allman

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/signals.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/signals.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/signals.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/signals.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* signals.c -- signal handling functions to allow clean shutdown
-
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,8 +38,9 @@
  * 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.
+ *
+ * $Id: signals.c,v 1.16 2008/10/08 13:12:41 wescraig Exp $
  */
-/* $Id: signals.c,v 1.14 2006/11/30 17:11:20 murch Exp $ */
 
 #include <config.h>
 
@@ -50,7 +52,7 @@
 #include "xmalloc.h"
 #include "exitcodes.h"
 
-static int gotsignal = 0;
+static volatile sig_atomic_t gotsignal = 0;
 
 static void sighandler(int sig)
 {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/signals.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/signals.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/signals.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/signals.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* signals.h -- signal handling functions to allow clean shutdown
-
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,8 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: signals.h,v 1.3 2008/03/24 17:09:19 murch Exp $
  */
-/* $Id: signals.h,v 1.2 2006/11/30 17:11:20 murch Exp $ */
 
 #ifndef INCLUDED_SIGNALS_H
 #define INCLUDED_SIGNALS_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smmapd.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smmapd.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smmapd.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smmapd.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,6 +38,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: smmapd.c,v 1.21 2008/10/08 15:47:08 murch Exp $
+ *
  * smmapd.c -- sendmail socket map daemon
  *
  *
@@ -71,8 +74,6 @@
  * In case of errors (status TEMP, TIMEOUT or PERM) the result field
  * may contain an explanatory message.
  *
- *
- * $Id: smmapd.c,v 1.15 2007/02/05 18:41:48 jeaton Exp $
  */
 
 #include <config.h>
@@ -115,13 +116,30 @@
 extern void setproctitle_init(int argc, char **argv, char **envp);
 int begin_handling(void);
 
+void smmapd_reset(void)
+{
+    if (map_in) {
+	/* Flush the incoming buffer */
+	prot_NONBLOCK(map_in);
+	prot_fill(map_in);
+	prot_free(map_in);
+    }
+
+    if (map_out) {
+	/* Flush the outgoing buffer */
+	prot_flush(map_out);
+	prot_free(map_out);
+    }
+
+    map_in = map_out = NULL;
+
+    cyrus_reset_stdio(); 
+}
+
 void shut_down(int code) __attribute__((noreturn));
 void shut_down(int code)
 {
-    if (map_in) prot_free(map_in);
-    if (map_out) prot_free(map_out);
-
-    cyrus_reset_stdio(); 
+    smmapd_reset();
 
     mboxlist_close();
     mboxlist_done();
@@ -191,16 +209,16 @@
 		 char **argv __attribute__((unused)),
 		 char **envp __attribute__((unused)))
 {
-    int r; 
 
     map_in = prot_new(0, 0);
     map_out = prot_new(1, 1);
     prot_setflushonread(map_in, map_out);
     prot_settimeout(map_in, 360);
 
-    r = begin_handling();
-
-    shut_down(r);
+    if (begin_handling() != 0) shut_down(0);
+
+    /* prepare for new connection */
+    smmapd_reset();
     return 0;
 }
 
@@ -273,7 +291,8 @@
         char *host;
         struct sockaddr_in sin,sfrom;
         char buf[512];
-        int soc, x, rc;
+        int soc, rc;
+	socklen_t x;
 
 	/*
 	 * check to see if mailbox exists and we can append to it:
@@ -335,7 +354,7 @@
                return r;
             }
 
-            sprintf(buf,"%d:cyrus %s,%c",strlen(key)+6,key,4);
+            sprintf(buf,SIZE_T_FMT ":cyrus %s,%c",strlen(key)+6,key,4);
             sendto(soc,buf,strlen(buf),0,(struct sockaddr *)&sin,sizeof(sin));
 
             x = sizeof(sfrom);
@@ -361,6 +380,10 @@
     return r;
 }
 
+/*
+ * begin_handling: handle requests on a single connection.
+ * returns non-zero if requested to stop handling new connections (SIGHUP)
+ */
 #define MAXREQUEST 1024		/* XXX  is this reasonable? */
 
 int begin_handling(void)
@@ -376,7 +399,7 @@
 
 	if (signals_poll() == SIGHUP) {
 	    /* caught a SIGHUP, return */
-	    return 0;
+	    return 1;
 	}
 
 	while (isdigit(c)) {
@@ -426,17 +449,17 @@
             break;
 
 	case 0:
-	    prot_printf(map_out, "%d:OK %s,", 3+strlen(key), key);
+	    prot_printf(map_out, SIZE_T_FMT ":OK %s,", 3+strlen(key), key);
 	    break;
 
 	case IMAP_MAILBOX_NONEXISTENT:
-	    prot_printf(map_out, "%d:NOTFOUND %s,",
+	    prot_printf(map_out, SIZE_T_FMT ":NOTFOUND %s,",
 			9+strlen(error_message(r)), error_message(r));
 	    break;
 
 	case IMAP_QUOTA_EXCEEDED:
 	    if (!config_getswitch(IMAPOPT_LMTP_OVER_QUOTA_PERM_FAILURE)) {
-		prot_printf(map_out, "%d:TEMP %s,", strlen(error_message(r))+5,
+		prot_printf(map_out, SIZE_T_FMT ":TEMP %s,", strlen(error_message(r))+5,
 			    error_message(r));
 		break;
 	    }
@@ -444,11 +467,11 @@
 
 	default:
 	    if (errstring)
-		prot_printf(map_out, "%d:PERM %s (%s),",
+		prot_printf(map_out, SIZE_T_FMT ":PERM %s (%s),",
 			    5+strlen(error_message(r))+3+strlen(errstring),
 			    error_message(r), errstring);
 	    else
-		prot_printf(map_out, "%d:PERM %s,",
+		prot_printf(map_out, SIZE_T_FMT ":PERM %s,",
 			    5+strlen(error_message(r)), error_message(r));
 	    break;
 	}

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smtpclient.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smtpclient.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smtpclient.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smtpclient.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* smtpclient.c -- Routines for sending a message via SMTP
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: smtpclient.c,v 1.2 2003/10/22 18:02:59 rjs3 Exp $
+ * $Id: smtpclient.c,v 1.3 2008/03/24 17:09:19 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smtpclient.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smtpclient.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smtpclient.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/smtpclient.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* smtpclient.h -- Routines for sending a message via SMTP
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: smtpclient.h,v 1.2 2003/10/22 18:02:59 rjs3 Exp $
+ * $Id: smtpclient.h,v 1.3 2008/03/24 17:09:19 murch Exp $
  */
 
 #ifndef INCLUDED_SMTPCLIENT_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/spool.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/spool.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/spool.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/spool.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* spool.c -- Routines for spooling/parsing messages from a prot stream
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: spool.c,v 1.9 2006/11/30 17:11:20 murch Exp $
+ * $Id: spool.c,v 1.14 2008/03/24 17:09:19 murch Exp $
  */
 
 #include <config.h>
@@ -50,9 +49,9 @@
 #endif
 #include <stdio.h>
 #include <string.h>
-#include <assert.h>
 #include <ctype.h>
 
+#include "assert.h"
 #include "spool.h"
 #include "prot.h"
 #include "util.h"
@@ -291,7 +290,7 @@
 
  ph_error:
     /* put the last character back; we'll copy it later */
-    prot_ungetc(c, fin);
+    if (c != EOF) prot_ungetc(c, fin);
 
     /* and we didn't get a header */
     if (headname != NULL) *headname = NULL;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/spool.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/spool.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/spool.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/spool.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* spool.h -- Routines for spooling/parsing messages from a prot stream
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: spool.h,v 1.5 2006/11/30 17:11:20 murch Exp $
+ * $Id: spool.h,v 1.6 2008/03/24 17:09:19 murch Exp $
  */
 
 #ifndef INCLUDED_SPOOL_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,7 @@
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* SQUAT code for searching indexes.
+ *  Robert O'Callahan
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,13 +40,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: squat.c,v 1.8 2006/11/30 17:11:20 murch Exp $
+ * $Id: squat.c,v 1.11 2008/03/24 17:09:19 murch Exp $
  */
-
-/*
-  SQUAT code for searching indexes.
-  Robert O'Callahan
-*/
 
 #include <config.h>
 
@@ -52,10 +50,10 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
 
 #include "squat_internal.h"
 
+#include "assert.h"
 #include "xmalloc.h"
 
 struct _SquatSearchIndex {
@@ -613,3 +611,344 @@
   free(index);
   return r;
 }
+
+/* ====================================================================== */
+
+/* squat_scan(SquatSearchIndex* index, char first_char
+ *            SquatScanCallback handler, void* closure)
+ *
+ * sweeps the entire subtrie for a given starting character. It generates
+ * callbacks to the hander routine (which has it own opaque data structure
+ * in closure) for each document ID that it finds in the leaves. The
+ * callback function looks something like:
+ *
+ *   int add_word_callback(void* closure, char *name, int doc_ID);
+ *
+ * "name" is the full four character squat "word", including first_char and
+ * a trailing '\0', just in case you want to print it. doc_ID is the
+ * normal squat doc_ID offset.
+ *
+ * squat_scan_recurse() and squat_scan_leaf() are helper functions to
+ * scan the entire trie. squat_find_branch() is used to find the initial
+ * subtrie for a given first_char.
+ *
+ */
+
+static int squat_scan_leaf(char const* doc_list, char *name,
+                           SquatScanCallback handler, void* closure)
+{
+  int i;
+
+  i = (int)squat_decode_I(&doc_list);
+  if ((i & 1) != 0) {
+    handler(closure, name, i >> 1);
+  } else {
+    int size = i >> 1;
+    char const* s = doc_list;
+    int last_doc = 0;
+    
+    while (s - doc_list < size) {
+      i = (int)squat_decode_I(&s);
+      if ((i & 1) == 1) {
+        last_doc = last_doc + (i >> 1);
+        handler(closure, name, last_doc);
+      } else {
+        int count = i >> 1;
+        int delta = squat_decode_I(&s);
+              
+        last_doc += delta;
+        handler(closure, name, last_doc);
+        while (--count > 0) {
+          last_doc++;
+          handler(closure, name, last_doc);
+        }
+      }
+    }
+  }
+  return(SQUAT_OK);
+}
+
+static int squat_scan_recurse(char const* s, char const* data_end,
+                              char *name, int level,
+                              SquatScanCallback handler, void* closure)
+{
+  int r = SQUAT_OK;
+  char p;
+  char const* branch_start = s;
+  char const* start_of_list;
+  int skip;
+  char count;
+  char const* base;
+  int offset, j;
+  int next_offset;
+  int ch;
+
+  /* Ignore empty subtrees generated by old versions of squatter */
+  if ((s[0] == 0) && (s[1] == 0))
+    return(SQUAT_OK);
+
+  p = *s++;
+  if ((p & 0xE0) != 0) {
+    /* Byte >= 0x20 (ASCII SPACE) indicates singleton list */
+
+    name[level] = p;
+    if (level < (SQUAT_WORD_SIZE-1)) {
+      next_offset = squat_decode_I(&s);
+      s = branch_start - next_offset;
+      if (next_offset < 0 || s >= data_end) {
+        return(SQUAT_ERR);
+      }
+      r = squat_scan_recurse(s, data_end, name, level+1, handler, closure);
+    } else {
+      r = squat_scan_leaf(s, name, handler, closure);
+    }
+    return(r);
+  }
+
+  count = (*s++) + 1;   /* +1 to allow range 1..32 using (*s) < 32 */
+  base = s;
+  s += count;
+  start_of_list = s;       /* So that we can repeat */
+
+  /* Up to 256 subtree branches, determined by variable length bitmask
+   * which is up to 32 bytes (plus two lead in bytes).
+   *      p*8  : First p*8 branches all empty, can be ignored
+   *  count*8  : Size of base array, in bits
+   *
+   *
+   * Should be able to optimise following into linear scan,
+   * without returning to start_of_list each time around the loop
+   */
+
+  for (ch = 8*p; ch < 8*(p+count) && r == SQUAT_OK; ch++) {
+    offset = (unsigned char)ch/8 - p;
+    if ((base[offset] & (1 << (ch & 7))) == 0) /* not in list */
+      continue;
+
+    /* figure out how many entries there are before our entry */
+    skip = 0;
+    for (j = 0; j < offset; j++) {
+      skip += bit_counts[(unsigned char)base[j]];
+    }
+    for (j = 0; j < (ch & 7); j++) {
+      if ((base[offset] & (1 << j)) != 0) {
+        skip++;
+      }
+    }
+    s = start_of_list;
+    
+    name[level] = ch;
+    if (level < (SQUAT_WORD_SIZE-1)) {
+      s = squat_decode_skip_I(s, skip);
+      next_offset = squat_decode_I(&s);
+
+      s = branch_start - next_offset;
+      if (next_offset < 0 || s >= data_end) {
+        return(SQUAT_ERR);
+      }
+      r = squat_scan_recurse(s, data_end, name, level+1, handler, closure);
+    } else {
+      /* leaf case. We need to scan through the document lists for each
+         leaf to skip. */
+      while (skip-- > 0) {
+        char const* t = s;
+        int v = (int)squat_decode_I(&t);
+          
+        if ((v & 1) != 0) {
+          s = t;  /* singleton; no more data to eat for this word */
+        } else {
+          s = t + (v >> 1); /* run-list; size is in v>>1 */
+        }
+      }
+      r = squat_scan_leaf(s, name, handler, closure);
+    }
+  }
+  return(r);
+}
+
+/* char const** prev is used by squat_count_docs to find start of
+ * mmap()ed byte range that we need to traverse, so that we can
+ * read in the data before we start trie walk. No other purpose.
+ */
+
+static int squat_find_branch(char const** result, char const** prev,
+                             char const* s,
+                             char const* data_end, char ch)
+{
+  char p;
+  char const* branch_start = s, *t;
+  int skip;
+  char count;
+  char const* base;
+  int offset, j;
+  int next_offset, prev_offset;
+
+  *result = NULL;
+  if (prev) *prev = NULL;
+
+  /* Ignore empty subtrees generated by old versions of squatter */
+  if ((s[0] == 0) && (s[1] == 0)) {
+    *result = NULL;
+    return(SQUAT_OK);
+  }
+
+  p = *s++;
+
+  if ((p & 0xE0) != 0) { /* singleton */
+    if (p != ch) {
+      *result = NULL;
+      return(SQUAT_OK);
+    }
+
+    next_offset = squat_decode_I(&s);
+    s = branch_start - next_offset;
+    if (next_offset < 0 || s >= data_end) {
+      return(SQUAT_ERR);
+    }
+    *result = s;
+    return(SQUAT_OK);
+  }
+
+  count = (*s++) + 1;
+  offset = (unsigned char)ch/8 - p;
+  base = s;
+  s += count;
+
+  /* Does this character fall in range */
+  if (((unsigned char)ch < 8*p) ||
+      ((unsigned char)ch >= 8*(p + count)) ||
+      ((base[offset] & (1 << (ch & 7))) == 0)) {
+    *result = NULL;
+    return(SQUAT_OK);
+  }
+
+  /* figure out how many entries there are before our entry */
+  skip = 0;
+  for (j = 0; j < offset; j++) {
+    skip += bit_counts[(unsigned char)base[j]];
+  }
+  for (j = 0; j < (ch & 7); j++) {
+    if ((base[offset] & (1 << j)) != 0) {
+      skip++;
+    }
+  }
+
+  if (skip > 0) {
+    s = squat_decode_skip_I(s, skip-1);
+    prev_offset = squat_decode_I(&s);
+
+    t = branch_start - prev_offset;
+    if (prev && (prev_offset >= 0 && t < data_end)) {
+      *prev = t;
+    }
+  }
+
+  /* find offset to next branch data */
+  next_offset = squat_decode_I(&s);
+
+  s = branch_start - next_offset;
+  if (next_offset < 0 || s >= data_end) {
+    return(SQUAT_ERR);
+  }
+  *result = s;
+  return(SQUAT_OK);
+}
+
+int squat_scan(SquatSearchIndex* index, char first_char,
+               SquatScanCallback handler, void* closure)
+{
+  char buf[SQUAT_WORD_SIZE+1];
+  const char *s;
+  int r = squat_find_branch(&s, NULL,
+                            index->word_list, index->data_end, first_char);
+
+  if (r != SQUAT_OK)
+    return(r);
+  if (!s)
+    return SQUAT_OK;
+    
+  memset(buf, 0, sizeof(buf));
+  buf[0] = first_char;
+
+  return(squat_scan_recurse(s, index->data_end, buf, 1, handler, closure));
+
+  return SQUAT_OK;
+}
+
+/* ====================================================================== */
+
+/* squat_count_docs(SquatSearchIndex* index, char first_char, int *counter)
+ *
+ * count the total number of document ID which appear in the entire
+ * subtree for a given starting character. Typically followed immediately
+ * by a call to squat_scan after caller has allocated a target array
+ * which is large enough for counter callback elements.
+ *
+ * squat_count_docs() will page in lots of data from disk via the mmapped
+ * index file. Unfortunately squat indexes are built back to front, so
+ * the scan would read blocks out of order as the data structure is
+ * traversed. squat_preload_data() is a rather evil hack to try and
+ * force sequential disk I/O: it serves no other function.
+ */
+
+static int
+squat_count_docs_callback(void* closure,
+                          char *name __attribute__((unused)),
+                          int doc_ID __attribute__((unused)))
+{
+  int *counter = (int *)closure;
+
+  (*counter)++;
+
+  return SQUAT_CALLBACK_CONTINUE;
+}
+
+/* Attempt to load blocks of data from mmap()ed array before we start
+   random access */
+
+#define PRELOAD_BLOCK_SIZE (4096)          /*  4 KBytes */
+#define PRELOAD_MAX_SIZE   (20*1024*1024)  /* 20 MBytes */
+
+static void
+squat_preload_data(char const* t, char const* s)
+{
+  char buf[PRELOAD_BLOCK_SIZE];
+  char const* start = (t > s) ? s : t;
+  unsigned long len = (t > s) ? (t-s) : (s-t);
+
+  if (len >= PRELOAD_MAX_SIZE)
+    return;
+
+  while (len > 0) {
+    unsigned long size = (len > PRELOAD_BLOCK_SIZE) ? PRELOAD_BLOCK_SIZE : len;
+
+    memcpy(buf, start, size);
+    start += size;
+    len   -= size;
+  }
+}
+                          
+int squat_count_docs(SquatSearchIndex* index, char first_char, int *counter)
+{
+  char buf[SQUAT_WORD_SIZE+1];
+  const char *s, *t;
+  int r = squat_find_branch(&s, &t, index->word_list,
+                            index->data_end, first_char);
+  *counter = 0;
+
+  if (r != SQUAT_OK)
+    return(r);
+  if (!s)
+    return SQUAT_OK;
+
+  /* First trie is at index->doc_ID_list + (no_docIDs *4). However
+   * no_docIDs doesn't appear to be stored anywhere (zero terminated list).
+   * Following is good enough for our purposes */
+  squat_preload_data((t) ? t : index->doc_ID_list, s);
+
+  memset(buf, 0, sizeof(buf));
+  buf[0] = first_char;
+
+  return(squat_scan_recurse(s, index->data_end, buf, 1,
+                            squat_count_docs_callback, counter));
+}

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,7 +38,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: squat.h,v 1.2 2003/02/13 20:15:31 rjs3 Exp $
+ * $Id: squat.h,v 1.4 2008/03/24 17:09:19 murch Exp $
  */
 
 /*
@@ -257,8 +258,8 @@
    index are released whether this call succeeds or fails.
    Call this after successfully calling squat_index_init or
    squat_index_close_document. */
+
 int         squat_index_finish(SquatIndex* index);
-
 
 /* Notify SQUAT that something has gone wrong and index construction
    must be aborted. It is the client's responsibility to close and/or
@@ -267,6 +268,15 @@
    Call this anytime. */
 int         squat_index_destroy(SquatIndex* index);
 
+
+typedef int (* SquatScanCallback)(void* closure, char *name, int doc_ID);
+
+int         squat_scan(SquatSearchIndex* index, char first_char,
+                       SquatScanCallback handler,
+                       void* closure);
+
+int         squat_count_docs(SquatSearchIndex* index, char first_char,
+                             int *counter);
 
 /***************************************
    INDEX SEARCH API
@@ -317,4 +327,12 @@
    Call this anytime. */
 int               squat_search_close(SquatSearchIndex* index);
 
+
+typedef int (* SquatDocChooserCallback)(void* closure,
+                                        SquatListDoc const* doc);
+
+int squat_index_add_existing(SquatIndex* index,
+                             SquatSearchIndex *old_index,
+                             SquatDocChooserCallback choose_existing,
+                             void *closure);
 #endif

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_build.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_build.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_build.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_build.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,7 +38,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: squat_build.c,v 1.11 2006/11/30 17:11:20 murch Exp $
+ * $Id: squat_build.c,v 1.16 2008/03/24 17:09:19 murch Exp $
  */
 
 /*
@@ -94,11 +95,11 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <assert.h>
 #include <sys/mman.h>
 
 #include "squat_internal.h"
 
+#include "assert.h"
 #include "index.h"
 #include "xmalloc.h"
 
@@ -241,6 +242,14 @@
   short last_valid_entry;
   SquatWordTableEntry entries[256];
 } SquatWordTable;
+
+/* Map docIDs in existing index to docIDs in the new index */
+struct doc_ID_map {
+  int *map;
+  int alloc;
+  int max;
+  int new;
+};
 
 struct _SquatIndex {
   char* tmp_path;                     /* Saved tmp_path option, with
@@ -281,6 +290,11 @@
   SquatStatsCallback stats_callback;  /* Saved stats_callback option */
   void* stats_callback_closure;
 
+  SquatSearchIndex* old_index;        /* Link to old index in incremental */
+  struct doc_ID_map doc_ID_map;       /* Map doc_IDs in old index to new */
+  SquatDocChooserCallback select_doc; /* Decide whether we want doc in new */
+  void *select_doc_closure;           /* Data for handler */
+
   /* put the big structures at the end */
 
   SquatWriteBuffer index_buffers[256]; /* Buffers for the temporary
@@ -293,6 +307,119 @@
 				starting with given char */
 };
 
+/* ====================================================================== */
+
+/* Collection of utility routines to maintain mapping between doc_ID in
+ * the old and new squat files. Not a one to one map as old documents
+ * (old messages in Cyrus) may have been deleted.
+ */
+
+/* Copy existing document details verbatim from old to new index */
+static int squat_index_copy_document(SquatIndex* index, char const* name,
+                                     SquatInt64 size)
+{
+  char* buf;
+  int r = squat_index_open_document(index, name);
+
+  if (r != SQUAT_OK)
+    return(r);
+
+  squat_set_last_error(SQUAT_ERR_OK);
+  if ((buf = prepare_buffered_write(&index->out, 10)) == NULL) {
+    return SQUAT_ERR;
+  }
+  buf = squat_encode_I(buf, size);
+  complete_buffered_write(&index->out, buf);
+
+  index->current_doc_len = -1;
+  index->current_doc_ID++;
+
+  return SQUAT_OK;
+}
+
+static void doc_ID_map_init(struct doc_ID_map *doc_ID_map)
+{
+  doc_ID_map->alloc = 50;
+  doc_ID_map->map   = xmalloc(doc_ID_map->alloc*sizeof(int));
+  doc_ID_map->max   = 0;
+  doc_ID_map->new   = 0;
+}
+
+static void doc_ID_map_free(struct doc_ID_map *doc_ID_map)
+{
+  if (doc_ID_map->map) free(doc_ID_map->map);
+
+  memset(doc_ID_map, 0, sizeof(struct doc_ID_map));
+}
+
+static void doc_ID_map_add(struct doc_ID_map *doc_ID_map, int exists)
+{
+  if (doc_ID_map->max == doc_ID_map->alloc) {
+    doc_ID_map->alloc *= 2;
+    doc_ID_map->map = xrealloc(doc_ID_map->map, doc_ID_map->alloc*sizeof(int));
+  }
+  if (exists) {
+    doc_ID_map->map[doc_ID_map->max++] = doc_ID_map->new++;
+  } else {
+    doc_ID_map->map[doc_ID_map->max++] = 0;  /* Does not exist in new index */
+  }
+}
+
+static int doc_ID_map_lookup(struct doc_ID_map *doc_ID_map, int docID)
+{
+  if ((docID < 1) || (docID > doc_ID_map->max))
+    return(0);
+
+  return(doc_ID_map->map[docID]);
+}
+
+static int copy_docIDs(void* closure, SquatListDoc const* doc)
+{
+  SquatIndex* index = (SquatIndex*)closure;
+  struct doc_ID_map *doc_ID_map = &index->doc_ID_map;
+  int choice = (index->select_doc)(index->select_doc_closure, doc);
+
+  if (choice > 0) {
+    doc_ID_map_add(doc_ID_map, 1);
+    return(squat_index_copy_document(index, doc->doc_name, doc->size));
+  }
+
+  /* This docID no longer exists */
+  doc_ID_map_add(doc_ID_map, 0);
+  return SQUAT_CALLBACK_CONTINUE;
+}
+
+/* Comes later */
+static int add_word_to_trie(SquatIndex* index, char const* word_ptr,
+                            int doc_ID);
+
+static int add_word_callback(void* closure, char *name, int doc_ID)
+{
+  SquatIndex* index = (SquatIndex*)closure;
+  struct doc_ID_map *doc_ID_map = &index->doc_ID_map;
+
+  /* Find doc_ID in the new index which corresponds to this old doc_ID */
+  if ((doc_ID = doc_ID_map_lookup(doc_ID_map, doc_ID)) == 0)
+    return SQUAT_ERR;
+
+  add_word_to_trie(index, name+1, doc_ID);
+
+  return SQUAT_CALLBACK_CONTINUE;
+}
+
+int squat_index_add_existing(SquatIndex* index,
+                             SquatSearchIndex *old_index,
+                             SquatDocChooserCallback select_doc,
+                             void *select_doc_closure) {
+  index->old_index = old_index;
+  index->select_doc = select_doc;
+  index->select_doc_closure = select_doc_closure;
+
+  return(squat_search_list_docs(old_index, copy_docIDs, index));
+}
+
+/* ====================================================================== */
+
 /* Initally, before we see a document, there are no words for the document. */
 static void init_doc_word_table(SquatWordTable** t) {
   SquatWordTable *ret = (SquatWordTable*)xmalloc(sizeof(SquatWordTable));
@@ -305,7 +432,7 @@
 
 SquatIndex* squat_index_init(int fd, SquatOptions const* options) {
   SquatIndex* index;
-  int i;
+  unsigned i;
   int path_len;
   char* buf;
   char const* tmp_path;
@@ -374,6 +501,9 @@
 
   memset(index->total_num_words, 0, sizeof(index->total_num_words));
 
+  index->old_index = NULL;            /* Until we are given one */
+  doc_ID_map_init(&index->doc_ID_map);
+
   return index;
 
 cleanup_out_buffer:
@@ -461,7 +591,7 @@
 /* Destroy the SquatWordTable. The leaf data and the internal nodes are free'd. */
 static void delete_doc_word_table(SquatWordTable* t, int depth) {
   if (depth > 2) {
-    int i;
+    unsigned i;
 
     depth--;
     for (i = 0; i < VECTOR_SIZE(t->entries); i++) {
@@ -472,7 +602,7 @@
       }
     }
   } else {
-    int i;
+    unsigned i;
 
     /* this happens to work whether the leaf entries are leaf_presence
        or leaf_docs. This is ugly but acceptable :-) */
@@ -804,7 +934,7 @@
         int last_byte = p->last_valid_entry >> 3;
 
         for (i = p->first_valid_entry >> 3; i <= last_byte; i++) {
-	    if(i >= VECTOR_SIZE(p->presence)) {
+	    if((unsigned) i >= VECTOR_SIZE(p->presence)) {
 		return SQUAT_ERR;
 	    } else {
 		int bits = (unsigned char)p->presence[i];
@@ -851,7 +981,7 @@
 
 int squat_index_close_document(SquatIndex* index) {
   char* buf;
-  int i;
+  unsigned i;
   
   squat_set_last_error(SQUAT_ERR_OK);
 
@@ -1178,6 +1308,8 @@
             != SQUAT_OK) {
           return SQUAT_ERR;
         }
+        free(entries[i].table);
+        entries[i].table = NULL;
       } else {
         offsets[i] = 0;
       }
@@ -1229,16 +1361,32 @@
    returned in 'result_offset'. */
 static int dump_index_trie_words(SquatIndex* index, int first_char,
                                  int* result_offset) {
+  SquatSearchIndex* old_index = index->old_index;
   SquatWriteBuffer* buf = index->index_buffers + first_char;
   int num_words = index->total_num_words[first_char];
   WordDocEntry* doc_table;
   char const* word_list_ptr;
   int r = SQUAT_OK;
   char const* word_ptr;
+  int existing = 0;
+
+  if (old_index &&
+      squat_count_docs(old_index, first_char, &existing) != SQUAT_OK) {
+    return(SQUAT_ERR);
+  }
   
   /* Allocate all the necessary document-ID linked list entries at once. */
-  doc_table = (WordDocEntry*)xmalloc(sizeof(WordDocEntry)*num_words);
+  doc_table = (WordDocEntry*)xmalloc(sizeof(WordDocEntry)*(num_words+existing));
   index->word_doc_allocator = doc_table;
+
+  /* Send existing trie across first as those leafs have lowest doc IDs */
+  if (old_index) {
+    r = squat_scan(old_index, first_char, add_word_callback, index);
+    if (r != SQUAT_OK) {
+      r = SQUAT_ERR;
+      goto cleanup;
+    }
+  }
 
   /* mmap the temporary file. */
   word_list_ptr = mmap(NULL, buf->total_output_bytes, PROT_READ, MAP_SHARED,
@@ -1269,10 +1417,6 @@
     }
   }
 
-  /* Make sure we used exactly as many linked list entries as we
-     thought we would. */
-  assert(index->word_doc_allocator - doc_table
-         == index->total_num_words[first_char]);
   /* Make sure we read all the bytes from the temporary file. */
   assert(word_ptr - word_list_ptr == buf->total_output_bytes);
  
@@ -1290,6 +1434,44 @@
 cleanup:
   free(doc_table);
 
+  return r;
+}
+
+static int dump_index_trie_words_no_file(SquatIndex* index,
+                                         int first_char,
+                                         int* result_offset) {
+  SquatSearchIndex* old_index = index->old_index;
+  WordDocEntry* doc_table;
+  int r = SQUAT_OK;
+  int existing = 0;
+
+  if (!old_index)
+    return(SQUAT_OK);   /* Should never happen? */
+    
+  if (squat_count_docs(old_index, first_char, &existing) != SQUAT_OK)
+    return(SQUAT_ERR);
+  if (existing == 0)
+    return(SQUAT_OK);
+
+  /* Allocate all the necessary document-ID linked list entries at once. */
+  doc_table = (WordDocEntry*)xmalloc(sizeof(WordDocEntry)*existing);
+  index->word_doc_allocator = doc_table;
+
+  /* Send existing trie across first as those leafs have lowest doc IDs */
+  r = squat_scan(old_index, first_char, add_word_callback, index);
+  if (r != SQUAT_OK) {
+    r = SQUAT_ERR;
+    goto cleanup;
+  }
+ 
+  if (index->word_doc_allocator > doc_table) {
+    /* Now dump the trie to the index file. */
+    r = write_trie_word_data(index, index->doc_word_table,
+                             SQUAT_WORD_SIZE - 1, result_offset);
+  }
+
+ cleanup:
+  free(doc_table);
   return r;
 }
 
@@ -1301,7 +1483,7 @@
   int doc_ID_list_offset;
   int word_list_offset;
   char* buf;
-  int i;
+  unsigned i;
   SquatDiskHeader* header;
   int offset_buf[256];
   
@@ -1371,8 +1553,13 @@
       }
       free(index->index_buffers[i].buf);
       index->index_buffers[i].buf = NULL;
-    } else {
-      offset_buf[i] = 0;
+    } else if (index->old_index) {
+      /* Only needed if incremental updates going on */
+      /* Just copy across existing trie if nothing new to merge in */
+      if (dump_index_trie_words_no_file(index, i, offset_buf + i) != SQUAT_OK) {
+        r = SQUAT_ERR;
+        goto cleanup;
+      }
     }
   }
 
@@ -1384,7 +1571,7 @@
     if (offset_buf[i] != 0) {
       offset_buf[i] = word_list_offset - offset_buf[i];
 
-      if (i < index->doc_word_table->first_valid_entry) {
+      if ((int) i < index->doc_word_table->first_valid_entry) {
         index->doc_word_table->first_valid_entry = i;
       }
       index->doc_word_table->last_valid_entry = i;
@@ -1448,6 +1635,7 @@
   }
   free(index->tmp_path);
   free(index->doc_ID_list);
+  doc_ID_map_free(&index->doc_ID_map);
   free(index);
 
   return r;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_internal.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_internal.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_internal.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_internal.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,7 @@
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* Internal routines used by SQUAT.
+ * Robert O'Callahan
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,16 +40,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: squat_internal.c,v 1.2 2003/02/13 20:15:31 rjs3 Exp $
+ * $Id: squat_internal.c,v 1.4 2008/03/24 17:09:19 murch Exp $
  */
 
-/*
-  Internal routines used by SQUAT.
-  Robert O'Callahan
-*/
-
-#include <assert.h>
-
+#include "assert.h"
 #include "squat_internal.h"
 
 static int last_err = SQUAT_ERR_OK;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_internal.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_internal.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_internal.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squat_internal.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,7 +38,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: squat_internal.h,v 1.2 2003/02/13 20:15:31 rjs3 Exp $
+ * $Id: squat_internal.h,v 1.3 2008/03/24 17:09:19 murch Exp $
  */
 
 /*

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squatter.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squatter.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squatter.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/squatter.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /* squatter.c -- SQUAT-based message indexing tool
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: squatter.c,v 1.17 2007/02/05 18:41:48 jeaton Exp $
+ * $Id: squatter.c,v 1.22 2008/04/04 13:58:59 murch Exp $
  */
 
 /*
@@ -96,6 +98,7 @@
 #include "map.h"
 #include "squat.h"
 #include "imapd.h"
+#include "util.h"
 
 /* global state */
 const int config_need_data = CONFIG_NEED_PARTITION_DATA;
@@ -120,10 +123,10 @@
 
 /* These stats are gathered 1) per mailbox and 2) for the whole operation. */
 typedef struct {
-  int indexed_bytes;    /* How many bytes of processed message text
+  unsigned long indexed_bytes;    /* How many bytes of processed message text
 			   have we indexed? */
-  int indexed_messages; /* How many messages have we indexed? */
-  int index_size;       /* How many bytes is the index using? */
+  unsigned long indexed_messages; /* How many messages have we indexed? */
+  unsigned long index_size;       /* How many bytes is the index using? */
   time_t start_time;    /* When did this operation start? */
   time_t end_time;      /* When did it end? */
 } SquatStats;
@@ -133,6 +136,7 @@
 static int verbose = 0;
 static int mailbox_count = 0;
 static int skip_unmodified = 0;
+static int incremental_mode = 0;
 static SquatStats total_stats;
 
 static void start_stats(SquatStats* stats) {
@@ -147,8 +151,8 @@
 }
 
 static void print_stats(FILE* out, SquatStats* stats) {
-  fprintf(out, "Indexed %d messages (%d bytes) "
-          "into %d index bytes in %d seconds\n",
+  fprintf(out, "Indexed %lu messages (%lu bytes) "
+          "into %lu index bytes in %d seconds\n",
           stats->indexed_messages, stats->indexed_bytes,
           stats->index_size, (int) (stats->end_time - stats->start_time));
 }
@@ -187,6 +191,99 @@
 
   exit(98);
 }
+
+/* ====================================================================== */
+
+/* uid_info is used to track which messages exist in old squat index, by
+ * parsing document names (e.g: m456. is part of message UID 456).
+ */
+
+struct uid_item {
+  unsigned long uid;
+  int flagged;
+};
+
+struct uid_info {
+  struct uid_item *list;
+  unsigned long len;
+  unsigned long uidvalidity;
+  int valid;
+};
+
+static void uid_info_init(struct uid_info *uid_info, unsigned long exists)
+{
+  uid_info->list = xmalloc((exists+1)*sizeof(struct uid_item));
+  uid_info->len  = exists;
+  uid_info->uidvalidity = 0L;
+  uid_info->valid = 1;
+}
+
+static void uid_info_free(struct uid_info *uid_info)
+{
+  if (uid_info->list != NULL)
+    free(uid_info->list);
+
+  uid_info->list = NULL;
+}
+
+static void uid_item_init(struct uid_item *uid_item, unsigned long uid)
+{
+  uid_item->uid = uid;
+  uid_item->flagged = 0;
+}
+
+static struct uid_item *find_uid_item(struct uid_info *uid_info,
+                                      unsigned long uid)
+{
+  struct uid_item *list = uid_info->list;
+  unsigned long first = 0;
+  unsigned long last  = uid_info->len;
+
+  /* Binary chop on sorted array */
+  while (first < last) {
+    unsigned long middle = (first + last) / 2;
+
+    if (list[middle].uid == uid)
+      return(&list[middle]);
+    if (list[middle].uid < uid)
+      first = middle + 1;
+    else
+      last = middle;
+  }
+  return(NULL);
+}
+
+/* Populate uid_info map using document names from SquatSearchIndex backend */
+static int doc_check(void *closure, SquatListDoc const* doc)
+{
+  struct uid_info *uid_info = (struct uid_info *)closure;
+  struct uid_item *uid_item;
+  unsigned long uid;
+
+  /* validity will be replaced with new value in same slot */
+  if  (!strncmp(doc->doc_name, "validity.", 9)) {
+    uid_info->uidvalidity = strtoul(doc->doc_name+9, NULL, 10);
+    return(1);
+  }
+
+  if (!strchr("tfcbsmh", doc->doc_name[0])) {
+    syslog(LOG_ERR, "Invalid document name: %s", doc->doc_name);
+    uid_info->valid = 0;
+    return(1);
+  }
+
+  uid = strtoul(doc->doc_name+1, NULL, 10);
+  if ((uid > 0) && (uid_item=find_uid_item(uid_info, uid))) {
+    uid_item->flagged = 1;
+    return(1);
+  }
+
+  /* Remove this UID from the index */
+  return(0);
+}
+
+/* ====================================================================== */
+
 
 typedef struct {
   SquatStats* mailbox_stats;
@@ -286,21 +383,197 @@
   }
 }
 
+/* Squat a single open mailbox */
+static int squat_single(struct mailbox *mailbox, int incremental,
+                        char *squat_file_name)
+{
+    char new_file_name[MAX_MAILBOX_PATH+1];
+    SquatStats stats;
+    SquatOptions options;
+    SquatReceiverData data;
+    SquatSearchIndex *old_index = NULL;
+    char uid_validity_buf[30];
+    struct index_record record;
+    struct uid_info  uid_info;
+    struct uid_item *uid_item;
+    struct stat index_file_info;
+    unsigned long lastuid;
+    unsigned msgno;
+    int new_index_fd = -1;
+    int old_index_fd = -1;
+    int r = 0;               /* Using IMAP_* not SQUAT_* return codes here */
+
+    uid_info_init(&uid_info, mailbox->exists);
+
+    strlcpy(new_file_name, squat_file_name, sizeof(new_file_name));
+    strlcat(new_file_name, ".NEW", sizeof(new_file_name));
+
+    if ((new_index_fd = open(new_file_name,
+                             O_CREAT|O_TRUNC|O_WRONLY, 0666)) < 0) {
+      fatal_syserror("Unable to create temporary index file");
+    }
+
+    options.option_mask = SQUAT_OPTION_TMP_PATH | SQUAT_OPTION_STATISTICS;
+    options.tmp_path = mailbox->path;
+    options.stats_callback = stats_callback;
+    options.stats_callback_closure = NULL;
+    data.index = squat_index_init(new_index_fd, &options);
+    if (data.index == NULL) {
+      fatal_squat_error("Initializing index");
+    }
+
+    if (mailbox_read_index_header(mailbox) != 0) {
+      r = IMAP_IOERROR;
+      goto bail;
+    }
+
+    lastuid  = 0;
+    uid_item = uid_info.list;
+    for (msgno = 1; msgno <= mailbox->exists ; msgno++) {
+      if ((r=mailbox_read_index_record(mailbox, msgno, &record)))
+        goto bail;
+      if (record.uid == 0) {
+        syslog(LOG_ERR, "Invalid UID 0 in index for %s: try reconstruct",
+               mailbox->name);
+        r = IMAP_IOERROR;
+        goto bail;
+      }
+      if ((msgno > 1) && (record.uid <= lastuid)) {
+        syslog(LOG_ERR,
+               "UID %lu out of order in index for %s: try reconstruct",
+               record.uid, mailbox->name);
+        r = IMAP_IOERROR;
+        goto bail;
+      }
+      uid_item_init(&uid_item[msgno-1], record.uid);
+      lastuid = record.uid;
+    }
+    /* Add zero UID as an end of list marker: uid_info_init() assigned space */
+    uid_item_init(&uid_item[mailbox->exists], 0);
+
+    /* Open existing index if it exists */
+    old_index_fd   = -1;
+    old_index = NULL;
+    if (incremental &&
+        ((old_index_fd = open(squat_file_name, O_RDONLY)) >= 0) &&
+        (old_index = squat_search_open(old_index_fd)) == NULL) {
+      close(old_index_fd);
+      old_index_fd = -1;
+    }
+
+    /* Fall back to full update if open() or squat_search_open() failed */
+    if (!old_index) incremental = 0;
+
+    if (incremental) {
+      /* Copy existing document names verbatim. They end up with the same
+       * doc_IDs as in the old index, which makes trie copying much simpler.
+       */
+      uid_info.valid       = 1;
+      uid_info.uidvalidity = 0L;
+      squat_index_add_existing(data.index, old_index, doc_check, &uid_info);
+
+      if (!uid_info.valid) {
+        syslog(LOG_ERR,
+               "Corrupt squat index for %s, retrying without incremental",
+               mailbox->name);
+        r = IMAP_IOERROR;
+        goto bail;
+      }
+
+      if (uid_info.uidvalidity != mailbox->uidvalidity) {
+        /* Squat file refers to old mailbox: force full rebuild */
+        r = IMAP_IOERROR;
+        goto bail;
+      }
+    } else {
+      /* write an empty document at the beginning to record the validity
+         nonce */
+      snprintf(uid_validity_buf, sizeof(uid_validity_buf), 
+               "validity.%ld", mailbox->uidvalidity);
+      if (squat_index_open_document(data.index, uid_validity_buf) != SQUAT_OK
+          || squat_index_close_document(data.index) != SQUAT_OK) {
+        fatal_squat_error("Writing index");
+      }
+    }
+
+    data.mailbox       = mailbox;
+    data.mailbox_stats = &stats;
+    start_stats(&stats);
+
+    uid_item =  uid_info.list;
+    index_operatemailbox(mailbox);
+    for (msgno = 1; msgno <= mailbox->exists ; msgno++) {
+      if ((r=mailbox_read_index_record(mailbox, msgno, &record))) {
+        index_closemailbox(mailbox);
+        goto bail;
+      }
+
+      /* Scan uid_item list for matching UID (ascending order, 0 termination) */
+      while (uid_item->uid && (uid_item->uid < record.uid))
+        uid_item++;
+
+      if ((uid_item->uid == record.uid) && uid_item->flagged)
+        continue;
+
+      /* This UID didn't appear in the old index file */
+      index_getsearchtext_single(mailbox, msgno, search_text_receiver, &data);
+      uid_item->flagged = 1;
+    }
+    index_closemailbox(mailbox);
+
+    if (squat_index_finish(data.index) != SQUAT_OK) {
+      if (incremental) {
+        syslog(LOG_ERR,
+               "Corrupt squat index %s, retrying without incremental update",
+               squat_file_name);
+        r = IMAP_IOERROR;
+        goto bail;
+      }
+      /* Just give up if not incremental */
+      fatal_squat_error("Closing index");
+    }
+
+    /* Check how big the resulting file is */
+    if (fstat(new_index_fd, &index_file_info) < 0) {
+      fatal_syserror("Unable to stat temporary index file");
+    }
+    stats.index_size        = index_file_info.st_size;
+    total_stats.index_size += index_file_info.st_size;
+
+    if (close(new_index_fd) < 0) {
+      fatal_syserror("Unable to complete writing temporary index file");
+    }
+    new_index_fd = -1;
+
+    /* OK, we successfully created the index under the temporary file name.
+       Let's rename it to make it the real index. */
+    if (rename(new_file_name, squat_file_name) < 0) {
+      fatal_syserror("Unable to rename temporary index file");
+    }
+
+    stop_stats(&stats);
+    if (verbose > 0) {
+      print_stats(stdout, &stats);
+    }
+
+ bail:
+    if (old_index)             squat_search_close(old_index);
+    if (old_index_fd >= 0)     close(old_index_fd);
+    if (new_index_fd >= 0)     close(new_index_fd);
+    uid_info_free(&uid_info);
+
+    return(r);
+}
+
 /* This is called once for each mailbox we're told to index. */
 static int index_me(char *name, int matchlen __attribute__((unused)),
 		    int maycreate __attribute__((unused)),
 		    void *rock) {
     struct mailbox m;
     int r;
-    SquatStats stats;
-    SquatReceiverData data;
     char squat_file_name[MAX_MAILBOX_PATH+1], *path;
-    char new_file_name[MAX_MAILBOX_PATH+1];
-    int fd;
-    SquatOptions options;
     struct stat squat_file_info;
     struct stat index_file_info;
-    char uid_validity_buf[30];
     char extname[MAX_MAILBOX_NAME+1];
     int use_annot = *((int *) rock);
     int mbtype;
@@ -357,9 +630,6 @@
 	if (r || !attrib.value || strcasecmp(attrib.value, "true"))
 	    return 0;
     }
-
-    data.mailbox_stats = &stats;
-    data.mailbox = &m;
 
     /* First we have to jump through hoops to open the mailbox and its
        Cyrus index. */
@@ -404,75 +674,18 @@
         }
     }
 
-    strlcpy(new_file_name, squat_file_name, sizeof(new_file_name));
-    strlcat(new_file_name, ".NEW", sizeof(new_file_name));
-
     syslog(LOG_INFO, "indexing mailbox %s... ", extname);
     if (verbose > 0) {
       printf("Indexing mailbox %s... ", extname);
     }
 
-    if ((fd = open(new_file_name,
-		   O_CREAT | O_TRUNC | O_WRONLY, S_IREAD | S_IWRITE))
-        < 0) {
-      fatal_syserror("Unable to create temporary index file");
-    }
-
-    options.option_mask = SQUAT_OPTION_TMP_PATH | SQUAT_OPTION_STATISTICS;
-    options.tmp_path = m.path;
-    options.stats_callback = stats_callback;
-    options.stats_callback_closure = NULL;
-    data.index = squat_index_init(fd, &options);
-    if (data.index == NULL) {
-      fatal_squat_error("Initializing index");
-    }
-
-    /* write an empty document at the beginning to record the validity
-       nonce */
-    snprintf(uid_validity_buf, sizeof(uid_validity_buf), 
-	     "validity.%ld", m.uidvalidity);
-    if (squat_index_open_document(data.index, uid_validity_buf) != SQUAT_OK
-        || squat_index_close_document(data.index) != SQUAT_OK) {
-      fatal_squat_error("Writing index");
-    }
-
-    start_stats(&stats);
-
-    mailbox_read_index_header(&m);
-    index_operatemailbox(&m);
-
-    index_getsearchtext(&m, search_text_receiver, &data);
-
-    index_closemailbox(&m);
+    if (!incremental_mode || (squat_single(&m, 1, squat_file_name) != 0)) {
+      /* Fall back to complete squat */
+      squat_single(&m, 0, squat_file_name);
+    }
+
     mailbox_close(&m);
-
     mailbox_count++;
-
-    if (squat_index_finish(data.index) != SQUAT_OK) {
-      fatal_squat_error("Closing index");
-    }
-
-    /* Check how big the resulting file is */
-    if (fstat(fd, &index_file_info) < 0) {
-      fatal_syserror("Unable to stat temporary index file");
-    }
-    stats.index_size = index_file_info.st_size;
-    total_stats.index_size += index_file_info.st_size;
-
-    if (close(fd) < 0) {
-      fatal_syserror("Unable to complete writing temporary index file");
-    }
-
-    /* OK, we successfully created the index under the temporary file name.
-       Let's rename it to make it the real index. */
-    if (rename(new_file_name, squat_file_name) < 0) {
-      fatal_syserror("Unable to rename temporary index file");
-    }
-
-    stop_stats(&stats);
-    if (verbose > 0) {
-      print_stats(stdout, &stats);
-    }
 
     return 0;
 }
@@ -486,12 +699,13 @@
     char buf[MAX_MAILBOX_PATH+1];
     int r;
 
-    if(geteuid() == 0)
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
         fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     setbuf(stdout, NULL);
 
-    while ((opt = getopt(argc, argv, "C:rsav")) != EOF) {
+    while ((opt = getopt(argc, argv, "C:rsiav")) != EOF) {
 	switch (opt) {
 	case 'C': /* alt config file */
           alt_config = optarg;
@@ -507,6 +721,10 @@
 
 	case 's': /* skip unmodifed */
 	  skip_unmodified = 1;
+          break;
+
+	case 'i': /* incremental mode */
+	  incremental_mode = 1;
           break;
 
 	case 'a': /* use /squat annotation */

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/statuscache.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/statuscache.h?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/statuscache.h (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/statuscache.h Mon Feb  9 12:49:22 2009
@@ -1,0 +1,94 @@
+/* statuscache.h -- Status caching routines
+ *
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: statuscache.h,v 1.2 2008/03/24 17:09:19 murch Exp $
+ */
+
+#ifndef STATUSCACHE_H
+#define STATUSCACHE_H
+
+#include "mailbox.h"
+
+/* name of the statuscache database */
+#define FNAME_STATUSCACHEDB "/statuscache.db"
+#define STATUSCACHE_VERSION 3
+
+/* open the statuscache db */
+void statuscache_open(char *name);
+
+struct statuscache_data {
+    unsigned statusitems;
+
+    time_t index_mtime;
+    ino_t index_ino;
+    off_t index_size;
+
+    unsigned long messages;
+    unsigned recent;
+    unsigned long uidnext;
+    unsigned long uidvalidity;
+    unsigned unseen;
+    modseq_t highestmodseq;
+};
+
+/* fill a statuscache entry */
+void statuscache_fill(struct statuscache_data *scdata, struct mailbox *mailbox,
+		      int statusitems, int num_recent, int num_unseen);
+
+/* lookup a single statuscache entry and return result */
+int statuscache_lookup(const char *mboxname, const char *userid,
+		       unsigned statusitems,
+		       struct statuscache_data *scdata);
+
+/* update a statuscache entry */
+int statuscache_update(const char *mboxname, const char *userid,
+		      struct statuscache_data *scdata);
+
+/* invalidate (delete) a statuscache entry */
+int statuscache_invalidate(const char *mboxname, const char *userid);
+
+/* close the database */
+void statuscache_close(void);
+
+/* done with database stuff */
+void statuscache_done(void);
+
+#endif /* STATUSCACHE_H */

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/statuscache_db.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/statuscache_db.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/statuscache_db.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/statuscache_db.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,268 @@
+/* statuscache_db.c -- Status caching routines
+ *
+ * Copyright (c) 1994-2008 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 legal
+ *    details, please contact
+ *      Carnegie Mellon University
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at 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.
+ *
+ * $Id: statuscache_db.c,v 1.4 2008/10/08 23:28:58 murch Exp $
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/uio.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <syslog.h>
+
+#include "assert.h"
+#include "cyrusdb.h"
+#include "exitcodes.h"
+#include "imapd.h"
+#include "global.h"
+#include "imap_err.h"
+#include "mboxlist.h"
+#include "seen.h"
+#include "util.h"
+#include "xmalloc.h"
+#include "xstrlcpy.h"
+
+#include "statuscache.h"
+
+#define DB config_statuscache_db
+
+struct db *statuscachedb;
+static int statuscache_dbopen = 0;
+
+void statuscache_open(char *fname)
+{
+    int ret;
+    char *tofree = NULL;
+
+    /* create db file name */
+    if (!fname) {
+	fname = xmalloc(strlen(config_dir)+sizeof(FNAME_STATUSCACHEDB));
+	tofree = fname;
+	strcpy(fname, config_dir);
+	strcat(fname, FNAME_STATUSCACHEDB);
+    }
+
+    ret = DB->open(fname, CYRUSDB_CREATE, &statuscachedb);
+    if (ret != 0) {
+	syslog(LOG_ERR, "DBERROR: opening %s: %s", fname,
+	       cyrusdb_strerror(ret));
+	fatal("can't read statuscache file", EC_TEMPFAIL);
+    }    
+
+    if (tofree) free(tofree);
+
+    statuscache_dbopen = 1;
+}
+
+void statuscache_close(void)
+{
+    int r;
+
+    if (statuscache_dbopen) {
+	r = DB->close(statuscachedb);
+	if (r) {
+	    syslog(LOG_ERR, "DBERROR: error closing statuscache: %s",
+		   cyrusdb_strerror(r));
+	}
+	statuscache_dbopen = 0;
+    }
+}
+
+void statuscache_fill(struct statuscache_data *scdata, struct mailbox *mailbox,
+		      int statusitems, int num_recent, int num_unseen)
+{
+    assert(scdata);
+    assert(mailbox);
+
+    scdata->statusitems = statusitems;
+
+    scdata->index_mtime = mailbox->index_mtime;
+    scdata->index_ino = mailbox->index_ino;
+    scdata->index_size = mailbox->index_size;
+
+    scdata->messages = mailbox->exists;
+    scdata->recent = num_recent;
+    scdata->uidnext = mailbox->last_uid+1;
+    scdata->uidvalidity = mailbox->uidvalidity;
+    scdata->unseen = num_unseen;
+    scdata->highestmodseq =
+	(mailbox->options & OPT_IMAP_CONDSTORE) ? mailbox->highestmodseq : 0;
+}
+
+void statuscache_done(void)
+{
+    /* DB->done() handled by cyrus_done() */
+}
+
+static char *statuscache_buildkey(const char *mailboxname, const char *userid,
+				  int *keylen)
+{
+    static char key[MAX_MAILBOX_NAME*2+2];
+
+    /* Build statuscache key */
+    *keylen = strlcpy(key, mailboxname, sizeof(key)) + 1;
+    *keylen += strlcpy(key + *keylen, userid, sizeof(key) - *keylen);
+
+    return key;
+}
+
+int statuscache_lookup(const char *mboxname, const char *userid,
+		       unsigned statusitems,
+		       struct statuscache_data *scdata)
+{
+    int keylen, datalen, r = 0;
+    const char *data = NULL, *dend;
+    char *p, *key = statuscache_buildkey(mboxname, userid, &keylen);
+    unsigned version;
+    char *path, *mpath;
+    struct stat istat;
+
+    memset(scdata, 0, sizeof(struct statuscache_data));
+
+    /* Check if there is an entry in the database */
+    do {
+	r = DB->fetch(statuscachedb, key, keylen, &data, &datalen, NULL);
+    } while (r == CYRUSDB_AGAIN);
+
+    if (r || !data || ((size_t) datalen < sizeof(unsigned))) {
+	return IMAP_NO_NOSUCHMSG;
+    }
+
+    dend = data + datalen;
+
+    version = (unsigned) strtoul(data, &p, 10);
+    if (version != (unsigned) STATUSCACHE_VERSION) {
+	/* Wrong version */
+	return IMAP_NO_NOSUCHMSG;
+    }
+
+    if (p < dend) scdata->statusitems = (unsigned) strtol(p, &p, 10);
+    if (p < dend) scdata->index_mtime = strtol(p, &p, 10);
+    if (p < dend) scdata->index_ino = strtoul(p, &p, 10);
+    if (p < dend) scdata->index_size = strtoofft(p, &p, 10);
+    if (p < dend) scdata->messages = strtoul(p, &p, 10);
+    if (p < dend) scdata->recent = (unsigned) strtoul(p, &p, 10);
+    if (p < dend) scdata->uidnext = strtoul(p, &p, 10);
+    if (p < dend) scdata->uidvalidity = strtoul(p, &p, 10);
+    if (p < dend) scdata->unseen = (unsigned) strtoul(p, &p, 10);
+#ifdef HAVE_LONG_LONG_INT
+    if (p < dend) scdata->highestmodseq = strtoull(p, &p, 10);
+#else
+    if (p < dend) scdata->highestmodseq = strtoul(p, &p, 10);
+#endif
+
+    /* Sanity check the data */
+    if (!scdata->statusitems || !scdata->index_mtime || !scdata->index_ino ||
+	!scdata->index_size || !scdata->uidnext || !scdata->uidvalidity) {
+	return IMAP_NO_NOSUCHMSG;
+    }
+
+    if ((scdata->statusitems & statusitems) != statusitems) {
+	/* Don't have all of the requested information */
+	return IMAP_NO_NOSUCHMSG;
+    }
+
+    /* Check status of index file */
+    r = mboxlist_detail(mboxname, NULL, &path, &mpath, NULL, NULL, NULL);
+    if (!r) r = mailbox_stat(path, mpath, NULL, &istat, NULL);
+
+    if (!r &&
+	(istat.st_mtime != scdata->index_mtime ||
+	 istat.st_ino   != scdata->index_ino ||
+	 istat.st_size  != scdata->index_size)) {
+	/* Our information is out of date */
+	r = IMAP_NO_NOSUCHMSG;
+    }
+
+    return r;
+}
+
+int statuscache_update(const char *mboxname, const char *userid,
+		       struct statuscache_data *scdata)
+{
+    char data[250];  /* enough room for 11*(UULONG + SP) */
+    int r, keylen, datalen;
+    char *key = statuscache_buildkey(mboxname, userid, &keylen);
+
+    datalen = snprintf(data, sizeof(data),
+		       "%u %u %ld %lu " OFF_T_FMT " %lu %u %lu %lu %u " MODSEQ_FMT,
+		       STATUSCACHE_VERSION, scdata->statusitems,
+		       scdata->index_mtime, scdata->index_ino,
+		       scdata->index_size, scdata->messages,
+		       scdata->recent, scdata->uidnext,
+		       scdata->uidvalidity, scdata->unseen,
+		       scdata->highestmodseq);
+
+    r = DB->store(statuscachedb, key, keylen, data, datalen, NULL);
+    if (r != CYRUSDB_OK) {
+	syslog(LOG_ERR, "DBERROR: error updating database: %s", 
+	       cyrusdb_strerror(r));
+    }
+    return 0; 
+}
+
+int statuscache_invalidate(const char *mboxname, const char *userid)
+{
+    int keylen, r;
+    char *key = statuscache_buildkey(mboxname, userid, &keylen);
+
+    /* Don't access DB if it hasn't been opened */
+    if (!statuscachedb) return 0;
+
+    /* Delete db entry */
+    r = DB->delete(statuscachedb, key, keylen, NULL, 1);
+    if (r != CYRUSDB_OK) {
+	syslog(LOG_ERR, "DBERROR: error deleting from database: %s", 
+	       cyrusdb_strerror(r));
+    }
+    return 0; 
+}
+

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_client.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_client.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_client.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_client.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* sync_client.c -- Cyrus synchonization client
  *
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: sync_client.c,v 1.35 2008/04/22 13:11:18 murch Exp $
+ *
  * Original version written by David Carter <dpc22 at cam.ac.uk>
  * Rewritten and integrated into Cyrus by Ken Murchison <ken at oceana.com>
- *
- * $Id: sync_client.c,v 1.4 2007/01/09 17:29:30 murch Exp $
  */
 
 #include <config.h>
@@ -60,6 +61,9 @@
 #include <sys/wait.h>
 #include <errno.h>
 #include <ctype.h>
+#include <signal.h>
+
+#include <netinet/tcp.h>
 
 #include "global.h"
 #include "assert.h"
@@ -77,10 +81,13 @@
 #include "imparse.h"
 #include "util.h"
 #include "prot.h"
+#include "message_guid.h"
 #include "sync_support.h"
 #include "sync_commit.h"
 #include "lock.h"
 #include "backend.h"
+#include "xstrlcat.h"
+#include "xstrlcpy.h"
 
 /* signal to config.c */
 const int config_need_data = 0;  /* YYY */
@@ -91,12 +98,12 @@
 struct auth_state *imapd_authstate = NULL;
 char *imapd_userid = NULL;
 
-void printastring(const char *s)
+void printastring(const char *s __attribute__((unused)))
 {
     fatal("not implemented", EC_SOFTWARE);
 }
 
-void printstring(const char *s)
+void printstring(const char *s __attribute__((unused)))
 {
     fatal("not implemented", EC_SOFTWARE);
 }
@@ -110,6 +117,7 @@
 extern char *optarg;
 extern int optind;
 
+static const char *servername = NULL;
 static struct protstream *toserver   = NULL;
 static struct protstream *fromserver = NULL;
 
@@ -117,11 +125,23 @@
 static struct sync_msgid_list *msgid_onserver = NULL;
 
 static struct namespace   sync_namespace;
-static struct auth_state *sync_authstate = NULL;
 
 static int verbose         = 0;
 static int verbose_logging = 0;
 static int connect_once    = 0;
+
+static struct protocol_t csync_protocol =
+{ "csync", "csync",
+  { 1, "* OK" },
+  { NULL, NULL, "* OK", NULL,
+    { { "* SASL ", CAPA_AUTH },
+      { "* STARTTLS", CAPA_STARTTLS },
+      { NULL, 0 } } },
+  { "STARTTLS", "OK", "NO", 0 },
+  { "AUTHENTICATE", INT_MAX, 0, "OK", "NO", "+ ", "*", NULL, 0 },
+  { "NOOP", NULL, "OK" },
+  { "EXIT", NULL, "OK" }
+};
 
 static int do_meta(char *user);
 
@@ -135,6 +155,7 @@
     quotadb_done();
     mboxlist_close();
     mboxlist_done();
+    cyrus_done();
     exit(code);
 }
 
@@ -148,7 +169,8 @@
 
 void fatal(const char *s, int code)
 {
-    fprintf(stderr, "sync_client: %s\n", s);
+    fprintf(stderr, "Fatal error: %s\n", s);
+    syslog(LOG_ERR, "Fatal error: %s", s);
     exit(code);
 }
 
@@ -225,16 +247,20 @@
             return(IMAP_IOERROR);
         }
 
-        if (msg && ((msg->uid < record.uid) ||
-                    ((msg->uid == record.uid) &&
-                     message_uuid_compare(&msg->uuid, &record.uuid)))) {
+        /* Skip over messages recorded on server which are missing on client
+         * (either will be expunged or have been expunged already) */
+        while (msg && (record.uid > msg->uid))
             msg = msg->next;
+
+        if (msg && (record.uid == msg->uid) &&
+            message_guid_compare_allow_null(&record.guid, &msg->guid)) {
+            msg = msg->next;  /* Ignore exact match */
             continue;
         }
 
         /* Want to upload this message; does the server have a copy? */
-        if (sync_msgid_lookup(server_msgid_list, &record.uuid))
-            sync_msgid_add(reserve_msgid_list, &record.uuid);
+        if (sync_msgid_lookup(server_msgid_list, &record.guid))
+            sync_msgid_add(reserve_msgid_list, &record.guid);
     }
     
     return(0);
@@ -262,8 +288,8 @@
         }
 
         /* Want to upload this message; does the server have a copy? */
-        if (sync_msgid_lookup(server_msgid_list, &record.uuid))
-            sync_msgid_add(reserve_msgid_list, &record.uuid);
+        if (sync_msgid_lookup(server_msgid_list, &record.guid))
+            sync_msgid_add(reserve_msgid_list, &record.guid);
     }
     
     return(0);
@@ -280,7 +306,7 @@
     struct sync_msgid    *msgid;
 
     for (msg = msglist->head ; msg ; msg = msg->next) {
-        if ((msgid=sync_msgid_lookup(reserve_msgid_list, &msg->uuid)))
+        if ((msgid=sync_msgid_lookup(reserve_msgid_list, &msg->guid)))
             msgid->count++;
     }
     
@@ -294,7 +320,7 @@
     struct sync_msgid *msgid;
 
     for (msg = folder->msglist->head ; msg ; msg = msg->next) {
-        msgid = sync_msgid_lookup(reserve_msgid_list, &msg->uuid);
+        msgid = sync_msgid_lookup(reserve_msgid_list, &msg->guid);
 
         if (msgid && !msgid->reserved)
             return(1);
@@ -314,12 +340,12 @@
     sync_printastring(toserver, folder->name);
 
     for (msg = folder->msglist->head ; msg ; msg = msg->next) {
-        msgid = sync_msgid_lookup(reserve_msgid_list, &msg->uuid);
+        msgid = sync_msgid_lookup(reserve_msgid_list, &msg->guid);
 
         if (msgid && !msgid->reserved) {
             /* Attempt to Reserve message in this folder */
             prot_printf(toserver, " "); 
-            sync_printastring(toserver, message_uuid_text(&msgid->uuid));
+            sync_printastring(toserver, message_guid_encode(&msgid->guid));
         }
     }
     prot_printf(toserver, "\r\n"); 
@@ -330,7 +356,7 @@
 
     /* Parse response to record successfully reserved messages */
     while (!r && unsolicited) {
-        struct message_uuid tmp_uuid;
+        struct message_guid tmp_guid;
 
         c = getword(fromserver, &arg);
 
@@ -343,16 +369,16 @@
             return(IMAP_PROTOCOL_ERROR);
         }
  
-        if (!message_uuid_from_text(&tmp_uuid, arg.s)) {
+        if (!message_guid_decode(&tmp_guid, arg.s)) {
             syslog(LOG_ERR, "Illegal response to RESERVE: %s", arg.s);
             sync_eatlines_unsolicited(fromserver, c);
             return(IMAP_PROTOCOL_ERROR);
         }
 
-        if ((msgid = sync_msgid_lookup(reserve_msgid_list, &tmp_uuid))) {
+        if ((msgid = sync_msgid_lookup(reserve_msgid_list, &tmp_guid))) {
             msgid->reserved = 1;
             reserve_msgid_list->reserved++;
-            sync_msgid_add(msgid_onserver, &tmp_uuid);
+            sync_msgid_add(msgid_onserver, &tmp_guid);
         } else
             syslog(LOG_ERR, "RESERVE: Unexpected response MessageID %s in %s",
                    arg.s, folder->name);
@@ -399,8 +425,8 @@
     /* Generate fast lookup hash of all MessageIDs available on server */
     for (folder = server_list->head ; folder ; folder = folder->next) {
         for (msg = folder->msglist->head ; msg ; msg = msg->next) {
-            if (!sync_msgid_lookup(server_msgid_list, &msg->uuid))
-                sync_msgid_add(server_msgid_list, &msg->uuid);
+            if (!sync_msgid_lookup(server_msgid_list, &msg->guid))
+                sync_msgid_add(server_msgid_list, &msg->guid);
         }
     }
 
@@ -436,7 +462,8 @@
         if (r) {
             if (mailbox_open) mailbox_close(&m);
 
-            syslog(LOG_ERR, "IOERROR: %s", error_message(r));
+            syslog(LOG_ERR, "IOERROR: Failed to open %s: %s",
+                   folder->name, error_message(r));
             goto bail;
         }
 
@@ -468,7 +495,7 @@
      * (as they will definitely be needed) */
     for (folder = server_list->head ; folder ; folder = folder->next) {
         for (msg = folder->msglist->head ; msg ; msg = msg->next) {
-            msgid = sync_msgid_lookup(reserve_msgid_list, &msg->uuid);
+            msgid = sync_msgid_lookup(reserve_msgid_list, &msg->guid);
 
             if (msgid && (msgid->count == 1)) {
                 reserve_folder(reserve_msgid_list, folder);
@@ -489,7 +516,7 @@
         if (folder->reserve) continue;
 
         for (count = 0, msg = folder->msglist->head ; msg ; msg = msg->next) {
-            msgid = sync_msgid_lookup(reserve_msgid_list, &msg->uuid);
+            msgid = sync_msgid_lookup(reserve_msgid_list, &msg->guid);
 
             if (msgid && !msgid->reserved)
                 count++;
@@ -554,7 +581,7 @@
         /* Quietly ignore objects that we don't have access to.
          * Includes directory stubs, which have not underlying cyrus.*
          * files in the filesystem */
-        if (r == IMAP_MAILBOX_NONEXISTENT) {
+        if (r == IMAP_PERMISSION_DENIED) {
             r = 0;
             continue;
         }
@@ -565,7 +592,8 @@
 
        if (r) {
             if (mailbox_open) mailbox_close(&m);
-            syslog(LOG_ERR, "IOERROR: %s", error_message(r));
+            syslog(LOG_ERR, "IOERROR: Failed to open %s: %s",
+                   folder->name, error_message(r));
             return(r);
         }
 
@@ -735,6 +763,17 @@
 			   SYNC_PARSE_EAT_OKLINE, NULL));
 }
 
+static int folder_setuidvalidity(char *name, unsigned long uidvalidity)
+{
+    prot_printf(toserver, "SETUIDVALIDITY "); 
+    sync_printastring(toserver, name);
+    prot_printf(toserver, " %lu\r\n", uidvalidity); 
+    prot_flush(toserver);
+
+    return(sync_parse_code("SETUIDVALIDITY",
+                           fromserver, SYNC_PARSE_EAT_OKLINE, NULL));
+}
+
 /* ====================================================================== */
 
 static int sieve_upload(char *user, char *name, unsigned long last_update)
@@ -899,6 +938,7 @@
             if (cvalue != svalue)
                 return(1);
         }
+	msg = msg->next;
     }
     return(0);
 }
@@ -980,6 +1020,7 @@
                                 mailbox->flagname[flag]);
         }
         prot_printf(toserver, ")");
+	msg = msg->next;
     }
 
     if (!have_update)
@@ -989,6 +1030,85 @@
     prot_flush(toserver);
 
     return(sync_parse_code("SETFLAGS",fromserver,SYNC_PARSE_EAT_OKLINE,NULL));
+}
+
+/* ====================================================================== */
+
+static int check_modseq(struct mailbox *mailbox, struct sync_msg_list *list)
+{
+    struct sync_msg *msg;
+    unsigned long msgno;
+    struct index_record record;
+
+    /* Updates on the client should always cause a highestmodseq */
+    if (mailbox->highestmodseq != list->highestmodseq)
+        return(1);
+
+    msg = list->head;
+    for (msgno = 1; msg && (msgno <= mailbox->exists) ; msgno++) {
+        mailbox_read_index_record(mailbox, msgno, &record);
+
+        /* Skip msgs on client missing on server (will upload later) */
+        if (record.uid < msg->uid)
+            continue;
+
+        /* Skip over messages recorded on server which are missing on client
+         * (either will be expunged or have been expunged already) */
+        while (msg && (msg->uid < record.uid))
+            msg = msg->next;
+
+        if (!(msg && (record.uid == msg->uid)))
+            continue;
+
+        /* Got a message on client which has same UID as message on server */
+        /* If the modseqs don't match, then we need to make an update */
+        if (record.modseq != msg->modseq)
+            return(1);
+
+        msg = msg->next;
+    }
+    return(0);
+}
+
+static int update_modseq(struct mailbox *mailbox, struct sync_msg_list *list)
+{
+    struct sync_msg *msg;
+    unsigned long msgno;
+    struct index_record record;
+
+    prot_printf(toserver, "SETMODSEQ " MODSEQ_FMT, mailbox->highestmodseq);
+
+    msg = list->head;
+    for (msgno = 1; msg && (msgno <= mailbox->exists) ; msgno++) {
+        mailbox_read_index_record(mailbox, msgno, &record);
+
+        /* Skip msgs on client missing on server (will upload later) */
+        if (record.uid < msg->uid)
+            continue;
+        
+        /* Skip over messages recorded on server which are missing on client
+         * (either will be expunged or have been expunged already) */
+        while (msg && (msg->uid < record.uid))
+            msg = msg->next;
+
+        if (!(msg && (record.uid == msg->uid)))
+            continue;
+
+        /* Got a message on client which has same UID as message on server */
+        if (record.modseq == msg->modseq) {
+            msg = msg->next;
+            continue;
+        }
+
+        /* ... but a different modseq */
+        prot_printf(toserver, " %lu " MODSEQ_FMT, record.uid, record.modseq);
+        msg = msg->next;
+    }
+
+    prot_printf(toserver, "\r\n");
+    prot_flush(toserver);
+
+    return(sync_parse_code("SETMODSEQ",fromserver,SYNC_PARSE_EAT_OKLINE,NULL));
 }
 
 /* ====================================================================== */
@@ -1090,7 +1210,7 @@
             msg = msg->next;
 
         if (msg && (record.uid == msg->uid) &&
-            message_uuid_compare(&record.uuid, &msg->uuid)) {
+            message_guid_compare_allow_null(&record.guid, &msg->guid)) {
             msg = msg->next;  /* Ignore exact match */
             continue;
         }
@@ -1105,20 +1225,25 @@
 /* Upload missing messages from folders (uses UPLOAD COPY where possible) */
 
 static int upload_message_work(struct mailbox *mailbox,
-			       unsigned long msgno,
+			       unsigned long msgno __attribute__((unused)),
 			       struct index_record *record)
 {
-    unsigned long cache_size;
     int flags_printed = 0;
     int r = 0, flag, need_body;
     static unsigned long sequence = 1;
     const char *msg_base = NULL;
     unsigned long msg_size = 0;
 
+    /* Protocol for SIMPLE items:
+     * C:  SIMPLE  <msgid> <uid> 
+     *             <internaldate> <sent-date> <last-updated> <modseq> <flags>
+     *             <msg literal (includes msg size!)>
+     */
+
     /* Protocol for PARSED items:
      * C:  PARSED  <msgid> <uid>
      *             <internaldate> <sent-date> <last-updated> <modseq> <flags>
-     *             <hdr size> <content_lines>
+     *             <hdr size> <content_lines> <cache_version>
      *             <cache literal (includes cache size!)>
      * <msg literal (includes msg size!)>
      */
@@ -1128,17 +1253,16 @@
      *           <internaldate> <sent-date> <last-updated> <modseq> <flags>
      */
 
-    if (sync_msgid_lookup(msgid_onserver, &record->uuid)) {
+    if (sync_msgid_lookup(msgid_onserver, &record->guid)) {
         prot_printf(toserver, " COPY");
         need_body = 0;
     } else {
-        sync_msgid_add(msgid_onserver, &record->uuid);
-        prot_printf(toserver, " PARSED");
+        prot_printf(toserver, " SIMPLE");
         need_body = 1;
     }
 
     prot_printf(toserver, " %s %lu %lu %lu %lu " MODSEQ_FMT " (",
-             message_uuid_text(&record->uuid),
+             message_guid_encode(&record->guid),
              record->uid, record->internaldate,
              record->sentdate, record->last_updated, record->modseq);
 
@@ -1163,15 +1287,6 @@
 
     if (need_body) {
         /* Server doesn't have this message yet */
-        cache_size = mailbox_cache_size(mailbox, msgno);
-
-        if (cache_size == 0) {
-            syslog(LOG_ERR,
-                   "upload_messages(): Empty cache entry for msgno %lu",
-                   msgno);
-            return(IMAP_INTERNAL);
-        }
-        
         r = mailbox_map_message(mailbox, record->uid, &msg_base, &msg_size);
         
         if (r) {
@@ -1179,16 +1294,9 @@
                    record->uid, mailbox->name);
             return(IMAP_IOERROR);
         }
-
-        prot_printf(toserver, " %lu %lu %lu {%lu+}\r\n",
-		    record->header_size, record->content_lines,
-		    record->cache_version, cache_size);
-
-        prot_write(toserver,
-		   (char *)(mailbox->cache_base + record->cache_offset),
-		   cache_size);
-                    
-        prot_printf(toserver, "{%lu+}\r\n", msg_size);
+        sync_msgid_add(msgid_onserver, &record->guid);
+
+        prot_printf(toserver, " {%lu+}\r\n", msg_size);
         prot_write(toserver, (char *)msg_base, msg_size);
         mailbox_unmap_message(mailbox, record->uid, &msg_base, &msg_size);
         sequence++;
@@ -1196,16 +1304,72 @@
     return(r);
 }
 
+/* upload_messages() null operations still requires UIDLAST update */
+
+static int update_uidlast(struct mailbox *mailbox)
+{
+    prot_printf(toserver, "UIDLAST %lu %lu\r\n",
+             mailbox->last_uid, mailbox->last_appenddate);
+    prot_flush(toserver);
+    return(sync_parse_code("UIDLAST",fromserver, SYNC_PARSE_EAT_OKLINE, NULL));
+}
+
+static int index_list_work(struct mailbox *mailbox,
+			   struct sync_index_list *index_list)
+{
+    struct sync_index *index;
+    int r = 0;
+    int c = ' ';
+    static struct buf token;   /* BSS */
+
+    if (index_list->count == 0) return(0);
+
+    prot_printf(toserver, "UPLOAD %lu %lu",
+                index_list->last_uid, mailbox->last_appenddate); 
+
+    for (index = index_list->head; index; index = index->next) {
+        r = upload_message_work(mailbox, index->msgno, &(index->record));
+	      if (r) break;
+    }
+
+    prot_printf(toserver, "\r\n");
+    prot_flush(toserver);
+
+    if (r) {
+        sync_parse_code("UPLOAD", fromserver, SYNC_PARSE_EAT_OKLINE, NULL);
+        return(r);
+    }
+    r = sync_parse_code("UPLOAD", fromserver, SYNC_PARSE_NOEAT_OKLINE, NULL);
+    if (r) return(r);
+
+    if ((c = getword(fromserver, &token)) != ' ') {
+        eatline(fromserver, c);
+        syslog(LOG_ERR, "Garbage on Upload response");
+        return(IMAP_PROTOCOL_ERROR);
+    }
+    eatline(fromserver, c);
+
+    /* Clear out msgid_on_server list if server restarted */
+    if (!strcmp(token.s, "[RESTART]")) {
+        int hash_size = msgid_onserver->hash_size;
+
+        sync_msgid_list_free(&msgid_onserver);
+        msgid_onserver = sync_msgid_list_create(hash_size);
+
+        syslog(LOG_INFO, "UPLOAD: received RESTART");
+    }
+
+    return(0);
+}
+
 static int upload_messages_list(struct mailbox *mailbox,
 				struct sync_msg_list *list)
 {
-    unsigned long msgno = 1;
+    unsigned long msgno;
     int r = 0;
     struct index_record record;
     struct sync_msg *msg;
-    int count;
-    int c = ' ';
-    static struct buf token;   /* BSS */
+    struct sync_index_list *index_list;
     int max_count = config_getint(IMAPOPT_SYNC_BATCH_SIZE);
 
     if (max_count <= 0) max_count = INT_MAX;
@@ -1216,15 +1380,19 @@
         return(IMAP_IOERROR);
     }
 
-repeatupload:
-
+    msgno = 1;
     msg = list->head;
-    for (count = 0; count < max_count && msgno <= mailbox->exists ; msgno++) {
+    do {
+	/* Break UPLOAD into chunks of <=max_count messages */
+	index_list = sync_index_list_create();
+
+	for (; (index_list->count < (unsigned) max_count) &&
+		 (msgno <= mailbox->exists); msgno++) {
         r = mailbox_read_index_record(mailbox, msgno, &record);
 
         if (r) {
             syslog(LOG_ERR,
-                   "IOERROR: reading index entry for nsgno %lu of %s: %m",
+		       "IOERROR: reading index entry for msgno %lu of %s: %m",
                    record.uid, mailbox->name);
             return(IMAP_IOERROR);
         }
@@ -1235,56 +1403,38 @@
             msg = msg->next;
 
         if (msg && (record.uid == msg->uid) &&
-            message_uuid_compare(&record.uuid, &msg->uuid)) {
+		message_guid_compare_allow_null(&record.guid, &msg->guid)) {
             msg = msg->next;  /* Ignore exact match */
             continue;
         }
 
-        if (count++ == 0)
-            prot_printf(toserver, "UPLOAD %lu %lu",
-                     mailbox->last_uid, mailbox->last_appenddate); 
-
-        /* Message with this UUID exists on client but not server */
-        if ((r=upload_message_work(mailbox, msgno, &record)))
-            return(r);
-
-        if (msg && (msg->uid == record.uid))  /* Overwritten on server */
-            msg = msg->next;
-    }
-
-    if (count == 0)
-        return(r);
-
-    prot_printf(toserver, "\r\n"); 
-    prot_flush(toserver);
-
-    r = sync_parse_code("UPLOAD", fromserver, SYNC_PARSE_NOEAT_OKLINE, NULL);
-    if (r) return(r);
-
-    if ((c = getword(fromserver, &token)) != ' ') {
-        eatline(fromserver, c);
-        syslog(LOG_ERR, "Garbage on Upload response");
-        return(IMAP_PROTOCOL_ERROR);
-    }
-    eatline(fromserver, c);
-
-    /* Clear out msgid_on_server list if server restarted */
-    if (!strcmp(token.s, "[RESTART]")) {
-        int hash_size = msgid_onserver->hash_size;
-
-        sync_msgid_list_free(&msgid_onserver);
-        msgid_onserver = sync_msgid_list_create(hash_size);
-
-	syslog(LOG_INFO, "UPLOAD: received RESTART");
-    }
-
-    /* don't overload the server with too many uploads at once! */
-    if (count >= max_count) {
-	syslog(LOG_INFO, "UPLOAD: hit %d uploads at msgno %d", count, msgno);
-	goto repeatupload;
-    }
-
-    return(0);
+	    /* Message with this GUID exists on client but not server */
+	    sync_index_list_add(index_list, msgno, &record);
+    }
+
+	if (index_list->count == 0) {
+	    /* Reached end of existing messages, with nothing in our list -
+	     * final UID might not be same as UIDLAST, force update */
+	    r = update_uidlast(mailbox);
+    }
+	else {
+	    /* We have a chunk of messages to UPLOAD */
+	    if (msgno > mailbox->exists) {
+		/* Last chunk - set final UID to be the same as UIDLAST */
+		index_list->last_uid = mailbox->last_uid;
+	    } else {
+		syslog(LOG_NOTICE,
+		       "Hit upload limit %d at UID %lu for %s, sending",
+		       max_count, index_list->last_uid, mailbox->name);
+    }
+
+	    r = index_list_work(mailbox, index_list);
+    }
+	sync_index_list_free(&index_list);
+
+    } while (!r && (msgno <= mailbox->exists));
+
+    return(r);
 }
 
 static int upload_messages_from(struct mailbox *mailbox,
@@ -1293,9 +1443,10 @@
     unsigned long msgno;
     int r = 0;
     struct index_record record;
-    int count = 0;
-    int c = ' ';
-    static struct buf token;   /* BSS */
+    struct sync_index_list *index_list;
+    int max_count = config_getint(IMAPOPT_SYNC_BATCH_SIZE);
+
+    if (max_count <= 0) max_count = INT_MAX;
 
     if (chdir(mailbox->path)) {
         syslog(LOG_ERR, "Couldn't chdir to %s: %s",
@@ -1303,64 +1454,51 @@
         return(IMAP_IOERROR);
     }
 
-    for (msgno = 1 ; msgno <= mailbox->exists ; msgno++) {
+    msgno = 1;
+    do {
+	/* Break UPLOAD into chunks of <=max_count messages */
+	index_list = sync_index_list_create();
+
+	for (; (index_list->count <= (unsigned) max_count) &&
+		 (msgno <= mailbox->exists); msgno++) {
         r =  mailbox_read_index_record(mailbox, msgno, &record);
 
         if (r) {
             syslog(LOG_ERR,
-                   "IOERROR: reading index entry for nsgno %lu of %s: %m",
+		       "IOERROR: reading index entry for msgno %lu of %s: %m",
                    record.uid, mailbox->name);
             return(IMAP_IOERROR);
         }
 
-        if (record.uid <= old_last_uid)
-            continue;
-
-        if (count++ == 0)
-            prot_printf(toserver, "UPLOAD %lu %lu",
-                     mailbox->last_uid, mailbox->last_appenddate); 
-
-        if ((r=upload_message_work(mailbox, msgno, &record)))
-            return(r);
-    }
-
-    if (count == 0)
-        return(r);
-
-    prot_printf(toserver, "\r\n"); 
-    prot_flush(toserver);
-
-    r = sync_parse_code("UPLOAD", fromserver, SYNC_PARSE_NOEAT_OKLINE, NULL);
-    if (r) return(r);
-
-    if ((c = getword(fromserver, &token)) != ' ') {
-        eatline(fromserver, c);
-        syslog(LOG_ERR, "Garbage on Upload response");
-        return(IMAP_PROTOCOL_ERROR);
-    }
-    eatline(fromserver, c);
-
-    /* Clear out msgid_on_server list if server restarted */
-    if (!strcmp(token.s, "[RESTART]")) {
-        int hash_size = msgid_onserver->hash_size;
-
-        sync_msgid_list_free(&msgid_onserver);
-        msgid_onserver = sync_msgid_list_create(hash_size);
-
-	syslog(LOG_INFO, "UPLOAD: received RESTART");
-    }
-
-    return(0);
-}
-
-/* upload_messages() null operations still requires UIDLAST update */
-
-static int update_uidlast(struct mailbox *mailbox)
-{
-    prot_printf(toserver, "UIDLAST %lu %lu\r\n",
-             mailbox->last_uid, mailbox->last_appenddate);
-    prot_flush(toserver);
-    return(sync_parse_code("UIDLAST",fromserver, SYNC_PARSE_EAT_OKLINE, NULL));
+	    if (record.uid <= old_last_uid) continue;
+
+	    /* Message with this GUID exists on client but not server */
+	    sync_index_list_add(index_list, msgno, &record);
+    }
+
+	if (index_list->count == 0) {
+	    /* Reached end of existing messages, with nothing in our list -
+	     * final UID might not be same as UIDLAST, force update */
+	    r = update_uidlast(mailbox);
+    }
+	else {
+	    /* We have a chunk of messages to UPLOAD */
+	    if (msgno > mailbox->exists) {
+		/* Last chunk - set final UID to be the same as UIDLAST */
+		index_list->last_uid = mailbox->last_uid;
+	    } else {
+		syslog(LOG_NOTICE,
+		       "Hit upload limit %d at UID %lu for %s, sending",
+		       max_count, index_list->last_uid, mailbox->name);
+    }
+
+	    r = index_list_work(mailbox, index_list);
+	}
+	sync_index_list_free(&index_list);
+
+    } while(!r && (msgno <= mailbox->exists));
+
+    return(r);
 }
 
 
@@ -1402,7 +1540,7 @@
     sync_printastring(toserver, user);
     prot_printf(toserver, " ");
     sync_printastring(toserver, m.name);
-    prot_printf(toserver, " %lu %lu %lu ",
+    prot_printf(toserver, " %lu %u %lu ",
 		lastread, last_recent_uid, lastchange);
     sync_printastring(toserver, seenuid);
     prot_printf(toserver, "\r\n");
@@ -1516,7 +1654,7 @@
 
     prot_printf(toserver, "LIST_ANNOTATIONS ");
     sync_printastring(toserver, name);
-    prot_printf(toserver, "\r\n", name);
+    prot_printf(toserver, "\r\n");
     prot_flush(toserver);
     r=sync_parse_code("LIST_ANNOTATIONS", fromserver,
 		      SYNC_PARSE_EAT_OKLINE, &unsolicited);
@@ -1618,13 +1756,8 @@
  */
 
 static int do_mailbox_work(struct mailbox *mailbox, 
-			   struct sync_msg_list *list, int just_created,
-			   char *uniqueid)
-{
-    unsigned int last_recent_uid;
-    time_t lastread, lastchange;
-    struct seen *seendb;
-    char *seenuid;
+			   struct sync_msg_list *list, int just_created)
+{
     int r = 0;
     int selected = 0;
     int flag_lookup_table[MAX_USER_FLAGS];
@@ -1639,6 +1772,16 @@
 
         selected = 1;
         if ((r=update_flags(mailbox, list, flag_lookup_table)))
+            goto bail;
+    }
+    
+    if (check_modseq(mailbox, list)) {
+        if (!selected &&
+            (r=folder_select(mailbox->name, mailbox->uniqueid, NULL)))
+            return(r);
+
+        selected = 1;
+        if ((r=update_modseq(mailbox, list)))
             goto bail;
     }
     
@@ -1821,9 +1964,9 @@
                 if (!r && do_contents) {
                     struct sync_msg_list *folder_msglist;
 
-                    /* 0L, 0L Forces last_uid and seendb push as well */
-                    folder_msglist = sync_msg_list_create(m.flagname, 0);
-                    r = do_mailbox_work(&m, folder_msglist, 1, m.uniqueid);
+                    /* 0L forces lastuid, highestmodseq push */
+                    folder_msglist = sync_msg_list_create(m.flagname, 0L, 0L);
+                    r = do_mailbox_work(&m, folder_msglist, 1);
                     sync_msg_list_free(&folder_msglist);
                 }
             } else {
@@ -1831,7 +1974,11 @@
                 if (!(folder2->acl && !strcmp(m.acl, folder2->acl)))
                     r = folder_setacl(folder->name, m.acl);
 
-                if ((folder2->options ^ m.options) & OPT_IMAP_CONDSTORE) {
+                if (!r && (m.uidvalidity != folder2->uidvalidity))
+                    r = folder_setuidvalidity(folder->name, m.uidvalidity);
+
+                if (!r &&
+                    (folder2->options ^ m.options) & OPT_IMAP_CONDSTORE) {
                     r = folder_setannotation(m.name,
 					     "/vendor/cmu/cyrus-imapd/condstore",
 					     "",
@@ -1845,7 +1992,7 @@
 		if (!r) r = do_annotation(m.name);
 
                 if (!r && do_contents)
-                    r = do_mailbox_work(&m, folder2->msglist, 0, m.uniqueid);
+                    r = do_mailbox_work(&m, folder2->msglist, 0);
             }
         } else {
 	    char *userid, *part;
@@ -1864,9 +2011,9 @@
             if (!r && do_contents) {
                 struct sync_msg_list *folder_msglist;
 
-                /* 0L, 0L Forces last_uid and seendb push as well */
-                folder_msglist = sync_msg_list_create(m.flagname, 0);
-                r = do_mailbox_work(&m, folder_msglist, 1, m.uniqueid);
+                /* 0L forces uidlast, highestmodseq push */
+                folder_msglist = sync_msg_list_create(m.flagname, 0L, 0L);
+                r = do_mailbox_work(&m, folder_msglist, 1);
                 sync_msg_list_free(&folder_msglist);
             }
 
@@ -1905,7 +2052,9 @@
     static struct buf id;
     static struct buf acl;
     static struct buf name;
+    static struct buf uidvalidity;
     static struct buf lastuid;
+    static struct buf highestmodseq;
     static struct buf options;
     static struct buf arg;
     struct quota quota, *quotap;
@@ -1938,7 +2087,13 @@
             if ((c = getastring(fromserver, toserver, &acl)) != ' ')
                 goto parse_err;
 
+            if ((c = getastring(fromserver, toserver, &uidvalidity)) != ' ')
+                goto parse_err;
+
             if ((c = getastring(fromserver, toserver, &lastuid)) !=3D ' ')
+                goto parse_err;
+
+            if ((c = getastring(fromserver, toserver, &highestmodseq)) != ' ')
                 goto parse_err;
 
             c = getastring(fromserver, toserver, &options);
@@ -1952,11 +2107,20 @@
 
             if (c == '\r') c = prot_getc(fromserver);
             if (c != '\n') goto parse_err;
+            if (!imparse_isnumber(uidvalidity.s)) goto parse_err;
             if (!imparse_isnumber(lastuid.s))  goto parse_err;
 
             folder = sync_folder_list_add(server_list, id.s, name.s, acl.s,
-					  sync_atoul(options.s), quotap);
-            folder->msglist = sync_msg_list_create(NULL, sync_atoul(lastuid.s));
+					  sync_atoul(uidvalidity.s),
+					  sync_atoul(options.s),
+                                          quotap);
+#ifdef HAVE_LONG_LONG_INT
+            folder->msglist = sync_msg_list_create
+                (NULL, sync_atoul(lastuid.s), sync_atoull(highestmodseq.s));
+#else
+            folder->msglist = sync_msg_list_create
+                (NULL, sync_atoul(lastuid.s), sync_atoul(highestmodseq.s));
+#endif
             break;
         case 1:
             /* New message in current folder */
@@ -1965,10 +2129,16 @@
         
             if (((c = getword(fromserver, &arg)) != ' ') ||
                 ((msg->uid = sync_atoul(arg.s)) == 0)) goto parse_err;
-            
+#ifdef HAVE_LONG_LONG_INT
+            if (((c = getword(fromserver, &arg)) != ' ') ||
+                ((msg->modseq = sync_atoull(arg.s)) == 0)) goto parse_err;
+#else
+            if (((c = getword(fromserver, &arg)) != ' ') ||
+                ((msg->modseq = sync_atoul(arg.s)) == 0)) goto parse_err;
+#endif
             if (((c = getword(fromserver, &arg)) != ' ')) goto parse_err;
 
-            if (!message_uuid_from_text(&msg->uuid, arg.s))
+            if (!message_guid_decode(&msg->guid, arg.s))
                 goto parse_err;
 
             c = sync_getflags(fromserver, &msg->flags, &folder->msglist->meta);
@@ -2043,8 +2213,12 @@
 		   void *rock)
 {
     struct sync_folder_list *list = (struct sync_folder_list *) rock;
-
-    sync_folder_list_add(list, NULL, name, NULL, 0, NULL);
+    int mbtype;
+
+    mboxlist_detail(name, &mbtype, NULL, NULL, NULL, NULL, NULL);
+    if (!(mbtype & (MBTYPE_RESERVE | MBTYPE_MOVING | MBTYPE_REMOTE))) {
+	sync_folder_list_add(list, NULL, name, NULL, 0, 0, NULL);
+    }
     return(0);
 }
 
@@ -2055,7 +2229,7 @@
 {
     struct sync_folder_list *list = (struct sync_folder_list *) rock;
 
-    sync_folder_list_add(list, name, name, NULL, 0, NULL);
+    sync_folder_list_add(list, name, name, NULL, 0, 0, NULL);
     return(0);
 }
 
@@ -2067,7 +2241,7 @@
     int r = 0;
     unsigned long msgno;
     struct index_record record;
-    int lastuid = 0;
+    unsigned lastuid = 0;
 
     if ((r=mailbox_open_header(folder->name, 0, &m)))
         return(r);
@@ -2318,7 +2492,7 @@
     return(0);
 }
 
-int do_user_parse(char *user,
+int do_user_parse(char *user __attribute__((unused)),
 		      struct sync_folder_list *server_list,
 		      struct sync_folder_list *server_sub_list,
 		      struct sync_sieve_list  *server_sieve_list)
@@ -2332,7 +2506,9 @@
     static struct buf time;
     static struct buf flag;
     static struct buf acl;
+    static struct buf uidvalidity;
     static struct buf lastuid;
+    static struct buf highestmodseq;
     static struct buf options;
     static struct buf arg;
     struct sync_folder *folder = NULL;
@@ -2370,7 +2546,8 @@
             c = getastring(fromserver, toserver, &name);
             if (c == '\r') c = prot_getc(fromserver);
             if (c != '\n') goto parse_err;
-            sync_folder_list_add(server_sub_list, name.s, name.s, NULL, 0, NULL);
+            sync_folder_list_add(server_sub_list, name.s, name.s,
+                                 NULL, 0, 0, NULL);
             break;
         case 2:
             /* New folder */
@@ -2383,7 +2560,13 @@
             if ((c = getastring(fromserver, toserver, &acl)) != ' ')
                 goto parse_err;
 
+            if ((c = getastring(fromserver, toserver, &uidvalidity)) != ' ')
+                goto parse_err;
+
             if ((c = getastring(fromserver, toserver, &lastuid)) !=3D ' ')
+                goto parse_err;
+
+            if ((c = getastring(fromserver, toserver, &highestmodseq)) != ' ')
                 goto parse_err;
 
             c = getastring(fromserver, toserver, &options);
@@ -2397,11 +2580,21 @@
 
             if (c == '\r') c = prot_getc(fromserver);
             if (c != '\n') goto parse_err;
+            if (!imparse_isnumber(uidvalidity.s))   goto parse_err;
             if (!imparse_isnumber(lastuid.s)) goto parse_err;
+            if (!imparse_isnumber(highestmodseq.s)) goto parse_err;
 
             folder = sync_folder_list_add(server_list, id.s, name.s, acl.s,
-					  sync_atoul(options.s), quotap);
-            folder->msglist = sync_msg_list_create(NULL, sync_atoul(lastuid.s));
+					  sync_atoul(uidvalidity.s),
+					  sync_atoul(options.s),
+                                          quotap);
+#ifdef HAVE_LONG_LONG_INT
+            folder->msglist = sync_msg_list_create
+                (NULL, sync_atoul(lastuid.s), sync_atoull(highestmodseq.s));
+#else
+            folder->msglist = sync_msg_list_create
+                (NULL, sync_atoul(lastuid.s), sync_atoul(highestmodseq.s));
+#endif
             break;
         case 1:
             /* New message in current folder */
@@ -2410,10 +2603,16 @@
 
             if (((c = getword(fromserver, &arg)) != ' ') ||
                 ((msg->uid = sync_atoul(arg.s)) == 0)) goto parse_err;
-            
+#ifdef HAVE_LONG_LONG_INT
+            if (((c = getword(fromserver, &arg)) != ' ') ||
+                ((msg->modseq = sync_atoull(arg.s)) == 0)) goto parse_err;
+#else
+            if (((c = getword(fromserver, &arg)) != ' ') ||
+                ((msg->modseq = sync_atoul(arg.s)) == 0)) goto parse_err;
+#endif
             if (((c = getword(fromserver, &arg)) != ' ')) goto parse_err;
 
-            if (!message_uuid_from_text(&msg->uuid, arg.s))
+            if (!message_guid_decode(&msg->guid, arg.s))
                 goto parse_err;
 
             c = sync_getflags(fromserver, &msg->flags, &folder->msglist->meta);
@@ -2517,7 +2716,6 @@
 
 static int do_user(char *user)
 {
-    struct sync_lock lock;
     int r = 0;
     int vanished = 0;
 
@@ -2552,10 +2750,7 @@
          * Following just protects us against folder rename smack in the
          * middle of night or manual sys. admin inspired sync run */
 
-        sync_lock_reset(&lock);
-        sync_lock(&lock);
         r = do_user_work(user, &vanished);
-        sync_unlock(&lock);
     }
     return(r);
 }
@@ -2585,7 +2780,7 @@
             r = IMAP_PROTOCOL_ERROR;
             break;
         }
-        sync_folder_list_add(server_list, name.s, name.s, NULL, 0, NULL);
+        sync_folder_list_add(server_list, name.s, name.s, NULL, 0, 0, NULL);
 
         r = sync_parse_code("LSUB", fromserver,
                             SYNC_PARSE_EAT_OKLINE, &unsolicited);
@@ -2719,7 +2914,6 @@
 static int do_sync(const char *filename)
 {
     struct sync_user_list   *user_folder_list = sync_user_list_create();
-    struct sync_user        *user;
     struct sync_action_list *user_list   = sync_action_list_create();
     struct sync_action_list *meta_list   = sync_action_list_create();
     struct sync_action_list *sieve_list  = sync_action_list_create();
@@ -2734,7 +2928,6 @@
     struct sync_folder_list *folder_list = sync_folder_list_create();
     static struct buf type, arg1, arg2;
     char *arg1s, *arg2s;
-    char *userid;
     struct sync_action *action;
     int c;
     int fd;
@@ -2772,13 +2965,11 @@
             continue;
         }
 
-	if ((c = getastring(input, 0, &arg1)) == EOF)
-            break;
+	if ((c = getastring(input, 0, &arg1)) == EOF) break;
         arg1s = arg1.s;
 
         if (c == ' ') {
-            if ((c = getastring(input, 0, &arg2)) == EOF)
-                break;
+            if ((c = getastring(input, 0, &arg2)) == EOF) break;
             arg2s = arg2.s;
 
         } else 
@@ -2993,8 +3184,8 @@
     for (action = mailbox_list->head ; action ; action = action->next) {
         if (!action->active)
             continue;
-
-	sync_folder_list_add(folder_list, NULL, action->name, NULL, 0, NULL);
+	sync_folder_list_add(folder_list, NULL, action->name,
+                             NULL, 0, 0, NULL);
     }
 
     if (folder_list->count) {
@@ -3091,6 +3282,12 @@
 
 /* ====================================================================== */
 
+enum {
+    RESTART_NONE = 0,
+    RESTART_NORMAL,
+    RESTART_RECONNECT
+};
+
 int do_daemon_work(const char *sync_log_file, const char *sync_shutdown_file,
 		   unsigned long timeout, unsigned long min_delta,
 		   int *restartp)
@@ -3102,27 +3299,42 @@
     int    delta;
     struct stat sbuf;
 
-    *restartp = 0;
-
+    *restartp = RESTART_NONE;
+
+    /* Create a work log filename.  Use the parent PID so we can
+     * try to reprocess it if the child fails.
+     */
     work_file_name = xmalloc(strlen(sync_log_file)+20);
     snprintf(work_file_name, strlen(sync_log_file)+20,
-             "%s-%d", sync_log_file, getpid());
+             "%s-%d", sync_log_file, getppid());
 
     session_start = time(NULL);
 
     while (1) {
         single_start = time(NULL);
 
+	/* Check for shutdown file */
         if (sync_shutdown_file && !stat(sync_shutdown_file, &sbuf)) {
             unlink(sync_shutdown_file);
             break;
         }
 
-        if ((timeout > 0) && ((single_start - session_start) > timeout)) {
-            *restartp = 1;
+	/* See if its time to RESTART */
+        if ((timeout > 0) &&
+	    ((single_start - session_start) > (time_t) timeout)) {
+            *restartp = RESTART_NORMAL;
             break;
         }
 
+        if ((stat(work_file_name, &sbuf) == 0) &&
+	    (sbuf.st_mtime - single_start < 3600)) {
+	    /* Existing work log file from our parent < 1 hour old */
+	    /* XXX  Is 60 minutes a resonable timeframe? */
+	    syslog(LOG_NOTICE,
+		   "Reprocessing sync log file %s", work_file_name);
+	}
+	else {
+	    /* Check for sync_log file */
         if (stat(sync_log_file, &sbuf) < 0) {
             if (min_delta > 0) {
                 sleep(min_delta);
@@ -3132,38 +3344,50 @@
             continue;
         }
 
+	    /* Move sync_log to our work file */
         if (rename(sync_log_file, work_file_name) < 0) {
             syslog(LOG_ERR, "Rename %s -> %s failed: %m",
                    sync_log_file, work_file_name);
-            exit(1);
-        }
-
-        if ((r=do_sync(work_file_name)))
-            return(r);
+		r = IMAP_IOERROR;
+		break;
+	    }
+        }
+
+	/* Process the work log */
+        if ((r=do_sync(work_file_name))) {
+	    syslog(LOG_ERR,
+		   "Processing sync log file %s failed: %s",
+		   work_file_name, error_message(r));
+	    break;
+	}
         
+	/* Remove the work log */
         if (unlink(work_file_name) < 0) {
             syslog(LOG_ERR, "Unlink %s failed: %m", work_file_name);
-            exit(1);
+	    r = IMAP_IOERROR;
+	    break;
         }
         delta = time(NULL) - single_start;
 
-        if ((delta < min_delta) && ((min_delta-delta) > 0))
+        if (((unsigned) delta < min_delta) && ((min_delta-delta) > 0))
             sleep(min_delta-delta);
     }
     free(work_file_name);
 
-    if (*restartp == 0)
-        return(0);
-
+    if (*restartp == RESTART_NORMAL) {
     prot_printf(toserver, "RESTART\r\n"); 
     prot_flush(toserver);
 
     r = sync_parse_code("RESTART", fromserver, SYNC_PARSE_EAT_OKLINE, NULL);
 
-    if (r)
-        syslog(LOG_ERR, "sync_client RESTART failed");
-    else
+	if (r) {
+	    syslog(LOG_ERR, "sync_client RESTART failed: %s",
+		   error_message(r));
+	} else {
         syslog(LOG_INFO, "sync_client RESTART succeeded");
+	}
+	r = 0;
+    }
 
     return(r);
 }
@@ -3172,9 +3396,10 @@
 				sasl_callback_t *cb)
 {
     int wait;
+    struct protoent *proto;
 
     for (wait = 15;; wait *= 2) {
-	be = backend_connect(be, servername, &protocol[PROTOCOL_CSYNC],
+	be = backend_connect(be, servername, &csync_protocol,
 			     "", cb, NULL);
 
 	if (be || connect_once || wait > 1000) break;
@@ -3188,7 +3413,25 @@
     if (!be) {
 	fprintf(stderr, "Can not connect to server '%s'\n",
 		servername);
+	syslog(LOG_ERR, "Can not connect to server '%s'", servername);
 	_exit(1);
+    }
+
+    /* Disable Nagle's Algorithm => increase throughput
+     *
+     * http://en.wikipedia.org/wiki/Nagle's_algorithm
+     */ 
+    if (servername[0] != '/') {
+	if ((proto = getprotobyname("tcp")) != NULL) {
+	    int on = 1;
+
+	    if (setsockopt(be->sock, proto->p_proto, TCP_NODELAY,
+			   (void *) &on, sizeof(on)) != 0) {
+		syslog(LOG_ERR, "unable to setsocketopt(TCP_NODELAY): %m");
+	    }
+	} else {
+	    syslog(LOG_ERR, "unable to getprotobyname(\"tcp\"): %m");
+	}
     }
 
     return be;
@@ -3203,9 +3446,8 @@
     int status;
     int restart;
 
-    /* for a child so we can release from master */
-    if ((pid=fork()) < 0)
-	fatal("fork failed", EC_SOFTWARE);
+    /* fork a child so we can release from master */
+    if ((pid=fork()) < 0) fatal("fork failed", EC_SOFTWARE);
 
     if (pid != 0) { /* parent */
 	cyrus_done();
@@ -3219,18 +3461,23 @@
         return;
     }
 
+    signal(SIGPIPE, SIG_IGN); /* don't fail on server disconnects */
+
     do {
-        if ((pid=fork()) < 0)
-            fatal("fork failed", EC_SOFTWARE);
-
-        if (pid == 0) {
+	/* fork a child so we can RESTART (flush memory) */
+        if ((pid=fork()) < 0) fatal("fork failed", EC_SOFTWARE);
+
+        if (pid == 0) { /* child */
+
 	    if (be->sock == -1) {
 		/* Reopen up connection to server */
-		be = replica_connect(be, be->hostname, cb);
+		be = replica_connect(be, servername, cb);
 
 		if (!be) {
 		    fprintf(stderr, "Can not connect to server '%s'\n",
 			    be->hostname);
+		    syslog(LOG_ERR, "Can not connect to server '%s'",
+			   be->hostname);
 		    _exit(1);
 		}
 
@@ -3242,14 +3489,36 @@
             r = do_daemon_work(sync_log_file, sync_shutdown_file,
                                timeout, min_delta, &restart);
 
-            if (r)       _exit(1);
+            if (r) {
+		/* See if we're still connected to the server.
+		 * If we are, we had some type of error, so we exit.
+		 * Otherwise, try reconnecting.
+		 */
+		if (!backend_ping(be)) _exit(1);
+
+		syslog(LOG_WARNING, "Lost connection to server. Reconnecting");
+		restart = 1;
+	    }
+
             if (restart) _exit(EX_TEMPFAIL);
             _exit(0);
         }
-        if (waitpid(pid, &status, 0) < 0)
-            fatal("waitpid failed", EC_SOFTWARE);
+
+	/* parent */
+        if (waitpid(pid, &status, 0) < 0) fatal("waitpid failed", EC_SOFTWARE);
+
 	backend_disconnect(be);
     } while (WIFEXITED(status) && (WEXITSTATUS(status) == EX_TEMPFAIL));
+
+    if (WIFEXITED(status)) {
+	syslog(LOG_ERR, "process %d exited, status %d\n", pid, 
+	       WEXITSTATUS(status));
+    }
+    if (WIFSIGNALED(status)) {
+	syslog(LOG_ERR, 
+	       "process %d exited, signaled to death by %d\n",
+	       pid, WTERMSIG(status));
+    }
 }
 
 /* ====================================================================== */
@@ -3273,14 +3542,12 @@
     int   opt, i = 0;
     char *alt_config     = NULL;
     char *input_filename = NULL;
-    const char *servername = NULL;
     int   r = 0;
     int   exit_rc = 0;
     int   mode = MODE_UNKNOWN;
     int   wait     = 0;
     int   timeout  = 600;
     int   min_delta = 0;
-    const char *sync_host = NULL;
     char sync_log_file[MAX_MAILBOX_PATH+1];
     const char *sync_shutdown_file = NULL;
     char buf[512];
@@ -3288,12 +3555,14 @@
     int len;
     struct backend *be = NULL;
     sasl_callback_t *cb;
+    int config_virtdomains;
 
     /* Global list */
     msgid_onserver = sync_msgid_list_create(SYNC_MSGID_LIST_HASH_SIZE);
 
-    if(geteuid() == 0)
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
         fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     setbuf(stdout, NULL);
 
@@ -3386,6 +3655,7 @@
     }
 
     /* Set namespace -- force standard (internal) */
+    config_virtdomains = config_getenum(IMAPOPT_VIRTDOMAINS);
     if ((r = mboxname_init_namespace(&sync_namespace, 1)) != 0) {
         fatal(error_message(r), EC_CONFIG);
     }
@@ -3449,6 +3719,9 @@
 		    exit_rc = 1;
 		}
 		else {
+		    mboxname_hiersep_tointernal(&sync_namespace, buf,
+						config_virtdomains ?
+						strcspn(buf, "@") : 0);
 		    if (do_user(buf)) {
 			if (verbose)
 			    fprintf(stderr,
@@ -3471,10 +3744,13 @@
 		exit_rc = 1;
 	    }
 	    else {
+		mboxname_hiersep_tointernal(&sync_namespace, argv[i],
+					    config_virtdomains ?
+					    strcspn(argv[i], "@") : 0);
 		if (do_user(argv[i])) {
 		    if (verbose)
 			fprintf(stderr, "Error from do_user(%s): bailing out!\n",
-				argv[1]);
+				argv[i]);
 		    syslog(LOG_ERR, "Error in do_user(%s): bailing out!", argv[i]);
 		    exit_rc = 1;
 		}
@@ -3486,8 +3762,7 @@
     case MODE_MAILBOX:
     {
 	struct sync_folder_list *folder_list = sync_folder_list_create();
-	struct sync_user   *user;
-	char   *s, *t;
+	char mailboxname[MAX_MAILBOX_NAME+1];
 
 	if (input_filename) {
 	    if ((file=fopen(input_filename, "r")) == NULL) {
@@ -3502,14 +3777,19 @@
 		if ((len == 0) || (buf[0] == '#'))
 		    continue;
 
-		if (!sync_folder_lookup_byname(folder_list, argv[i]))
+		(*sync_namespace.mboxname_tointernal)(&sync_namespace, buf,
+						      NULL, mailboxname);
+		if (!sync_folder_lookup_byname(folder_list, mailboxname))
 		    sync_folder_list_add(folder_list,
-					 NULL, argv[i], NULL, 0, NULL);
+					 NULL, mailboxname, NULL, 0, 0, NULL);
 	    }
 	    fclose(file);
 	} else for (i = optind; i < argc; i++) {
-	    if (!sync_folder_lookup_byname(folder_list, argv[i]))
-		sync_folder_list_add(folder_list, NULL, argv[i], NULL, 0, NULL);
+	    (*sync_namespace.mboxname_tointernal)(&sync_namespace, argv[i],
+						   NULL, mailboxname);
+	    if (!sync_folder_lookup_byname(folder_list, mailboxname))
+		sync_folder_list_add(folder_list, NULL, mailboxname,
+                                     NULL, 0, 0, NULL);
 	}
 
 	if ((r = send_lock())) {
@@ -3546,6 +3826,9 @@
 		exit_rc = 1;
 	    }
 	    else {
+		mboxname_hiersep_tointernal(&sync_namespace, argv[i],
+					    config_virtdomains ?
+					    strcspn(argv[i], "@") : 0);
 		if (do_sieve(argv[i])) {
 		    if (verbose) {
 			fprintf(stderr,
@@ -3588,6 +3871,5 @@
     sync_msgid_list_free(&msgid_onserver);
     backend_disconnect(be);
 
-  quit:
     shut_down(exit_rc);
 }

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_commit.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_commit.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_commit.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_commit.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* sync_commit.c -- Cyrus synchonization mailbox functions
  *
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: sync_commit.c,v 1.15 2008/03/24 17:09:20 murch Exp $
+ *
  * Original version written by David Carter <dpc22 at cam.ac.uk>
  * Rewritten and integrated into Cyrus by Ken Murchison <ken at oceana.com>
- *
- * $Id: sync_commit.c,v 1.2 2006/11/30 17:11:20 murch Exp $
  */
 
 #include <config.h>
@@ -69,6 +70,8 @@
 #include "mailbox.h"
 #include "quota.h"
 #include "xmalloc.h"
+#include "xstrlcat.h"
+#include "xstrlcpy.h"
 #include "acl.h"
 #include "seen.h"
 #include "mboxname.h"
@@ -77,204 +80,513 @@
 #include "imparse.h"
 #include "util.h"
 #include "retry.h"
+#include "lock.h"
 #include "sync_support.h"
 #include "sync_commit.h"
 
+/* A few support functions for sync_combine_commit() */
+
+/* uiditem used to generate list of msgnos sorted by ascending UID */
+struct uiditem {
+    unsigned long msgno;
+    unsigned long uid;
+};
+
+static int compare_uiditem(const void *a0, const void *b0)
+{
+    struct uiditem *a = (struct uiditem *) a0;
+    struct uiditem *b = (struct uiditem *) b0;
+
+    return ((a->uid) - (b->uid));
+}
+
+/* ---------------------------------------------------------------------- */
+
+/* Running counts which will go into the index and expunge headers */
+struct sync_counts {
+    unsigned long newexists;
+    uquota_t      newquota_used;
+    unsigned long newanswered;
+    unsigned long newflagged;
+    unsigned long newdeleted;
+    modseq_t      newhighestmodseq;
+};
+
+static void sync_counts_clear(struct sync_counts *c)
+{
+    memset(c, 0, sizeof(struct sync_counts));
+}
+
+
+static void sync_counts_update(struct sync_counts *c, struct index_record *p)
+{
+    c->newexists++;
+    c->newquota_used += p->size;
+
+    if (p->system_flags & FLAG_ANSWERED) c->newanswered++;
+    if (p->system_flags & FLAG_DELETED)  c->newdeleted++;
+    if (p->system_flags & FLAG_FLAGGED)  c->newflagged++;
+
+    if (p->modseq > c->newhighestmodseq) c->newhighestmodseq = p->modseq;
+}
+
+static void sync_counts_write(unsigned char *buf, struct sync_counts *c,
+			      time_t last_appenddate, unsigned long last_uid)
+{
+#if 0
+    /* XXX Historical?
+     * XXX Not clear why we do this in mailbox_expunge() etc.
+     * XXX OFFSET_MINOR version etc are not updated
+     */
+    if (mailbox->start_offset < INDEX_HEADER_SIZE) {
+        *((bit32 *)(buf+OFFSET_START_OFFSET)) = htonl(INDEX_HEADER_SIZE);
+        }
+#endif
+
+    /* Fix up exists and other counts */
+    *((bit32 *)(buf+OFFSET_EXISTS))   = htonl(c->newexists);
+    *((bit32 *)(buf+OFFSET_ANSWERED)) = htonl(c->newanswered);
+    *((bit32 *)(buf+OFFSET_DELETED))  = htonl(c->newdeleted);
+    *((bit32 *)(buf+OFFSET_FLAGGED))  = htonl(c->newflagged);
+
+    /* Fix up quota_mailbox_used */
+#ifdef HAVE_LONG_LONG_INT
+    *((bit64 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonll(c->newquota_used);
+#else
+    *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED64)) = htonl(0);
+    *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED))   = htonl(c->newquota_used);
+#endif
+
+    /* Fix up last_append time */
+    *((bit32 *)(buf+OFFSET_LAST_APPENDDATE)) = htonl(last_appenddate);
+
+    /* Fix up last_uid */
+    *((bit32 *)(buf+OFFSET_LAST_UID)) = htonl(last_uid);
+
+    /* Fix up highest modseq */
+#ifdef HAVE_LONG_LONG_INT
+    align_htonll(buf+OFFSET_HIGHESTMODSEQ_64, c->newhighestmodseq);
+#else
+    *((bit32 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonl(0);
+    *((bit32 *)(buf+OFFSET_HIGHESTMODSEQ))    = htonl(c->newhighestmodseq);
+#endif
+}
+
+/* ---------------------------------------------------------------------- */
+
+/* Code which is typically reused for index,expunge and cache files */
+
+static void sync_make_path(char *buf, int size, struct mailbox *mailbox,
+			   int mask, char *name)
+{
+    char *path = (mailbox->mpath && (config_metapartition_files & mask))
+	? mailbox->mpath : mailbox->path;
+
+    strlcpy(buf, path, size);
+    strlcat(buf, name, size);
+}
+
+static int sync_open_expunge(struct mailbox *mailbox, int *fdp,
+			     unsigned long *lenp)
+{
+    char fnamebuf[MAX_MAILBOX_PATH+1];
+    struct stat sbuf;
+    const char *lockfailaction;
+    int r;
+
+    sync_make_path(fnamebuf, sizeof(fnamebuf), mailbox,
+                   IMAP_ENUM_METAPARTITION_FILES_EXPUNGE, FNAME_EXPUNGE_INDEX);
+    *fdp = -1;
+    if ((stat(fnamebuf, &sbuf) < 0) ||
+        (sbuf.st_size < (int) INDEX_HEADER_SIZE) ||
+        ((*fdp = open(fnamebuf, O_RDWR, 0666)) < 0)) {
+	unlink(fnamebuf);
+        return(0);
+    }
+    *lenp = sbuf.st_size;
+
+    if ((r = lock_reopen(*fdp, fnamebuf, &sbuf, &lockfailaction)))
+         syslog(LOG_ERR, "IOERROR: %s expunge index for %s: %m",
+                lockfailaction, mailbox->name);
+    return(r);
+}
+
+/* Open a single index/expunge/cache file for writing */
+static int sync_open_single(FILE **filep, struct mailbox *mailbox, int mask,
+			    char *filename, char *suffix)
+{
+    char fnamebuf[MAX_MAILBOX_PATH+1];
+
+    sync_make_path(fnamebuf, sizeof(fnamebuf), mailbox, mask, filename);
+
+    if (suffix && suffix[0])
+        strlcat(fnamebuf, suffix, sizeof(fnamebuf));
+
+    if ((*filep = fopen(fnamebuf, "w+")))
+        return(0);
+
+    syslog(LOG_ERR, "IOERROR: creating %s: %m", fnamebuf);
+    return(IMAP_IOERROR);
+}
+
+/* Commit a single index/expunge/cache file */
+static int sync_rename_single(struct mailbox *mailbox, int mask, char *filename)
+{
+    char fnamebuf[MAX_MAILBOX_PATH+1], fnamebufnew[MAX_MAILBOX_PATH+1];
+
+    sync_make_path(fnamebuf, sizeof(fnamebuf), mailbox, mask, filename);
+
+    strlcpy(fnamebufnew, fnamebuf, sizeof(fnamebufnew));
+    strlcat(fnamebufnew, ".NEW", sizeof(fnamebufnew));
+
+    if (rename(fnamebufnew, fnamebuf)) {
+        syslog(LOG_ERR, "IOERROR: renaming %s for %s: %m",
+               filename, mailbox->name);
+        return(IMAP_IOERROR);
+    }
+    return(0);
+}
+
+/* Delete a single index/expunge/cache file */
+static int sync_delete_single(struct mailbox *mailbox, int mask,
+			      char *filename, char *suffix)
+{
+    char fnamebuf[MAX_MAILBOX_PATH+1];
+
+    sync_make_path(fnamebuf, sizeof(fnamebuf), mailbox, mask, filename);
+
+    if (suffix && suffix[0])
+        strlcat(fnamebuf, suffix, sizeof(fnamebuf));
+
+    return ((unlink(fnamebuf) < 0) ? IMAP_IOERROR : 0);
+}
+
+/* Update index/expunge/cache header */
+static void sync_write_header(struct mailbox *mailbox,
+			      const char *index_base,
+			      FILE *file)
+{
+    indexbuffer_t ibuf;
+    unsigned char *buf = ibuf.buf;
+    unsigned long n;
+
+    memcpy(buf, index_base, mailbox->start_offset);
+    *((bit32 *)buf+OFFSET_GENERATION_NO) = htonl(mailbox->generation_no+1);
+    fwrite(buf, 1, mailbox->start_offset, file);
+
+    /* Grow the index header if necessary */
+    for (n = mailbox->start_offset; n < INDEX_HEADER_SIZE; n++) {
+        if (n == OFFSET_UIDVALIDITY+3) {
+            putc(1, file);
+        } else {
+            putc(0, file);
+        }
+    }
+}
+
+/* Combine constant and variable components of uploaded message into
+   a single index_record, which can then be written to index/cache */
+static void sync_make_index_record(struct index_record *p,
+				   struct sync_upload_item *item)
+{
+    struct sync_message *message = item->message;
+    int n;
+
+    memset(p, 0, sizeof(struct index_record));
+    
+    p->uid            = item->uid;
+    p->internaldate   = item->internaldate;
+    p->sentdate       = item->sentdate;
+
+    /* XXX Should really have separate message->content_offset, even though
+     * XXX header_size and content_offset always seem to match */
+
+    p->size           = message->msg_size;
+    p->header_size    = message->hdr_size;
+    p->content_offset = message->hdr_size;
+    p->cache_offset   = message->cache_offset;
+
+    p->last_updated   = item->last_updated; 
+
+    p->system_flags   = item->flags.system_flags;
+    for (n = 0; n < MAX_USER_FLAGS/32; n++)
+        p->user_flags[n] = item->flags.user_flags[n];
+
+    p->content_lines = message->content_lines;
+    p->cache_version = message->cache_version;
+
+    message_guid_copy(&p->guid, &item->guid);
+    p->modseq = item->modseq;
+}
+            
+#include "index.h"
+
+static unsigned long sync_cacheitem_size(const char *cacheitem)
+{
+    unsigned int cache_ent;
+    const char *cacheitembegin = cacheitem;
+
+    for (cache_ent = 0; cache_ent < NUM_CACHE_FIELDS; cache_ent++) {
+        cacheitem = CACHE_ITEM_NEXT(cacheitem);
+            }
+    return(cacheitem - cacheitembegin); /* Compute size of this record */
+}
+
+static void sync_cacheitem_write(const char *cacheitem, FILE *newcache)
+{
+    fwrite(cacheitem, 1, sync_cacheitem_size(cacheitem), newcache);
+}
+
 /* ====================================================================== */
 
-static int
-sync_combine_commit(struct mailbox *mailbox,
-                    time_t last_appenddate,
-                    struct sync_upload_list  *upload_list,
-                    struct sync_message_list *message_list)
-{
-    char fnamebuf[MAX_MAILBOX_PATH+1], fnamebufnew[MAX_MAILBOX_PATH+1];
-    char *path;
+/* sync_combine_commit() is a three way combine on an open mailbox, the
+ * mailbox's cyrus.expunge and a list of messages to upload.
+ * Duplicate UIDs should be eliminated, with upload_list taking precedence.
+ *
+ * Inputs:
+ *   mailbox :: Target mailbox, in ascending UID order.
+ *   upload_list :: List of new messages to commit, in ascending UID order
+ *   message_list :: List of all messages recently uploaded or reserved on
+ *     server. Only needed for the mmap()ed cache file, which
+ *     is referenced by upload_list. Possible cleanup here.
+ *
+ * Additional input:
+ *   cyrus.expunge is a list of expunged messages in mailbox
+ *
+ * mmap() cyrus.expunge and generate an array of expunged UIDs sorted
+ * into ascending UID so that we can track all three sources in order.
+ *
+ * mailbox has cyrus.index and cyrus.cache mmap()ed for reading. Open
+ * cyrus.index.NEW, cyrus.cache.NEW, expunge.index.NEW for writing.
+ *
+ * Copy message files on upload_list into target mailbox. Will replace
+ * messages that are already there on GUID mismatch, as before.
+ *
+ * While messages left in mailbox or expunge list or upload_list:
+ *   if (next message from expunge list (if any) has UID less than
+ *       next message from upload_list (if any) or mailbox (if any)):
+ *     Add that message to cyrus.expunge.NEW and cyrus.cache.NEW
+ *
+ *   else if (next message from mailbox (if any) has UID less than next
+ *            message from upload_list (if any)):
+ *     Add that message to cyrus.index.NEW and cyrus.cache.NEW
+ *
+ *     If message matches next UID on expunge list (if any) then skip
+ *     that entry on the expunge list.
+ *
+ *   else
+ *     Add message from upload_list to cyrus.index.NEW and cyrus.cache.NEW
+ *
+ *     If message matches next UID on expunge list (if any) then skip
+ *     that entry on the expunge list.
+ *
+ *     If message matches next UID in mailbox (if any) then skip
+ *     that entry in mailbox
+ *
+ * Update cyrus.index and expunge.index headers, quota.
+ *
+ * fflush, fsync and commit new index, expunge and cache files
+ *
+ * Cleanup and exit.
+*/
+
+static int sync_combine_commit(struct mailbox *mailbox,
+			       time_t last_appenddate,
+			       struct sync_upload_list  *upload_list,
+			       struct sync_message_list *message_list)
+{
     FILE *newindex = NULL;
     FILE *newcache = NULL;
-    unsigned char *buf  = NULL;
+    FILE *newexpunge = NULL;
+    uquota_t original_quota = mailbox->quota_mailbox_used;
+    struct txn *tid = NULL;
+    indexbuffer_t ibuf;
+    unsigned char *buf = ibuf.buf;
     struct sync_upload_item *item;
-    struct sync_message     *message;
-    long quota_add       = 0;  /* Following may be negative on UUID conflict */
-    long numansweredflag = 0;
-    long numdeletedflag  = 0;
-    long numflaggedflag  = 0;
-    unsigned long newexists = 0;
-    unsigned long newdeleted;
-    unsigned long newanswered;
-    unsigned long newflagged;
-    unsigned long msgno;
-    char  target[MAX_MAILBOX_PATH+1];
-    struct index_record record;
-    int   n, r = 0, rc;
-    struct txn *tid = NULL;
-    modseq_t highestmodseq = 0;
+    int r = 0;
+    unsigned n;
+    int expunge_fd = -1;
+    const char *expunge_base = NULL;
+    unsigned long expunge_len = 0;
+    unsigned long expunge_exists = 0;
+    struct uiditem *expunge_uidmap = NULL;
+    time_t expunge_last_appenddate = 0;
+    unsigned long index_msgno, expunge_msgno, size = 0;
+    struct index_record index_record, expunge_record, tmp_record;
+    struct sync_counts index, expunge;
 
     if (upload_list->count == 0) return(0);   /* NOOP */
 
-    path = (mailbox->mpath &&
-	    (config_metapartition_files &
-	     IMAP_ENUM_METAPARTITION_FILES_INDEX)) ?
-	mailbox->mpath : mailbox->path;
-    strlcpy(fnamebuf, path, sizeof(fnamebuf));
-    strlcat(fnamebuf, FNAME_INDEX, sizeof(fnamebuf));
-    strlcat(fnamebuf, ".NEW", sizeof(fnamebuf));
-    newindex = fopen(fnamebuf, "w+");
-    if (!newindex) {
-        syslog(LOG_ERR, "IOERROR: creating %s: %m", fnamebuf);
-        return IMAP_IOERROR;
-    }
-
-    path = (mailbox->mpath &&
-	    (config_metapartition_files &
-	     IMAP_ENUM_METAPARTITION_FILES_CACHE)) ?
-	mailbox->mpath : mailbox->path;
-    strlcpy(fnamebuf, path, sizeof(fnamebuf));
-    strlcat(fnamebuf, FNAME_CACHE, sizeof(fnamebuf));
-    strlcat(fnamebuf, ".NEW", sizeof(fnamebuf));
-    newcache = fopen(fnamebuf, "w+");
-    if (!newcache) {
-        syslog(LOG_ERR, "IOERROR: creating %s: %m", fnamebuf);
-        fclose(newindex);
-        return IMAP_IOERROR;
-    }
-
-    /* Copy messages into target mailfolder (blat existing messages:
-     * caused by UUID conflict on messages: sync_client wins) */
-    for (item = upload_list->head ; item ; item = item->next) {
-#if 0
-        snprintf(target, MAX_MAILBOX_PATH,
-                 "%s/%lu.", mailbox->path, (unsigned long)item->uid);
-
-        if (mailbox_copyfile(item->message->msg_path, target, 0) != 0) {
-            /* Attempt undo before we bail out */
-            for (item=upload_list->head ; item != item; item = item->next)
-                unlink(item->message->msg_path);
-
-            goto fail;
+    sync_counts_clear(&index);
+    index.newhighestmodseq = mailbox->highestmodseq;
+
+    /* Map cyrus.expunge file if it exists */
+    if ((r = sync_open_expunge(mailbox, &expunge_fd, &size)))
+        goto bail;
+
+    if (expunge_fd != -1) {
+        map_refresh(expunge_fd, 1, &expunge_base, &expunge_len, size,
+                    "expunge", mailbox->name);
+    }
+
+    if (expunge_base && (expunge_len >= INDEX_HEADER_SIZE)) {
+        expunge_exists = ntohl(*((bit32 *)(expunge_base+OFFSET_EXISTS)));
+        expunge_last_appenddate
+            = ntohl(*((bit32 *)(expunge_base+OFFSET_LAST_APPENDDATE)));
+
+	sync_counts_clear(&expunge);
+#ifdef HAVE_LONG_LONG_INT
+	expunge.newhighestmodseq =
+	    align_ntohll(expunge_base+OFFSET_HIGHESTMODSEQ_64);
+#else
+	expunge.newhighestmodseq =
+	    ntohl(*((bit32 *)(expunge_base+OFFSET_HIGHESTMODSEQ)));
+    }
+#endif
+    }
+
+    /* expunge_uidmap is list of msgnos sorted in ascending UID */
+    if (expunge_exists > 0) {
+        expunge_uidmap = xmalloc(expunge_exists * sizeof(struct uiditem));
+
+        for (expunge_msgno = 1 ;
+             expunge_msgno <= expunge_exists; expunge_msgno++) {
+            r = mailbox_read_index_record_from_mapped
+                (mailbox, expunge_base, expunge_len,
+                 expunge_msgno, &expunge_record);
+
+            if (r) goto bail;
+
+            expunge_uidmap[expunge_msgno-1].msgno = expunge_msgno;
+            expunge_uidmap[expunge_msgno-1].uid   = expunge_record.uid;
         }
-#else
-	if (sync_message_copy_fromstage(item->message, mailbox, item->uid)) {
-	    goto fail;
-	}
-#endif
-    }
-
-    /* Make sure that new flag names recorded before we try to use them */
+        qsort(expunge_uidmap, expunge_exists,
+              sizeof(struct uiditem), compare_uiditem);
+    }
+
+    /* Open cyrus.index.NEW, cyrus.cache.NEW, cyrus.expunge.NEW */
+    if (!r)
+        r=sync_open_single(&newindex, mailbox,
+                           IMAP_ENUM_METAPARTITION_FILES_INDEX,
+                           FNAME_INDEX, ".NEW");
+    if (!r)
+        r=sync_open_single(&newcache, mailbox,
+                           IMAP_ENUM_METAPARTITION_FILES_CACHE,
+                           FNAME_CACHE, ".NEW");
+    if (!r)
+        r=sync_open_single(&newexpunge, mailbox,
+                           IMAP_ENUM_METAPARTITION_FILES_EXPUNGE,
+                           FNAME_EXPUNGE_INDEX, ".NEW");
+    if (r) goto bail;
+                            
+    /* Record new flag names before we try to use them (cyrus.header) */
     if (upload_list->meta.newflags) {
         sync_flags_meta_to_list(&upload_list->meta, mailbox->flagname);
 	mailbox_write_header(mailbox);
     }
 
-    buf = xmalloc(mailbox->start_offset > mailbox->record_size ?
-                  mailbox->start_offset : mailbox->record_size);
-
-    /* Copy index header across */
-    memcpy(buf, mailbox->index_base, mailbox->start_offset);
-    (*(bit32 *)buf)++;    /* Increment generation number */
-    fwrite(buf, 1, mailbox->start_offset, newindex);
-
-    /* Grow the index header if necessary */
-    for (n = mailbox->start_offset; n < INDEX_HEADER_SIZE; n++) {
-        if (n == OFFSET_UIDVALIDITY+3) {
-            putc(1, newindex);
+    /* Copy index, expunge, cache headers across */
+    sync_write_header(mailbox, mailbox->index_base, newindex);
+    if (expunge_base)
+        sync_write_header(mailbox, expunge_base, newexpunge);
+    /* XXX OFFSET_GENERATION_NO can only be zero */
+    *((bit32 *)buf+OFFSET_GENERATION_NO) = htonl(mailbox->generation_no+1);
+    fwrite(buf, 1, sizeof(bit32), newcache);
+
+    /* Copy messages into target mailfolder (blat existing messages:
+     * caused by GUID conflict on messages: sync_client wins) */
+    for (item = upload_list->head ; item ; item = item->next) {
+	if (sync_message_copy_fromstage(item->message, mailbox, item->uid,
+					item->internaldate)) {
+            r = IMAP_IOERROR;
+	    goto bail;
+	}
+    }
+
+    /* Time to start the three way merge */
+    item = upload_list->head;
+    index_msgno = 0;
+    expunge_msgno = 0;
+    
+    if (++index_msgno <= mailbox->exists)
+        mailbox_read_index_record(mailbox, index_msgno, &index_record);
+
+    if (++expunge_msgno <= expunge_exists)
+        mailbox_read_index_record_from_mapped
+            (mailbox, expunge_base, expunge_len,
+             expunge_uidmap[expunge_msgno-1].msgno, &expunge_record);
+                               
+    r = 0;
+    while (!r) {
+        int have_index   = (index_msgno   <= mailbox->exists);
+        int have_expunge = (expunge_msgno <= expunge_exists);
+
+        if (!item && !have_index && !have_expunge)
+            break;
+
+        if (have_expunge &&
+            (!have_index || (expunge_record.uid < index_record.uid)) &&
+            (!item       || (expunge_record.uid < item->uid))) {
+            /* Add expunged item to cyrus.expunge, cyrus.cache */
+	    mailbox_index_record_to_buf(&expunge_record, buf);
+            *((bit32 *)(buf+OFFSET_CACHE_OFFSET)) = htonl(ftell(newcache));
+
+            sync_cacheitem_write
+                (mailbox->cache_base+expunge_record.cache_offset, newcache);
+            fwrite(buf, 1, mailbox->record_size, newexpunge);
+            sync_counts_update(&expunge, &expunge_record);
+
+            if (++expunge_msgno <= expunge_exists)
+                mailbox_read_index_record_from_mapped
+                    (mailbox, expunge_base, expunge_len,
+                     expunge_uidmap[expunge_msgno-1].msgno, &expunge_record);
+        } else if ((index_msgno <= mailbox->exists) &&
+                   ((item == NULL) || (index_record.uid < item->uid))) {
+            /* Add existing item from mailbox to cyrus.index, cyrus.cache */
+	    mailbox_index_record_to_buf(&index_record, buf);
+            *((bit32 *)(buf+OFFSET_CACHE_OFFSET)) = htonl(ftell(newcache));
+
+            sync_cacheitem_write
+                (mailbox->cache_base+index_record.cache_offset, newcache);
+            fwrite(buf, 1, mailbox->record_size, newindex);
+            sync_counts_update(&index, &index_record);
+
+            /* Discard message from expunge list because of UID conflict */
+            if (have_expunge && (index_record.uid == expunge_record.uid) &&
+                (++expunge_msgno <= expunge_exists))
+                mailbox_read_index_record_from_mapped
+                    (mailbox, expunge_base, expunge_len,
+                     expunge_uidmap[expunge_msgno-1].msgno, &expunge_record);
+
+            if (++index_msgno <= mailbox->exists)
+                mailbox_read_index_record(mailbox, index_msgno, &index_record);
         } else {
-            putc(0, newindex);
-        }
-    }
-
-    /* Cache header is generation number only */
-    fwrite(buf, 1, sizeof(bit32), newcache);
-
-    item  = upload_list->head;
-    msgno = 0;
-    
-    if (++msgno <= mailbox->exists)
-        mailbox_read_index_record(mailbox, msgno, &record);
-
-    while (item || (msgno <= mailbox->exists)) {
-        newexists++;
-
-        if ((msgno <= mailbox->exists) &&
-            ((item == NULL) || (record.uid < item->uid))) {
-            /* Use record item from existing mailbox */
-	    mailbox_index_record_to_buf(&record, buf);
-
-            /* Write out message cache and index */
-            /* Fix up cache file offset */
+            /* Use item from upload list (may replace existing msg) */
+            sync_make_index_record(&tmp_record, item);
+	    mailbox_index_record_to_buf(&tmp_record, buf);
             *((bit32 *)(buf+OFFSET_CACHE_OFFSET)) = htonl(ftell(newcache));
 
-            fwrite(mailbox->cache_base + record.cache_offset,
-                   1, mailbox_cache_size(mailbox, msgno), newcache);
+            sync_cacheitem_write
+                (message_list->cache_base+tmp_record.cache_offset, newcache);
             fwrite(buf, 1, mailbox->record_size, newindex);
-
-            if (++msgno <= mailbox->exists)
-                mailbox_read_index_record(mailbox, msgno, &record);
-        } else {
-            /* Use List item from upload list (may replace existing msg) */
-            message = item->message;
-
-            *((bit32 *)(buf+OFFSET_UID))          = htonl(item->uid);
-            *((bit32 *)(buf+OFFSET_INTERNALDATE)) = htonl(item->internaldate);
-            *((bit32 *)(buf+OFFSET_SENTDATE))     = htonl(item->sentdate);
-            *((bit32 *)(buf+OFFSET_SIZE))         = htonl(message->msg_size);
-            *((bit32 *)(buf+OFFSET_HEADER_SIZE))  = htonl(message->hdr_size);
-            *((bit32 *)(buf+OFFSET_CONTENT_OFFSET)) = htonl(message->hdr_size);
-            *((bit32 *)(buf+OFFSET_LAST_UPDATED)) = htonl(item->last_updated);
-            *((bit32 *)(buf+OFFSET_SYSTEM_FLAGS))
-                = htonl(item->flags.system_flags);
-            
-            for (n = 0; n < MAX_USER_FLAGS/32; n++) {
-                *((bit32 *)(buf+OFFSET_USER_FLAGS+4*n))
-                    = htonl(item->flags.user_flags[n]);
-            }
-            *((bit32 *)(buf+OFFSET_CONTENT_LINES))
-		= htonl(message->content_lines);
-            *((bit32 *)(buf+OFFSET_CACHE_VERSION))
-		= htonl(message->cache_version);
-
-            message_uuid_pack(&item->uuid, buf+OFFSET_MESSAGE_UUID);
-
-#ifdef HAVE_LONG_LONG_INT
-            *((bit64 *)(buf+OFFSET_MODSEQ_64)) = htonll(item->modseq);
-#else
-	    /* zero the unused 32bits */
-            *((bit32 *)(buf+OFFSET_MODSEQ_64)) = htonl(0);
-            *((bit32 *)(buf+OFFSET_MODSEQ)) = htonl(item->modseq);
-#endif
-
-	    if (item->modseq > highestmodseq) highestmodseq = item->modseq;
-
-            quota_add  += message->msg_size;
-
-            if (item->flags.system_flags & FLAG_ANSWERED) numansweredflag++;
-            if (item->flags.system_flags & FLAG_DELETED)  numdeletedflag++;
-            if (item->flags.system_flags & FLAG_FLAGGED)  numflaggedflag++;
-
-            /* Write out message cache and index */
-            /* Fix up cache file offset */
-            *((bit32 *)(buf+OFFSET_CACHE_OFFSET)) = htonl(ftell(newcache));
-
-            fwrite((message_list->cache_base+message->cache_offset), 1, 
-                   message->cache_size, newcache);
-
-            fwrite(buf, 1, mailbox->record_size, newindex);
-
-            /* Discard existing msg on server because of UUID conflict */
-            /* Need to reclaim allocated space and resources */
-            if (record.uid == item->uid) {
-                quota_add -= record.size;
-                if (record.system_flags & FLAG_ANSWERED) numansweredflag--;
-                if (record.system_flags & FLAG_DELETED)  numdeletedflag--;
-                if (record.system_flags & FLAG_FLAGGED)  numflaggedflag--;
-
-                if (++msgno <= mailbox->exists)
-                    mailbox_read_index_record(mailbox, msgno, &record);
-            }
+            sync_counts_update(&index, &tmp_record);
+
+            /* Discard existing msg on server because of UID conflict */
+            if (have_index && (item->uid == index_record.uid) &&
+                (++index_msgno <= mailbox->exists))
+                mailbox_read_index_record(mailbox, index_msgno, &index_record);
+
+            /* Discard message from expunge list because of UID conflict */
+            if (have_expunge && (item->uid == expunge_record.uid) &&
+                (++expunge_msgno <= expunge_exists))
+                mailbox_read_index_record_from_mapped
+                    (mailbox, expunge_base, expunge_len,
+                     expunge_uidmap[expunge_msgno-1].msgno, &expunge_record);
 
             item = item->next;
         }
     }
+    if (r) goto bail;
 
     /* Fix up information in index header */
     rewind(newindex);
@@ -282,63 +594,46 @@
     if ((unsigned long)n != mailbox->start_offset) {
         syslog(LOG_ERR, "IOERROR: reading index header for %s: got %d of %ld",
                mailbox->name, n, mailbox->start_offset);
-        goto fail;
-    }
-
-    /* Fix up last_uid */
-    *((bit32 *)(buf+OFFSET_LAST_UID)) = htonl(upload_list->new_last_uid);
-
-    /* Fix up exists */
-    *((bit32 *)(buf+OFFSET_EXISTS)) = htonl(newexists);
-    /* fix up other counts */
-    newanswered = ntohl(*((bit32 *)(buf+OFFSET_ANSWERED)))+numansweredflag;
-    *((bit32 *)(buf+OFFSET_ANSWERED)) = htonl(newanswered);
-    newdeleted = ntohl(*((bit32 *)(buf+OFFSET_DELETED)))+numdeletedflag;
-    *((bit32 *)(buf+OFFSET_DELETED)) = htonl(newdeleted);
-    newflagged = ntohl(*((bit32 *)(buf+OFFSET_FLAGGED)))+numflaggedflag;
-    *((bit32 *)(buf+OFFSET_FLAGGED)) = htonl(newflagged);
-
-    /* Fix up quota_mailbox_used */
-    *((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED)) =
-        htonl(ntohl(*((bit32 *)(buf+OFFSET_QUOTA_MAILBOX_USED))) + quota_add );
-    /* Fix up start offset if necessary */
-    if (mailbox->start_offset < INDEX_HEADER_SIZE) {
-        *((bit32 *)(buf+OFFSET_START_OFFSET)) = htonl(INDEX_HEADER_SIZE);
-    }
-
-    /* Fix up last_append time */
-    *((bit32 *)(buf+OFFSET_LAST_APPENDDATE)) = htonl(last_appenddate);
-
-    /* Fix up highest modseq */
-#ifdef HAVE_LONG_LONG_INT
-    if (highestmodseq > *((bit64 *)(buf+OFFSET_HIGHESTMODSEQ_64))) {
-	*((bit64 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonll(highestmodseq);
-    }
-#else
-    if (highestmodseq > *((bit32 *)(buf+OFFSET_HIGHESTMODSEQ))) {
-	*((bit32 *)(buf+OFFSET_HIGHESTMODSEQ_64)) = htonl(0);
-	*((bit32 *)(buf+OFFSET_HIGHESTMODSEQ)) = htonl(highestmodseq);
-    }
-#endif
-
+        r = IMAP_IOERROR;
+        goto bail;
+    }
+    sync_counts_write(buf, &index, last_appenddate, upload_list->new_last_uid);
     rewind(newindex);
     fwrite(buf, 1, mailbox->start_offset, newindex);
 
+    /* Fix up information in expunge index header */
+    if (expunge_base) {
+        rewind(newexpunge);
+        n = fread(buf, 1, mailbox->start_offset, newexpunge);
+        if ((unsigned long)n != mailbox->start_offset) {
+            syslog(LOG_ERR,
+                   "IOERROR: reading expunge index header for %s:"
+                   "got %d of %ld",
+                   mailbox->name, n, mailbox->start_offset);
+            r = IMAP_IOERROR;
+            goto bail;
+    }
+        sync_counts_write(buf, &expunge, expunge_last_appenddate,
+                          upload_list->new_last_uid);
+        rewind(newexpunge);
+        fwrite(buf, 1, mailbox->start_offset, newexpunge);
+    }
+
     /* Ensure everything made it to disk */
-    fflush(newindex);
-    fflush(newcache);
-    if (ferror(newindex) || ferror(newcache) ||
-        fsync(fileno(newindex)) || fsync(fileno(newcache))) {
-        syslog(LOG_ERR, "IOERROR: writing index/cache for %s: %m",
+    if (fflush(newexpunge) || fsync(fileno(newexpunge)) ||
+        fflush(newindex)   || fsync(fileno(newindex)) ||
+        fflush(newcache)   || fsync(fileno(newcache))) {
+        syslog(LOG_ERR, "IOERROR: writing index/cache/expunge for %s: %m",
                mailbox->name);
-        goto fail;
+        r = IMAP_IOERROR;
+        goto bail;
     }
 
     /* Record quota addition */
-    if (mailbox->quota.root) {
+    if (!r && mailbox->quota.root) {
 	r = quota_read(&mailbox->quota, &tid, 1);
 	if (!r) {
-	    mailbox->quota.used += quota_add;
+	    mailbox->quota.used = index.newquota_used;
 	    r = quota_write(&mailbox->quota, &tid);
 	    if (!r) quota_commit(&tid);
 	}
@@ -346,125 +641,56 @@
 
 	if (r) {
 	    syslog(LOG_ERR,
-		   "LOSTQUOTA: unable to record add of %lu bytes in quota %s",
-		   quota_add, mailbox->quota.root);
+		   "LOSTQUOTA: unable to record add of " QUOTA_T_FMT
+                   " bytes in quota %s",
+		   index.newquota_used - original_quota, mailbox->quota.root);
 	}
     }
 
-    path = (mailbox->mpath &&
-	    (config_metapartition_files &
-	     IMAP_ENUM_METAPARTITION_FILES_INDEX)) ?
-	mailbox->mpath : mailbox->path;
-    strlcpy(fnamebuf, path, sizeof(fnamebuf));
-    strlcat(fnamebuf, FNAME_INDEX, sizeof(fnamebuf));
-
-    strlcpy(fnamebufnew, fnamebuf, sizeof(fnamebufnew));
-    strlcat(fnamebufnew, ".NEW", sizeof(fnamebufnew));
-    if (rename(fnamebufnew, fnamebuf)) {
-        syslog(LOG_ERR, "IOERROR: renaming index file for %s: %m",
-               mailbox->name);
-        goto fail;
-    }
-
-    path = (mailbox->mpath &&
-	    (config_metapartition_files &
-	     IMAP_ENUM_METAPARTITION_FILES_CACHE)) ?
-	mailbox->mpath : mailbox->path;
-    strlcpy(fnamebuf, path, sizeof(fnamebuf));
-    strlcat(fnamebuf, FNAME_CACHE, sizeof(fnamebuf));
-
-    strlcpy(fnamebufnew, fnamebuf, sizeof(fnamebufnew));
-    strlcat(fnamebufnew, ".NEW", sizeof(fnamebufnew));
-    if (rename(fnamebufnew, fnamebuf)) {
-        syslog(LOG_CRIT, ("CRITICAL IOERROR: renaming cache file for %s, "
-                          "need to reconstruct: %m"), mailbox->name);
-        goto fail;
-    }
-
-    /* No more fail clauses after this point: just clean up */
-    free(buf);
-    fclose(newindex);
-    fclose(newcache);
+    /* Commit the new cyrus.index, cyrus.cache and cyrus.expunge files */
+    if (!r)
+        r = sync_rename_single(mailbox, IMAP_ENUM_METAPARTITION_FILES_INDEX,
+                               FNAME_INDEX);
+    if (!r)
+        r = sync_rename_single(mailbox, IMAP_ENUM_METAPARTITION_FILES_CACHE,
+                               FNAME_CACHE);
+
+    if (expunge_exists == 0) {
+        sync_delete_single(mailbox, IMAP_ENUM_METAPARTITION_FILES_EXPUNGE,
+                           FNAME_EXPUNGE_INDEX, ".NEW");
+    } else if (!r)
+        r = sync_rename_single(mailbox,
+                               IMAP_ENUM_METAPARTITION_FILES_EXPUNGE,
+                               FNAME_EXPUNGE_INDEX);
+
+ bail:
+    if (newexpunge) fclose(newexpunge);
+    if (newcache)   fclose(newcache);
+    if (newindex)   fclose(newindex);
+
+    if (expunge_uidmap) free(expunge_uidmap);
+    if (expunge_fd)     close(expunge_fd);
+    if (expunge_base)   map_free(&expunge_base, &expunge_len);
+
     return(r);
-
- fail:
-    if (buf) free(buf);
-    if (newindex) fclose(newindex);
-    if (newcache) fclose(newcache);
-
-    return IMAP_IOERROR;
 }
 
 /* ====================================================================== */
-
-/* Couple of helper routines to clear out expunged messages that we want to
- * upload again to resolve inconsistent state. upload_list should be in
- * correct UID order, unsorted expunge index may be in any order (and we
- * want to preserve that order as expunge index is FIFO list).  Simplest
- * (reasonably efficient) solution is to convert upload_list linked list
- * into flat array of unsigned long "uid_array" and search with binary chop.
- */
-
-struct uid_array {
-    unsigned long *array;
-    unsigned long size;
-};
-
-static struct uid_array *
-uid_array_create(struct sync_upload_list *upload_list)
-{
-    struct uid_array *uid_array;
-    struct sync_upload_item *current;
-    unsigned long *array, i, size, lastuid = 0;
-
-    uid_array = xmalloc(sizeof(struct uid_array));
-    uid_array->array = xmalloc((upload_list->count+1) * sizeof(unsigned long));
-    uid_array->size  = upload_list->count;
-
-    current = upload_list->head;
-    size  = uid_array->size;
-    array = uid_array->array;
-
-    for (i = 0; current && (i < size); i++, current = current->next) {
-        if ((i > 0) && (lastuid > current->uid))
-            break;
-
-        lastuid = array[i] = current->uid;
-    }
-
-    if ((current != NULL) || (i < size)) {
-        syslog(LOG_ERR, "uid_array_create(): Invalid sequence");
-        free(uid_array->array);
-        free(uid_array);
-        return(NULL);
-    }
-    uid_array->array[size] = 0;
-
-    return(uid_array);
-}
-
-static void
-uid_array_free(struct uid_array *uid_array)
-{
-    free(uid_array->array);
-    free(uid_array);
-}
-
 /* ====================================================================== */
 
-static int
-sync_append_commit(struct mailbox *mailbox,
+static int sync_append_commit(struct mailbox *mailbox,
                    time_t last_appenddate,
                    struct sync_upload_list  *upload_list,
                    struct sync_message_list *message_list)
 {
     unsigned char *index_chunk, *record;
-    unsigned char *hbuf = xmalloc(mailbox->start_offset);
+    indexbuffer_t ibuf;
+    unsigned char *hbuf = ibuf.buf;
     struct iovec  *cache_iovec, *cachev;
     struct sync_upload_item *item;
     struct sync_message     *message;
     unsigned long cache_size;
-    unsigned long quota_add       = 0;
+    uquota_t      quota_add       = 0;
     unsigned long numansweredflag = 0;
     unsigned long numdeletedflag  = 0;
     unsigned long numflaggedflag  = 0;
@@ -472,10 +698,10 @@
     unsigned long newdeleted;
     unsigned long newanswered;
     unsigned long newflagged;
-    char  target[MAX_MAILBOX_PATH];
     int   n, r = 0;
+    long last_offset;
     struct txn *tid = NULL;
-    modseq_t highestmodseq = 0;
+    modseq_t highestmodseq = mailbox->highestmodseq;
 
     if (upload_list->count == 0) return(0);   /* NOOP */
 
@@ -516,7 +742,7 @@
 	    = htonl(message->content_lines);
         *((bit32 *)(record+OFFSET_CACHE_VERSION))
 	    = htonl(message->cache_version);
-        message_uuid_pack(&item->uuid, record+OFFSET_MESSAGE_UUID);
+        message_guid_export(&item->guid, record+OFFSET_MESSAGE_GUID);
 
 #ifdef HAVE_LONG_LONG_INT
             *((bit64 *)(record+OFFSET_MODSEQ_64)) = htonll(item->modseq);
@@ -553,7 +779,8 @@
             goto fail;
         }
 #else
-	if (sync_message_copy_fromstage(item->message, mailbox, item->uid)) {
+	if (sync_message_copy_fromstage(item->message, mailbox, item->uid,
+		item->internaldate)) {
 	    goto fail;
 	}
 #endif
@@ -570,9 +797,11 @@
     if (retry_writev(mailbox->cache_fd, cache_iovec, upload_list->count) < 0)
         goto fail;
 
-    lseek(mailbox->index_fd, mailbox->index_size, SEEK_SET);
+    
+    last_offset = mailbox->start_offset + mailbox->exists * mailbox->record_size;
+    lseek(mailbox->index_fd, last_offset, SEEK_SET);
     if (retry_write(mailbox->index_fd, index_chunk,
-                    upload_list->count * INDEX_RECORD_SIZE) < 0)
+                    upload_list->count * mailbox->record_size) < 0)
         goto fail;
 
 
@@ -603,8 +832,14 @@
     *((bit32 *)(hbuf+OFFSET_FLAGGED)) = htonl(newflagged);
 
     /* Fix up quota_mailbox_used */
+#ifdef HAVE_LONG_LONG_INT
+    *((bit64 *)(hbuf+OFFSET_QUOTA_MAILBOX_USED64)) = 
+      htonll(ntohll(*((bit64 *)(hbuf+OFFSET_QUOTA_MAILBOX_USED64)))+quota_add);
+#else
+    *((bit32 *)(hbuf+OFFSET_QUOTA_MAILBOX_USED64)) = htonl(0);
     *((bit32 *)(hbuf+OFFSET_QUOTA_MAILBOX_USED)) =
         htonl(ntohl(*((bit32 *)(hbuf+OFFSET_QUOTA_MAILBOX_USED)))+quota_add);
+#endif
 
     /* Fix up start offset if necessary */
     if (mailbox->start_offset < INDEX_HEADER_SIZE) {
@@ -616,8 +851,8 @@
 	
     /* Fix up highest modseq */
 #ifdef HAVE_LONG_LONG_INT
-    if (highestmodseq > ntohll(*((bit64 *)(hbuf+OFFSET_HIGHESTMODSEQ_64)))) {
-	*((bit64 *)(hbuf+OFFSET_HIGHESTMODSEQ_64)) = htonll(highestmodseq);
+    if (highestmodseq > align_ntohll(hbuf+OFFSET_HIGHESTMODSEQ_64)) {
+	align_htonll(hbuf+OFFSET_HIGHESTMODSEQ_64, highestmodseq);
     }
 #else
     if (highestmodseq > ntohl(*((bit32 *)(hbuf+OFFSET_HIGHESTMODSEQ)))) {
@@ -655,12 +890,12 @@
 
 	if (r) {
 	    syslog(LOG_ERR,
-		   "LOSTQUOTA: unable to record add of %lu bytes in quota %s",
+		   "LOSTQUOTA: unable to record add of " UQUOTA_T_FMT
+                   " bytes in quota %s",
 		   quota_add, mailbox->quota.root);
 	}
     }
 
-    free(hbuf);
     free(index_chunk);
     free(cache_iovec);
     return(r);
@@ -670,7 +905,6 @@
     ftruncate(mailbox->cache_fd, mailbox->cache_size);
     ftruncate(mailbox->index_fd, mailbox->index_size);
 
-    free(hbuf);
     free(index_chunk);
     free(cache_iovec);
     return(IMAP_IOERROR);
@@ -678,8 +912,7 @@
 
 /* ====================================================================== */
 
-int
-sync_upload_commit(struct mailbox *mailbox,
+int sync_upload_commit(struct mailbox *mailbox,
                    time_t last_appenddate,
                    struct sync_upload_list  *upload_list,
                    struct sync_message_list *message_list)
@@ -713,19 +946,10 @@
         return(r);
     }
 
-    if (mailbox->last_uid >= head->uid) {
-	/* Note for Ken:
-	 *
-	 * HERMES_TWO_PHASE_EXPUNGE has some code here to expire messages
-	 * which have been expunged but not expired before uploading them
-	 * again. This is to make sure that a message with a given UID
-	 * never ends up in both the live and expunged version of a given
-	 * mailbox. Something similar might be needed with the lazy
-	 * expunge code in Cyrus 2.3
-	 */
+    if (mailbox->last_uid >= head->uid)
 	r = sync_combine_commit(mailbox, last_appenddate,
 				upload_list, message_list);
-    } else
+    else
         r = sync_append_commit(mailbox, last_appenddate,
                                upload_list, message_list);
 
@@ -742,8 +966,7 @@
 /* ====================================================================== */
 /* ====================================================================== */
 
-int
-sync_uidlast_commit(struct mailbox *mailbox,
+int sync_uidlast_commit(struct mailbox *mailbox,
                     unsigned long last_uid,
                     time_t last_appenddate)
 {
@@ -789,10 +1012,52 @@
     return(0);
 }
 
+int sync_uidvalidity_commit(struct mailbox *mailbox,
+			    unsigned long uidvalidity)
+{
+    unsigned char *hbuf = xmalloc(mailbox->start_offset);
+    int n;
+
+    /* Fix up information in index header */
+    lseek(mailbox->index_fd, 0L, SEEK_SET);
+
+    n = read(mailbox->index_fd, hbuf, mailbox->start_offset);
+    if ((unsigned long)n != mailbox->start_offset) {
+        free(hbuf);
+        syslog(LOG_ERR,
+               "IOERROR: reading index header for %s: got %d of %lu",
+               mailbox->name, n, mailbox->start_offset);
+        return(IMAP_IOERROR);
+    }
+
+    /* Fix up uidvalidity */
+    *((bit32 *)(hbuf+OFFSET_UIDVALIDITY)) = htonl(uidvalidity);
+
+    /* And write it back out */
+    lseek(mailbox->index_fd, 0L, SEEK_SET);
+
+    n = retry_write(mailbox->index_fd, hbuf, mailbox->start_offset);
+
+    free(hbuf);
+    if ((unsigned long)n != mailbox->start_offset) {
+        syslog(LOG_ERR, "IOERROR: writing out new index header for %s",
+               mailbox->name);
+        return(IMAP_IOERROR);
+    }
+    
+    /* Ensure everything made it to disk */
+    if (fsync(mailbox->index_fd)) {
+        syslog(LOG_ERR, "IOERROR: writing index for %s: %m",
+               mailbox->name);
+        return(IMAP_IOERROR);
+    }
+    return(0);
+}
+
 /* ====================================================================== */
 
-int
-sync_setflags_commit(struct mailbox *mailbox, struct sync_flag_list *flag_list)
+int sync_setflags_commit(struct mailbox *mailbox,
+			 struct sync_flag_list *flag_list)
 {
     struct index_record record;
     struct sync_flag_item *item = flag_list->head;
@@ -863,24 +1128,113 @@
 
 /* ====================================================================== */
 
+int sync_highestmodseq_commit(struct mailbox *mailbox,
+                              modseq_t newhighestmodseq)
+{
+    unsigned char *hbuf = xmalloc(mailbox->start_offset);
+    int n;
+
+    /* Fix up information in index header */
+    lseek(mailbox->index_fd, 0L, SEEK_SET);
+
+    n = read(mailbox->index_fd, hbuf, mailbox->start_offset);
+    if ((unsigned long)n != mailbox->start_offset) {
+        free(hbuf);
+        syslog(LOG_ERR,
+               "IOERROR: reading index header for %s: got %d of %lu",
+               mailbox->name, n, mailbox->start_offset);
+        return(IMAP_IOERROR);
+    }
+
+#ifdef HAVE_LONG_LONG_INT
+    align_htonll(hbuf+OFFSET_HIGHESTMODSEQ_64, newhighestmodseq);
+#else
+    *((bit32 *)(hbuf+OFFSET_HIGHESTMODSEQ_64)) = htonl(0);
+    *((bit32 *)(hbuf+OFFSET_HIGHESTMODSEQ))    = htonl(newhighestmodseq);
+#endif
+
+    /* And write it back out */
+    lseek(mailbox->index_fd, 0L, SEEK_SET);
+
+    n = retry_write(mailbox->index_fd, hbuf, mailbox->start_offset);
+
+    free(hbuf);
+    if ((unsigned long)n != mailbox->start_offset) {
+        syslog(LOG_ERR, "IOERROR: writing out new index header for %s",
+               mailbox->name);
+        return(IMAP_IOERROR);
+    }
+    
+    /* Ensure everything made it to disk */
+    if (fsync(mailbox->index_fd)) {
+        syslog(LOG_ERR, "IOERROR: writing index for %s: %m",
+               mailbox->name);
+        return(IMAP_IOERROR);
+    }
+    return(0);
+}
+
+int sync_modseq_commit(struct mailbox *mailbox,
+                       struct sync_modseq_list *modseq_list)
+{
+    struct index_record record;
+    struct sync_modseq_item *item = modseq_list->head;
+    unsigned long msgno = 1;
+    int r = 0;
+    time_t now = time(NULL);
+
+    if (!r) r = mailbox_lock_header(mailbox);
+    if (!r) r = mailbox_lock_index(mailbox);
+
+    if (r) return(r);
+
+    while (item && (msgno <= mailbox->exists)) {
+        r = mailbox_read_index_record(mailbox, msgno, &record);
+
+        if (r) return(r);
+
+        if (record.uid == item->uid) {
+            record.modseq = item->modseq;
+            record.last_updated = ((record.last_updated >= now) ?
+                                   record.last_updated + 1 : now);
+            mailbox_write_index_record(mailbox, msgno, &record, 0);
+            item = item->next;
+        }
+        msgno++;
+    }
+
+    if (!r) r = mailbox_write_index_header(mailbox);
+    if (!r) mailbox_unlock_index(mailbox);
+    if (!r) mailbox_unlock_header(mailbox);
+
+    if (fsync(mailbox->index_fd)) {
+	syslog(LOG_ERR, "IOERROR: writing index record %lu for %s: %m",
+	       msgno, mailbox->name);
+	return IMAP_IOERROR;
+    }
+
+    r = mailbox_open_index(mailbox);   /* Update internal index */
+    return(r);
+}
+
+/* ====================================================================== */
+
 #define DB config_mboxlist_db
 
-int
-sync_create_commit(char *name, char *partition, char *uniqueid, char *acl,
-                   int mbtype, unsigned long options, unsigned long uidvalidity,
-                   int isadmin, char *userid, struct auth_state *auth_state)
+int sync_create_commit(char *name, char *partition, char *uniqueid, char *acl,
+		       int mbtype, unsigned long options,
+		       unsigned long uidvalidity,
+		       int isadmin __attribute__((unused)),
+		       char *userid __attribute__((unused)),
+		       struct auth_state *auth_state __attribute__((unused)))
 {
     int r;
     int free_uniqueid = 0;
-    const char *root = NULL;
     char *newpartition = NULL;
     char *mboxent = NULL;
     int newreserved = 0; /* made reserved entry in local mailbox list */
     int mboxopen = 0;
     struct mailbox m;
-    /* Must be atleast MAX_PARTITION_LEN + 30 for partition, need
-     * MAX_PARTITION_LEN + HOSTNAME_SIZE + 2 for mupdate location */
-    char buf[MAX_PARTITION_LEN + HOSTNAME_SIZE + 2];
 #if 0  /* XXX  is this really necessary since only sync_client talks to us? */
     /* Need an extra sanity check here as normal ACL logic is bypassed */
     r = mboxname_policycheck(name);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_commit.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_commit.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_commit.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_commit.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* sync_commit.h -- Cyrus synchonization mailbox functions
  *
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: sync_commit.h,v 1.5 2008/03/24 17:09:20 murch Exp $
+ *
  * Original version written by David Carter <dpc22 at cam.ac.uk>
  * Rewritten and integrated into Cyrus by Ken Murchison <ken at oceana.com>
- *
- * $Id: sync_commit.h,v 1.2 2006/11/30 17:11:20 murch Exp $
  */
 
 #ifndef INCLUDED_SYNC_COMMIT_H
@@ -54,8 +55,20 @@
 int sync_uidlast_commit(struct mailbox *mailbox, unsigned long last_uid,
 			time_t last_appenddate);
 
+int
+sync_uidvalidity_commit(struct mailbox *mailbox,
+                        unsigned long uidvalidity);
+
 int sync_setflags_commit(struct mailbox *mailbox,
 			 struct sync_flag_list *flag_list);
+
+int sync_highestmodseq_commit(struct mailbox *mailbox,
+                              modseq_t newhighestmodseq);
+
+
+int sync_modseq_commit(struct mailbox *mailbox,
+                       struct sync_modseq_list *modseq_list);
+
 
 int sync_create_commit(char *name, char *partition, char *uniqueid, char *acl,
 		       int mbtype, unsigned long options, unsigned long uidvalidity,

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_log.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_log.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_log.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_log.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* sync_log.c -- Cyrus synchonization logging functions
  *
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: sync_log.c,v 1.4 2008/03/24 17:09:20 murch Exp $
+ *
  * Original version written by David Carter <dpc22 at cam.ac.uk>
  * Rewritten and integrated into Cyrus by Ken Murchison <ken at oceana.com>
- *
- * $Id: sync_log.c,v 1.3 2007/02/05 18:41:48 jeaton Exp $
  */
 
 /* YYY Need better quoting for obscure filenames: use literals? */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_log.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_log.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_log.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_log.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* sync_log.c -- Cyrus synchonization logging functions
  *
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: sync_log.h,v 1.3 2008/03/24 17:09:20 murch Exp $
+ *
  * Original version written by David Carter <dpc22 at cam.ac.uk>
  * Rewritten and integrated into Cyrus by Ken Murchison <ken at oceana.com>
- *
- * $Id: sync_log.h,v 1.2 2006/11/30 17:11:20 murch Exp $
  */
 
 #ifndef INCLUDED_SYNC_LOG_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_reset.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_reset.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_reset.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_reset.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* sync_reset.c -- Remove a user account from a replica system
  *
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: sync_reset.c,v 1.6 2008/03/24 17:09:20 murch Exp $
+ *
  * Original version written by David Carter <dpc22 at cam.ac.uk>
  * Rewritten and integrated into Cyrus by Ken Murchison <ken at oceana.com>
- *
- * $Id: sync_reset.c,v 1.2 2006/11/30 17:11:20 murch Exp $
  */
 
 #include <config.h>
@@ -91,12 +92,12 @@
 struct auth_state *imapd_authstate = NULL;
 char *imapd_userid = NULL;
 
-void printastring(const char *s)
+void printastring(const char *s __attribute__((unused)))
 {
     fatal("not implemented", EC_SOFTWARE);
 }
 
-void printstring(const char *s)
+void printstring(const char *s __attribute__((unused)))
 {
     fatal("not implemented", EC_SOFTWARE);
 }
@@ -148,7 +149,7 @@
 }
 
 /* ====================================================================== */
-
+#if 0
 static int
 user_master_is_local(char *user)
 {
@@ -169,7 +170,7 @@
     /* rc: -1 => error, 0 => lookup failed, 1 => lookup suceeded */
     return(rc == 1);  
 }
-
+#endif
 
 /* ====================================================================== */
 
@@ -183,7 +184,7 @@
 
     /* List all mailboxes, including directories and deleted items */
 
-    sync_folder_list_add(list, name, name, NULL, 0, NULL);
+    sync_folder_list_add(list, name, name, NULL, 0, 0, NULL);
     return(0);
 }
 
@@ -195,7 +196,7 @@
 {
     struct sync_folder_list *list = (struct sync_folder_list *) rock;
 
-    sync_folder_list_add(list, name, name, NULL, 0, NULL);
+    sync_folder_list_add(list, name, name, NULL, 0, 0, NULL);
     return(0);
 }
 
@@ -218,12 +219,12 @@
 
     if (verbose > 1)
         fprintf(stderr, "   RESET %s\n", user);
-
+#if 0
     if (user_master_is_local(user)) {
         fprintf(stderr, "Attempt to update master for %s\n", user);
         return(IMAP_INVALID_USER);
     }
-
+#endif
     if ((r = sync_lock(lock))) {
         fprintf(stderr, "Failed to lock: %s\n", error_message(r));
         return(r);
@@ -322,8 +323,9 @@
 
     sync_lock_reset(&lock);
 
-    if(geteuid() == 0)
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
         fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     setbuf(stdout, NULL);
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_server.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_server.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_server.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_server.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* sync_server.c -- Cyrus synchonization server
  *
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: sync_server.c,v 1.26 2008/09/23 16:28:15 murch Exp $
+ *
  * Original version written by David Carter <dpc22 at cam.ac.uk>
  * Rewritten and integrated into Cyrus by Ken Murchison <ken at oceana.com>
- *
- * $Id: sync_server.c,v 1.2 2006/11/30 17:11:20 murch Exp $
  */
 
 #include <config.h>
@@ -54,7 +55,6 @@
 #include <string.h>
 #include <fcntl.h>
 #include <signal.h>
-#include <assert.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/param.h>
@@ -63,12 +63,14 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 #include <arpa/inet.h>
 #include <ctype.h>
 
 #include <sasl/sasl.h>
 #include <sasl/saslutil.h>
 
+#include "assert.h"
 #include "acl.h"
 #include "annotate.h"
 #include "append.h"
@@ -88,12 +90,17 @@
 #include "retry.h"
 #include "seen.h"
 #include "spool.h"
+#include "statuscache.h"
 #include "telemetry.h"
 #include "tls.h"
+#include "user.h"
 #include "util.h"
 #include "version.h"
 #include "xmalloc.h"
-
+#include "xstrlcat.h"
+#include "xstrlcpy.h"
+
+#include "message_guid.h"
 #include "sync_support.h"
 #include "sync_commit.h"
 /*#include "cdb.h"*/
@@ -123,7 +130,7 @@
 static SSL *tls_conn;
 #endif /* HAVE_SSL */
 
-sasl_conn_t *sync_saslconn; /* the sasl connection context */
+sasl_conn_t *sync_saslconn = NULL; /* the sasl connection context */
 
 char *sync_userid = 0;
 struct namespace sync_namespace;
@@ -163,7 +170,9 @@
 			time_t lastread, unsigned int last_recent_uid,
 			time_t lastchange, char *seenuid);
 static void cmd_setseen_all(char *user, struct buf *data);
+static void cmd_setmodseq(struct mailbox *mailbox);
 static void cmd_setacl(char *name, char *acl);
+static void cmd_setuidvalidity(char *name, unsigned long uidvalidity);
 static void cmd_expunge(struct mailbox *mailbox);
 static void cmd_mailboxes();
 static void cmd_user(char *userid);
@@ -220,8 +229,6 @@
 
 static void sync_reset(void)
 {
-    int i;
-
     proc_cleanup();
 
     if (sync_in) {
@@ -328,6 +335,11 @@
     annotatemore_init(0, NULL, NULL);
     annotatemore_open(NULL);
 
+    /* Open the statuscache so we can invalidate seen states */
+    if (config_getswitch(IMAPOPT_STATUSCACHE)) {
+	statuscache_open(NULL);
+    }
+
     return 0;
 }
 
@@ -337,16 +349,19 @@
 static void dobanner(void)
 {
     const char *mechlist;
-    unsigned int mechcount;
-
+    int mechcount;
+
+    if (!sync_userid) {
     if (sasl_listmech(sync_saslconn, NULL,
 		      "* SASL ", " ", "\r\n",
-		      &mechlist, NULL, &mechcount) == SASL_OK && mechcount > 0) {
+			  &mechlist, NULL, &mechcount) == SASL_OK
+	    && mechcount > 0) {
 	prot_printf(sync_out, "%s", mechlist);
     }
 
     if (tls_enabled() && !sync_starttls_done) {
 	prot_printf(sync_out, "* STARTTLS\r\n");
+    }
     }
 
     prot_printf(sync_out,
@@ -363,11 +378,11 @@
 		 char **argv __attribute__((unused)),
 		 char **envp __attribute__((unused)))
 {
+    struct protoent *proto;
     socklen_t salen;
     char localip[60], remoteip[60];
     char hbuf[NI_MAXHOST];
     int niflags;
-    int timeout;
     sasl_security_properties_t *secprops = NULL;
 
     signals_poll();
@@ -403,7 +418,6 @@
 	if (getsockname(0, (struct sockaddr *)&sync_localaddr, &salen) == 0) {
 	    sync_haveaddr = 1;
 	}
-    }
 
     /* other params should be filled in */
     if (sasl_server_new("csync", config_servername, NULL, NULL, NULL,
@@ -411,7 +425,7 @@
 	fatal("SASL failed initializing: sasl_server_new()",EC_TEMPFAIL); 
 
     /* will always return something valid */
-    secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
+	secprops = mysasl_secprops(SASL_SEC_NOANONYMOUS);
     sasl_setprop(sync_saslconn, SASL_SEC_PROPS, secprops);
     sasl_setprop(sync_saslconn, SASL_SSF_EXTERNAL, &extprops_ssf);
     
@@ -425,6 +439,27 @@
 		  remoteip, 60) == 0) {
 	sasl_setprop(sync_saslconn, SASL_IPREMOTEPORT, remoteip);  
 	saslprops.ipremoteport = xstrdup(remoteip);
+    }
+
+	/* Disable Nagle's Algorithm => increase throughput
+	 *
+	 * http://en.wikipedia.org/wiki/Nagle's_algorithm
+	 */
+	if ((proto = getprotobyname("tcp")) != NULL) {
+	    int on = 1;
+
+	    if (setsockopt(1, proto->p_proto, TCP_NODELAY,
+			   (void *) &on, sizeof(on)) != 0) {
+		syslog(LOG_ERR, "unable to setsocketopt(TCP_NODELAY): %m");
+	    }
+	} else {
+	    syslog(LOG_ERR, "unable to getprotobyname(\"tcp\"): %m");
+	}
+    } else {
+	/* we're not connected to an internet socket! */
+	strcpy(sync_clienthost, "[unix socket]");
+	sync_userid = xstrdup("cyrus");
+	sync_userisadmin = 1;
     }
 
     proc_register("sync_server", sync_clienthost, NULL, NULL);
@@ -466,9 +501,12 @@
  */
 void shut_down(int code)
 {
-    int i;
-
     proc_cleanup();
+
+    if (config_getswitch(IMAPOPT_STATUSCACHE)) {
+	statuscache_close();
+	statuscache_done();
+    }
 
     seen_done();
     mboxlist_close();
@@ -540,7 +578,7 @@
        ret = sasl_setprop(*conn, SASL_IPLOCALPORT,
                           saslprops.iplocalport);
     if(ret != SASL_OK) return ret;
-    secprops = mysasl_secprops(SASL_SEC_NOPLAINTEXT);
+    secprops = mysasl_secprops(SASL_SEC_NOANONYMOUS);
     ret = sasl_setprop(*conn, SASL_SEC_PROPS, secprops);
     if(ret != SASL_OK) return ret;
     /* end of service_main initialization excepting SSF */
@@ -841,7 +879,7 @@
 		c = getastring(sync_in, sync_out, &arg1);
 		if (c != ' ') goto missingargs;
 
-                /* Let cmd_reserve() process list of Message-UUIDs */
+                /* Let cmd_reserve() process list of Message-GUIDs */
                 cmd_reserve(arg1.s, message_list);
                 continue;
             }
@@ -885,6 +923,9 @@
 		if (c != ' ') goto missingargs;
                 cmd_setflags(mailbox);
                 continue;
+            } else if (!strcmp(cmd.s, "Setmodseq")) {
+                cmd_setmodseq(mailbox);
+                continue;
             } else if (!strcmp(cmd.s, "Setseen")) {
 		if (c != ' ') goto missingargs;
 		c = getastring(sync_in, sync_out, &arg1);
@@ -957,6 +998,20 @@
 		if (c == '\r') c = prot_getc(sync_in);
 		if (c != '\n') goto extraargs;
                 cmd_set_annotation(arg1.s, arg2.s, arg3.s, arg4.s);
+                continue;
+            }
+            else if (!strcmp(cmd.s, "Setuidvalidity")) {
+		if (c != ' ') goto missingargs;
+		c = getastring(sync_in, sync_out, &arg1);
+		if (c != ' ') goto missingargs;
+		c = getastring(sync_in, sync_out, &arg2);
+		if (c == EOF) goto missingargs;
+		if (c == '\r') c = prot_getc(sync_in);
+		if (c != '\n') goto extraargs;
+
+                if (!imparse_isnumber(arg2.s)) goto invalidargs;
+
+                cmd_setuidvalidity(arg1.s, sync_atoul(arg2.s));
                 continue;
             }
 	    break;
@@ -1087,9 +1142,9 @@
 static void cmd_authenticate(char *mech, char *resp)
 {
     int r, sasl_result;
-    const int *ssfp;
+    sasl_ssf_t ssf;
     char *ssfmsg = NULL;
-    const char *canon_user;
+    const void *val;
 
     if (sync_userid) {
 	prot_printf(sync_out, "502 Already authenticated\r\n");
@@ -1100,7 +1155,6 @@
 		   sync_in, sync_out, &sasl_result, NULL);
 
     if (r) {
-	int code;
 	const char *errorstring = NULL;
 
 	switch (r) {
@@ -1140,8 +1194,7 @@
     /* get the userid from SASL --- already canonicalized from
      * mysasl_proxy_policy()
      */
-    sasl_result = sasl_getprop(sync_saslconn, SASL_USERNAME,
-			       (const void **) &canon_user);
+    sasl_result = sasl_getprop(sync_saslconn, SASL_USERNAME, &val);
     if (sasl_result != SASL_OK) {
 	prot_printf(sync_out, "NO weird SASL error %d SASL_USERNAME\r\n", 
 		    sasl_result);
@@ -1151,24 +1204,25 @@
 	return;
     }
 
-    sync_userid = xstrdup(canon_user);
+    sync_userid = xstrdup((const char *) val);
     proc_register("sync_server", sync_clienthost, sync_userid, (char *)0);
 
     syslog(LOG_NOTICE, "login: %s %s %s%s %s", sync_clienthost, sync_userid,
 	   mech, sync_starttls_done ? "+TLS" : "", "User logged in");
 
-    sasl_getprop(sync_saslconn, SASL_SSF, (const void **) &ssfp);
+    sasl_getprop(sync_saslconn, SASL_SSF, &val);
+    ssf = *((sasl_ssf_t *) val);
 
     /* really, we should be doing a sasl_getprop on SASL_SSF_EXTERNAL,
        but the current libsasl doesn't allow that. */
     if (sync_starttls_done) {
-	switch(*ssfp) {
+	switch(ssf) {
 	case 0: ssfmsg = "tls protection"; break;
 	case 1: ssfmsg = "tls plus integrity protection"; break;
 	default: ssfmsg = "tls plus privacy protection"; break;
 	}
     } else {
-	switch(*ssfp) {
+	switch(ssf) {
 	case 0: ssfmsg = "no protection"; break;
 	case 1: ssfmsg = "integrity protection"; break;
 	default: ssfmsg = "privacy protection"; break;
@@ -1228,6 +1282,7 @@
   
     result=tls_start_servertls(0, /* read */
 			       1, /* write */
+			       180, /* 3 minutes */
 			       layerp,
 			       &auth_id,
 			       &tls_conn);
@@ -1272,6 +1327,7 @@
 }
 #endif /* HAVE_SSL */
 
+#if 0
 static int
 user_master_is_local(char *user)
 {
@@ -1290,6 +1346,7 @@
     /* rc: -1 => error, 0 => lookup failed, 1 => lookup suceeded */
     return(rc == 1);  
 }
+#endif
 
 /* ====================================================================== */
 
@@ -1366,15 +1423,17 @@
     struct mailbox m;
     struct index_record record;
     static struct buf arg;
-    int r = 0, c;
+    int r = 0, c = ' ';
     int mailbox_open = 0;
-    int alloc = RESERVE_DELTA, count = 0, i, msgno;
-    struct message_uuid *ids = xmalloc(alloc*sizeof(struct message_uuid));
+    int alloc = RESERVE_DELTA, count = 0, i;
+    unsigned msgno;
+    struct message_guid *ids = xmalloc(alloc*sizeof(struct message_guid));
     char *err = NULL;
     char mailbox_msg_path[MAX_MAILBOX_PATH+1];
     char *stage_msg_path;
     struct sync_message *message = NULL;
-    struct message_uuid tmp_uuid;
+    struct message_guid tmp_guid;
+    unsigned long cache_size;
 
     if ((r = sync_message_list_newstage(message_list, mailbox_name))) {
 	eatline(sync_in,c);
@@ -1386,16 +1445,16 @@
     do {
         c = getastring(sync_in, sync_out, &arg);
 
-        if (!arg.s || !message_uuid_from_text(&tmp_uuid, arg.s)) {
+        if (!arg.s || !message_guid_decode(&tmp_guid, arg.s)) {
             err = "Not a MessageID";
             goto parse_err;
         }
         
         if (alloc == count) {
             alloc += RESERVE_DELTA;
-            ids = xrealloc(ids, (alloc*sizeof(struct message_uuid)));
+            ids = xrealloc(ids, (alloc*sizeof(struct message_guid)));
         }
-        message_uuid_copy(&ids[count++], &tmp_uuid);
+        message_guid_copy(&ids[count++], &tmp_guid);
     } while (c == ' ');
 
     if (c == EOF) {
@@ -1423,14 +1482,17 @@
         goto cleanup;
     }
 
-    for (i = 0, msgno = 1 ; msgno <= m.exists; msgno++) {
+    for (i = 0, msgno = 1 ; (msgno <= m.exists) && (i < count); msgno++) {
         mailbox_read_index_record(&m, msgno, &record);
 
-        if (!message_uuid_compare(&record.uuid, &ids[i]))
+        if (!message_guid_compare(&record.guid, &ids[i]))
             continue;
 
-        if (sync_message_find(message_list, &record.uuid))
-            continue; /* Duplicate UUID on RESERVE list */
+        if (sync_message_find(message_list, &record.guid)) {
+	    /* Duplicate GUID on RESERVE list */
+	    i++;
+            continue;
+	}
 
         /* Attempt to reserve this message */
         snprintf(mailbox_msg_path, sizeof(mailbox_msg_path),
@@ -1439,25 +1501,33 @@
 
         if (mailbox_copyfile(mailbox_msg_path, stage_msg_path, 0) != 0) {
             syslog(LOG_ERR, "IOERROR: Unable to link %s -> %s: %m",
-                   message->msg_path, mailbox_msg_path);
+                   mailbox_msg_path, stage_msg_path);
             i++;       /* Failed to reserve message. */
             continue;
         }
 
+        cache_size = mailbox_cache_size(&m, msgno);
+        if (!cache_size) {
+            syslog(LOG_ERR, "IOERROR: bogus cache record %s %d",
+                m.name, msgno);
+            i++;       /* Failed to read cache record */
+            continue;
+        }
+
         /* Reserve succeeded */
-        message = sync_message_add(message_list, &record.uuid);
+        message = sync_message_add(message_list, &record.guid);
         message->msg_size     = record.size;
         message->hdr_size     = record.header_size;
         message->cache_offset = sync_message_list_cache_offset(message_list);
         message->content_lines = record.content_lines;
         message->cache_version = record.cache_version;
-        message->cache_size   = mailbox_cache_size(&m, msgno);
+        message->cache_size   = cache_size;
         
         sync_message_list_cache(message_list,
                                 (char *)(m.cache_base+record.cache_offset),
                                 message->cache_size);
 
-        prot_printf(sync_out, "* %s\r\n", message_uuid_text(&record.uuid));
+        prot_printf(sync_out, "* %s\r\n", message_guid_encode(&record.guid));
         i++;
     }
     mailbox_close(&m);
@@ -1506,8 +1576,6 @@
 
 static void cmd_setquota(char *root, int limit)
 {
-    char quota_path[MAX_MAILBOX_PATH];
-    struct quota quota;
     int r = 0;
 
     /* NB: Minimal interface without two phase expunge */
@@ -1531,7 +1599,7 @@
 
     /* List all mailboxes, including directories and deleted items */
 
-    sync_folder_list_add(list, name, name, NULL, 0, NULL);
+    sync_folder_list_add(list, name, name, NULL, 0, 0, NULL);
     return(0);
 }
 
@@ -1542,7 +1610,7 @@
 {
     struct sync_folder_list *list = (struct sync_folder_list *) rock;
 
-    sync_folder_list_add(list, name, name, NULL, 0, NULL);
+    sync_folder_list_add(list, name, name, NULL, 0, 0, NULL);
     return(0);
 }
 
@@ -1612,7 +1680,7 @@
 {
     unsigned long msgno;
     struct index_record record;
-    int lastuid = 0;
+    unsigned lastuid = 0;
 
     /* Quietly preload data from index */
     for (msgno = 1 ; msgno <= mailbox->exists; msgno++) {
@@ -1634,8 +1702,8 @@
     for (msgno = 1 ; msgno <= mailbox->exists; msgno++) {
         mailbox_read_index_record(mailbox, msgno, &record);
 
-        prot_printf(sync_out, "* %lu %s (",
-                 record.uid, message_uuid_text(&record.uuid));
+        prot_printf(sync_out, "* %lu " MODSEQ_FMT " %s (",
+                 record.uid, record.modseq, message_guid_encode(&record.guid));
 
         flags_printed = 0;
 
@@ -1666,11 +1734,12 @@
         return;
     }
     cmd_status_work(mailbox);
-    prot_printf(sync_out, "OK %lu\r\n", mailbox->last_uid);
+    prot_printf(sync_out, "OK %lu " MODSEQ_FMT "\r\n",
+                mailbox->last_uid, mailbox->highestmodseq);
 }
 
 /* ====================================================================== */
-
+#if 0
 static const char *
 seen_parse(const char *s, unsigned long *first_uidp, unsigned long *last_uidp)
 {
@@ -1750,7 +1819,7 @@
     }
     return(NULL);
 }
-
+#endif
 /* ====================================================================== */
 
 static void cmd_upload(struct mailbox *mailbox,
@@ -1763,7 +1832,7 @@
     struct sync_upload_item *item;
     struct sync_message     *message;
     static struct buf arg;
-    int   c;
+    int   c = ' ';
     enum {MSG_SIMPLE, MSG_PARSED, MSG_COPY} msg_type;
     int   r = 0;
     char *err;
@@ -1805,15 +1874,15 @@
             goto parse_err;
         }
 
-        /* Get Message-UUID */
+        /* Get Message-GUID */
         if ((c = getastring(sync_in, sync_out, &arg)) != ' ') {
             err = "Invalid sequence ID";
             goto parse_err;
         }
         if (!strcmp(arg.s, "NIL"))
-            message_uuid_set_null(&item->uuid);
-        else if (!message_uuid_from_text(&item->uuid, arg.s)) {
-            err = "Invalid Message-UUID";
+            message_guid_set_null(&item->guid);
+        else if (!message_guid_decode(&item->guid, arg.s)) {
+            err = "Invalid Message-GUID";
             goto parse_err;
         }
 
@@ -1860,17 +1929,19 @@
         switch (msg_type) {
         case MSG_SIMPLE:
             if (c != ' ') {
-                err = "Invalid flags";
+                err = "Invalid flags or missing message";
                 goto parse_err;
             }
 
-            if (message_list->cache_buffer_size > 0)
-                sync_message_list_cache_flush(message_list);
-
-            /* YYY Problem: sync_server needs source of Message-UUID for
-               new uploaded messages. Schema 2? */
-
-            message = sync_message_add(message_list, NULL /* YYY */);
+            if (message_list->cache_buffer_size > 0) {
+                r = sync_message_list_cache_flush(message_list);
+                if (r) {
+                    err = "Failed to flush messages to disk";
+                    goto parse_err;
+                }
+            }
+
+            message = sync_message_add(message_list, &item->guid);
 
             r = sync_getsimple(sync_in, sync_out, message_list, message);
 
@@ -1882,11 +1953,11 @@
             break;
         case MSG_PARSED:
             if (c != ' ') {
-                err = "Invalid flags";
+                err = "Invalid flags or missing message";
                 goto parse_err;
             }
 
-            message = sync_message_add(message_list, &item->uuid);
+            message = sync_message_add(message_list, &item->guid);
 
             /* Parse Message (header size, content lines, cache, message body */
             if ((c = getastring(sync_in, sync_out, &arg)) != ' ') {
@@ -1916,7 +1987,7 @@
 
             break;
         case MSG_COPY:
-            if (!(message=sync_message_find(message_list, &item->uuid))) {
+            if (!(message=sync_message_find(message_list, &item->guid))) {
                 err = "Unknown Reserved message";
                 goto parse_err;
             }
@@ -1944,10 +2015,10 @@
     }
 
     /* Make sure cache data flushed to disk before we commit */
-    sync_message_fsync(message_list);
-    sync_message_list_cache_flush(message_list);
-
-    r=sync_upload_commit(mailbox, last_appenddate, upload_list, message_list);
+    r = sync_message_fsync(message_list);
+    if (!r) sync_message_list_cache_flush(message_list);
+    if (!r) r = sync_upload_commit(mailbox, last_appenddate,
+                                   upload_list, message_list);
 
     if (r) {
         prot_printf(sync_out, "NO Failed to commit message upload to %s: %s\r\n",
@@ -2163,6 +2234,117 @@
         prot_printf(sync_out, "OK SetAcl Suceeded\r\n");
 }
 
+/* ====================================================================== */
+
+static void cmd_setuidvalidity(char *name, unsigned long uidvalidity)
+{
+    struct mailbox m;
+    int mboxopen = 0;
+    int r;
+
+    /* Open and lock mailbox */
+    r = mailbox_open_header(name, 0, &m);
+    if (!r) mboxopen = 1;
+    if (!r) r = mailbox_open_index(&m);
+    if (!r) r = sync_uidvalidity_commit(&m, uidvalidity);
+
+    if (!r) {
+        prot_printf(sync_out, "OK SetUIDvalidity succeeded\r\n");
+    } else {
+        prot_printf(sync_out, "NO SetUIDvalidity failed: %s\r\n",
+                    error_message(r));
+    }
+
+    if (mboxopen) mailbox_close(&m);
+}
+
+/* ====================================================================== */
+
+static void cmd_setmodseq(struct mailbox *mailbox)
+{
+    struct sync_modseq_list *modseq_list = sync_modseq_list_create();
+    static struct buf arg;
+    char *err = NULL;
+    int   c;
+    int   r = 0;
+    unsigned long uid = 0;
+    modseq_t modseq, highestmodseq;
+
+    if (!mailbox) {
+        eatline(sync_in, ' ');
+        prot_printf(sync_out, "NO Mailbox not open\r\n");
+        return;
+    }
+
+    if ((c = getastring(sync_in, sync_out, &arg)) == EOF)
+        goto bail;
+
+#ifdef HAVE_LONG_LONG_INT
+    highestmodseq = sync_atoull(arg.s);
+#else
+    highestmodseq = sync_atoul(arg.s);
+#endif
+
+    while (c == ' ') {
+        err  = NULL;
+
+        /* Parse UID */
+        if ((c = getastring(sync_in, sync_out, &arg)) == EOF)
+            goto bail;
+
+        if ((c != ' ') || ((uid = sync_atoul(arg.s)) == 0))
+            err = "Invalid UID";
+        else if (uid > mailbox->last_uid)
+            err = "UID out of range";
+
+        if ((c = getastring(sync_in, sync_out, &arg)) == EOF)
+            goto bail;
+
+        if ((c != ' ') && (c != '\r') && (c != '\n')) {
+            if (!err) err = "Invalid modseq";
+        } else {
+#ifdef HAVE_LONG_LONG_INT
+            modseq = sync_atoull(arg.s);
+#else
+            modseq = sync_atoul(arg.s);
+#endif
+            if (modseq == 0)
+                err = "Invalid modseq";
+        }
+
+        if (err != NULL) {
+            eatline(sync_in, c);
+            prot_printf(sync_out, "BAD Syntax error in Setflags: %s\r\n", err);
+            goto bail;
+        }
+        sync_modseq_list_add(modseq_list, uid, modseq);
+
+	/* if we see a SP, we're trying to set more than one flag */
+    }
+
+    if (c == '\r') c = prot_getc(sync_in);
+    if (c != '\n') {
+        eatline(sync_in, c);
+        prot_printf(sync_out, "BAD Garbage at end of Setmodseq sequence\r\n");
+        goto bail;
+    }
+
+    r = sync_highestmodseq_commit(mailbox, highestmodseq);
+    if (!r) r = sync_modseq_commit(mailbox, modseq_list);
+
+    if (r) {
+        prot_printf(sync_out,
+                    "NO Failed to commit modseq update for %s: %s\r\n",
+                    mailbox->name, error_message(r));
+    } else {
+        prot_printf(sync_out, "OK Updated modseqs on %lu messages okay\r\n",
+                    modseq_list->count);
+    }
+
+ bail:
+    sync_modseq_list_free(&modseq_list);
+}
+
 
 /* ====================================================================== */
 
@@ -2173,8 +2355,9 @@
     unsigned long  count;
 };
 
-static int cmd_expunge_decide(struct mailbox *mailbox __attribute__((unused)),
-			      void *rock, char *indexbuf,
+static unsigned cmd_expunge_decide(struct mailbox *mailbox __attribute__((unused)),
+				   void *rock,
+				   unsigned char *indexbuf,
 			      int expunge_flags __attribute__((unused)))
 {
     struct uid_list *uids = (struct uid_list *)rock;
@@ -2274,7 +2457,10 @@
 
 /* ====================================================================== */
 
-static int do_mailbox_single(char *name, int matchlen, int maycreate, void *rock)
+static int do_mailbox_single(char *name,
+			     int matchlen __attribute__((unused)),
+			     int maycreate __attribute__((unused)),
+			     void *rock)
 {
     struct mailbox m;
     int r;
@@ -2296,7 +2482,9 @@
         sync_printastring(sync_out, m.name);
 	prot_printf(sync_out, " ");
         sync_printastring(sync_out, m.acl);
+        prot_printf(sync_out, " %lu", m.uidvalidity);
         prot_printf(sync_out, " %lu", m.last_uid);
+	prot_printf(sync_out, " " MODSEQ_FMT, m.highestmodseq);
 	prot_printf(sync_out, " %lu", m.options);
 	if (m.quota.root && !strcmp(name, m.quota.root) &&
 	    !quota_read(&m.quota, NULL, 0)) {
@@ -2314,8 +2502,10 @@
 
 /* ====================================================================== */
 
-static int do_lsub_all_single(char *name, int matchlen, int maycreate,
-			       void *rock)
+static int do_lsub_all_single(char *name,
+			      int matchlen __attribute__((unused)),
+			      int maycreate __attribute__((unused)),
+			      void *rock __attribute__((unused)))
 {
     prot_printf(sync_out, "*** ");
     sync_printastring(sync_out, name);
@@ -2334,7 +2524,6 @@
     char **folder_name = xmalloc(alloc*sizeof(char *));
     char *err;
     int live = 1;
-    int r = 0;
 
     /* Parse list of Folders */
     do {
@@ -2486,9 +2675,8 @@
 		       unsigned long uidvalidity)
 {
     int r;
-    char buf[MAX_MAILBOX_PATH+1];
     char aclbuf[128];
-    int size;
+    size_t size;
 
     if (uniqueid && !strcasecmp(uniqueid, "NIL"))
         uniqueid = NULL;
@@ -2550,7 +2738,10 @@
 
 }
 
-static int do_lsub_single(char *name, int matchlen, int maycreate, void *rock)
+static int do_lsub_single(char *name,
+			  int matchlen __attribute__((unused)),
+			  int maycreate __attribute__((unused)),
+			  void *rock __attribute__((unused)))
 {
     prot_printf(sync_out, "* ");
     sync_printastring(sync_out, name);
@@ -2561,7 +2752,6 @@
 
 static void cmd_lsub(char *user)
 {
-    char buf[MAX_MAILBOX_PATH];
     int r;
 
     r = ((*sync_namespacep).mboxlist_findsub)(sync_namespacep, "*",

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_support.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_support.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_support.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_support.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* sync_support.c -- Cyrus synchonization support functions
  *
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * Original version written by David Carter <dpc22 at cam.ac.uk>
- * Rewritten and integrated into Cyrus by Ken Murchison <ken at oceana.com>
- *
- * $Id: sync_support.c,v 1.2 2006/11/30 17:11:20 murch Exp $
+ * $Id: sync_support.c,v 1.21 2008/10/08 15:47:08 murch Exp $
  */
 
 #include <config.h>
@@ -71,6 +69,8 @@
 #include "mailbox.h"
 #include "quota.h"
 #include "xmalloc.h"
+#include "xstrlcat.h"
+#include "xstrlcpy.h"
 #include "acl.h"
 #include "seen.h"
 #include "mboxname.h"
@@ -82,14 +82,14 @@
 #include "retry.h"
 #include "lock.h"
 #include "prot.h"
+
+#include "message_guid.h"
 #include "sync_support.h"
 #include "sync_commit.h"
 
 /* Parse routines */
 
 enum {
-    MAXQUOTED = 8192,
-    MAXWORD = 8192,
     MAXLITERAL = INT_MAX / 20
 };
 
@@ -121,7 +121,7 @@
 	if (len == buf->alloc) {
 	    buf->alloc += BUFGROWSIZE;
 	    buf->s = xrealloc(buf->s, buf->alloc+1);
-            if (len > MAXWORD) {
+            if (len > config_maxword) {
                 fatal("word too long", EC_IOERR);
             }
 	}
@@ -183,7 +183,7 @@
 
     /* if it's too long, literal it */
     if (*p || len >= 1024) {
-	prot_printf(out, "{%lu+}\r\n%s", strlen(s), s);
+	prot_printf(out, "{" SIZE_T_FMT "+}\r\n%s", strlen(s), s);
     } else {
 	prot_printf(out, "\"%s\"", s);
     }
@@ -216,7 +216,7 @@
 
     /* if it's too long, literal it */
     if (*p || len >= 1024) {
-	prot_printf(out, "{%lu+}\r\n%s", strlen(s), s);
+	prot_printf(out, "{" SIZE_T_FMT "+}\r\n%s", strlen(s), s);
     } else {
 	prot_printf(out, "\"%s\"", s);
     }
@@ -413,10 +413,61 @@
 
 /* ====================================================================== */
 
+/* sync_index stuff */
+
+struct sync_index_list *sync_index_list_create()
+{
+    struct sync_index_list *l = xzmalloc(sizeof (struct sync_index_list));
+
+    l->head     = NULL;
+    l->tail     = NULL;
+    l->count    = 0;
+    l->last_uid = 0;
+
+    return l;
+}
+
+void sync_index_list_add(struct sync_index_list *l,
+        unsigned long msgno, struct index_record *record)
+{
+    struct sync_index *result = xzmalloc(sizeof(struct sync_index));
+
+    result->msgno = msgno;
+    memcpy(&(result->record), record, sizeof(struct index_record));
+
+    if (l->tail)
+        l->tail = l->tail->next = result;
+    else
+        l->head = l->tail = result;
+
+    l->count++;
+    l->last_uid = record->uid;
+}
+
+void sync_index_list_free(struct sync_index_list **lp)
+{
+    struct sync_index_list *l = *lp;
+    struct sync_index *current, *next;
+
+    current = l->head;
+    while (current) {
+        next = current->next;
+        free(current);
+        current = next;
+    }
+    free(l);
+
+    *lp = NULL;
+}
+
+
+/* ====================================================================== */
+
 /* sync_msg stuff */
 
 struct sync_msg_list *sync_msg_list_create(char **flagname,
-					   unsigned long last_uid)
+					   unsigned long last_uid,
+                                           modseq_t highestmodseq)
 {
     struct sync_msg_list *l = xzmalloc(sizeof (struct sync_msg_list));
 
@@ -424,6 +475,7 @@
     l->tail     = NULL;
     l->count    = 0;
     l->last_uid = last_uid;
+    l->highestmodseq = highestmodseq;
     sync_flags_meta_clear(&l->meta);
 
     if (flagname)
@@ -485,18 +537,18 @@
 }
 
 struct sync_msgid *sync_msgid_add(struct sync_msgid_list *l,
-				  struct message_uuid *uuid)
+				  struct message_guid *guid)
 {
     struct sync_msgid *result;
     int offset;
 
-    if (message_uuid_isnull(uuid))
+    if (message_guid_isnull(guid))
         return(NULL);
 
     result = xzmalloc(sizeof(struct sync_msgid));
-    offset = message_uuid_hash(uuid, l->hash_size);
-
-    message_uuid_copy(&result->uuid, uuid);
+    offset = message_guid_hash(guid, l->hash_size);
+
+    message_guid_copy(&result->guid, guid);
 
     l->count++;
     if (l->tail)
@@ -511,6 +563,22 @@
     return(result);
 }
 
+void sync_msgid_remove(struct sync_msgid_list *l,
+		       struct message_guid *guid)
+{
+    int offset = message_guid_hash(guid, l->hash_size);
+    struct sync_msgid *msgid;
+
+    if (message_guid_isnull(guid)) return;
+
+    for (msgid = l->hash[offset] ; msgid ; msgid = msgid->hash_next) {
+	if (message_guid_compare(&msgid->guid, guid)) {
+	    message_guid_set_null(&msgid->guid);
+	    return;
+	}
+    }
+}
+
 void sync_msgid_list_free(struct sync_msgid_list **lp)
 {
     struct sync_msgid_list *l = *lp;
@@ -529,16 +597,16 @@
 }
 
 struct sync_msgid *sync_msgid_lookup(struct sync_msgid_list *l,
-				     struct message_uuid *uuid)
-{
-    int offset = message_uuid_hash(uuid, l->hash_size);
+				     struct message_guid *guid)
+{
+    int offset = message_guid_hash(guid, l->hash_size);
     struct sync_msgid *msgid;
 
-    if (message_uuid_isnull(uuid))
+    if (message_guid_isnull(guid))
         return(NULL);
 
     for (msgid = l->hash[offset] ; msgid ; msgid = msgid->hash_next) {
-        if (message_uuid_compare(&msgid->uuid, uuid))
+        if (message_guid_compare(&msgid->guid, guid))
             return(msgid);
     }
     return(NULL);
@@ -559,6 +627,7 @@
 
 struct sync_folder *sync_folder_list_add(struct sync_folder_list *l,
 					 char *id, char *name, char *acl,
+                                         unsigned long uidvalidity,
 					 unsigned long options,
 					 struct quota *quota)
 {
@@ -576,6 +645,7 @@
     result->id      = (id)   ? xstrdup(id)   : NULL;
     result->name    = (name) ? xstrdup(name) : NULL;
     result->acl     = (acl)  ? xstrdup(acl)  : NULL;
+    result->uidvalidity = uidvalidity;
     result->options = options;
     if (quota) {
 	result->quota.root = result->name;
@@ -856,7 +926,8 @@
     return 0;
 }
 
-void sync_message_list_cache(struct sync_message_list *l, char *entry, int size)
+void sync_message_list_cache(struct sync_message_list *l,
+			     char *entry, unsigned size)
 {
     if ((l->cache_buffer_size + size) > l->cache_buffer_alloc) {
         if (size > l->cache_buffer_alloc)
@@ -872,7 +943,7 @@
 
 int sync_message_list_cache_flush(struct sync_message_list *l)
 {
-    int n;
+    unsigned n;
 
     if (l->cache_buffer_size == 0)
         return(0);
@@ -906,17 +977,17 @@
 }
 
 struct sync_message *sync_message_add(struct sync_message_list *l,
-				      struct message_uuid *uuid)
+				      struct message_guid *guid)
 {
     struct sync_message *result;
     int offset;
 
     result = xzmalloc(sizeof(struct sync_message));
-    message_uuid_set_null(&result->uuid);
+    message_guid_set_null(&result->guid);
     
-    result->msg_path = xzmalloc(5 * (MAX_MAILBOX_PATH+1) * sizeof(char));
+    result->msg_path = xzmalloc((MAX_MAILBOX_PATH+1) * sizeof(char));
     result->msg_path_end = result->msg_path +
-	5 * (MAX_MAILBOX_PATH+1) * sizeof(char);
+	(MAX_MAILBOX_PATH+1) * sizeof(char);
 
     snprintf(result->stagename, sizeof(result->stagename), "%lu.", l->count);
 
@@ -931,10 +1002,10 @@
     else
         l->head = l->tail = result;
 
-    if (uuid && !message_uuid_isnull(uuid)) {
-        /* Messages with UUIDs get fast hash lookup for duplicate copies */
-        message_uuid_copy(&result->uuid, uuid);
-        offset = message_uuid_hash(uuid, l->hash_size);
+    if (guid && !message_guid_isnull(guid)) {
+        /* Messages with GUIDs get fast hash lookup for duplicate copies */
+        message_guid_copy(&result->guid, guid);
+        offset = message_guid_hash(guid, l->hash_size);
 
         /* Insert at start of list */
         result->hash_next = l->hash[offset];
@@ -943,21 +1014,25 @@
     return(result);
 }
 
-void sync_message_fsync(struct sync_message_list *l)
+int sync_message_fsync(struct sync_message_list *l)
 {
     int i;
-
-    if (l->file_count == 0)
-        return;
+    int r = 0;
+
+    if (l->file_count == 0) return(0);
 
     /* fsync() files in reverse order: ReiserFS FAQ indicates that this
      * gives best potential for optimisation */
     for (i = (l->file_count-1) ; i >= 0 ; i--) {
-        fsync(fileno(l->file[i]));
-        fclose(l->file[i]);
+        if ((fflush(l->file[i]) != 0) ||
+            (fsync(fileno(l->file[i])) < 0) ||
+            (fclose(l->file[i]) != 0))
+            r = IMAP_IOERROR;  /* Aggregate to single error */
         l->file[i] = NULL;
     }
     l->file_count = 0;
+
+    return(r);
 }
 
 FILE *sync_message_open(struct sync_message_list *l,
@@ -965,8 +1040,21 @@
 {
     FILE *file;
 
-    if (l->file_count == l->file_max)
-        sync_message_fsync(l);
+    if (l->file_count == l->file_max) {
+        if (sync_message_fsync(l) != 0) {
+            syslog(LOG_ERR, "sync_message_open(): Unable to flush files");
+            return(NULL);
+        }
+    }
+
+    /* unlink just in case a previous crash left a file 
+     * hard linked into someone else's mailbox! */
+    if (unlink(message->msg_path) == -1 && errno != ENOENT) {
+	syslog(LOG_ERR,
+	       "sync_message_open(): failed to unlink stale file %s: %m",
+	       message->msg_path);
+	return(NULL);
+    }
 
     /* Open read/write so file can later be mmap()ed if needed */
     if ((file=fopen(message->msg_path, "w+")) == NULL) {
@@ -982,13 +1070,15 @@
 
 int sync_message_copy_fromstage(struct sync_message *message,
 				struct mailbox *mailbox,
-				unsigned long uid)
+				unsigned long uid,
+				time_t internaldate)
 {
     int r;
     const char *root;
     char *partition, stagefile[MAX_MAILBOX_PATH+1], *p;
     size_t sflen;
     char  target[MAX_MAILBOX_PATH+1];
+    struct utimbuf settime;
  
     /* Find mailbox partition */
     r = mboxlist_detail(mailbox->name, NULL, NULL, NULL, &partition, NULL, NULL);
@@ -1067,7 +1157,12 @@
 
     snprintf(target, MAX_MAILBOX_PATH, "%s/%lu.", mailbox->path, uid);
 
-    return mailbox_copyfile(p, target, 0);
+    r = mailbox_copyfile(p, target, 0);
+    if (!r) {
+	settime.actime = settime.modtime = internaldate;
+	utime(target, &settime);
+    }
+    return (r);
 }
 
 void sync_message_list_free(struct sync_message_list **lp)
@@ -1105,16 +1200,16 @@
 }
 
 struct sync_message *sync_message_find(struct sync_message_list *l,
-				       struct message_uuid *uuid)
+				       struct message_guid *guid)
 {
     struct sync_message *current;
-    int offset = message_uuid_hash(uuid, l->hash_size);
-
-    if (message_uuid_isnull(uuid))
+    int offset = message_guid_hash(guid, l->hash_size);
+
+    if (message_guid_isnull(guid))
         return(NULL);
 
     for (current = l->hash[offset] ; current ; current = current->hash_next) {
-        if (message_uuid_compare(&current->uuid, uuid))
+        if (message_guid_compare(&current->guid, guid))
             return(current);
     }
     return(NULL);
@@ -1252,8 +1347,7 @@
     FILE         *file;
     int           r = 0;
     unsigned long size;
-    const char *msg_base = 0;
-    unsigned long msg_len = 0;
+    struct body *body = NULL;
     struct index_record record;
     char buf[8192+1];
     int n;
@@ -1261,11 +1355,22 @@
     /* If switching from PARSED to SIMPLE, need to flush cache.  This is
      * redundant as it duplicates code in cmd_upload() (which is the
      * logical place for the code to go), but better safe than sorry. */
-    if (list->cache_buffer_size > 0)
-        sync_message_list_cache_flush(list);
+    if (list->cache_buffer_size > 0) {
+        if ((r = sync_message_list_cache_flush(list)))
+            return(r);
+    }
 
     if ((r = sync_getliteral_size(input, output, &message->msg_size)))
         return(r);
+
+    /* unlink just in case a previous crash left a file 
+     * hard linked into someone else's mailbox! */
+    if (unlink(message->msg_path) == -1 && errno != ENOENT) {
+	syslog(LOG_ERR,
+	       "sync_getsimple(): failed to unlink stale file %s: %m",
+	       message->msg_path);
+	return(IMAP_IOERROR);
+    }
 
     /* Open read/write so file can later be mmap()ed */
     if ((file=fopen(message->msg_path, "w+")) == NULL) {
@@ -1306,16 +1411,16 @@
         return(IMAP_IOERROR);
     }
 
-    map_refresh(fileno(file), 1, &msg_base, &msg_len, message->msg_size,
-		"new message", "unknown");
-
-    r = message_parse_mapped_async(msg_base, msg_len,
-                                   MAILBOX_FORMAT_NORMAL,
-                                   list->cache_fd, &record);
-    map_free(&msg_base, &msg_len);
+    r = message_parse_file(file, NULL, NULL, &body);
+    if (!r) r = message_create_record(list->cache_name,
+				      list->cache_fd,
+				      &record, body);
+    if (body) message_free_body(body);
 
     message->hdr_size     = record.header_size;
     message->cache_offset = record.cache_offset;
+    message->content_lines = record.content_lines;
+    message->cache_version = record.cache_version;
     message->cache_size 
         = lseek(list->cache_fd, 0, SEEK_CUR) - record.cache_offset;
 
@@ -1354,6 +1459,27 @@
     l->count++;
 
     return(result);
+}
+
+void sync_upload_list_remove(struct sync_upload_list *l,
+			     struct sync_upload_item *i)
+{
+    struct sync_upload_item *prev, *current, *next;
+
+    prev = NULL;
+    current = l->head;
+    while (current) {
+	next = current->next;
+	if (current == i) {
+	    l->count--;
+	    free(current);
+	    if (prev) prev->next = next;
+	    else l->head = next;
+	    return;
+	}
+	prev = current;
+	current = next;
+    }
 }
 
 void sync_upload_list_free(struct sync_upload_list **lp)
@@ -1418,21 +1544,69 @@
 
 /* ====================================================================== */
 
+struct sync_modseq_list *sync_modseq_list_create()
+{
+    struct sync_modseq_list *l = xzmalloc(sizeof (struct sync_modseq_list));
+
+    l->head   = NULL;
+    l->tail   = NULL;
+    l->count  = 0;
+    return(l);
+}
+
+struct sync_modseq_item *sync_modseq_list_add(struct sync_modseq_list *l,
+                                              unsigned long uid,
+                                              modseq_t modseq)
+{
+    struct sync_modseq_item *result
+        = xzmalloc(sizeof(struct sync_modseq_item));
+
+    result->uid = uid;
+    result->modseq = modseq;
+
+    if (l->tail)
+        l->tail = l->tail->next = result;
+    else
+        l->head = l->tail = result;
+
+    l->count++;
+    return(result);
+}
+
+void sync_modseq_list_free(struct sync_modseq_list **lp)
+{
+    struct sync_modseq_list *l = *lp;
+    struct sync_modseq_item *current, *next;
+
+    current = l->head;
+    while (current) {
+        next = current->next;
+        free(current);
+        current = next;
+    }
+    free(l);
+    *lp = NULL;
+}
+
+/* ====================================================================== */
+
 char *sync_sieve_get_path(char *userid, char *sieve_path, size_t psize)
 {
     char *domain;
 
     if (config_getenum(IMAPOPT_VIRTDOMAINS) && (domain = strchr(userid, '@'))) {
-	char d = (char) dir_hash_c(domain+1);
+	char d = (char) dir_hash_c(domain+1, config_fulldirhash);
 	*domain = '\0';  /* split user at domain */
 	snprintf(sieve_path, psize, "%s%s%c/%s/%c/%s",
 		 config_getstring(IMAPOPT_SIEVEDIR),
-		 FNAME_DOMAINDIR, d, domain+1, dir_hash_c(userid), userid);
+		 FNAME_DOMAINDIR, d, domain+1,
+		 dir_hash_c(userid, config_fulldirhash), userid);
 	*domain = '@';  /* reassemble user at domain */
     }
     else {
 	snprintf(sieve_path, psize, "%s/%c/%s",
-		 config_getstring(IMAPOPT_SIEVEDIR), dir_hash_c(userid), userid);
+		 config_getstring(IMAPOPT_SIEVEDIR),
+		 dir_hash_c(userid, config_fulldirhash), userid);
     }
 
     return sieve_path;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_support.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_support.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_support.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/sync_support.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* sync_support.h -- Cyrus synchonization support functions
  *
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,16 +39,17 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: sync_support.h,v 1.11 2008/03/24 17:09:20 murch Exp $
+ *
  * Original version written by David Carter <dpc22 at cam.ac.uk>
  * Rewritten and integrated into Cyrus by Ken Murchison <ken at oceana.com>
- *
- * $Id: sync_support.h,v 1.2 2006/11/30 17:11:20 murch Exp $
  */
 
 #ifndef INCLUDED_SYNC_SUPPORT_H
 #define INCLUDED_SYNC_SUPPORT_H
 
 #include "prot.h"
+#include "mailbox.h"
 
 #define SYNC_MSGID_LIST_HASH_SIZE        (65536)
 #define SYNC_MESSAGE_LIST_HASH_SIZE      (65536)
@@ -97,12 +99,36 @@
 
 /* ====================================================================== */
 
+/* sync_index_list records index records for upload */
+
+struct sync_index {
+    struct sync_index *next;
+    struct index_record record;
+    unsigned long msgno;
+};
+
+struct sync_index_list {
+    struct sync_index *head, *tail;
+    unsigned long count;
+    unsigned long last_uid;
+};
+
+struct sync_index_list *sync_index_list_create(void);
+
+void sync_index_list_add(struct sync_index_list *l,
+             unsigned long msgno, struct index_record *record);
+
+void sync_index_list_free(struct sync_index_list **lp);
+
+/* ====================================================================== */
+
 /* sync_msg_list records message lists in client */
 
 struct sync_msg {
     struct sync_msg *next;
-    struct message_uuid uuid;
+    struct message_guid guid;
     unsigned long uid;
+    modseq_t modseq;
     struct sync_flags flags;
 };
 
@@ -110,11 +136,13 @@
     struct sync_msg *head, *tail;
     unsigned long count;
     unsigned long last_uid;
+    modseq_t highestmodseq;
     struct sync_flags_meta meta;
 };
 
 struct sync_msg_list *sync_msg_list_create(char **flagname,
-					   unsigned long last_uid);
+					   unsigned long last_uid,
+                                           modseq_t highestmodseq);
 
 struct sync_msg *sync_msg_list_add(struct sync_msg_list *l);
 
@@ -125,7 +153,7 @@
 struct sync_msgid {
     struct sync_msgid *next;
     struct sync_msgid *hash_next;
-    struct message_uuid uuid;
+    struct message_guid guid;
     int count;
     int reserved;
 };
@@ -142,10 +170,13 @@
 struct sync_msgid_list *sync_msgid_list_create(int hash_size);
 
 struct sync_msgid *sync_msgid_add(struct sync_msgid_list *list,
-				  struct message_uuid *uuid);
+				  struct message_guid *guid);
+
+void sync_msgid_remove(struct sync_msgid_list *l,
+		       struct message_guid *guid);
 
 struct sync_msgid *sync_msgid_lookup(struct sync_msgid_list *list,
-				     struct message_uuid *uuid);
+				     struct message_guid *guid);
 
 void sync_msgid_list_free(struct sync_msgid_list **list);
 
@@ -158,6 +189,7 @@
     char *name;
     char *acl;
     unsigned options;
+    unsigned long uidvalidity;
     struct quota quota;
     int   mark; 
     int   reserve;  /* Folder has been processed by reserve operation */
@@ -173,6 +205,7 @@
 
 struct sync_folder *sync_folder_list_add(struct sync_folder_list *l,
 					 char *id, char *name, char *acl,
+                                         unsigned long uidvalidity,
 					 unsigned long options,
 					 struct quota *quota);
 
@@ -249,7 +282,7 @@
     unsigned  long  cache_size;
     unsigned  long  content_lines;
     unsigned  long  cache_version;
-    struct message_uuid uuid;
+    struct message_guid guid;
     char           stagename[100];
 
     /* the msg_path buffer consists of
@@ -287,8 +320,10 @@
 
 struct sync_message_list *sync_message_list_create(int hash_size, int file_max);
 
+int sync_message_list_newstage(struct sync_message_list *l, char *mboxname);
+
 void sync_message_list_cache(struct sync_message_list *l,
-			     char *entry, int size);
+			     char *entry, unsigned size);
 
 int sync_message_list_cache_flush(struct sync_message_list *l);
 
@@ -296,7 +331,7 @@
 
 
 struct sync_message *sync_message_add(struct sync_message_list *l,
-				      struct message_uuid *uuid);
+				      struct message_guid *guid);
 
 char *sync_message_next_path(struct sync_message_list *l);
 
@@ -305,16 +340,17 @@
 int sync_message_list_need_restart(struct sync_message_list *l);
 
 struct sync_message *sync_message_find(struct sync_message_list *l,
-				       struct message_uuid *uuid);
-
-void sync_message_fsync(struct sync_message_list *l);
+				       struct message_guid *guid);
+
+int sync_message_fsync(struct sync_message_list *l);
 
 FILE *sync_message_open(struct sync_message_list *l,
 			struct sync_message *message);
 
 int sync_message_copy_fromstage(struct sync_message *message,
 				struct mailbox *mailbox,
-				unsigned long uid);
+				unsigned long uid,
+				time_t internaldate);
 
 /* ====================================================================== */
 
@@ -325,7 +361,7 @@
     time_t sentdate;    
     time_t last_updated;
     struct sync_flags    flags;
-    struct message_uuid  uuid;
+    struct message_guid  guid;
     modseq_t modseq;
     struct sync_message *message;
 };
@@ -342,6 +378,9 @@
 						 char **flagname);
 
 struct sync_upload_item *sync_upload_list_add(struct sync_upload_list *l);
+
+void sync_upload_list_remove(struct sync_upload_list *l,
+			     struct sync_upload_item *i);
 
 void sync_upload_list_free(struct sync_upload_list **lp);
 
@@ -380,6 +419,28 @@
 struct sync_flag_item *sync_flag_list_add(struct sync_flag_list *l);
 
 void sync_flag_list_free(struct sync_flag_list **lp);
+
+/* ====================================================================== */
+
+struct sync_modseq_item {
+    struct sync_modseq_item *next;
+    unsigned long uid;
+    modseq_t modseq;
+};
+
+struct sync_modseq_list {
+    struct sync_modseq_item *head;
+    struct sync_modseq_item *tail;
+    unsigned long count;
+};
+
+struct sync_modseq_list *sync_modseq_list_create();
+
+struct sync_modseq_item *sync_modseq_list_add(struct sync_modseq_list *l,
+                                              unsigned long uid,
+                                              modseq_t modseq);
+
+void sync_modseq_list_free(struct sync_modseq_list **lp);
 
 /* ====================================================================== */
 
@@ -476,6 +537,8 @@
 
 void sync_lock_reset(struct sync_lock *sync_lock);
 
+int sync_unlock(struct sync_lock *lock);
+
 int sync_lock(struct sync_lock *lock);
 
 int sync_user_unlock(struct sync_lock *lock);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/syncnews.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/syncnews.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/syncnews.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/syncnews.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* syncnews.c -- program to synchronize active file with mailbox list
  *
- * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,11 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-
-/*
- * $Id: syncnews.c,v 1.27 2006/11/30 17:11:20 murch Exp $
- */
+ * $Id: syncnews.c,v 1.29 2008/03/24 17:09:20 murch Exp $
+ */
+
 #include <config.h>
 
 #ifdef HAVE_UNISTD_H
@@ -94,7 +92,9 @@
     int opt;
     char *alt_config = NULL;
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     while ((opt = getopt(argc, argv, "C:")) != EOF) {
 	switch (opt) {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/telemetry.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/telemetry.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/telemetry.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/telemetry.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* telemetry.c -- common server telemetry
- * $Id: telemetry.c,v 1.8 2003/10/22 18:50:08 rjs3 Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: telemetry.c,v 1.9 2008/03/24 17:09:20 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/telemetry.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/telemetry.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/telemetry.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/telemetry.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* telemetry.h -- interface for telemetry
- * $Id: telemetry.h,v 1.3 2003/07/22 19:17:20 rjs3 Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: telemetry.h,v 1.4 2008/03/24 17:09:20 murch Exp $
  */
 
 #ifndef INCLUDED_TELEMETRY_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls.c Mon Feb  9 12:49:22 2009
@@ -4,7 +4,7 @@
  *
  * Based upon Lutz Jaenicke's TLS patches for postfix
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -20,14 +20,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -41,7 +42,11 @@
  * 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.
-
+ *
+ * $Id: tls.c,v 1.65 2008/04/15 17:58:08 murch Exp $
+ */
+
+/*
 * NAME
 *	tls
 * SUMMARY
@@ -66,7 +71,7 @@
 *
 *	tls_stop_servertls() sends the "close notify" alert via
 *	SSL_shutdown() to the peer and resets all connection specific
-*	TLS data. As RFC2487 does not specify a seperate shutdown, it
+*	TLS data. As RFC2487 does not specify a separate shutdown, it
 *	is supposed that the underlying TCP connection is shut down
 *	immediately afterwards, so we don't care about additional data
 *	coming through the channel.
@@ -93,8 +98,6 @@
 *
 */
 
-/* $Id: tls.c,v 1.53 2007/02/05 18:49:56 jeaton Exp $ */
-
 #include <config.h>
 
 #ifdef HAVE_SSL
@@ -118,6 +121,7 @@
 
 /* Application-specific. */
 #include "assert.h"
+#include "nonblock.h"
 #include "xmalloc.h"
 #include "xstrlcat.h"
 #include "xstrlcpy.h"
@@ -219,6 +223,49 @@
     return (rsa_tmp);
 }
 
+#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
+/* Logic copied from OpenSSL apps/s_server.c: give the TLS context
+ * DH params to work with DHE-* cipher suites. Hardcoded fallback
+ * in case no DH params in tls_key_file or tls_cert_file.
+ */
+static DH *get_dh1024(void)
+{
+    /* Second Oakley group 1024-bits MODP group from RFC2409 */
+    DH *dh=NULL;
+
+    if ((dh=DH_new()) == NULL) return(NULL);
+    dh->p=get_rfc2409_prime_1024(NULL);
+    dh->g=NULL;
+    BN_dec2bn(&(dh->g), "2");
+    if ((dh->p == NULL) || (dh->g == NULL)) return(NULL);
+
+    return(dh);
+	
+}
+static DH *load_dh_param(const char *keyfile, const char *certfile)
+{
+    DH *ret=NULL;
+    BIO *bio = NULL;
+
+    if (keyfile) bio = BIO_new_file(keyfile, "r");
+
+    if ((bio == NULL) && certfile) bio = BIO_new_file(certfile,"r");
+
+    if (bio) ret=PEM_read_bio_DHparams(bio,NULL,NULL,NULL);
+
+    if (ret == NULL) {
+	ret = get_dh1024();
+	syslog(LOG_NOTICE, "imapd:Loading hard-coded DH parameters");
+    } else {
+	syslog(LOG_NOTICE, "imapd:Loading DH parameters from file");
+    }
+
+    if (bio != NULL) BIO_free(bio);
+
+    return(ret);
+}
+#endif /* OPENSSL_VERSION_NUMBER >= 0x009080fL */
+
 /* taken from OpenSSL apps/s_cb.c */
 
 static int verify_callback(int ok, X509_STORE_CTX * ctx)
@@ -359,6 +406,10 @@
 			  const char *cert_file, const char *key_file)
 {
     if (cert_file != NULL) {
+	/* SSL_CTX_use_certificate_chain_file() requires an empty error stack.
+	 * To make sure there is no error from previous op, we clear it here...
+	 */
+	ERR_clear_error();
 	if (SSL_CTX_use_certificate_chain_file(ctx, cert_file) <= 0) {
 	    syslog(LOG_ERR, "unable to get certificate from '%s'", cert_file);
 	    return (0);
@@ -390,7 +441,7 @@
 			  SSL_SESSION *sess)
 {
     int len;
-    unsigned char *data = NULL, *asn;
+    unsigned char *data = NULL;
     time_t expire;
     int ret = -1;
 
@@ -409,7 +460,7 @@
 
     /* transform the session into its ASN1 representation */
     if (data) {
-	asn = data + sizeof(time_t);
+	unsigned char *asn = data + sizeof(time_t);
 	len = i2d_SSL_SESSION(sess, &asn);
 	if (!len) syslog(LOG_ERR, "i2d_SSL_SESSION failed");
     }
@@ -650,7 +701,7 @@
 	strlcpy(dbdir, config_dir, sizeof(dbdir));
 	strlcat(dbdir, FNAME_TLSSESSIONS, sizeof(dbdir));
 
-	r = DB->open(dbdir, CYRUSDB_CREATE, &sessdb);
+	r = (DB->open)(dbdir, CYRUSDB_CREATE, &sessdb);
 	if (r != 0) {
 	    syslog(LOG_ERR, "DBERROR: opening %s: %s",
 		   dbdir, cyrusdb_strerror(ret));
@@ -683,6 +734,12 @@
 	return (-1);
     }
     SSL_CTX_set_tmp_rsa_callback(s_ctx, tmp_rsa_cb);
+
+#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
+    /* Load DH params for DHE-* key exchanges */
+    SSL_CTX_set_tmp_dh(s_ctx, load_dh_param(s_key_file, s_cert_file));
+    /* FIXME: Load ECDH params for ECDHE suites when 0.9.9 is released */
+#endif
 
     verify_depth = verifydepth;
     if (askcert!=0)
@@ -745,7 +802,7 @@
   * filled in if the client authenticated. 'ret' is the SSL connection
   * on success.
   */
-int tls_start_servertls(int readfd, int writefd,
+int tls_start_servertls(int readfd, int writefd, int timeout,
 			int *layerbits, char **authid, SSL **ret)
 {
     int     sts;
@@ -800,14 +857,79 @@
     if (var_imapd_tls_loglevel >= 3)
 	do_dump = 1;
 
-    if ((sts = SSL_accept(tls_conn)) <= 0) {
-	SSL_SESSION *session = SSL_get_session(tls_conn);
-	if (session) {
-	    SSL_CTX_remove_session(s_ctx, session);
+    nonblock(readfd, 1);
+    while (1) {
+	fd_set rfds;
+	struct timeval tv;
+	int err;
+
+	FD_ZERO(&rfds);
+	FD_SET(readfd, &rfds);
+	tv.tv_sec = timeout;
+	tv.tv_usec = 0;
+
+	sts = select(1, &rfds, NULL, NULL, &tv);
+	if (sts <= 0) {
+	    if (sts == 0) {
+		syslog(LOG_DEBUG, "SSL_accept() timed out -> fail");
+	    } else {
+		syslog(LOG_DEBUG,
+		       "tls_start_servertls() failed in select() -> fail: %m");
+	    }
+	    r = -1;
+	    goto done;
+	}
+
+	sts = SSL_accept(tls_conn);
+	if (sts > 0) {
+	    syslog(LOG_DEBUG, "SSL_accept() succeeded -> done");
+	    break;
+	}
+
+	/* Check the error code */
+	err = SSL_get_error(tls_conn, sts);
+	switch (err) {
+	case SSL_ERROR_WANT_READ:
+	case SSL_ERROR_WANT_WRITE:
+	    syslog(LOG_DEBUG, "SSL_accept() incomplete -> wait");
+	    continue;
+	case SSL_ERROR_SYSCALL:
+	    if (sts == 0) {
+		syslog(LOG_DEBUG, "EOF in SSL_accept() -> fail");
+	    } else if (errno == EINTR || errno == EAGAIN) {
+		syslog(LOG_DEBUG,
+		       "SSL_accept() interrupted by signal %m -> retry");
+		continue;
+	    } else {
+		syslog(LOG_DEBUG,
+		       "SSL_accept() interrupted by signal %m -> fail");
+	    }
+	    break;
+	case SSL_ERROR_SSL:
+	    err = ERR_get_error();
+	    if (err == 0) {
+		syslog(LOG_DEBUG, "protocol error in SSL_accept() -> fail");
+	    } else {
+		syslog(LOG_DEBUG, "%s in SSL_accept() -> fail",
+		       ERR_reason_error_string(err));
+	    }
+	    break;
+	case SSL_ERROR_ZERO_RETURN:
+	    syslog(LOG_DEBUG,
+		   "TLS/SSL connection closed in SSL_accept() -> fail");
+	    break;
+	default:
+	    syslog(LOG_DEBUG,
+		   "SSL_accept() failed with unknown error %d -> fail",
+		   err);
+	    break;
 	}
 	r = -1;
 	goto done;
-    }
+
+	/* Should never get here */
+    }
+
     /* Only loglevel==4 dumps everything */
     if (var_imapd_tls_loglevel < 4)
 	do_dump = 0;
@@ -861,7 +983,7 @@
 
 	if (authid != NULL) {
 	    /* save the peer id for our caller */
-	    *authid = peer_CN ? xstrdup(peer_CN) : NULL;
+	    *authid = peer_CN[0] ? xstrdup(peer_CN) : NULL;
 	}
 	X509_free(peer);
     }
@@ -890,8 +1012,13 @@
     }
 
  done:
+    nonblock(readfd, 0);
     if (r && tls_conn) {
 	/* error; clean up */
+	SSL_SESSION *session = SSL_get_session(tls_conn);
+	if (session) {
+	    SSL_CTX_remove_session(s_ctx, session);
+	}
 	SSL_free(tls_conn);
 	tls_conn = NULL;
     }
@@ -931,7 +1058,7 @@
     int r;
 
     if (tls_serverengine && sess_dbopen) {
-	r = DB->close(sessdb);
+	r = (DB->close)(sessdb);
 	if (r) {
 	    syslog(LOG_ERR, "DBERROR: error closing tlsdb: %s",
 		   cyrusdb_strerror(r));
@@ -1008,7 +1135,7 @@
     strlcpy(dbdir, config_dir, sizeof(dbdir));
     strlcat(dbdir, FNAME_TLSSESSIONS, sizeof(dbdir));
 
-    ret = DB->open(dbdir, CYRUSDB_CREATE, &sessdb);
+    ret = (DB->open)(dbdir, CYRUSDB_CREATE, &sessdb);
     if (ret != CYRUSDB_OK) {
 	syslog(LOG_ERR, "DBERROR: opening %s: %s",
 	       dbdir, cyrusdb_strerror(ret));
@@ -1019,7 +1146,7 @@
 	sess_dbopen = 1;
 	prock.count = prock.deletions = 0;
 	DB->foreach(sessdb, "", 0, &prune_p, &prune_cb, &prock, NULL);
-	DB->close(sessdb);
+	(DB->close)(sessdb);
 	sessdb = NULL;
 	sess_dbopen = 0;
 
@@ -1206,7 +1333,7 @@
 
 	if (authid != NULL) {
 	    /* save the peer id for our caller */
-	    *authid = peer_CN ? xstrdup(peer_CN) : NULL;
+	    *authid = peer_CN[0] ? xstrdup(peer_CN) : NULL;
 	}
 	X509_free(peer);
     }
@@ -1218,7 +1345,7 @@
     if (layerbits != NULL)
 	*layerbits = tls_cipher_usebits;
     
-    syslog(LOG_NOTICE, "starttls: %s with cipher %s (%d/%d bits %s)"
+    syslog(LOG_DEBUG, "starttls: %s with cipher %s (%d/%d bits %s client)"
 	   " no authentication", 
 	   tls_protocol, tls_cipher_name,
 	   tls_cipher_usebits, tls_cipher_algbits,

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls.h Mon Feb  9 12:49:22 2009
@@ -4,7 +4,7 @@
  *
  *  Based upon Lutz Jaenicke's TLS patches for postfix
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -20,14 +20,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -41,9 +42,9 @@
  * 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.
+ *
+ * $Id: tls.h,v 1.20 2008/03/24 17:09:20 murch Exp $
  */
-
-/* $Id: tls.h,v 1.18 2003/10/22 18:50:09 rjs3 Exp $ */
 
 #ifndef INCLUDED_TLS_H
 #define INCLUDED_TLS_H
@@ -69,7 +70,7 @@
 			  char *var_tls_key_file);
 
 /* start tls negotiation */
-int tls_start_servertls(int readfd, int writefd, 
+int tls_start_servertls(int readfd, int writefd, int timeout,
 			int *layerbits, char **authid, SSL **ret);
 
 int tls_start_clienttls(int readfd, int writefd,

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls_prune.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls_prune.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls_prune.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/tls_prune.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
-/* 
- * tls_prune.c -- program to prune TLS session db of expired sessions
+/* tls_prune.c -- program to prune TLS session db of expired sessions
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +38,9 @@
  * 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.
+ *
+ * $Id: tls_prune.c,v 1.10 2008/03/24 17:09:20 murch Exp $
  */
-
-/* $Id: tls_prune.c,v 1.7 2006/11/30 17:11:20 murch Exp $ */
 
 #include <config.h>
 
@@ -50,6 +50,7 @@
 #include "exitcodes.h"
 #include "global.h"
 #include "tls.h"
+#include "util.h"
 #include "xmalloc.h"
 
 /* global state */
@@ -67,7 +68,9 @@
     int opt,r;
     char *alt_config = NULL;
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
 
     while ((opt = getopt(argc, argv, "C:")) != EOF) {
 	switch (opt) {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/unexpunge.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/unexpunge.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/unexpunge.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/unexpunge.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* unexpunge.c -- Program to unexpunge messages
  *
- * Copyright (c) 1998-2005 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: unexpunge.c,v 1.4 2007/02/07 14:27:52 murch Exp $
+ * $Id: unexpunge.c,v 1.12 2008/03/24 17:09:20 murch Exp $
  */
 
 #include <config.h>
@@ -73,6 +74,7 @@
 #include "xmalloc.h"
 #include "xstrlcpy.h"
 #include "xstrlcat.h"
+#include "sync_log.h"
 
 /* global state */
 const int config_need_data = 0;
@@ -86,6 +88,7 @@
 {
     fprintf(stderr,
 	    "unexpunge [-C <altconfig>] -l <mailbox>\n"
+            "unexpunge [-C <altconfig>] -t time-interval [ -d ] [ -v ] mailbox\n"
 	    "unexpunge [-C <altconfig>] -a [-d] [-v] <mailbox>\n"
 	    "unexpunge [-C <altconfig>] -u [-d] [-v] <mailbox> <uid>...\n");
     exit(-1);
@@ -95,6 +98,7 @@
     MODE_UNKNOWN = -1,
     MODE_LIST,
     MODE_ALL,
+    MODE_TIME,
     MODE_UID
 };
 
@@ -168,8 +172,8 @@
 {
     int r = 0;
     const char *irec;
-    char buf[INDEX_HEADER_SIZE > INDEX_RECORD_SIZE ?
-	     INDEX_HEADER_SIZE : INDEX_RECORD_SIZE];
+    indexbuffer_t ibuf;
+    unsigned char *buf = ibuf.buf;
     char *path, fnamebuf[MAX_MAILBOX_PATH+1], fnamebufnew[MAX_MAILBOX_PATH+1];
     FILE *newindex = NULL, *newexpungeindex = NULL;
     unsigned emsgno, imsgno;
@@ -284,7 +288,7 @@
     memcpy(buf, mailbox->index_base, mailbox->start_offset);
 
     /* Update uidvalidity */
-    *((bit32 *)(buf+OFFSET_UIDVALIDITY)) = now;
+    *((bit32 *)(buf+OFFSET_UIDVALIDITY)) = htonl(now);
 
     /* Fix up exists */
     newexists = ntohl(*((bit32 *)(buf+OFFSET_EXISTS))) + *numrestored;
@@ -327,7 +331,7 @@
     memcpy(buf, expunge_index_base, mailbox->start_offset);
 
     /* Update uidvalidity */
-    *((bit32 *)(buf+OFFSET_UIDVALIDITY)) = now;
+    *((bit32 *)(buf+OFFSET_UIDVALIDITY)) = htonl(now);
 
     /* Fix up exists */
     newexists = ntohl(*((bit32 *)(buf+OFFSET_EXISTS))) - *numrestored;
@@ -431,10 +435,14 @@
     const char *lockfailaction;
     struct msg *msgs;
     unsigned numrestored = 0;
-
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
-
-    while ((opt = getopt(argc, argv, "C:laudv")) != EOF) {
+    time_t last_update, time_since = time(NULL);
+    int len, secs = 0;
+
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
+
+    while ((opt = getopt(argc, argv, "C:laudt:v")) != EOF) {
 	switch (opt) {
 	case 'C': /* alt config file */
 	    alt_config = optarg;
@@ -450,6 +458,32 @@
 	    mode = MODE_ALL;
 	    break;
 	
+	case 't':
+	    if (mode != MODE_UNKNOWN) usage();
+
+	    mode = MODE_TIME;
+            secs = atoi(optarg);
+            len  = strlen(optarg);
+            
+            if ((secs > 0) && (len > 1)) {
+                switch (optarg[len-1]) {
+                case 'm':
+                    secs *= 60;
+                    break;
+                case 'h':
+                    secs *= (60*60);
+                    break;
+                case 'd':
+                    secs *= (24*60*60);
+                    break;
+                case 'w':
+                    secs *= (7*24*60*60);
+                    break;
+                }
+            }
+            time_since = time(NULL) - secs;
+	    break;
+
 	case 'u':
 	    if (mode != MODE_UNKNOWN) usage();
 	    mode = MODE_UID;
@@ -480,6 +514,8 @@
 
     quotadb_init(0);
     quotadb_open(NULL);
+
+    sync_log_init();
 
     /* Set namespace -- force standard (internal) */
     if ((r = mboxname_init_namespace(&unex_namespace, 1)) != 0) {
@@ -538,7 +574,7 @@
 	const char *rec;
 	unsigned msgno;
 	unsigned long *uids = NULL;
-	unsigned nuids;
+	unsigned nuids = 0;
 
 	map_refresh(expunge_fd, 1, &expunge_index_base,
 		    &expunge_index_len, sbuf.st_size, "expunge",
@@ -550,7 +586,7 @@
 
 	/* Get UIDs of messages to restore */
 	if (mode == MODE_UID) {
-	    int i;
+	    unsigned i;
 
 	    nuids = argc - ++optind;
 	    uids = (unsigned long *) xmalloc(nuids * sizeof(unsigned long));
@@ -575,6 +611,10 @@
 	    switch (mode) {
 	    case MODE_LIST: msgs[msgno].restore = 0; break;
 	    case MODE_ALL: msgs[msgno].restore = 1; break;
+            case MODE_TIME:
+                last_update = ntohl(*((bit32 *)(rec+OFFSET_LAST_UPDATED)));
+                msgs[msgno].restore = (last_update > time_since);
+                break;
 	    case MODE_UID:
 		/* see if this UID is in our list */
 		msgs[msgno].restore = bsearch(&uid, uids, nuids,
@@ -618,6 +658,8 @@
     mailbox_unlock_pop(&mailbox);
     mailbox_unlock_index(&mailbox);
     mailbox_unlock_header(&mailbox);
+
+    if (!r) sync_log_mailbox(mailbox.name);
     mailbox_close(&mailbox);
 
     quotadb_close();

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/user.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/user.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/user.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/user.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* user.c -- User manipulation routines
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: user.c,v 1.21 2006/11/30 17:11:20 murch Exp $
+ * $Id: user.c,v 1.24 2008/03/24 17:09:20 murch Exp $
  */
 
 #include <config.h>
@@ -128,16 +127,16 @@
     if(config_getswitch(IMAPOPT_SIEVEUSEHOMEDIR)) return 0;
     
     if (config_virtdomains && (domain = strchr(user, '@'))) {
-	char d = (char) dir_hash_c(domain+1);
+	char d = (char) dir_hash_c(domain+1, config_fulldirhash);
 	*domain = '\0';  /* split user at domain */
-	hash = (char) dir_hash_c(user);
+	hash = (char) dir_hash_c(user, config_fulldirhash);
 	snprintf(sieve_path, sizeof(sieve_path), "%s%s%c/%s/%c/%s",
 		 config_getstring(IMAPOPT_SIEVEDIR),
 		 FNAME_DOMAINDIR, d, domain+1, hash, user);
 	*domain = '@';  /* reassemble user at domain */
     }
     else {
-	hash = (char) dir_hash_c(user);
+	hash = (char) dir_hash_c(user, config_fulldirhash);
 
 	snprintf(sieve_path, sizeof(sieve_path), "%s/%c/%s",
 		 config_getstring(IMAPOPT_SIEVEDIR), hash, user);
@@ -252,32 +251,32 @@
     if(config_getswitch(IMAPOPT_SIEVEUSEHOMEDIR)) return 0;
     
     if (config_virtdomains && (domain = strchr(olduser, '@'))) {
-	char d = (char) dir_hash_c(domain+1);
+	char d = (char) dir_hash_c(domain+1, config_fulldirhash);
 	*domain = '\0';  /* split user at domain */
-	hash = (char) dir_hash_c(olduser);
+	hash = (char) dir_hash_c(olduser, config_fulldirhash);
 	snprintf(oldpath, sizeof(oldpath), "%s%s%c/%s/%c/%s",
 		 config_getstring(IMAPOPT_SIEVEDIR),
 		 FNAME_DOMAINDIR, d, domain+1, hash, olduser);
 	*domain = '@';  /* reassemble user at domain */
     }
     else {
-	hash = (char) dir_hash_c(olduser);
+	hash = (char) dir_hash_c(olduser, config_fulldirhash);
 
 	snprintf(oldpath, sizeof(oldpath), "%s/%c/%s",
 		 config_getstring(IMAPOPT_SIEVEDIR), hash, olduser);
     }
 
     if (config_virtdomains && (domain = strchr(newuser, '@'))) {
-	char d = (char) dir_hash_c(domain+1);
+	char d = (char) dir_hash_c(domain+1, config_fulldirhash);
 	*domain = '\0';  /* split user at domain */
-	hash = (char) dir_hash_c(newuser);
+	hash = (char) dir_hash_c(newuser, config_fulldirhash);
 	snprintf(newpath, sizeof(newpath), "%s%s%c/%s/%c/%s",
 		 config_getstring(IMAPOPT_SIEVEDIR),
 		 FNAME_DOMAINDIR, d, domain+1, hash, newuser);
 	*domain = '@';  /* reassemble user at domain */
     }
     else {
-	hash = (char) dir_hash_c(newuser);
+	hash = (char) dir_hash_c(newuser, config_fulldirhash);
 
 	snprintf(newpath, sizeof(newpath), "%s/%c/%s",
 		 config_getstring(IMAPOPT_SIEVEDIR), hash, newuser);
@@ -423,7 +422,7 @@
     char *inboxname = ((struct find_rock *) rockp)->inboxname;
 
     return (!strncmp(key, inboxname, strlen(inboxname)) &&
-	    (keylen == strlen(inboxname) || key[strlen(inboxname)] == '.'));
+	    (keylen == (int) strlen(inboxname) || key[strlen(inboxname)] == '.'));
 }
 
 static int find_cb(void *rockp,

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/user.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/user.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/user.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/user.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* user.h -- User manipulation routines
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: user.h,v 1.6 2003/10/22 18:50:09 rjs3 Exp $
+ * $Id: user.h,v 1.7 2008/03/24 17:09:20 murch Exp $
  */
 
 #ifndef INCLUDED_USER_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/version.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/version.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/version.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/version.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /* version.c: versioning functions
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: version.c,v 1.21 2007/02/07 18:58:07 murch Exp $
+ * $Id: version.c,v 1.22 2008/03/24 17:09:20 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/version.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/version.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/version.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/version.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /* version.h: the version number
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,10 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: version.h,v 1.144 2007/02/06 18:07:42 murch Exp $
+ * $Id: version.h,v 1.158 2008/10/14 14:40:51 murch Exp $
  */
 
-#define _CYRUS_VERSION "v2.3.8"
+#define _CYRUS_VERSION "v2.3.13"
 
 /* EXTRA_IDENT is a hack to add some version information for which compile
  * was used to build this version (at CMU, but we don't care what you do with
@@ -67,7 +69,7 @@
 	"NO_ATOMIC_RENAME UNSELECT " \
 	"CHILDREN MULTIAPPEND BINARY " \
 	"SORT SORT=MODSEQ THREAD=ORDEREDSUBJECT THREAD=REFERENCES " \
-	"ANNOTATEMORE CATENATE CONDSTORE"
+	"ANNOTATEMORE CATENATE CONDSTORE SCAN"
 
 
 /* Values for ID processing */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/xversion.sh
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/xversion.sh?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/xversion.sh (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imap/xversion.sh Mon Feb  9 12:49:22 2009
@@ -3,18 +3,58 @@
 # xversion.sh: extract the timestamp from the $Id: string
 # in every source file and use the most recent as the CYRUS_CVSDATE
 #
-# $Id: xversion.sh,v 1.7 2003/10/22 18:03:00 rjs3 Exp $
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: xversion.sh,v 1.9 2008/03/24 17:09:20 murch Exp $
 
 if [ "$AWK" = "" ]; then
     AWK=awk
 fi
 
+TMPF=/tmp/xversion.$$
 DATEPAT=[1-2][0-9][0-9][0-9]/[0-1][0-9]/[0-3][0-9]
 TIMEPAT=[0-2][0-9]:[0-5][0-9]:[0-5][0-9]
 
-printf "/* Generated automatically by xversion.sh */\n\n" > xversion.h
+printf "/* Generated automatically by xversion.sh */\n\n" > $TMPF
 
-printf "#define CYRUS_CVSDATE " >> xversion.h
+printf "#define CYRUS_CVSDATE " >> $TMPF
 
 find .. -name '*.[chly]' -print | \
 	xargs egrep '\$Id: ' | \
@@ -22,4 +62,13 @@
 	match ($0, pattern) {
 	    printf "\"%s\"\n", substr($0, RSTART, RLENGTH)
 	}' pattern="$DATEPAT $TIMEPAT" | \
-	sort | tail -1 >> xversion.h
+	sort | tail -1 >> $TMPF
+
+if [ -f xversion.h ] && cmp -s $TMPF xversion.h
+then
+    rm $TMPF
+else
+    mv $TMPF xversion.h
+    rm -f version.o
+fi
+

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imtest/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imtest/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imtest/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imtest/Makefile.in Mon Feb  9 12:49:22 2009
@@ -2,7 +2,7 @@
 # 
 # @configure_input@
 #
-# Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -18,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -40,7 +41,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 # 
-# $Id: Makefile.in,v 1.31 2006/11/30 17:11:22 murch Exp $
+# $Id: Makefile.in,v 1.32 2008/03/24 18:55:59 murch Exp $
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/imtest/imtest.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/imtest/imtest.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/imtest/imtest.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/imtest/imtest.c Mon Feb  9 12:49:22 2009
@@ -1,9 +1,8 @@
 /* imtest.c -- IMAP/POP3/NNTP/LMTP/SMTP/MUPDATE/MANAGESIEVE test client
  * Ken Murchison (multi-protocol implementation)
  * Tim Martin (SASL implementation)
- * $Id: imtest.c,v 1.110 2006/11/30 17:11:22 murch Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,6 +40,8 @@
  * 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.
+ *
+ * $Id: imtest.c,v 1.120 2008/10/08 15:47:08 murch Exp $
  */
 
 #include "config.h"
@@ -82,6 +84,8 @@
 #include "imparse.h"
 #include "iptostring.h"
 #include "xmalloc.h"
+#include "xstrlcat.h"
+#include "xstrlcpy.h"
 
 #ifdef HAVE_SSL
 #include <openssl/ssl.h>
@@ -190,7 +194,7 @@
     char *cmd;		/* tls command string */
     char *ok;		/* start tls prompt */
     char *fail;		/* failure response */
-    int auto_capa;      /* capa response given automatically after TLS */
+    int auto_capa;      /* capability response sent automatically after TLS */
 };
 
 struct sasl_cmd_t {
@@ -205,6 +209,8 @@
     char *cancel;	/* cancel auth string */
     char *(*parse_success)(char *str);
 			/* [OPTIONAL] parse response for success data */
+    int auto_capa;      /* capability response sent automatically
+			   after AUTH with SASL security layer */
 };
 
 struct logout_cmd_t {
@@ -1061,7 +1067,7 @@
 	    out = NULL;
 	}
 	else if (!sendliteral &&
-		 ((strlen(cmdbuf) + outlen + 3) > sasl_cmd->maxlen)) {
+		 ((int) (strlen(cmdbuf) + outlen + 3) > sasl_cmd->maxlen)) {
 	    /* initial response is too long for auth command,
 	       so wait for a server challenge before sending it */
 	    goto noinitresp;
@@ -1450,13 +1456,21 @@
     return;
 }
 
+enum {
+    AUTO_BANNER = -1,
+    AUTO_NO = 0,
+    AUTO_YES = 1
+};
+
 static char *ask_capability(struct protocol_t *prot,
 			    int *supports_starttls, int automatic)
 {
-    char str[1024];
-    char *ret = NULL, *tmp;
+    char str[1024] = "";
+    char *ret = NULL, *tmp, *resp;
     
     *supports_starttls = 0;
+
+    resp = (automatic == AUTO_BANNER) ? prot->banner.resp : prot->capa_cmd.resp;
 
     if (!automatic) {
 	/* no capability command */
@@ -1470,7 +1484,8 @@
 
     do { /* look for the end of the capabilities */
 	if (prot_fgets(str, sizeof(str), pin) == NULL) {
-	    imtest_fatal("prot layer failure");
+	    if (!*str) imtest_fatal("prot layer failure");
+	    else break;
 	}
 	printf("S: %s", str);
 
@@ -1488,8 +1503,16 @@
 	    else
 		ret = strdup(tmp+strlen(prot->capa_cmd.auth));
 	}
-    } while (strncasecmp(str, prot->capa_cmd.resp, strlen(prot->capa_cmd.resp)));
-    
+    
+	if (!resp) {
+	    /* multiline response with no distinct end (IMAP banner) */
+	    prot_NONBLOCK(pin);
+	}
+
+ 	/* look for the end of the capabilities */
+    } while (!resp || strncasecmp(str, resp, strlen(resp)));
+    
+    prot_BLOCK(pin);
     return ret;
 }
 
@@ -1778,7 +1801,8 @@
 {
     int lup;
     
-    prot_printf(pout,"A003 APPEND %s (\\Seen) {%u}\r\n",mbox,size+strlen(HEADERS));
+    prot_printf(pout,"A003 APPEND %s (\\Seen) {" SIZE_T_FMT "}\r\n",
+		mbox,size+strlen(HEADERS));
     /* do normal header foo */
     prot_printf(pout,HEADERS);
     
@@ -1870,8 +1894,6 @@
     unsigned int passlen;
     
     interaction(SASL_CB_AUTHNAME, NULL, "Authname", &username, &userlen);
-    interaction(SASL_CB_PASS, NULL, "Please enter your password",
-		&pass, &passlen);
     
     printf("C: USER %s\r\n", username);
     prot_printf(pout,"USER %s\r\n", username);
@@ -1885,6 +1907,9 @@
     
     if (strncasecmp(str, "+OK ", 4)) return IMTEST_FAIL;
     
+    interaction(SASL_CB_PASS, NULL, "Please enter your password",
+		&pass, &passlen);
+
     printf("C: PASS <omitted>\r\n");
     prot_printf(pout,"PASS %s\r\n",pass);
     prot_flush(pout);
@@ -2200,10 +2225,10 @@
 
 static struct protocol_t protocols[] = {
     { "imap", "imaps", "imap",
-      { 0, "* OK", NULL },
+      { 1, NULL, NULL },
       { "C01 CAPABILITY", "C01 ", " STARTTLS", " AUTH=", &imap_parse_mechlist },
       { "S01 STARTTLS", "S01 OK", "S01 NO", 0 },
-      { "A01 AUTHENTICATE", 0, 0, "A01 OK", "A01 NO", "+ ", "*", NULL },
+      { "A01 AUTHENTICATE", 0, 0, "A01 OK", "A01 NO", "+ ", "*", NULL, 0 },
       &imap_do_auth, { "Q01 LOGOUT", "Q01 " },
       &imap_init_conn, &generic_pipe, &imap_reset
     },
@@ -2211,29 +2236,29 @@
       { 0, "+OK ", &pop3_parse_banner },
       { "CAPA", ".", "STLS", "SASL ", NULL },
       { "STLS", "+OK", "-ERR", 0 },
-      { "AUTH", 255, 0, "+OK", "-ERR", "+ ", "*", NULL },
+      { "AUTH", 255, 0, "+OK", "-ERR", "+ ", "*", NULL, 0 },
       &pop3_do_auth, { "QUIT", "+OK" }, NULL, NULL, NULL
     },
     { "nntp", "nntps", "nntp",
       { 0, "20", NULL },
       { "CAPABILITIES", ".", "STARTTLS", "SASL ", NULL },
       { "STARTTLS", "382", "580", 0 },
-      { "AUTHINFO SASL", 512, 0, "28", "48", "383 ", "*", &nntp_parse_success },
+      { "AUTHINFO SASL", 512, 0, "28", "48", "383 ", "*", &nntp_parse_success, 0 },
       &nntp_do_auth, { "QUIT", "205" }, NULL, NULL, NULL
     },
     { "lmtp", NULL, "lmtp",
       { 0, "220 ", NULL },
-      { "LHLO example.com", "250 ", "STARTTLS", "AUTH ", NULL },
+      { "LHLO lmtptest", "250 ", "STARTTLS", "AUTH ", NULL },
       { "STARTTLS", "220", "454", 0 },
-      { "AUTH", 512, 0, "235", "5", "334 ", "*", NULL },
+      { "AUTH", 512, 0, "235", "5", "334 ", "*", NULL, 0 },
       &xmtp_do_auth, { "QUIT", "221" },
       &xmtp_init_conn, &generic_pipe, &xmtp_reset
     },
     { "smtp", "smtps", "smtp",
       { 0, "220 ", NULL },
-      { "EHLO example.com", "250 ", "STARTTLS", "AUTH ", NULL },
+      { "EHLO smtptest", "250 ", "STARTTLS", "AUTH ", NULL },
       { "STARTTLS", "220", "454", 0 },
-      { "AUTH", 512, 0, "235", "5", "334 ", "*", NULL },
+      { "AUTH", 512, 0, "235", "5", "334 ", "*", NULL, 0 },
       &xmtp_do_auth, { "QUIT", "221" },
       &xmtp_init_conn, &generic_pipe, &xmtp_reset
     },
@@ -2241,28 +2266,28 @@
       { 1, "* OK", NULL },
       { NULL , "* OK", "* STARTTLS", "* AUTH ", NULL },
       { "S01 STARTTLS", "S01 OK", "S01 NO", 1 },
-      { "A01 AUTHENTICATE", INT_MAX, 1, "A01 OK", "A01 NO", "", "*", NULL },
+      { "A01 AUTHENTICATE", INT_MAX, 1, "A01 OK", "A01 NO", "", "*", NULL, 0 },
       NULL, { "Q01 LOGOUT", "Q01 " }, NULL, NULL, NULL
     },
     { "sieve", NULL, SIEVE_SERVICE_NAME,
       { 1, "OK", NULL },
       { "CAPABILITY", "OK", "\"STARTTLS\"", "\"SASL\" ", NULL },
-      { "STARTTLS", "OK", "NO", 0 },
-      { "AUTHENTICATE", INT_MAX, 1, "OK", "NO", NULL, "*", &sieve_parse_success },
+      { "STARTTLS", "OK", "NO", 1 },
+      { "AUTHENTICATE", INT_MAX, 1, "OK", "NO", NULL, "*", &sieve_parse_success, 1 },
       NULL, { "LOGOUT", "OK" }, NULL, NULL, NULL
     },
     { "csync", NULL, "csync",
       { 1, "* OK", NULL },
       { NULL , "* OK", "* STARTTLS", "* SASL ", NULL },
       { "STARTTLS", "OK", "NO", 1 },
-      { "AUTHENTICATE", INT_MAX, 0, "OK", "NO", "+ ", "*", NULL },
+      { "AUTHENTICATE", INT_MAX, 0, "OK", "NO", "+ ", "*", NULL, 0 },
       NULL, { "EXIT", "OK" }, NULL, NULL, NULL
     },
     { NULL, NULL, NULL,
       { 0, NULL, NULL },
       { NULL, NULL, NULL, NULL, NULL },
       { NULL, NULL, NULL, 0 },
-      { NULL, 0, 0, NULL, NULL, NULL, NULL, NULL },
+      { NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, 0 },
       NULL, { NULL, NULL }, NULL, NULL, NULL
     }
 };
@@ -2274,9 +2299,10 @@
     char servername[1024];
     char *filename=NULL;
     
-    char *mechlist;
+    char *mechlist = NULL;
     unsigned ext_ssf = 0;
-    const int *ssfp;
+    const void *ssfp;
+    sasl_ssf_t ssf;
     int maxssf = 128;
     int minssf = 0;
     int c;
@@ -2447,7 +2473,7 @@
 	imtest_fatal("unknown protocol\n");
     
     if (dossl && !protocol->sprotocol)
-	imtest_fatal("protocol can not be SSL-wrapped\n");
+	imtest_fatal("protocol cannot be SSL-wrapped\n");
 
     if (run_stress_test && strcmp(protocol->protocol, "imap"))
 	imtest_fatal("stress test can only be run for IMAP\n");
@@ -2505,7 +2531,7 @@
 	}
 
 	if (init_net(servername, port) != IMTEST_OK) {
-	    imtest_fatal("Network initialization - can not connect to %s:%s",
+	    imtest_fatal("Network initialization - cannot connect to %s:%s",
 			 servername, port);
 	}
     
@@ -2526,7 +2552,12 @@
 #endif /* HAVE_SSL */
 
 	if (protocol->banner.is_capa) {
-	    mechlist = ask_capability(protocol, &server_supports_tls, 1);
+	    /* try to get the capabilities from the banner */
+	    mechlist = ask_capability(protocol, &server_supports_tls, AUTO_BANNER);
+	    if (!mechlist && !server_supports_tls) {
+		/* found no capabilities in banner -> get them explicitly */
+		protocol->banner.is_capa = 0;
+	    }
 	}
 	else {
 	    do { /* look for the banner response */
@@ -2540,8 +2571,9 @@
 		    rock = protocol->banner.parse_banner(str);
 	    } while (strncasecmp(str, protocol->banner.resp,
 				 strlen(protocol->banner.resp)));
-	
-	    mechlist = ask_capability(protocol, &server_supports_tls, 0);
+	}	
+	if (!protocol->banner.is_capa) {
+	    mechlist = ask_capability(protocol, &server_supports_tls, AUTO_NO);
 	}
 	
 #ifdef HAVE_SSL
@@ -2606,11 +2638,21 @@
 	    printf("Authentication failed. %s\n", s);
 	}
 	
-	result = sasl_getprop(conn, SASL_SSF, (const void **)&ssfp);
+	result = sasl_getprop(conn, SASL_SSF, &ssfp);
+	ssf = *((sasl_ssf_t *) ssfp);
 	if (result != SASL_OK) {
 	    printf("SSF: unable to determine (SASL ERROR %d)\n", result);
 	} else {
-	    printf("Security strength factor: %d\n", ext_ssf + *ssfp);
+	    printf("Security strength factor: %d\n", ext_ssf + ssf);
+
+	    if (ssf && protocol->sasl_cmd.auto_capa) {
+		/* ask for the capabilities again */
+		if (verbose==1)
+		    printf("Asking for capabilities again "
+			   "since they might have changed\n");
+		mechlist = ask_capability(protocol, &server_supports_tls, 1);
+		if (mechlist) free(mechlist);
+	    }
 	}
 
     } while (--reauth);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,6 +1,7 @@
 # Makefile.in - installsieve makefile
 # @configure_input@
-# Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+#
+# Copyright (c) 1994-2008 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
@@ -16,14 +17,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -37,8 +39,8 @@
 # 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.
-
-# $Id: Makefile.in,v 1.13 2003/10/22 18:50:11 rjs3 Exp $
+#
+# $Id: Makefile.in,v 1.14 2008/03/24 20:33:11 murch Exp $
 
 srcdir = @srcdir@
 VPATH = @srcdir@

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/codes.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/codes.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/codes.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/codes.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: codes.h,v 1.5 2008/03/24 20:33:11 murch Exp $
  */
-
-/* $Id: codes.h,v 1.4 2003/02/13 20:15:37 rjs3 Exp $ */
 
 #ifndef _CODES_H_
 #define _CODES_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/exitcodes.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/exitcodes.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/exitcodes.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/exitcodes.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* exitcodes.h -- wrapper around sysextis.h
- * $Id: exitcodes.h,v 1.4 2003/02/13 20:15:37 rjs3 Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: exitcodes.h,v 1.5 2008/03/24 20:33:11 murch Exp $
  */
 
 /* Sendmail has some weird ideas on what constitutes permenant failure.  On

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/installscript.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/installscript.c?rev=768&root=cyrus22&r1=767&r2=
3D768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/installscript.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/installscript.c Mon Feb  9 12:49:22 2009
@@ -1,9 +1,8 @@
 /* installscrip.c -- command line program to install sieve scripts
  * Tim Martin
  * 9/21/99
- */
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,9 +40,9 @@
  * 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.
+ *
+ * $Id: installscript.c,v 1.30 2008/03/24 20:33:11 murch Exp $
  */
-
-/* $Id: installscript.c,v 1.29 2003/02/13 20:15:37 rjs3 Exp $ */
 
 #include <sys/stat.h>
 #include <sys/types.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/isieve.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/isieve.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/isieve.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/isieve.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: isieve.c,v 1.6 2008/03/24 20:33:11 murch Exp $
  */
-
-/* $Id: isieve.c,v 1.5 2003/02/13 20:15:37 rjs3 Exp $ */
 
 #include <netinet/in.h>
 #include <netdb.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/isieve.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/isieve.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/isieve.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/isieve.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: isieve.h,v 1.6 2008/03/24 20:33:11 murch Exp $
  */
-
-/* $Id: isieve.h,v 1.5 2003/02/13 20:15:37 rjs3 Exp $ */
 
 #ifndef ISIEVE_H_
 #define ISIEVE_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/lex.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/lex.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/lex.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/lex.c Mon Feb  9 12:49:22 2009
@@ -1,9 +1,7 @@
 /* lex.c -- lexers for command line script installer
  * Tim Martin
- * $Id: lex.c,v 1.11 2003/02/13 20:15:37 rjs3 Exp $
- */
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,6 +39,8 @@
  * 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.
+ *
+ * $Id: lex.c,v 1.12 2008/03/24 20:33:11 murch Exp $
  */
 
 #include <stdlib.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/lex.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/lex.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/lex.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/lex.h Mon Feb  9 12:49:22 2009
@@ -1,9 +1,8 @@
 /* lex.h 
  * Tim Martin
  * 9/21/99
- */
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,9 +40,9 @@
  * 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.
+ *
+ * $Id: lex.h,v 1.9 2008/03/24 20:33:11 murch Exp $
  */
-
-/* $Id: lex.h,v 1.8 2003/02/13 20:15:37 rjs3 Exp $ */
 
 #ifndef _LEX_H_
 #define _LEX_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/mystring.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/mystring.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/mystring.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/mystring.c Mon Feb  9 12:49:22 2009
@@ -1,9 +1,8 @@
 /* mystring.c -- string utility
  * Tim Martin
  * 9/21/99
- */
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,9 +40,9 @@
  * 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.
+ *
+ * $Id: mystring.c,v 1.7 2008/03/24 20:33:11 murch Exp $
  */
-
-/* $Id: mystring.c,v 1.6 2003/02/13 20:15:37 rjs3 Exp $ */
 
 #include "mystring.h"
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/mystring.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/mystring.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/mystring.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/mystring.h Mon Feb  9 12:49:22 2009
@@ -1,9 +1,8 @@
 /* mystring.h
  * Tim Martin
  * 9/21/99
- */
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,9 +40,9 @@
  * 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.
+ *
+ * $Id: mystring.h,v 1.7 2008/03/24 20:33:11 murch Exp $
  */
-
-/* $Id: mystring.h,v 1.6 2003/02/13 20:15:37 rjs3 Exp $ */
 
 #include "codes.h"
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/request.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/request.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/request.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/request.c Mon Feb  9 12:49:22 2009
@@ -1,9 +1,8 @@
 /* request.c -- request to execute functions on the timsieved server
  * Tim Martin
  * 9/21/99
- */
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,9 +40,9 @@
  * 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.
+ *
+ * $Id: request.c,v 1.20 2008/03/24 20:33:11 murch Exp $
  */
-
-/* $Id: request.c,v 1.19 2003/02/13 20:15:37 rjs3 Exp $ */
 
 #include <sys/stat.h>
 #include <sys/types.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/request.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/request.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/request.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/installsieve/request.h Mon Feb  9 12:49:22 2009
@@ -1,9 +1,8 @@
 /* request.h -- request to execute functions on the timsieved server
  * Tim Martin
  * 9/21/99
- */
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,9 +40,9 @@
  * 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.
+ *
+ * $Id: request.h,v 1.14 2008/03/24 20:33:11 murch Exp $
  */
-
-/* $Id: request.h,v 1.13 2003/02/13 20:15:37 rjs3 Exp $ */
 
 #ifndef _REQUEST_H_
 #define _REQUEST_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/Makefile.in Mon Feb  9 12:49:22 2009
@@ -2,7 +2,7 @@
 # 
 # @configure_input@
 # 
-# Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -18,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -39,8 +40,8 @@
 # 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.
-
-# $Id: Makefile.in,v 1.65 2006/11/30 17:11:22 murch Exp $
+#
+# $Id: Makefile.in,v 1.72 2008/03/24 17:43:08 murch Exp $
 
 # Authorization namespace.
 AUTH=auth.o auth_krb.o auth_unix.o auth_krb5.o auth_pts.o
@@ -83,10 +84,11 @@
 	$(srcdir)/nonblock.h $(srcdir)/parseaddr.h $(srcdir)/prot.h \
 	$(srcdir)/retry.h $(srcdir)/sysexits.h $(srcdir)/strhash.h \
 	$(srcdir)/lsort.h $(srcdir)/stristr.h \
-	$(srcdir)/util.h $(srcdir)/xstrlcpy.h $(srcdir)/xstrlcat.h $(srcdir)/xmalloc.h $(srcdir)/imapurl.h \
+	$(srcdir)/util.h $(srcdir)/xstrlcpy.h $(srcdir)/xstrlcat.h \
+	$(srcdir)/xmalloc.h $(srcdir)/imapurl.h \
 	$(srcdir)/cyrusdb.h $(srcdir)/iptostring.h $(srcdir)/rfc822date.h \
 	$(srcdir)/libcyr_cfg.h $(srcdir)/byteorder64.h \
-	$(srcdir)/message_uuid.h $(srcdir)/md5.h $(srcdir)/hmac-md5.h
+	$(srcdir)/md5.h $(srcdir)/hmac-md5.h
 
 LIBCYR_OBJS = acl.o bsearch.o charset.o glob.o retry.o util.o \
 	libcyr_cfg.o mkgmtime.o prot.o parseaddr.o imclient.o imparse.o \
@@ -95,14 +97,14 @@
 	gmtoff_ at WITH_GMTOFF@.o map_ at WITH_MAP@.o $(ACL) $(AUTH) \
 	@LIBOBJS@ @CYRUSDB_OBJS@ @MD5OBJ@ \
 	iptostring.o xmalloc.o wildmat.o byteorder64.o \
-	message_uuid.o xstrlcat.o xstrlcpy.o
+	xstrlcat.o xstrlcpy.o
 
 LIBCYRM_HDRS = $(srcdir)/hash.h $(srcdir)/mpool.h $(srcdir)/xmalloc.h \
-	$(srcdir)/xstrlcat.h $(srcdir)/xstrlcpy.h \
-	$(srcdir)/strhash.o $(srcdir)/libconfig.h $(srcdir)/assert.h \
+	$(srcdir)/xstrlcat.h $(srcdir)/xstrlcpy.h $(srcdir)/util.h \
+	$(srcdir)/strhash.h $(srcdir)/libconfig.h $(srcdir)/assert.h \
 	imapopts.h
 LIBCYRM_OBJS = libconfig.o imapopts.o hash.o mpool.o xmalloc.o strhash.o \
-	xstrlcat.o xstrlcpy.o assert.o @IPV6_OBJS@
+	xstrlcat.o xstrlcpy.o assert.o util.o @IPV6_OBJS@
 
 all: $(BUILTSOURCES) libcyrus_min.a libcyrus.a
 
@@ -135,7 +137,7 @@
 	$(RANLIB) libcyrus_min.a
 
 imapopts.c: imapoptions $(srcdir)/../tools/config2header
-	$(srcdir)/../tools/config2header CC=$(CC) $(srcdir)/imapopts.c $(srcdir)/imapopts.h < $(srcdir)/imapoptions
+	$(srcdir)/../tools/config2header CC="$(CC)" $(srcdir)/imapopts.c $(srcdir)/imapopts.h < $(srcdir)/imapoptions
 
 imapopts.h: imapopts.c
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* acl.c -- routines for access control lists
- $Id: acl.c,v 1.12 2007/01/02 17:19:49 murch Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: acl.c,v 1.13 2008/03/24 17:43:08 murch Exp $
  *
  * Author: Chris Newman
  * Start Date: 6/28/93

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /* acl.h -- definitions for access control lists
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,12 +39,11 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: acl.h,v 1.19 2008/03/24 17:43:08 murch Exp $
  * 
  * Author: Chris Newman
  * Start Date: 6/28/93
  */
-
-/* $Id: acl.h,v 1.18 2006/11/30 17:11:22 murch Exp $ */
 
 #ifndef INCLUDED_ACL_H
 #define INCLUDED_ACL_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl_afs.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl_afs.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl_afs.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/acl_afs.c Mon Feb  9 12:49:22 2009
@@ -8,9 +8,7 @@
  *
  */
 /* 
- $Id: acl_afs.c,v 1.26 2006/11/30 17:11:22 murch Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -26,14 +24,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -48,7 +47,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: acl_afs.c,v 1.28 2008/03/24 17:43:08 murch Exp $
  */
 
 #include <config.h>
@@ -122,37 +121,21 @@
     char *rights;
 
     /* Convert 'identifier' into canonical form */
+    canonid = auth_canonifyid(*identifier == '-' ? identifier+1 : identifier, 0);
+    if (canonid) {
     if (*identifier == '-') {
-	canonid = auth_canonifyid(identifier+1, 0);
-	if (!canonid) {
-	    if (access != 0L) {
-		return -1;
-	    } else {
-		/* trying to delete invalid/non-existent identifier */
-		canonid = identifier+1;
-	    }
-	}
 	newidentifier = xmalloc(strlen(canonid)+2);
 	newidentifier[0] = '-';
 	strcpy(newidentifier+1, canonid);
 	identifier = newidentifier;
-	if (canonproc) {
-	    access = ~(canonproc(canonrock, canonid, ~access));
-	}
-    }
-    else {
-	canonid = auth_canonifyid(identifier, 0);
-	if (canonid) {
+	} else {
 	    identifier = canonid;
+	}
 	} else if (access != 0L) {
 	    return -1;
 	} else {
 	    /* trying to delete invalid/non-existent identifier */
 	}
-	if (canonproc) {
-	    access = canonproc(canonrock, identifier, access);
-	}
-    }
 
     /* Find any existing entry for 'identifier' in 'acl' */
     for (thisid = nextid = *acl; *thisid; thisid = nextid) {
@@ -193,6 +176,13 @@
     case ACL_MODE_REMOVE:
 	access = oldaccess & ~access;
 	break;
+    }
+
+    if (canonproc) {
+	if (*identifier == '-')
+	    access = ~(canonproc(canonrock, identifier+1, ~access));
+	else
+	    access = canonproc(canonrock, identifier, access);
     }
 
     if (access == 0L) {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/assert.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/assert.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/assert.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/assert.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* assert.c -- handle assertion failures
- * $Id: assert.c,v 1.18 2003/10/22 18:50:12 rjs3 Exp $
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: assert.c,v 1.19 2008/03/24 17:43:08 murch Exp $
  */
+
 #include <config.h>
 #include <stdio.h>
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/assert.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/assert.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/assert.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/assert.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* assert.h -- assert() macro that can exit cleanly
- $Id: assert.h,v 1.10 2003/02/13 20:15:38 rjs3 Exp $
-
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: assert.h,v 1.11 2008/03/24 17:43:08 murch Exp $
  */
 
 #ifndef INCLUDED_ASSERT_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: auth.c,v 1.3 2008/03/24 17:43:08 murch Exp $
  */
-
-/* $Id: auth.c,v 1.2 2006/11/30 17:11:22 murch Exp $ */
 
 #include <config.h>
 #include <stdlib.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* auth.h -- Site authorization module
- * $Id: auth.h,v 1.17 2006/11/30 17:11:22 murch Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: auth.h,v 1.18 2008/03/24 17:43:08 murch Exp $
  */
 
 #ifndef INCLUDED_AUTH_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_krb.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_krb.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_krb.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_krb.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* auth_krb.c -- Kerberos authorization
- * $Id: auth_krb.c,v 1.42 2006/11/30 17:11:22 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: auth_krb.c,v 1.44 2008/03/24 17:43:08 murch Exp $
  */
 
 #include <config.h>
@@ -345,6 +347,7 @@
     const char *identifier __attribute__((unused)))
 {
 	fatal("Authentication mechanism (krb) not compiled in", EC_CONFIG);
+	return 0;
 }
 
 static char *mycanonifyid(
@@ -352,12 +355,14 @@
     size_t len __attribute__((unused)))
 {
 	fatal("Authentication mechanism (krb) not compiled in", EC_CONFIG);
+	return NULL;
 }
 
 static struct auth_state *mynewstate(
     const char *identifier __attribute__((unused)))
 {
 	fatal("Authentication mechanism (krb) not compiled in", EC_CONFIG);
+	return NULL;
 }
 
 static void myfreestate(

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_krb5.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_krb5.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_krb5.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_krb5.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* auth_krb5.c -- Kerberos V authorization for Cyrus IMAP
- * $Id: auth_krb5.c,v 1.5 2006/11/30 17:11:22 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: auth_krb5.c,v 1.7 2008/03/24 17:43:08 murch Exp $
  */
 
 #include <config.h>
@@ -45,6 +47,7 @@
 
 #include "auth.h"
 #include "exitcodes.h"
+#include "xmalloc.h"
 
 #ifdef HAVE_GSSAPI_H
 
@@ -57,7 +60,6 @@
 #include <krb5.h>
 
 #include "auth.h"
-#include "xmalloc.h"
 
 struct auth_state {
     char *userid; /* Canonified Userid */
@@ -204,6 +206,7 @@
     const char *identifier __attribute__((unused)))
 {
 	fatal("Authentication mechanism (krb5) not compiled in", EC_CONFIG);
+	return 0;
 }
 
 static char *mycanonifyid(
@@ -211,12 +214,14 @@
     size_t len __attribute__((unused)))
 {
 	fatal("Authentication mechanism (krb5) not compiled in", EC_CONFIG);
+	return NULL;
 }
 
 static struct auth_state *mynewstate(
     const char *identifier __attribute__((unused)))
 {
 	fatal("Authentication mechanism (krb5) not compiled in", EC_CONFIG);
+	return NULL;
 }
 
 static void myfreestate(

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_pts.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_pts.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_pts.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_pts.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* auth_pts.c -- PTLOADER authorization
- * $Id: auth_pts.c,v 1.12 2007/02/05 18:43:26 jeaton Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: auth_pts.c,v 1.15 2008/03/24 17:43:08 murch Exp $
  */
 
 #include <config.h>
@@ -108,7 +109,7 @@
   tv.tv_usec = 0;
 
   syslog(LOG_DEBUG, "timeout_select: sock = %d, rp = 0x%x, wp =3D 0x%x, sec = %d", 
-         sock, rp, wp, sec);
+         sock, (unsigned) rp, (unsigned) wp, sec);
 
   if ((r = select(sock+1, rp, wp, NULL, &tv)) == 0) {
     /* r == 0 then timed out. we change this into an error */
@@ -359,7 +360,7 @@
     
     strcpy(fnamebuf, config_dir);
     strcat(fnamebuf, PTS_DBFIL);
-    r = the_ptscache_db->open(fnamebuf, CYRUSDB_CREATE, &ptdb);
+    r = (the_ptscache_db->open)(fnamebuf, CYRUSDB_CREATE, &ptdb);
     if (r != 0) {
 	syslog(LOG_ERR, "DBERROR: opening %s: %s", fnamebuf,
 	       cyrusdb_strerror(ret));
@@ -501,7 +502,7 @@
     }
 
     /* close and unlock the database */
-    the_ptscache_db->close(ptdb);
+    (the_ptscache_db->close)(ptdb);
 
     return rc;
 }

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_pts.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_pts.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_pts.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_pts.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* auth_pts.h -- PTLOADER authorization module.
-   $Id: auth_pts.h,v 1.3 2006/11/30 17:11:22 murch Exp $
-	
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: auth_pts.h,v 1.4 2008/03/24 17:43:08 murch Exp $
  */ 
 
 #ifndef INCLUDED_AUTH_PTS_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_unix.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_unix.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_unix.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/auth_unix.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* auth_unix.c -- Unix passwd file authorization
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-
-/*
- * $Id: auth_unix.c,v 1.40 2006/11/30 17:11:22 murch Exp $
+ * $Id: auth_unix.c,v 1.51 2008/08/26 19:20:39 wescraig Exp $
  */
 
 #include <config.h>
@@ -178,7 +176,9 @@
     
     if (!strncmp(retbuf, "group:", 6)) {
 	grp = getgrnam(retbuf+6);
-	if (!grp) return 0;
+	if (!grp) return NULL;
+	if (strlen(grp->gr_name) >= sizeof(retbuf)-6)
+		return NULL;
 	strcpy(retbuf+6, grp->gr_name);
 	return retbuf;
     }
@@ -223,7 +223,12 @@
     struct auth_state *newstate;
     struct passwd *pwd;
     struct group *grp;
+#if defined(HAVE_GETGROUPLIST) && defined(__GLIBC__)
+    gid_t gid, *groupids = NULL;
+    int ret, ngroups = 10;
+#else
     char **mem;
+#endif
 
     identifier = mycanonifyid(identifier, 0);
     if (!identifier) return 0;
@@ -240,6 +245,44 @@
 
     pwd = getpwnam(identifier);
 	
+#if defined(HAVE_GETGROUPLIST) && defined(__GLIBC__)
+    gid = pwd ? pwd->pw_gid : (gid_t) -1;
+
+    /* get the group ids */
+    do {
+	groupids = (gid_t *)xrealloc((gid_t *)groupids,
+				     ngroups * sizeof(gid_t));
+
+	newstate->ngroups = ngroups; /* copy of ngroups for comparision */
+	ret = getgrouplist(identifier, gid, groupids, &ngroups);
+	/*
+	 * This is tricky. We do this as long as getgrouplist tells us to
+	 * realloc _and_ the number of groups changes. It tells us to realloc
+	 * also in the case of failure...
+	 */
+    } while (ret == -1 && ngroups != newstate->ngroups);
+
+    if (ret == -1) {
+	newstate->ngroups = 0;
+	newstate->group = NULL;
+	goto err;
+    }
+
+    newstate->ngroups = 0;
+    newstate->group = (char **)xmalloc(ngroups * sizeof(char *));
+    while (ngroups--) {
+	if (pwd || groupids[ngroups] != gid) {
+	    if ((grp = getgrgid(groupids[ngroups]))) {
+		newstate->ngroups++;
+		newstate->group[newstate->ngroups-1] = xstrdup(grp->gr_name);
+	    }
+	}
+    }
+
+err:
+    if (groupids) free(groupids);
+
+#else /* !HAVE_GETGROUPLIST */
     setgrent();
     while ((grp = getgrent())) {
 	for (mem = grp->gr_mem; *mem; mem++) {
@@ -254,13 +297,20 @@
 	}
     }
     endgrent();
+#endif /* HAVE_GETGROUPLIST */
+
     return newstate;
 }
 
 static void myfreestate(auth_state)
 struct auth_state *auth_state;
 {
-    if (auth_state->group) free((char *)auth_state->group);
+    if (auth_state->group) {
+	while (auth_state->ngroups) {
+	    free((char *)auth_state->group[--auth_state->ngroups]);
+	}
+	free((char *)auth_state->group);
+    }
     free((char *)auth_state);
 }
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/bsearch.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/bsearch.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/bsearch.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/bsearch.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* bsearch.c -- binary search newline-separated fields in memory
- $Id: bsearch.c,v 1.20 2006/11/30 17:11:22 murch Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: bsearch.c,v 1.23 2008/03/24 17:43:08 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/bsearch.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/bsearch.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/bsearch.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/bsearch.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* bsearch.h -- binary search
-	$Id: bsearch.h,v 1.8 2006/11/30 17:11:22 murch Exp $
-	
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: bsearch.h,v 1.9 2008/03/24 17:43:08 murch Exp $
  */
 
 #ifndef INCLUDED_BSEARCH_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/byteorder64.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/byteorder64.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/byteorder64.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/byteorder64.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* byteorder64.c -- convert 64-bit values between host and network byte order
  * 
- * Copyright (c) 2004 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,12 +39,15 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: byteorder64.c,v 1.2 2006/11/30 17:11:22 murch Exp $
+ * $Id: byteorder64.c,v 1.4 2008/03/24 17:43:08 murch Exp $
  */
 
 #include <config.h>
+#include "byteorder64.h"
 
-#if defined(HAVE_LONG_LONG_INT) && !defined(WORDS_BIGENDIAN)
+#if defined(HAVE_LONG_LONG_INT)
+
+#if !defined(WORDS_BIGENDIAN)
 
 #include <netinet/in.h>
 
@@ -92,4 +96,22 @@
     return u2.a;
 }
 
-#endif /* defined(HAVE_LONG_LONG_INT) && !defined(WORDS_BIGENDIAN) */
+#endif /* !defined(WORDS_BIGENDIAN) */
+
+#include <string.h>
+
+void *align_htonll(void *dst, unsigned long long src)
+{
+    unsigned long long tmp = htonll(src);
+    return memcpy(dst, (void *) &tmp, sizeof(unsigned long long));
+}
+
+unsigned long long align_ntohll(const void *src)
+{
+    unsigned long long dst;
+
+    memcpy((void *) &dst, src, sizeof(unsigned long long));
+    return ntohll(dst);
+}
+
+#endif /* defined(HAVE_LONG_LONG_INT) */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/byteorder64.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/byteorder64.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/byteorder64.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/byteorder64.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* byteorder64.h -- convert 64-bit values between host and network byte order
  *
- * Copyright (c) 2004 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: byteorder64.h,v 1.2 2006/11/30 17:11:22 murch Exp $
+ * $Id: byteorder64.h,v 1.4 2008/03/24 17:43:08 murch Exp $
  */
 
 #ifndef _BYTEORDER64_H
@@ -61,5 +62,10 @@
 extern unsigned long long _ntohll(unsigned long long);
 
 #endif /* WORDS_BIGENDIAN */
+
+/* 64-bit host/network byte-order swap functions to/from non-aligned buffers */
+extern void *align_htonll(void *dst, unsigned long long src);
+extern unsigned long long align_ntohll(const void *src);
+
 #endif /* HAVE_LONG_LONG_INT */
 #endif /* _BYTEORDER64_H */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* charset.c -- International character set support
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,10 +38,10 @@
  * 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.
- */
-/*
- * $Id: charset.c,v 1.46 2006/11/30 17:11:22 murch Exp $
- */
+ *
+ * $Id: charset.c,v 1.50 2008/03/24 17:43:08 murch Exp $
+ */
+
 #include <config.h>
 #include <ctype.h>
 #include <stdlib.h>
@@ -586,7 +587,7 @@
      * Select buffer to hold canonical searching fomat data to
      * search
      */
-    if (substrlen < sizeof(smallbuf)/2) {
+    if (substrlen < (int) sizeof(smallbuf)/2) {
 	bufsize = sizeof(smallbuf);
 	buf = smallbuf;
     }

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: charset.h,v 1.20 2006/11/30 17:11:22 murch Exp $
+ * $Id: charset.h,v 1.21 2008/03/24 17:43:08 murch Exp $
  */
 
 #ifndef INCLUDED_CHARSET_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/gb2312.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/gb2312.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/gb2312.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/gb2312.t Mon Feb  9 12:49:22 2009
@@ -1,3 +1,44 @@
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: gb2312.t,v 1.2 2008/04/04 12:46:35 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-2022-jp.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-2022-jp.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-2022-jp.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-2022-jp.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
 #
-#                      All Rights Reserved
+# Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
 #
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
 #
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+# 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-2022-jp.t,v 1.6 2008/04/04 12:46:36 murch Exp $
 :US-ASCII
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-2022-kr.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-2022-kr.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-2022-kr.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-2022-kr.t Mon Feb  9 12:49:22 2009
@@ -1,4 +1,44 @@
-
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-2022-kr.t,v 1.2 2008/04/04 12:46:37 murch Exp $
 :US-ASCII
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-1.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-1.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-1.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-1.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-8859-1.t,v 1.6 2008/04/04 12:46:39 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-15.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-15.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-15.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-15.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 2002 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-8859-15.t,v 1.3 2008/04/04 12:46:39 murch Exp $
 #
 # Charset put together by Ewald Dieterich <ewald.dieterich at fun.de>
 # Reference: http://www.iana.org/assignments/charset-reg/ISO-8859-15

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-2.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-2.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-2.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-2.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-8859-2.t,v 1.5 2008/04/04 12:46:40 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-3.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-3.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-3.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-3.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-8859-3.t,v 1.5 2008/04/04 12:46:40 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-4.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-4.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-4.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-4.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-8859-4.t,v 1.6 2008/04/04 12:46:40 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-5.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-5.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-5.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-5.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-8859-5.t,v 1.5 2008/04/04 12:46:40 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-6.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-6.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-6.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-6.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-8859-6.t,v 1.6 2008/04/04 12:46:40 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-7.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-7.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-7.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-7.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-8859-7.t,v 1.6 2008/04/04 12:46:40 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-8.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-8.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-8.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-8.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-8859-8.t,v 1.5 2008/04/04 12:46:41 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-9.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-9.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-9.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/iso-8859-9.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: iso-8859-9.t,v 1.6 2008/04/04 12:46:41 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/koi8-r.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/koi8-r.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/koi8-r.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/koi8-r.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: koi8-r.t,v 1.5 2008/04/04 12:46:41 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/unidata2.txt
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/unidata2.txt?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/unidata2.txt (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/unidata2.txt Mon Feb  9 12:49:22 2009
@@ -1,3 +1,44 @@
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: unidata2.txt,v 1.2 2008/04/04 12:46:42 murch Exp $
 0000;<control>;Cc;0;ON;;;;;N;NULL;;;;
 0001;<control>;Cc;0;ON;;;;;N;START OF HEADING;;;;
 0002;<control>;Cc;0;ON;;;;;N;START OF TEXT;;;;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/unifix.txt
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/unifix.txt?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/unifix.txt (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/unifix.txt Mon Feb  9 12:49:22 2009
@@ -1,3 +1,45 @@
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: unifix.txt,v 1.4 2008/04/04 12:46:44 murch Exp $
+
 # Modifications to Unicode data for better case-insensitive searching
 
 # unicode char;char name;general category;canonical combining class;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/us-ascii.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/us-ascii.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/us-ascii.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/us-ascii.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 1998 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: us-ascii.t,v 1.5 2008/04/04 12:46:44 murch Exp $
  0 0000 NULL (NUL)
  1 0001 START OF HEADING (SOH)
  2 0002 START OF TEXT (STX)

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1250.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1250.t?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1250.t (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1250.t Mon Feb  9 12:49:22 2009
@@ -1,0 +1,295 @@
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: windows-1250.t,v 1.2 2008/04/04 12:46:44 murch Exp $
+#
+# Charset put together by Ewald Dieterich <ewald.dieterich at fun.de>
+# Reference: http://www.microsoft.com/globaldev/reference/sbcs/1252.htm
+ 0 0000 NULL (NUL)
+ 1 0001 START OF HEADING (SOH)
+ 2 0002 START OF TEXT (STX)
+ 3 0003 END OF TEXT (ETX)
+ 4 0004 END OF TRANSMISSION (EOT)
+ 5 0005 ENQUIRY (ENQ)
+ 6 0006 ACKNOWLEDGE (ACK)
+ 7 0007 BELL (BEL)
+ 8 0008 BACKSPACE (BS)
+ 9 0009 CHARACTER TABULATION (HT)
+ A 000a LINE FEED (LF)
+ B 000b LINE TABULATION (VT)
+ C 000c FORM FEED (FF)
+ D 000d CARRIAGE RETURN (CR)
+ E 000e SHIFT OUT (SO)
+ F 000f SHIFT IN (SI)
+10 0010 DATALINK ESCAPE (DLE)
+11 0011 DEVICE CONTROL ONE (DC1)
+12 0012 DEVICE CONTROL TWO (DC2)
+13 0013 DEVICE CONTROL THREE (DC3)
+14 0014 DEVICE CONTROL FOUR (DC4)
+15 0015 NEGATIVE ACKNOWLEDGE (NAK)
+16 0016 SYNCRONOUS IDLE (SYN)
+17 0017 END OF TRANSMISSION BLOCK (ETB)
+18 0018 CANCEL (CAN)
+19 0019 END OF MEDIUM (EM)
+1A 001a SUBSTITUTE (SUB)
+1B 001b ESCAPE (ESC)
+1C 001c FILE SEPARATOR (IS4)
+1D 001d GROUP SEPARATOR (IS3)
+1E 001e RECORD SEPARATOR (IS2)
+1F 001f UNIT SEPARATOR (IS1)
+20 0020 SPACE
+21 0021 EXCLAMATION MARK
+22 0022 QUOTATION MARK
+23 0023 NUMBER SIGN
+24 0024 DOLLAR SIGN
+25 0025 PERCENT SIGN
+26 0026 AMPERSAND
+27 0027 APOSTROPHE
+28 0028 LEFT PARENTHESIS
+29 0029 RIGHT PARENTHESIS
+2A 002a ASTERISK
+2B 002b PLUS SIGN
+2C 002c COMMA
+2D 002d HYPHEN-MINUS
+2E 002e FULL STOP
+2F 002f SOLIDUS
+30 0030 DIGIT ZERO
+31 0031 DIGIT ONE
+32 0032 DIGIT TWO
+33 0033 DIGIT THREE
+34 0034 DIGIT FOUR
+35 0035 DIGIT FIVE
+36 0036 DIGIT SIX
+37 0037 DIGIT SEVEN
+38 0038 DIGIT EIGHT
+39 0039 DIGIT NINE
+3A 003a COLON
+3B 003b SEMICOLON
+3C 003c LESS-THAN SIGN
+3D 003d EQUALS SIGN
+3E 003e GREATER-THAN SIGN
+3F 003f QUESTION MARK
+40 0040 COMMERCIAL AT
+41 0041 LATIN CAPITAL LETTER A
+42 0042 LATIN CAPITAL LETTER B
+43 0043 LATIN CAPITAL LETTER C
+44 0044 LATIN CAPITAL LETTER D
+45 0045 LATIN CAPITAL LETTER E
+46 0046 LATIN CAPITAL LETTER F
+47 0047 LATIN CAPITAL LETTER G
+48 0048 LATIN CAPITAL LETTER H
+49 0049 LATIN CAPITAL LETTER I
+4A 004a LATIN CAPITAL LETTER J
+4B 004b LATIN CAPITAL LETTER K
+4C 004c LATIN CAPITAL LETTER L
+4D 004d LATIN CAPITAL LETTER M
+4E 004e LATIN CAPITAL LETTER N
+4F 004f LATIN CAPITAL LETTER O
+50 0050 LATIN CAPITAL LETTER P
+51 0051 LATIN CAPITAL LETTER Q
+52 0052 LATIN CAPITAL LETTER R
+53 0053 LATIN CAPITAL LETTER S
+54 0054 LATIN CAPITAL LETTER T
+55 0055 LATIN CAPITAL LETTER U
+56 0056 LATIN CAPITAL LETTER V
+57 0057 LATIN CAPITAL LETTER W
+58 0058 LATIN CAPITAL LETTER X
+59 0059 LATIN CAPITAL LETTER Y
+5A 005a LATIN CAPITAL LETTER Z
+5B 005b LEFT SQUARE BRACKET
+5C 005c REVERSE SOLIDUS
+5D 005d RIGHT SQUARE BRACKET
+5E 005e CIRCUMFLEX ACCENT
+5F 005f LOW LINE
+60 0060 GRAVE ACCENT
+61 0061 LATIN SMALL LETTER A
+62 0062 LATIN SMALL LETTER B
+63 0063 LATIN SMALL LETTER C
+64 0064 LATIN SMALL LETTER D
+65 0065 LATIN SMALL LETTER E
+66 0066 LATIN SMALL LETTER F
+67 0067 LATIN SMALL LETTER G
+68 0068 LATIN SMALL LETTER H
+69 0069 LATIN SMALL LETTER I
+6A 006a LATIN SMALL LETTER J
+6B 006b LATIN SMALL LETTER K
+6C 006c LATIN SMALL LETTER L
+6D 006d LATIN SMALL LETTER M
+6E 006e LATIN SMALL LETTER N
+6F 006f LATIN SMALL LETTER O
+70 0070 LATIN SMALL LETTER P
+71 0071 LATIN SMALL LETTER Q
+72 0072 LATIN SMALL LETTER R
+73 0073 LATIN SMALL LETTER S
+74 0074 LATIN SMALL LETTER T
+75 0075 LATIN SMALL LETTER U
+76 0076 LATIN SMALL LETTER V
+77 0077 LATIN SMALL LETTER W
+78 0078 LATIN SMALL LETTER X
+79 0079 LATIN SMALL LETTER Y
+7A 007a LATIN SMALL LETTER Z
+7B 007b LEFT CURLY BRACKET
+7C 007c VERTICAL LINE
+7D 007d RIGHT CURLY BRACKET
+7E 007e TILDE
+7F 007f DELETE (DEL)
+80 20AC EURO SIGN
+82 201A SINGLE LOW-9 QUOTATION MARK
+84 201E DOUBLE LOW-9 QUOTATION MARK
+85 2026 HORIZONTAL ELLIPSIS
+86 2020 DAGGER
+87 2021 DOUBLE DAGGER
+89 2030 PER MILLE SIGN
+8A 0160 LATIN CAPITAL LETTER S WITH CARON
+8B 2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+8C 015A LATIN CAPITAL LETTER S WITH ACUTE
+8D 0164 LATIN CAPITAL LETTER T WITH CARON
+8E 017D LATIN CAPITAL LETTER Z WITH CARON
+8F 0179 LATIN CAPITAL LETTER Z WITH ACUTE
+91 2018 LEFT SINGLE QUOTATION MARK
+92 2019 RIGHT SINGLE QUOTATION MARK
+93 201C LEFT DOUBLE QUOTATION MARK
+94 201D RIGHT DOUBLE QUOTATION MARK
+95 2022 BULLET
+96 2013 EN DASH
+97 2014 EM DASH
+99 2122 TRADE MARK SIGN
+9A 0161 LATIN SMALL LETTER S WITH CARON
+9B 203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+9C 015B LATIN SMALL LETTER S WITH ACUTE
+9D 0165 LATIN SMALL LETTER T WITH CARON
+9E 017E LATIN SMALL LETTER Z WITH CARON
+9F 017A LATIN SMALL LETTER Z WITH ACUTE
+A0 00A0 NO-BREAK SPACE
+A1 02C7 CARON
+A2 02D8 BREVE
+A3 0141 LATIN CAPITAL LETTER L WITH STROKE
+A4 00A4 CURRENCY SIGN
+A5 0104 LATIN CAPITAL LETTER A WITH OGONEK
+A6 00A6 BROKEN BAR
+A7 00A7 SECTION SIGN
+A8 00A8 DIAERESIS
+A9 00A9 COPYRIGHT SIGN
+AA 015E LATIN CAPITAL LETTER S WITH CEDILLA
+AB 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+AC 00AC NOT SIGN
+AD 00AD SOFT HYPHEN
+AE 00AE REGISTERED SIGN
+AF 017B LATIN CAPITAL LETTER Z WITH DOT ABOVE
+B0 00B0 DEGREE SIGN
+B1 00B1 PLUS-MINUS SIGN
+B2 02DB OGONEK
+B3 0142 LATIN SMALL LETTER L WITH STROKE
+B4 00B4 ACUTE ACCENT
+B5 00B5 MICRO SIGN
+B6 00B6 PILCROW SIGN
+B7 00B7 MIDDLE DOT
+B8 00B8 CEDILLA
+B9 0105 LATIN SMALL LETTER A WITH OGONEK
+BA 015F LATIN SMALL LETTER S WITH CEDILLA
+BB 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+BC 013D LATIN CAPITAL LETTER L WITH CARON
+BD 02DD DOUBLE ACUTE ACCENT
+BE 013E LATIN SMALL LETTER L WITH CARON
+BF 017C LATIN SMALL LETTER Z WITH DOT ABOVE
+C0 0154 LATIN CAPITAL LETTER R WITH ACUTE
+C1 00C1 LATIN CAPITAL LETTER A WITH ACUTE
+C2 00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+C3 0102 LATIN CAPITAL LETTER A WITH BREVE
+C4 00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
+C5 0139 LATIN CAPITAL LETTER L WITH ACUTE
+C6 0106 LATIN CAPITAL LETTER C WITH ACUTE
+C7 00C7 LATIN CAPITAL LETTER C WITH CEDILLA
+C8 010C LATIN CAPITAL LETTER C WITH CARON
+C9 00C9 LATIN CAPITAL LETTER E WITH ACUTE
+CA 0118 LATIN CAPITAL LETTER E WITH OGONEK
+CB 00CB LATIN CAPITAL LETTER E WITH DIAERESIS
+CC 011A LATIN CAPITAL LETTER E WITH CARON
+CD 00CD LATIN CAPITAL LETTER I WITH ACUTE
+CE 00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+CF 010E LATIN CAPITAL LETTER D WITH CARON
+D0 0110 LATIN CAPITAL LETTER D WITH STROKE
+D1 0143 LATIN CAPITAL LETTER N WITH ACUTE
+D2 0147 LATIN CAPITAL LETTER N WITH CARON
+D3 00D3 LATIN CAPITAL LETTER O WITH ACUTE
+D4 00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+D5 0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+D6 00D6 LATIN CAPITAL LETTER O WITH DIAERESIS
+D7 00D7 MULTIPLICATION SIGN
+D8 0158 LATIN CAPITAL LETTER R WITH CARON
+D9 016E LATIN CAPITAL LETTER U WITH RING ABOVE
+DA 00DA LATIN CAPITAL LETTER U WITH ACUTE
+DB 0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+DC 00DC LATIN CAPITAL LETTER U WITH DIAERESIS
+DD 00DD LATIN CAPITAL LETTER Y WITH ACUTE
+DE 0162 LATIN CAPITAL LETTER T WITH CEDILLA
+DF 00DF LATIN SMALL LETTER SHARP S
+E0 0155 LATIN SMALL LETTER R WITH ACUTE
+E1 00E1 LATIN SMALL LETTER A WITH ACUTE
+E2 00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX
+E3 0103 LATIN SMALL LETTER A WITH BREVE
+E4 00E4 LATIN SMALL LETTER A WITH DIAERESIS
+E5 013A LATIN SMALL LETTER L WITH ACUTE
+E6 0107 LATIN SMALL LETTER C WITH ACUTE
+E7 00E7 LATIN SMALL LETTER C WITH CEDILLA
+E8 010D LATIN SMALL LETTER C WITH CARON
+E9 00E9 LATIN SMALL LETTER E WITH ACUTE
+EA 0119 LATIN SMALL LETTER E WITH OGONEK
+EB 00EB LATIN SMALL LETTER E WITH DIAERESIS
+EC 011B LATIN SMALL LETTER E WITH CARON
+ED 00ED LATIN SMALL LETTER I WITH ACUTE
+EE 00EE LATIN SMALL LETTER I WITH CIRCUMFLEX
+EF 010F LATIN SMALL LETTER D WITH CARON
+F0 0111 LATIN SMALL LETTER D WITH STROKE
+F1 0144 LATIN SMALL LETTER N WITH ACUTE
+F2 0148 LATIN SMALL LETTER N WITH CARON
+F3 00F3 LATIN SMALL LETTER O WITH ACUTE
+F4 00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX
+F5 0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE
+F6 00F6 LATIN SMALL LETTER O WITH DIAERESIS
+F7 00F7 DIVISION SIGN
+F8 0159 LATIN SMALL LETTER R WITH CARON
+F9 016F LATIN SMALL LETTER U WITH RING ABOVE
+FA 00FA LATIN SMALL LETTER U WITH ACUTE
+FB 0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE
+FC 00FC LATIN SMALL LETTER U WITH DIAERESIS
+FD 00FD LATIN SMALL LETTER Y WITH ACUTE
+FE 0163 LATIN SMALL LETTER T WITH CEDILLA
+FF 02D9 DOT ABOVE

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1251.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1251.t?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1251.t (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1251.t Mon Feb  9 12:49:22 2009
@@ -1,0 +1,299 @@
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: windows-1251.t,v 1.2 2008/04/04 12:46:45 murch Exp $
+#
+# Charset put together by Ewald Dieterich <ewald.dieterich at fun.de>
+# Reference: http://www.microsoft.com/globaldev/reference/sbcs/1252.htm
+ 0 0000 NULL (NUL)
+ 1 0001 START OF HEADING (SOH)
+ 2 0002 START OF TEXT (STX)
+ 3 0003 END OF TEXT (ETX)
+ 4 0004 END OF TRANSMISSION (EOT)
+ 5 0005 ENQUIRY (ENQ)
+ 6 0006 ACKNOWLEDGE (ACK)
+ 7 0007 BELL (BEL)
+ 8 0008 BACKSPACE (BS)
+ 9 0009 CHARACTER TABULATION (HT)
+ A 000a LINE FEED (LF)
+ B 000b LINE TABULATION (VT)
+ C 000c FORM FEED (FF)
+ D 000d CARRIAGE RETURN (CR)
+ E 000e SHIFT OUT (SO)
+ F 000f SHIFT IN (SI)
+10 0010 DATALINK ESCAPE (DLE)
+11 0011 DEVICE CONTROL ONE (DC1)
+12 0012 DEVICE CONTROL TWO (DC2)
+13 0013 DEVICE CONTROL THREE (DC3)
+14 0014 DEVICE CONTROL FOUR (DC4)
+15 0015 NEGATIVE ACKNOWLEDGE (NAK)
+16 0016 SYNCRONOUS IDLE (SYN)
+17 0017 END OF TRANSMISSION BLOCK (ETB)
+18 0018 CANCEL (CAN)
+19 0019 END OF MEDIUM (EM)
+1A 001a SUBSTITUTE (SUB)
+1B 001b ESCAPE (ESC)
+1C 001c FILE SEPARATOR (IS4)
+1D 001d GROUP SEPARATOR (IS3)
+1E 001e RECORD SEPARATOR (IS2)
+1F 001f UNIT SEPARATOR (IS1)
+20 0020 SPACE
+21 0021 EXCLAMATION MARK
+22 0022 QUOTATION MARK
+23 0023 NUMBER SIGN
+24 0024 DOLLAR SIGN
+25 0025 PERCENT SIGN
+26 0026 AMPERSAND
+27 0027 APOSTROPHE
+28 0028 LEFT PARENTHESIS
+29 0029 RIGHT PARENTHESIS
+2A 002a ASTERISK
+2B 002b PLUS SIGN
+2C 002c COMMA
+2D 002d HYPHEN-MINUS
+2E 002e FULL STOP
+2F 002f SOLIDUS
+30 0030 DIGIT ZERO
+31 0031 DIGIT ONE
+32 0032 DIGIT TWO
+33 0033 DIGIT THREE
+34 0034 DIGIT FOUR
+35 0035 DIGIT FIVE
+36 0036 DIGIT SIX
+37 0037 DIGIT SEVEN
+38 0038 DIGIT EIGHT
+39 0039 DIGIT NINE
+3A 003a COLON
+3B 003b SEMICOLON
+3C 003c LESS-THAN SIGN
+3D 003d EQUALS SIGN
+3E 003e GREATER-THAN SIGN
+3F 003f QUESTION MARK
+40 0040 COMMERCIAL AT
+41 0041 LATIN CAPITAL LETTER A
+42 0042 LATIN CAPITAL LETTER B
+43 0043 LATIN CAPITAL LETTER C
+44 0044 LATIN CAPITAL LETTER D
+45 0045 LATIN CAPITAL LETTER E
+46 0046 LATIN CAPITAL LETTER F
+47 0047 LATIN CAPITAL LETTER G
+48 0048 LATIN CAPITAL LETTER H
+49 0049 LATIN CAPITAL LETTER I
+4A 004a LATIN CAPITAL LETTER J
+4B 004b LATIN CAPITAL LETTER K
+4C 004c LATIN CAPITAL LETTER L
+4D 004d LATIN CAPITAL LETTER M
+4E 004e LATIN CAPITAL LETTER N
+4F 004f LATIN CAPITAL LETTER O
+50 0050 LATIN CAPITAL LETTER P
+51 0051 LATIN CAPITAL LETTER Q
+52 0052 LATIN CAPITAL LETTER R
+53 0053 LATIN CAPITAL LETTER S
+54 0054 LATIN CAPITAL LETTER T
+55 0055 LATIN CAPITAL LETTER U
+56 0056 LATIN CAPITAL LETTER V
+57 0057 LATIN CAPITAL LETTER W
+58 0058 LATIN CAPITAL LETTER X
+59 0059 LATIN CAPITAL LETTER Y
+5A 005a LATIN CAPITAL LETTER Z
+5B 005b LEFT SQUARE BRACKET
+5C 005c REVERSE SOLIDUS
+5D 005d RIGHT SQUARE BRACKET
+5E 005e CIRCUMFLEX ACCENT
+5F 005f LOW LINE
+60 0060 GRAVE ACCENT
+61 0061 LATIN SMALL LETTER A
+62 0062 LATIN SMALL LETTER B
+63 0063 LATIN SMALL LETTER C
+64 0064 LATIN SMALL LETTER D
+65 0065 LATIN SMALL LETTER E
+66 0066 LATIN SMALL LETTER F
+67 0067 LATIN SMALL LETTER G
+68 0068 LATIN SMALL LETTER H
+69 0069 LATIN SMALL LETTER I
+6A 006a LATIN SMALL LETTER J
+6B 006b LATIN SMALL LETTER K
+6C 006c LATIN SMALL LETTER L
+6D 006d LATIN SMALL LETTER M
+6E 006e LATIN SMALL LETTER N
+6F 006f LATIN SMALL LETTER O
+70 0070 LATIN SMALL LETTER P
+71 0071 LATIN SMALL LETTER Q
+72 0072 LATIN SMALL LETTER R
+73 0073 LATIN SMALL LETTER S
+74 0074 LATIN SMALL LETTER T
+75 0075 LATIN SMALL LETTER U
+76 0076 LATIN SMALL LETTER V
+77 0077 LATIN SMALL LETTER W
+78 0078 LATIN SMALL LETTER X
+79 0079 LATIN SMALL LETTER Y
+7A 007a LATIN SMALL LETTER Z
+7B 007b LEFT CURLY BRACKET
+7C 007c VERTICAL LINE
+7D 007d RIGHT CURLY BRACKET
+7E 007e TILDE
+7F 007f DELETE (DEL)
+80 0402 CYRILLIC CAPITAL LETTER DJE
+81 0403 CYRILLIC CAPITAL LETTER GJE
+82 201A SINGLE LOW-9 QUOTATION MARK
+83 0453 CYRILLIC SMALL LETTER GJE
+84 201E DOUBLE LOW-9 QUOTATION MARK
+85 2026 HORIZONTAL ELLIPSIS
+86 2020 DAGGER
+87 2021 DOUBLE DAGGER
+88 20AC EURO SIGN
+89 2030 PER MILLE SIGN
+8A 0409 CYRILLIC CAPITAL LETTER LJE
+8B 2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+8C 040A CYRILLIC CAPITAL LETTER NJE
+8D 040C CYRILLIC CAPITAL LETTER KJE
+8E 040B CYRILLIC CAPITAL LETTER TSHE
+8F 040F CYRILLIC CAPITAL LETTER DZHE
+90 0452 CYRILLIC SMALL LETTER DJE
+91 2018 LEFT SINGLE QUOTATION MARK
+92 2019 RIGHT SINGLE QUOTATION MARK
+93 201C LEFT DOUBLE QUOTATION MARK
+94 201D RIGHT DOUBLE QUOTATION MARK
+95 2022 BULLET
+96 2013 EN DASH
+97 2014 EM DASH
+99 2122 TRADE MARK SIGN
+9A 0459 CYRILLIC SMALL LETTER LJE
+9B 203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+9C 045A CYRILLIC SMALL LETTER NJE
+9D 045C CYRILLIC SMALL LETTER KJE
+9E 045B CYRILLIC SMALL LETTER TSHE
+9F 045F CYRILLIC SMALL LETTER DZHE
+A0 00A0 NO-BREAK SPACE
+A1 040E CYRILLIC CAPITAL LETTER SHORT U
+A2 045E CYRILLIC SMALL LETTER SHORT U
+A3 0408 CYRILLIC CAPITAL LETTER JE
+A4 00A4 CURRENCY SIGN
+A5 0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN
+A6 00A6 BROKEN BAR
+A7 00A7 SECTION SIGN
+A8 0401 CYRILLIC CAPITAL LETTER IO
+A9 00A9 COPYRIGHT SIGN
+AA 0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE
+AB 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+AC 00AC NOT SIGN
+AD 00AD SOFT HYPHEN
+AE 00AE REGISTERED SIGN
+AF 0407 CYRILLIC CAPITAL LETTER YI
+B0 00B0 DEGREE SIGN
+B1 00B1 PLUS-MINUS SIGN
+B2 0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+B3 0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+B4 0491 CYRILLIC SMALL LETTER GHE WITH UPTURN
+B5 00B5 MICRO SIGN
+B6 00B6 PILCROW SIGN
+B7 00B7 MIDDLE DOT
+B8 0451 CYRILLIC SMALL LETTER IO
+B9 2116 NUMERO SIGN
+BA 0454 CYRILLIC SMALL LETTER UKRAINIAN IE
+BB 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+BC 0458 CYRILLIC SMALL LETTER JE
+BD 0405 CYRILLIC CAPITAL LETTER DZE
+BE 0455 CYRILLIC SMALL LETTER DZE
+BF 0457 CYRILLIC SMALL LETTER YI
+C0 0410 CYRILLIC CAPITAL LETTER A
+C1 0411 CYRILLIC CAPITAL LETTER BE
+C2 0412 CYRILLIC CAPITAL LETTER VE
+C3 0413 CYRILLIC CAPITAL LETTER GHE
+C4 0414 CYRILLIC CAPITAL LETTER DE
+C5 0415 CYRILLIC CAPITAL LETTER IE
+C6 0416 CYRILLIC CAPITAL LETTER ZHE
+C7 0417 CYRILLIC CAPITAL LETTER ZE
+C8 0418 CYRILLIC CAPITAL LETTER I
+C9 0419 CYRILLIC CAPITAL LETTER SHORT I
+CA 041A CYRILLIC CAPITAL LETTER KA
+CB 041B CYRILLIC CAPITAL LETTER EL
+CC 041C CYRILLIC CAPITAL LETTER EM
+CD 041D CYRILLIC CAPITAL LETTER EN
+CE 041E CYRILLIC CAPITAL LETTER O
+CF 041F CYRILLIC CAPITAL LETTER PE
+D0 0420 CYRILLIC CAPITAL LETTER ER
+D1 0421 CYRILLIC CAPITAL LETTER ES
+D2 0422 CYRILLIC CAPITAL LETTER TE
+D3 0423 CYRILLIC CAPITAL LETTER U
+D4 0424 CYRILLIC CAPITAL LETTER EF
+D5 0425 CYRILLIC CAPITAL LETTER HA
+D6 0426 CYRILLIC CAPITAL LETTER TSE
+D7 0427 CYRILLIC CAPITAL LETTER CHE
+D8 0428 CYRILLIC CAPITAL LETTER SHA
+D9 0429 CYRILLIC CAPITAL LETTER SHCHA
+DA 042A CYRILLIC CAPITAL LETTER HARD SIGN
+DB 042B CYRILLIC CAPITAL LETTER YERU
+DC 042C CYRILLIC CAPITAL LETTER SOFT SIGN
+DD 042D CYRILLIC CAPITAL LETTER E
+DE 042E CYRILLIC CAPITAL LETTER YU
+DF 042F CYRILLIC CAPITAL LETTER YA
+E0 0430 CYRILLIC SMALL LETTER A
+E1 0431 CYRILLIC SMALL LETTER BE
+E2 0432 CYRILLIC SMALL LETTER VE
+E3 0433 CYRILLIC SMALL LETTER GHE
+E4 0434 CYRILLIC SMALL LETTER DE
+E5 0435 CYRILLIC SMALL LETTER IE
+E6 0436 CYRILLIC SMALL LETTER ZHE
+E7 0437 CYRILLIC SMALL LETTER ZE
+E8 0438 CYRILLIC SMALL LETTER I
+E9 0439 CYRILLIC SMALL LETTER SHORT I
+EA 043A CYRILLIC SMALL LETTER KA
+EB 043B CYRILLIC SMALL LETTER EL
+EC 043C CYRILLIC SMALL LETTER EM
+ED 043D CYRILLIC SMALL LETTER EN
+EE 043E CYRILLIC SMALL LETTER O
+EF 043F CYRILLIC SMALL LETTER PE
+F0 0440 CYRILLIC SMALL LETTER ER
+F1 0441 CYRILLIC SMALL LETTER ES
+F2 0442 CYRILLIC SMALL LETTER TE
+F3 0443 CYRILLIC SMALL LETTER U
+F4 0444 CYRILLIC SMALL LETTER EF
+F5 0445 CYRILLIC SMALL LETTER HA
+F6 0446 CYRILLIC SMALL LETTER TSE
+F7 0447 CYRILLIC SMALL LETTER CHE
+F8 0448 CYRILLIC SMALL LETTER SHA
+F9 0449 CYRILLIC SMALL LETTER SHCHA
+FA 044A CYRILLIC SMALL LETTER HARD SIGN
+FB 044B CYRILLIC SMALL LETTER YERU
+FC 044C CYRILLIC SMALL LETTER SOFT SIGN
+FD 044D CYRILLIC SMALL LETTER E
+FE 044E CYRILLIC SMALL LETTER YU
+FF 044F CYRILLIC SMALL LETTER YA

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1252.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1252.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1252.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1252.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 2002 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: windows-1252.t,v 1.3 2008/04/04 12:46:45 murch Exp $
 #
 # Charset put together by Ewald Dieterich <ewald.dieterich at fun.de>
 # Reference: http://www.microsoft.com/globaldev/reference/sbcs/1252.htm

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1255.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1255.t?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1255.t (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1255.t Mon Feb  9 12:49:22 2009
@@ -1,0 +1,277 @@
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: windows-1255.t,v 1.2 2008/04/04 12:46:46 murch Exp $
+#
+# Charset put together by Ewald Dieterich <ewald.dieterich at fun.de>
+# Reference: http://www.microsoft.com/globaldev/reference/sbcs/1252.htm
+ 0 0000 NULL (NUL)
+ 1 0001 START OF HEADING (SOH)
+ 2 0002 START OF TEXT (STX)
+ 3 0003 END OF TEXT (ETX)
+ 4 0004 END OF TRANSMISSION (EOT)
+ 5 0005 ENQUIRY (ENQ)
+ 6 0006 ACKNOWLEDGE (ACK)
+ 7 0007 BELL (BEL)
+ 8 0008 BACKSPACE (BS)
+ 9 0009 CHARACTER TABULATION (HT)
+ A 000a LINE FEED (LF)
+ B 000b LINE TABULATION (VT)
+ C 000c FORM FEED (FF)
+ D 000d CARRIAGE RETURN (CR)
+ E 000e SHIFT OUT (SO)
+ F 000f SHIFT IN (SI)
+10 0010 DATALINK ESCAPE (DLE)
+11 0011 DEVICE CONTROL ONE (DC1)
+12 0012 DEVICE CONTROL TWO (DC2)
+13 0013 DEVICE CONTROL THREE (DC3)
+14 0014 DEVICE CONTROL FOUR (DC4)
+15 0015 NEGATIVE ACKNOWLEDGE (NAK)
+16 0016 SYNCRONOUS IDLE (SYN)
+17 0017 END OF TRANSMISSION BLOCK (ETB)
+18 0018 CANCEL (CAN)
+19 0019 END OF MEDIUM (EM)
+1A 001a SUBSTITUTE (SUB)
+1B 001b ESCAPE (ESC)
+1C 001c FILE SEPARATOR (IS4)
+1D 001d GROUP SEPARATOR (IS3)
+1E 001e RECORD SEPARATOR (IS2)
+1F 001f UNIT SEPARATOR (IS1)
+20 0020 SPACE
+21 0021 EXCLAMATION MARK
+22 0022 QUOTATION MARK
+23 0023 NUMBER SIGN
+24 0024 DOLLAR SIGN
+25 0025 PERCENT SIGN
+26 0026 AMPERSAND
+27 0027 APOSTROPHE
+28 0028 LEFT PARENTHESIS
+29 0029 RIGHT PARENTHESIS
+2A 002a ASTERISK
+2B 002b PLUS SIGN
+2C 002c COMMA
+2D 002d HYPHEN-MINUS
+2E 002e FULL STOP
+2F 002f SOLIDUS
+30 0030 DIGIT ZERO
+31 0031 DIGIT ONE
+32 0032 DIGIT TWO
+33 0033 DIGIT THREE
+34 0034 DIGIT FOUR
+35 0035 DIGIT FIVE
+36 0036 DIGIT SIX
+37 0037 DIGIT SEVEN
+38 0038 DIGIT EIGHT
+39 0039 DIGIT NINE
+3A 003a COLON
+3B 003b SEMICOLON
+3C 003c LESS-THAN SIGN
+3D 003d EQUALS SIGN
+3E 003e GREATER-THAN SIGN
+3F 003f QUESTION MARK
+40 0040 COMMERCIAL AT
+41 0041 LATIN CAPITAL LETTER A
+42 0042 LATIN CAPITAL LETTER B
+43 0043 LATIN CAPITAL LETTER C
+44 0044 LATIN CAPITAL LETTER D
+45 0045 LATIN CAPITAL LETTER E
+46 0046 LATIN CAPITAL LETTER F
+47 0047 LATIN CAPITAL LETTER G
+48 0048 LATIN CAPITAL LETTER H
+49 0049 LATIN CAPITAL LETTER I
+4A 004a LATIN CAPITAL LETTER J
+4B 004b LATIN CAPITAL LETTER K
+4C 004c LATIN CAPITAL LETTER L
+4D 004d LATIN CAPITAL LETTER M
+4E 004e LATIN CAPITAL LETTER N
+4F 004f LATIN CAPITAL LETTER O
+50 0050 LATIN CAPITAL LETTER P
+51 0051 LATIN CAPITAL LETTER Q
+52 0052 LATIN CAPITAL LETTER R
+53 0053 LATIN CAPITAL LETTER S
+54 0054 LATIN CAPITAL LETTER T
+55 0055 LATIN CAPITAL LETTER U
+56 0056 LATIN CAPITAL LETTER V
+57 0057 LATIN CAPITAL LETTER W
+58 0058 LATIN CAPITAL LETTER X
+59 0059 LATIN CAPITAL LETTER Y
+5A 005a LATIN CAPITAL LETTER Z
+5B 005b LEFT SQUARE BRACKET
+5C 005c REVERSE SOLIDUS
+5D 005d RIGHT SQUARE BRACKET
+5E 005e CIRCUMFLEX ACCENT
+5F 005f LOW LINE
+60 0060 GRAVE ACCENT
+61 0061 LATIN SMALL LETTER A
+62 0062 LATIN SMALL LETTER B
+63 0063 LATIN SMALL LETTER C
+64 0064 LATIN SMALL LETTER D
+65 0065 LATIN SMALL LETTER E
+66 0066 LATIN SMALL LETTER F
+67 0067 LATIN SMALL LETTER G
+68 0068 LATIN SMALL LETTER H
+69 0069 LATIN SMALL LETTER I
+6A 006a LATIN SMALL LETTER J
+6B 006b LATIN SMALL LETTER K
+6C 006c LATIN SMALL LETTER L
+6D 006d LATIN SMALL LETTER M
+6E 006e LATIN SMALL LETTER N
+6F 006f LATIN SMALL LETTER O
+70 0070 LATIN SMALL LETTER P
+71 0071 LATIN SMALL LETTER Q
+72 0072 LATIN SMALL LETTER R
+73 0073 LATIN SMALL LETTER S
+74 0074 LATIN SMALL LETTER T
+75 0075 LATIN SMALL LETTER U
+76 0076 LATIN SMALL LETTER V
+77 0077 LATIN SMALL LETTER W
+78 0078 LATIN SMALL LETTER X
+79 0079 LATIN SMALL LETTER Y
+7A 007a LATIN SMALL LETTER Z
+7B 007b LEFT CURLY BRACKET
+7C 007c VERTICAL LINE
+7D 007d RIGHT CURLY BRACKET
+7E 007e TILDE
+7F 007f DELETE (DEL)
+80 20AC EURO SIGN
+82 201A SINGLE LOW-9 QUOTATION MARK
+83 0192 LATIN SMALL LETTER F WITH HOOK
+84 201E DOUBLE LOW-9 QUOTATION MARK
+85 2026 HORIZONTAL ELLIPSIS
+86 2020 DAGGER
+87 2021 DOUBLE DAGGER
+88 02C6 MODIFIER LETTER CIRCUMFLEX ACCENT
+89 2030 PER MILLE SIGN
+8B 2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+91 2018 LEFT SINGLE QUOTATION MARK
+92 2019 RIGHT SINGLE QUOTATION MARK
+93 201C LEFT DOUBLE QUOTATION MARK
+94 201D RIGHT DOUBLE QUOTATION MARK
+95 2022 BULLET
+96 2013 EN DASH
+97 2014 EM DASH
+98 02DC SMALL TILDE
+99 2122 TRADE MARK SIGN
+9B 203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+A0 00A0 NO-BREAK SPACE
+A1 00A1 INVERTED EXCLAMATION MARK
+A2 00A2 CENT SIGN
+A3 00A3 POUND SIGN
+A4 20AA NEW SHEQEL SIGN
+A5 00A5 YEN SIGN
+A6 00A6 BROKEN BAR
+A7 00A7 SECTION SIGN
+A8 00A8 DIAERESIS
+A9 00A9 COPYRIGHT SIGN
+AA 00D7 MULTIPLICATION SIGN
+AB 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+AC 00AC NOT SIGN
+AD 00AD SOFT HYPHEN
+AE 00AE REGISTERED SIGN
+AF 00AF MACRON
+B0 00B0 DEGREE SIGN
+B1 00B1 PLUS-MINUS SIGN
+B2 00B2 SUPERSCRIPT TWO
+B3 00B3 SUPERSCRIPT THREE
+B4 00B4 ACUTE ACCENT
+B5 00B5 MICRO SIGN
+B6 00B6 PILCROW SIGN
+B7 00B7 MIDDLE DOT
+B8 00B8 CEDILLA
+B9 00B9 SUPERSCRIPT ONE
+BA 00F7 DIVISION SIGN
+BB 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+BC 00BC VULGAR FRACTION ONE QUARTER
+BD 00BD VULGAR FRACTION ONE HALF
+BE 00BE VULGAR FRACTION THREE QUARTERS
+BF 00BF INVERTED QUESTION MARK
+C0 05B0 HEBREW POINT SHEVA
+C1 05B1 HEBREW POINT HATAF SEGOL
+C2 05B2 HEBREW POINT HATAF PATAH
+C3 05B3 HEBREW POINT HATAF QAMATS
+C4 05B4 HEBREW POINT HIRIQ
+C5 05B5 HEBREW POINT TSERE
+C6 05B6 HEBREW POINT SEGOL
+C7 05B7 HEBREW POINT PATAH
+C8 05B8 HEBREW POINT QAMATS
+C9 05B9 HEBREW POINT HOLAM
+CB 05BB HEBREW POINT QUBUTS
+CC 05BC HEBREW POINT DAGESH OR MAPIQ
+CD 05BD HEBREW POINT METEG
+CE 05BE HEBREW PUNCTUATION MAQAF
+CF 05BF HEBREW POINT RAFE
+D0 05C0 HEBREW PUNCTUATION PASEQ
+D1 05C1 HEBREW POINT SHIN DOT
+D2 05C2 HEBREW POINT SIN DOT
+D3 05C3 HEBREW PUNCTUATION SOF PASUQ
+D4 05F0 HEBREW LIGATURE YIDDISH DOUBLE VAV
+D5 05F1 HEBREW LIGATURE YIDDISH VAV YOD
+D6 05F2 HEBREW LIGATURE YIDDISH DOUBLE YOD
+D7 05F3 HEBREW PUNCTUATION GERESH
+D8 05F4 HEBREW PUNCTUATION GERSHAYIM
+E0 05D0 HEBREW LETTER ALEF
+E1 05D1 HEBREW LETTER BET
+E2 05D2 HEBREW LETTER GIMEL
+E3 05D3 HEBREW LETTER DALET
+E4 05D4 HEBREW LETTER HE
+E5 05D5 HEBREW LETTER VAV
+E6 05D6 HEBREW LETTER ZAYIN
+E7 05D7 HEBREW LETTER HET
+E8 05D8 HEBREW LETTER TET
+E9 05D9 HEBREW LETTER YOD
+EA 05DA HEBREW LETTER FINAL KAF
+EB 05DB HEBREW LETTER KAF
+EC 05DC HEBREW LETTER LAMED
+ED 05DD HEBREW LETTER FINAL MEM
+EE 05DE HEBREW LETTER MEM
+EF 05DF HEBREW LETTER FINAL NUN
+F0 05E0 HEBREW LETTER NUN
+F1 05E1 HEBREW LETTER SAMEKH
+F2 05E2 HEBREW LETTER AYIN
+F3 05E3 HEBREW LETTER FINAL PE
+F4 05E4 HEBREW LETTER PE
+F5 05E5 HEBREW LETTER FINAL TSADI
+F6 05E6 HEBREW LETTER TSADI
+F7 05E7 HEBREW LETTER QOF
+F8 05E8 HEBREW LETTER RESH
+F9 05E9 HEBREW LETTER SHIN
+FA 05EA HEBREW LETTER TAV
+FD 200E LEFT-TO-RIGHT MARK
+FE 200F RIGHT-TO-LEFT MARK

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1256.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1256.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1256.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/charset/windows-1256.t Mon Feb  9 12:49:22 2009
@@ -1,22 +1,44 @@
-#        Copyright 2003 by Carnegie Mellon University
-#
-#                      All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU 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.
+#
+# Copyright (c) 1994-2008 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 legal
+#    details, please contact
+#      Carnegie Mellon University
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at 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.
+#
+# $Id: windows-1256.t,v 1.2 2008/04/04 12:46:46 murch Exp $
 #
 # Charset put together by Rayed Alrashed <rayed at saudi.net.sa>
 # Reference:

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/chartable.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/chartable.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/chartable.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/chartable.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
-/* Definitions internal to charset.c and chartable.c */
-
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* Definitions internal to charset.c and chartable.c
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,9 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: chartable.h,v 1.6 2008/03/24 17:43:08 murch Exp $
  */
-
-/* $Id: chartable.h,v 1.5 2003/02/13 20:15:39 rjs3 Exp $ */
 
 /* note that these are all uppercase letters. since the translation
    tables canonicalize to lower case letters, we never see these bytes

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: cyrusdb.c,v 1.13 2008/07/30 16:03:38 murch Exp $
  */
-
-/* $Id: cyrusdb.c,v 1.11 2006/11/30 17:11:22 murch Exp $ */
 
 #include <config.h>
 #include <stdlib.h>
@@ -71,6 +72,9 @@
     &cyrusdb_flat,
     &cyrusdb_skiplist,
     &cyrusdb_quotalegacy,
+#if defined HAVE_MYSQL || defined HAVE_PGSQL || defined HAVE_SQLITE
+    &cyrusdb_sql,
+#endif
     NULL };
 
 void cyrusdb_init() 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: cyrusdb.h,v 1.33 2008/07/30 16:03:38 murch Exp $
  */
-
-/* $Id: cyrusdb.h,v 1.31 2006/11/30 17:11:22 murch Exp $ */
 
 #ifndef INCLUDED_CYRUSDB_H
 #define INCLUDED_CYRUSDB_H
@@ -189,6 +190,7 @@
 extern struct cyrusdb_backend cyrusdb_flat;
 extern struct cyrusdb_backend cyrusdb_skiplist;
 extern struct cyrusdb_backend cyrusdb_quotalegacy;
+extern struct cyrusdb_backend cyrusdb_sql;
 
 extern int cyrusdb_copyfile(const char *srcname, const char *dstname);
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_berkeley.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_berkeley.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_berkeley.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_berkeley.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /*  cyrusdb_berkeley: berkeley db backends
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,20 +38,20 @@
  * 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.
+ *
+ * $Id: cyrusdb_berkeley.c,v 1.22 2008/03/24 17:43:08 murch Exp $
  */
-
-/* $Id: cyrusdb_berkeley.c,v 1.16 2007/02/05 18:43:26 jeaton Exp $ */
 
 #include <config.h>
 
 #include <db.h>
 #include <syslog.h>
-#include <assert.h>
 #include <string.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "assert.h"
 #include "bsearch.h"
 #include "cyrusdb.h"
 #include "exitcodes.h"
@@ -176,7 +177,15 @@
 	syslog(LOG_WARNING,
 	       "DBERROR: invalid berkeley_locks_max value, using internal default");
     } else {
+#if DB_VERSION_MAJOR >= 4
+	r = dbenv->set_lk_max_locks(dbenv, opt);
+	if (!r)
+	    r = dbenv->set_lk_max_lockers(dbenv, opt);
+	if (!r)
+	    r = dbenv->set_lk_max_objects(dbenv, opt);
+#else
 	r = dbenv->set_lk_max(dbenv, opt);
+#endif
 	if (r) {
 	    dbenv->err(dbenv, r, "set_lk_max");
 	    syslog(LOG_ERR, "DBERROR: set_lk_max(): %s", db_strerror(r));
@@ -204,7 +213,7 @@
 	r = dbenv->set_cachesize(dbenv, 0, opt * 1024, 0);
 	if (r) {
 	    dbenv->err(dbenv, r, "set_cachesize");
-	    dbenv->close(dbenv, 0);
+	    (dbenv->close)(dbenv, 0);
 	    syslog(LOG_ERR, "DBERROR: set_cachesize(): %s", db_strerror(r));
 	    return CYRUSDB_IOERROR;
 	}
@@ -215,9 +224,9 @@
     flags |= DB_INIT_LOCK | DB_INIT_MPOOL | 
 	     DB_INIT_LOG | DB_INIT_TXN;
 #if (DB_VERSION_MAJOR > 3) || ((DB_VERSION_MAJOR == 3) && (DB_VERSION_MINOR > 0))
-    r = dbenv->open(dbenv, dbdir, flags, 0644); 
+    r = (dbenv->open)(dbenv, dbdir, flags, 0644); 
 #else
-    r = dbenv->open(dbenv, dbdir, NULL, flags, 0644); 
+    r = (dbenv->open)(dbenv, dbdir, NULL, flags, 0644); 
 #endif
     if (r) {
         if (do_retry && (r == ENOENT)) {
@@ -256,7 +265,7 @@
 
     if (--dbinit) return 0;
 
-    r = dbenv->close(dbenv, 0);
+    r = (dbenv->close)(dbenv, 0);
     dbinit = 0;
     if (r) {
 	syslog(LOG_ERR, "DBERROR: error exiting application: %s",
@@ -379,7 +388,8 @@
     return 0;
 }
 
-static int mbox_compar(DB *db, const DBT *a, const DBT *b)
+static int mbox_compar(DB *db __attribute__((unused)),
+		       const DBT *a, const DBT *b)
 {
     return bsearch_ncompare((const char *) a->data, a->size,
 			    (const char *) b->data, b->size);
@@ -404,15 +414,15 @@
     if (flags & CYRUSDB_MBOXSORT) db->set_bt_compare(db, mbox_compar);
 
 #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
-    r = db->open(db, NULL, fname, NULL, type, dbflags | DB_AUTO_COMMIT, 0664);
+    r = (db->open)(db, NULL, fname, NULL, type, dbflags | DB_AUTO_COMMIT, 0664);
 #else
-    r = db->open(db, fname, NULL, type, dbflags, 0664);
+    r = (db->open)(db, fname, NULL, type, dbflags, 0664);
 #endif
 
     if (r != 0) {
 	int level = (flags & CYRUSDB_CREATE) ? LOG_ERR : LOG_DEBUG;
 	syslog(level, "DBERROR: opening %s: %s", fname, db_strerror(r));
-	r = db->close(db, DB_NOSYNC);
+	r = (db->close)(db, DB_NOSYNC);
         if (r != 0) {
             syslog(level, "DBERROR: closing %s: %s", fname, db_strerror(r));
         }
@@ -442,7 +452,7 @@
     assert(dbinit && db);
 
     /* since we're using txns, we can supply DB_NOSYNC */
-    r = a->close(a, DB_NOSYNC);
+    r = (a->close)(a, DB_NOSYNC);
     if (r != 0) {
 	syslog(LOG_ERR, "DBERROR: error closing: %s", db_strerror(r));
 	r = CYRUSDB_IOERROR;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_flat.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_flat.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_flat.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_flat.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /*  cyrusdb_flat: a sorted flat textfile backend
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: cyrusdb_flat.c,v 1.39 2008/03/24 17:43:08 murch Exp $
  */
-
-/* $Id: cyrusdb_flat.c,v 1.37 2007/02/05 18:43:26 jeaton Exp $ */
 
 #include <config.h>
 
@@ -443,7 +444,7 @@
 	else dontmove = 0;
 	
 	/* does it still match prefix? */
-	if (keylen < prefixlen) break;
+	if (keylen < (size_t) prefixlen) break;
 	if (prefixlen && memcmp(key, prefix, prefixlen)) break;
 
 	if (!goodp || goodp(rock, key, keylen, data, datalen)) {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_quotalegacy.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_quotalegacy.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_quotalegacy.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_quotalegacy.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /*  cyrusdb_quotalegacy: cyrusdb backend for accessing legacy quota files
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: cyrusdb_quotalegacy.c,v 1.19 2008/09/19 17:10:51 murch Exp $
  */
-
-/* $Id: cyrusdb_quotalegacy.c,v 1.14 2007/02/05 18:43:26 jeaton Exp $ */
 
 #include <config.h>
 
@@ -55,7 +56,23 @@
 #include <sys/stat.h>
 #include <sys/uio.h>
 #include <fcntl.h>
-#include <glob.h>
+
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif
 
 #include "assert.h"
 #include "cyrusdb.h"
@@ -75,30 +92,40 @@
 
 /* we have the file locked iff we have an outstanding transaction */
 
+struct subtxn {
+    int fd;
+
+    char *fnamenew;
+    int fdnew;
+
+    int delete;
+};
+
+struct txn {
+    hash_table table;	/* hash table of sub-transactions */
+
+    int (*proc)(char *, struct subtxn *);  /* commit/abort procedure */
+
+    int result;		/* final result of the commit/abort */
+};
+
 struct db {
     char *path;
 
-    char *data;  /* allocated buffer for fetched data */
-
-    hash_table table;  /* transaction (hash table of sub-transactions) */
+    char *data;		/* allocated buffer for fetched data */
+
+    struct txn txn;	/* transaction associated with this db handle */
 };
 
-struct subtxn {
-    int fd;
-
-    char *fnamenew;
-    int fdnew;
-
-    int delete;
-};
-
-int abort_txn(struct db *db __attribute__((unused)), struct txn *tid);
+static int abort_txn(struct db *db __attribute__((unused)), struct txn *tid);
+
 
 /* simple hash so it's easy to find these things in the filesystem;
    our human time is worth more than efficiency */
 static void hash_quota(char *buf, size_t size, const char *qr, char *path)
 {
     int config_virtdomains = libcyrus_config_getswitch(CYRUSOPT_VIRTDOMAINS);
+    int config_fulldirhash = libcyrus_config_getswitch(CYRUSOPT_FULLDIRHASH);
     const char *idx;
     char c, *p;
     unsigned len;
@@ -111,7 +138,7 @@
 
     if (config_virtdomains && (p = strchr(qr, '!'))) {
 	*p = '\0';  /* split domain!qr */
-	c = (char) dir_hash_c(qr);
+	c = (char) dir_hash_c(qr, config_fulldirhash);
 	if ((len = snprintf(buf, size, "%s%c/%s",
 			    FNAME_DOMAINDIR, c, qr)) >= size) {
 	    fatal("insufficient buffer size in hash_quota", EC_TEMPFAIL);
@@ -123,7 +150,7 @@
 
 	if (!*qr) {
 	    /* quota for entire domain */
-	    if (snprintf(buf, size, "%sroot", FNAME_QUOTADIR) >= size) {
+	    if (snprintf(buf, size, "%sroot", FNAME_QUOTADIR) >= (int) size) {
 		fatal("insufficient buffer size in hash_quota",
 		      EC_TEMPFAIL);
 	    }
@@ -137,9 +164,9 @@
     } else {
 	idx++;
     }
-    c = (char) dir_hash_c(idx);
-
-    if (snprintf(buf, size, "%s%c/%s", FNAME_QUOTADIR, c, qr) >= size) {
+    c = (char) dir_hash_c(idx, config_fulldirhash);
+
+    if (snprintf(buf, size, "%s%c/%s", FNAME_QUOTADIR, c, qr) >= (int) size) {
 	fatal("insufficient buffer size in hash_quota", EC_TEMPFAIL);
     }
 }
@@ -238,7 +265,7 @@
     if (db) {
 	if (db->path) free(db->path);
 	if (db->data) free(db->data);
-	free_hash_table(&db->table, NULL);
+	free_hash_table(&db->txn.table, NULL);
 	free(db);
     }
 }
@@ -287,7 +314,7 @@
     assert(fname && ret);
 
     db->path = xstrdup(fname);
-    construct_hash_table(&db->table, 200, 0);
+    construct_hash_table(&db->txn.table, 200, 0);
 
     /* strip any filename from the path */
     if ((p = strrchr(db->path, '/'))) *p = '\0';
@@ -345,9 +372,9 @@
 
     if (tid) {
 	if (!*tid)
-	    *tid = (struct txn *) &db->table;
+	    *tid = &db->txn;
 	else
-	    mytid = (struct subtxn *) hash_lookup(quota_path, &db->table);
+	    mytid = (struct subtxn *) hash_lookup(quota_path, &db->txn.table);
     }
 
     /* open and lock file, if needed */
@@ -376,7 +403,7 @@
 	    }
 
 	    mytid = new_subtxn(quota_path, quota_fd);
-	    hash_insert(quota_path, mytid, &db->table);
+	    hash_insert(quota_path, mytid, &db->txn.table);
 	}
     }
     else
@@ -468,6 +495,71 @@
     return strcmp(qr1, qr2);
 }   
 
+#define PATH_ALLOC 100
+struct qr_path {
+    char **path;
+    size_t count;
+    size_t alloc;
+};
+
+static void scan_qr_dir(char *quota_path, char *prefix, struct qr_path *pathbuf)
+{
+    int config_fulldirhash = libcyrus_config_getswitch(CYRUSOPT_FULLDIRHASH);
+    int config_virtdomains = libcyrus_config_getswitch(CYRUSOPT_VIRTDOMAINS);
+    char *endp;
+    int c, i;
+    DIR *qrdir;
+    struct dirent *next = NULL;
+
+    /* strip off the qr specific path */
+    endp = strstr(quota_path, FNAME_QUOTADIR) + strlen(FNAME_QUOTADIR);
+    strcpy(endp, "?/");
+
+    c = config_fulldirhash ? 'A' : 'a';
+    for (i = 0; i < 26; i++, c++) {
+	*endp = c;
+
+	qrdir = opendir(quota_path);
+
+	if (qrdir) {
+	    while ((next = readdir(qrdir)) != NULL) {
+		if (!strcmp(next->d_name, ".")
+		    || !strcmp(next->d_name, "..")) continue;
+
+		if (!strncmp(next->d_name, prefix, strlen(prefix))) {
+		    if (pathbuf->count == pathbuf->alloc) {
+			pathbuf->alloc += PATH_ALLOC;
+			pathbuf->path = xrealloc(pathbuf->path, pathbuf->alloc);
+		    }
+		    pathbuf->path[pathbuf->count] = xmalloc(MAX_QUOTA_PATH+1);
+		    sprintf(pathbuf->path[pathbuf->count++],
+			    "%s%s", quota_path, next->d_name);
+		}
+	    }
+
+	    closedir(qrdir);
+	}
+    }
+
+    if (config_virtdomains && !strlen(prefix) &&
+	strstr(quota_path, FNAME_DOMAINDIR)) {
+	/* search for a domain quota */
+	struct stat buf;
+
+	strcpy(endp, "root");
+
+	if (!stat(quota_path, &buf)) {
+	    if (pathbuf->count == pathbuf->alloc) {
+		pathbuf->alloc += PATH_ALLOC;
+		pathbuf->path = xrealloc(pathbuf->path, pathbuf->alloc);
+	    }
+	    pathbuf->path[pathbuf->count] = xmalloc(MAX_QUOTA_PATH+1);
+	    sprintf(pathbuf->path[pathbuf->count++],
+		    "%s", quota_path);
+	}
+    }
+}
+
 static int foreach(struct db *db,
 		   char *prefix, int prefixlen,
 		   foreach_p *goodp,
@@ -475,10 +567,11 @@
 		   struct txn **tid)
 {
     int r = CYRUSDB_OK;
+    int config_fulldirhash = libcyrus_config_getswitch(CYRUSOPT_FULLDIRHASH);
     int config_virtdomains = libcyrus_config_getswitch(CYRUSOPT_VIRTDOMAINS);
     char quota_path[MAX_QUOTA_PATH+1];
-    glob_t globbuf;
-    int i;
+    struct qr_path pathbuf;
+    size_t i;
     char *tmpprefix = NULL, *p = NULL;
 
     /* if we need to truncate the prefix, do so */
@@ -493,48 +586,62 @@
     if (config_virtdomains && (p = strchr(prefix, '!')))
 	prefix = p + 1;
 
-    /* strip off the qr specific path and replace with pattern */
-    sprintf(strstr(quota_path, FNAME_QUOTADIR) + strlen(FNAME_QUOTADIR),
-	    "?/%s*", prefix);
-
     /* search for the quotaroots */
-    glob(quota_path, GLOB_NOSORT, NULL, &globbuf);
-
-    if (config_virtdomains) {
-	if (!prefixlen) {
+    memset(&pathbuf, 0, sizeof(struct qr_path));
+    scan_qr_dir(quota_path, prefix, &pathbuf);
+
+    if (config_virtdomains && !prefixlen) {
 	    /* search for all virtdomain quotaroots */
-	    snprintf(quota_path, sizeof(quota_path), "%s%s?/*%s?/*",
-		     db->path, FNAME_DOMAINDIR, FNAME_QUOTADIR);
-	    glob(quota_path, GLOB_NOSORT | GLOB_APPEND, NULL, &globbuf);
-
-	    /* search for all domain quotas */
-	    snprintf(quota_path, sizeof(quota_path), "%s%s?/*%sroot",
-		     db->path, FNAME_DOMAINDIR, FNAME_QUOTADIR);
-	    glob(quota_path, GLOB_NOSORT | GLOB_APPEND, NULL, &globbuf);
-	}
-	else if (!strlen(prefix)) {
-	    /* search for the domain quotas */
-	    strcpy(strstr(quota_path, FNAME_QUOTADIR) + strlen(FNAME_QUOTADIR),
-		   "root");
-	    glob(quota_path, GLOB_NOSORT | GLOB_APPEND, NULL, &globbuf);
-	}
-    }
+	char *endp;
+	int c, i, n;
+	DIR *qrdir;
+	struct dirent *next = NULL;
+
+	n = snprintf(quota_path, sizeof(quota_path), "%s%s",
+		     db->path, FNAME_DOMAINDIR);
+
+	endp = quota_path + n;
+	strcpy(endp, "?/");
+
+	c = config_fulldirhash ? 'A' : 'a';
+	for (i = 0; i < 26; i++, c++) {
+	    *endp = c;
+
+	    qrdir = opendir(quota_path);
+
+	    if (qrdir) {
+		while ((next = readdir(qrdir)) != NULL) {
+		    if (!strcmp(next->d_name, ".")
+			|| !strcmp(next->d_name, "..")) continue;
+
+		    snprintf(endp+2, sizeof(quota_path) - (n+2),
+			     "%s%s", next->d_name, FNAME_QUOTADIR);
+		    scan_qr_dir(quota_path, "", &pathbuf);
+		}
+
+		closedir(qrdir);
+	    }
+	}
+    }
+
     if (tmpprefix) free(tmpprefix);
 
-    if (tid && !*tid) *tid = (struct txn *) &db->table;
+    if (tid && !*tid) *tid = &db->txn;
 
     /* sort the quotaroots (ignoring paths) */
-    qsort(globbuf.gl_pathv, globbuf.gl_pathc, sizeof(char *), &compar_qr);
-
-    for (i = 0; i < globbuf.gl_pathc; i++) {
+    qsort(pathbuf.path, pathbuf.count, sizeof(char *), &compar_qr);
+
+    for (i = 0; i < pathbuf.count; i++) {
 	const char *data, *key;
 	int keylen, datalen;
 
-	r = myfetch(db, globbuf.gl_pathv[i], &data, &datalen, tid);
+	r = myfetch(db, pathbuf.path[i], &data, &datalen, tid);
 	if (r) break;
 
-	key = path_to_qr(globbuf.gl_pathv[i], quota_path);
+	key = path_to_qr(pathbuf.path[i], quota_path);
 	keylen = strlen(key);
+
+	free(pathbuf.path[i]);
 
 	if (!goodp || goodp(rock, key, keylen, data, datalen)) {
 	    /* make callback */
@@ -543,7 +650,7 @@
 	}
     }
 
-    globfree(&globbuf);
+    free(pathbuf.path);
 
     return r;
 }
@@ -570,9 +677,9 @@
 
     if (tid) {
 	if (!*tid)
-	    *tid = (struct txn *) &db->table;
+	    *tid = &db->txn;
 	else
-	    mytid = (struct subtxn *) hash_lookup(quota_path, &db->table);
+	    mytid = (struct subtxn *) hash_lookup(quota_path, &db->txn.table);
     }
 
     /* open and lock file, if needed */
@@ -603,8 +710,7 @@
 
 	mytid = new_subtxn(quota_path, fd);
 
-	if (tid)
-	    hash_insert(quota_path, mytid, &db->table);
+	if (tid) hash_insert(quota_path, mytid, &db->txn.table);
     }
 
     if (!data) {
@@ -674,7 +780,8 @@
 		syslog(LOG_ERR, "IOERROR: writing quota file %s: %m",
 		       new_quota_path);
 	    else
-		syslog(LOG_ERR, "IOERROR: writing quota file %s: failed to write %d bytes",
+		syslog(LOG_ERR,
+		       "IOERROR: writing quota file %s: failed to write %d bytes",
 		       new_quota_path, datalen+1);
 	    if (tid)
 		abort_txn(db, *tid);
@@ -718,47 +825,35 @@
     return mystore(db, key, keylen, NULL, 0, mytid, 1);
 }
 
-struct txn_rock {
-    hash_table *table;
-    int (*func)(char *, struct subtxn *);
-    int ret;
-};
-
-static void enum_func(char *fname, void *data, void *rock)
-{
-    struct txn_rock *trock = (struct txn_rock *) rock;
+static void txn_proc(char *fname, void *data, void *rock)
+{
+    struct txn *tid = (struct txn *) rock;
     int r;
 
-    r = trock->func(fname, (struct subtxn *) data);
-    hash_del(fname, trock->table);
-
-    if (r && !trock->ret) trock->ret = r;
-}
-
-int commit_txn(struct db *db __attribute__((unused)), struct txn *tid)
-{
-    struct txn_rock trock;
-
-    trock.table = (hash_table *) tid;
-    trock.func = commit_subtxn;
-    trock.ret = 0;
-
-    hash_enumerate((hash_table *) tid, enum_func, &trock);
-
-    return trock.ret;
-}
-
-int abort_txn(struct db *db __attribute__((unused)), struct txn *tid)
-{
-    struct txn_rock trock;
-
-    trock.table = (hash_table *) tid;
-    trock.func = abort_subtxn;
-    trock.ret = 0;
-
-    hash_enumerate((hash_table *) tid, enum_func, &trock);
-
-    return trock.ret;
+    r = tid->proc(fname, (struct subtxn *) data);
+    hash_del(fname, &tid->table);
+
+    if (r && !tid->result) tid->result = r;
+}
+
+static int commit_txn(struct db *db __attribute__((unused)), struct txn *tid)
+{
+    tid->proc = commit_subtxn;
+    tid->result = 0;
+
+    hash_enumerate(&tid->table, txn_proc, tid);
+
+    return tid->result;
+}
+
+static int abort_txn(struct db *db __attribute__((unused)), struct txn *tid)
+{
+    tid->proc = abort_subtxn;
+    tid->result = 0;
+
+    hash_enumerate(&tid->table, txn_proc, tid);
+
+    return tid->result;
 }
 
 struct cyrusdb_backend cyrusdb_quotalegacy = 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_skiplist.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_skiplist.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_skiplist.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_skiplist.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* cyrusdb_skiplist.c -- cyrusdb skiplist implementation
- * $Id: cyrusdb_skiplist.c,v 1.52 2007/02/05 18:43:26 jeaton Exp $
  *
- * Copyright (c) 1998, 2000, 2002 Carnegie Mellon University.
- * All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +38,8 @@
  * 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.
+ *
+ * $Id: cyrusdb_skiplist.c,v 1.64 2008/10/08 15:47:08 murch Exp $
  */
 
 /* xxx check retry_xxx for failure */
@@ -50,7 +51,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
-#include <assert.h>
 #include <errno.h>
 #include <syslog.h>
 #include <sys/types.h>
@@ -61,6 +61,7 @@
 #endif
 #include <netinet/in.h>
 
+#include "assert.h"
 #include "bsearch.h"
 #include "cyrusdb.h"
 #include "libcyr_cfg.h"
@@ -138,6 +139,21 @@
     DUMMY = 257
 };
 
+enum {
+    UNLOCKED = 0,
+    READLOCKED = 1,
+    WRITELOCKED = 2,
+};
+
+struct txn {
+    int syncfd;
+
+    /* logstart is where we start changes from on commit, where we truncate
+       to on abort */
+    unsigned logstart;
+    unsigned logend;			/* where to write to continue this txn */
+};
+
 struct db {
     /* file data */
     char *fname;
@@ -149,29 +165,31 @@
     ino_t map_ino;
 
     /* header info */
-    int version;
-    int version_minor;
-    int maxlevel;
-    int curlevel;
-    int listsize;
-    int logstart;		/* where the log starts from last chkpnt */
+    unsigned version;
+    unsigned version_minor;
+    unsigned maxlevel;
+    unsigned curlevel;
+    unsigned listsize;
+    unsigned logstart;		/* where the log starts from last chkpnt */
     time_t last_recovery;
+
+    /* tracking info */
+    int lock_status;
+    int is_open;
+    struct txn *current_txn;
 
     /* comparator function to use for sorting */
     int (*compar) (const char *s1, int l1, const char *s2, int l2);
 };
 
-struct txn {
-    int ismalloc;
-    int syncfd;
-
-    /* logstart is where we start changes from on commit, where we truncate
-       to on abort */
-    int logstart;
-    int logend;			/* where to write to continue this txn */
+struct db_list {
+    struct db *db;
+    struct db_list *next;
+    int refcount;
 };
 
 static time_t global_recovery = 0;
+static struct db_list *open_db = NULL;
 
 /* Perform an FSYNC/FDATASYNC if we are *not* operating in UNSAFE mode */
 #define DO_FSYNC (!libcyrus_config_getswitch(CYRUSOPT_SKIPLIST_UNSAFE))
@@ -182,16 +200,6 @@
 };
 
 static int compare(const char *s1, int l1, const char *s2, int l2);
-
-static void newtxn(struct db *db, struct txn *t)
-{
-    /* fill in t */
-    t->ismalloc = 0;
-    t->syncfd = -1;
-    t->logstart = db->map_size;
-    assert(t->logstart != -1);
-    t->logend = t->logstart;
-}
 
 static void getsyncfd(struct db *db, struct txn *t)
 {
@@ -257,6 +265,8 @@
     }
 
     srand(time(NULL) * getpid());
+
+    open_db = NULL;
 
     return 0;
 }
@@ -388,7 +398,7 @@
 #define FORWARD(ptr, x) (ntohl(*((bit32 *)(FIRSTPTR(ptr) + 4 * (x)))))
 
 /* how many levels does this record have? */
-static int LEVEL(const char *ptr)
+static unsigned LEVEL(const char *ptr)
 {
     const bit32 *p, *q;
 
@@ -399,7 +409,7 @@
 }
 
 /* how big is this record? */
-static int RECSIZE(const char *ptr)
+static unsigned RECSIZE(const char *ptr)
 {
     int ret = 0;
     switch (TYPE(ptr)) {
@@ -429,17 +439,61 @@
 
 /* Determine if it is safe to append to this skiplist database.
  *  e.g. does it end in 4 bytes of -1 followed by a commit record? 
+ * *or* does it end with 'DELETE' + 4 bytes + a commit record?
  * *or* is this the beginning of the log, in which case we only need
  * the padding from the last INORDER (or DUMMY) record
  */
 static int SAFE_TO_APPEND(struct db *db)
 {
-    return (db->map_size % 4
-	    || (db->map_size == db->logstart &&
-		*((bit32 *)(db->map_base + db->map_size - 4)) != htonl(-1))
-	    || (db->map_size != db->logstart &&
-		*((bit32 *)(db->map_base + db->map_size - 8)) != htonl(-1) &&
-		*((bit32 *)(db->map_base + db->map_size - 4)) != htonl(COMMIT)));
+    /* check it's a multiple of 4 */
+    if (db->map_size % 4) return 1;
+
+    /* is it the beginning of the log? */
+    if (db->map_size == db->logstart) {
+	if (*((bit32 *)(db->map_base + db->map_size - 4)) != htonl(-1)) {
+	    return 1;
+	}
+    }
+
+    /* in the middle of the log somewhere */
+    else {
+	if (*((bit32 *)(db->map_base + db->map_size - 4)) != htonl(COMMIT)) {
+	    return 1;
+	}
+
+	/* if it's not an end of a record or a delete */
+	if (!((*((bit32 *)(db->map_base + db->map_size - 8)) == htonl(-1)) ||
+	      (*((bit32 *)(db->map_base + db->map_size -12)) == htonl(DELETE)))) {
+	    return 1;
+	}
+    }
+
+    return 0;
+}
+
+static int newtxn(struct db *db, struct txn **tidptr)
+{
+    struct txn *tid;
+    /* is this file safe to append to?
+     * 
+     * If it isn't, we need to run recovery. */
+    if (SAFE_TO_APPEND(db)) {
+	int r = recovery(db, RECOVERY_FORCE | RECOVERY_CALLER_LOCKED);
+	if (r) return r;
+    }
+
+    /* create the transaction */
+    tid = xmalloc(sizeof(struct txn));
+    tid->syncfd = -1;
+    tid->logstart = db->map_size;
+/*    assert(t->logstart != -1);*/
+    tid->logend = tid->logstart;
+    db->current_txn = tid;
+
+    /* pass it back out */
+    *tidptr = tid;
+
+    return 0;
 }
 
 
@@ -451,7 +505,8 @@
     const char *dptr;
     int r;
     
-    assert(db && db->map_len && db->fname && db->map_base);
+    assert(db && db->map_len && db->fname && db->map_base 
+              && db->is_open && db->lock_status);
     if (db->map_len < HEADER_SIZE) {
 	syslog(LOG_ERR, 
 	       "skiplist: file not large enough for header: %s", db->fname);
@@ -529,6 +584,7 @@
     char buf[HEADER_SIZE];
     int n;
 
+    assert (db->lock_status == WRITELOCKED);
     memcpy(buf + 0, HEADER_MAGIC, HEADER_MAGIC_SIZE);
     *((bit32 *)(buf + OFFSET_VERSION)) = htonl(db->version);
     *((bit32 *)(buf + OFFSET_VERSION_MINOR)) = htonl(db->version_minor);
@@ -550,28 +606,11 @@
     return 0;
 }
 
-static int dispose_db(struct db *db)
-{
-    if (!db) return 0;
-    if (db->fname) { 
-	free(db->fname);
-    }
-    if (db->map_base) {
-	map_free(&db->map_base, &db->map_len);
-    }
-    if (db->fd != -1) {
-	close(db->fd);
-    }
-
-    free(db);
-
-    return 0;
-}
-
 /* make sure our mmap() is big enough */
 static int update_lock(struct db *db, struct txn *txn) 
 {
     /* txn->logend is the current size of the file */
+    assert (db->is_open && db->lock_status == WRITELOCKED);
     map_refresh(db->fd, 0, &db->map_base, &db->map_len, txn->logend,
 		db->fname, 0);
     db->map_size = txn->logend;
@@ -585,6 +624,7 @@
     const char *lockfailaction;
     const char *fname = altname ? altname : db->fname;
 
+    assert(db->lock_status == UNLOCKED);
     if (lock_reopen(db->fd, fname, &sbuf, &lockfailaction) < 0) {
 	syslog(LOG_ERR, "IOERROR: %s %s: %m", lockfailaction, fname);
 	return CYRUSDB_IOERROR;
@@ -594,13 +634,14 @@
     }
     db->map_size = sbuf.st_size;
     db->map_ino = sbuf.st_ino;
+    db->lock_status = WRITELOCKED;
     
     map_refresh(db->fd, 0, &db->map_base, &db->map_len, sbuf.st_size,
 		fname, 0);
 
-    if (db->curlevel) {
-	/* reread curlevel */
-	db->curlevel = ntohl(*((bit32 *)(db->map_base + OFFSET_CURLEVEL)));
+    if (db->is_open) {
+	/* reread header */
+	read_header(db);
     }
     
     /* printf("%d: write lock: %d\n", getpid(), db->map_ino); */
@@ -613,6 +654,7 @@
     struct stat sbuf, sbuffile;
     int newfd = -1;
 
+    assert(db->lock_status == UNLOCKED);
     for (;;) {
 	if (lock_shared(db->fd) < 0) {
 	    syslog(LOG_ERR, "IOERROR: lock_shared %s: %m", db->fname);
@@ -648,15 +690,16 @@
     }
     db->map_size = sbuf.st_size;
     db->map_ino = sbuf.st_ino;
+    db->lock_status = READLOCKED;
     
     /* printf("%d: read lock: %d\n", getpid(), db->map_ino); */
 
     map_refresh(db->fd, 0, &db->map_base, &db->map_len, sbuf.st_size,
 		db->fname, 0);
 
-    if (db->curlevel) {
-	/* reread curlevel */
-	db->curlevel = ntohl(*((bit32 *)(db->map_base + OFFSET_CURLEVEL)));
+    if (db->is_open) {
+	/* reread header */
+	read_header(db);
     }
     
     return 0;
@@ -664,22 +707,94 @@
 
 static int unlock(struct db *db)
 {
+    if (db->lock_status == UNLOCKED) {
+	syslog(LOG_NOTICE, "skiplist: unlock while not locked");
+    }
     if (lock_unlock(db->fd) < 0) {
 	syslog(LOG_ERR, "IOERROR: lock_unlock %s: %m", db->fname);
 	return CYRUSDB_IOERROR;
     }
+    db->lock_status = UNLOCKED;
 
     /* printf("%d: unlock: %d\n", getpid(), db->map_ino); */
 
     return 0;
 }
 
+static int lock_or_refresh(struct db *db, struct txn **tidptr)
+{
+    int r;
+
+    assert(db != NULL && tidptr != NULL);
+
+    if (*tidptr) {
+	/* check that the DB agrees that we're in this transaction */
+	assert(db->current_txn == *tidptr);
+
+     	/* just update the active transaction */
+	update_lock(db, *tidptr);
+
+    } else {
+	/* check that the DB isn't in a transaction */
+	assert(db->current_txn == NULL);
+
+	/* grab a r/w lock */
+	if ((r = write_lock(db, NULL)) < 0) {
+	    return r;
+	}
+
+	/* start the transaction */
+	if ((r = newtxn(db, tidptr))) {
+	    return r;
+	}
+    }
+
+    return 0;
+}
+
+static int dispose_db(struct db *db)
+{
+    if (!db) return 0;
+    assert(db->is_open);
+    if (db->lock_status) {
+	syslog(LOG_ERR, "skiplist: closed while still locked");
+	unlock(db);
+    }
+    if (db->fname) { 
+	free(db->fname);
+    }
+    if (db->map_base) {
+	map_free(&db->map_base, &db->map_len);
+    }
+    if (db->fd != -1) {
+	close(db->fd);
+    }
+
+    free(db);
+
+    return 0;
+}
+
 static int myopen(const char *fname, int flags, struct db **ret)
 {
-    struct db *db = (struct db *) xzmalloc(sizeof(struct db));
+    struct db *db;
+    struct db_list *list_ent = open_db;
     int r;
     int new = 0;
 
+    while (list_ent && strcmp(list_ent->db->fname, fname)) {
+	list_ent = list_ent->next;
+    }
+    if (list_ent) {
+	/* we already have this DB open! */
+	syslog(LOG_NOTICE, "skiplist: %s is already open %d time%s, returning object", 
+	fname, list_ent->refcount, list_ent->refcount == 1 ? "" : "s");
+	*ret = list_ent->db;
+	++list_ent->refcount;
+	return 0;
+    }
+
+    db = (struct db *) xzmalloc(sizeof(struct db));
     db->fd = -1;
     db->fname = xstrdup(fname);
     db->compar = (flags & CYRUSDB_MBOXSORT) ? bsearch_ncompare : compare;
@@ -699,29 +814,31 @@
 	return CYRUSDB_IOERROR;
     }
 
- retry:
     db->curlevel = 0;
-
-    if (new) {
-	/* lock the db (this normally rereads db->curlevel, but
-	 db->curlevel is currently 0) */
+    db->is_open = 0;
+    db->lock_status = UNLOCKED;
+
+    /* grab a read lock, only reading the header */
+    r = read_lock(db);
+	if (r < 0) {
+	    dispose_db(db);
+	    return r;
+	}
+
+    /* if the file is empty, then the header needs to be created first */
+    if (db->map_size == 0) {
+        unlock(db);
 	r = write_lock(db, NULL);
 	if (r < 0) {
 	    dispose_db(db);
 	    return r;
 	}
-    } else {
-	/* grab a read lock */
-	r = read_lock(db);
-	if (r < 0) {
-	    dispose_db(db);
-	    return r;
-	}
-    }
-
-    if (new && db->map_size == 0) {
-	/* make sure someone didn't come along and "fix" this db */
-
+    }
+
+    /* race condition.  Another process may have already got the write
+     * lock and created the header. Only go ahead if the map_size is 
+     * still zero (read/write_lock updates map_size). */
+    if (db->map_size == 0) {
 	/* initialize in memory structure */
 	db->version = SKIPLIST_VERSION;
 	db->version_minor = SKIPLIST_VERSION_MINOR;
@@ -759,14 +876,13 @@
 	    r = CYRUSDB_IOERROR;
 	}
 
-    }
-
-    if (db->map_size == 0) {
-	/* race condition to initialize this guy! */
-	new = 1;
-	unlock(db);
-	goto retry;
-    }
+	/* map the new file */
+	db->map_size = db->logstart;
+	map_refresh(db->fd, 0, &db->map_base, &db->map_len, db->logstart,
+		    db->fname, 0);
+    }
+
+    db->is_open = 1;
 
     r = read_header(db);
     if (r) {
@@ -788,12 +904,36 @@
     }
 
     *ret = db;
+
+    /* track this database in the open list */
+    list_ent = (struct db_list *) xzmalloc(sizeof(struct db_list));
+    list_ent->db = db;
+    list_ent->next = open_db;
+    list_ent->refcount = 1;
+    open_db = list_ent;
+
     return 0;
 }
 
 int myclose(struct db *db)
 {
+    struct db_list *list_ent = open_db;
+    struct db_list *prev = NULL;
+
+    /* remove this DB from the open list */
+    while (list_ent && list_ent->db != db) {
+	prev = list_ent;
+	list_ent = list_ent->next;
+    }
+    assert(list_ent);
+    if (--list_ent->refcount <= 0) {
+	if (prev) prev->next = list_ent->next;
+	else open_db = list_ent->next;
+	free(list_ent);
     return dispose_db(db);
+    }
+
+    return 0;
 }
 
 static int compare(const char *s1, int l1, const char *s2, int l2)
@@ -823,10 +963,10 @@
 {
     const char *ptr = db->map_base + DUMMY_OFFSET(db);
     int i;
-    int offset;
+    unsigned offset;
 
     if (updateoffsets) {
-	for (i = 0; i < db->maxlevel; i++) {
+	for (i = 0; (unsigned) i < db->maxlevel; i++) {
 	    updateoffsets[i] = DUMMY_OFFSET(db);
 	}
     }
@@ -849,10 +989,9 @@
 int myfetch(struct db *db,
 	    const char *key, int keylen,
 	    const char **data, int *datalen,
-	    struct txn **mytid)
+	    struct txn **tidptr)
 {
     const char *ptr;
-    struct txn t, *tp;
     int r = 0;
 
     assert(db != NULL && key != NULL);
@@ -860,26 +999,25 @@
     if (data) *data = NULL;
     if (datalen) *datalen = 0;
 
-    if (!mytid) {
+    /* Hacky workaround:
+     *
+     * If no transaction was passed, but we're in a transaction,
+     * then just do the read within that transaction. 
+     */
+    if (!tidptr && db->current_txn != NULL) {
+	tidptr = &(db->current_txn);
+	}
+
+    if (tidptr) {
+	/* make sure we're write locked and up to date */
+	if ((r = lock_or_refresh(db, tidptr)) < 0) {
+	    return r;
+	}
+    } else {
 	/* grab a r lock */
 	if ((r = read_lock(db)) < 0) {
 	    return r;
 	}
-
-	tp = NULL;
-    } else if (!*mytid) {
-	/* grab a r/w lock */
-	if ((r = write_lock(db, NULL)) < 0) {
-	    return r;
-	}
-
-	/* fill in t */
-	newtxn(db, &t);
-
-	tp = &t;
-    } else {
-	tp = *mytid;
-	update_lock(db, tp);
     }
 
     ptr = find_node(db, key, keylen, 0);
@@ -892,15 +1030,7 @@
 	if (data) *data = DATA(ptr);
     }
 
-    if (mytid) {
-	if (!*mytid) {
-	    /* return the txn structure */
-
-	    *mytid = xmalloc(sizeof(struct txn));
-	    memcpy(*mytid, tp, sizeof(struct txn));
-	    (*mytid)->ismalloc = 1;
-	}
-    } else {
+    if (!tidptr) {
 	/* release read lock */
 	int r1;
 	if ((r1 = unlock(db)) < 0) {
@@ -914,16 +1044,16 @@
 static int fetch(struct db *mydb, 
 		 const char *key, int keylen,
 		 const char **data, int *datalen,
-		 struct txn **mytid)
-{
-    return myfetch(mydb, key, keylen, data, datalen, mytid);
+		 struct txn **tidptr)
+{
+    return myfetch(mydb, key, keylen, data, datalen, tidptr);
 }
 static int fetchlock(struct db *db, 
 		     const char *key, int keylen,
 		     const char **data, int *datalen,
-		     struct txn **mytid)
-{
-    return myfetch(db, key, keylen, data, datalen, mytid);
+		     struct txn **tidptr)
+{
+    return myfetch(db, key, keylen, data, datalen, tidptr);
 }
 
 /* foreach allows for subsidary mailbox operations in 'cb'.
@@ -933,38 +1063,36 @@
 	      char *prefix, int prefixlen,
 	      foreach_p *goodp,
 	      foreach_cb *cb, void *rock, 
-	      struct txn **tid)
+	      struct txn **tidptr)
 {
     const char *ptr;
     char *savebuf = NULL;
     size_t savebuflen = 0;
     size_t savebufsize;
-    struct txn t, *tp;
     int r = 0, cb_r = 0;
 
     assert(db != NULL);
     assert(prefixlen >= 0);
 
-    if (!tid) {
+    /* Hacky workaround:
+     *
+     * If no transaction was passed, but we're in a transaction,
+     * then just do the read within that transaction. 
+     */
+    if (!tidptr && db->current_txn != NULL) {
+	tidptr = &(db->current_txn);
+	}
+
+    if (tidptr) {
+	/* make sure we're write locked and up to date */
+	if ((r = lock_or_refresh(db, tidptr)) < 0) {
+	    return r;
+	}
+    } else {
 	/* grab a r lock */
 	if ((r = read_lock(db)) < 0) {
 	    return r;
 	}
-
-	tp = NULL;
-    } else if (!*tid) {
-	/* grab a r/w lock */
-	if ((r = write_lock(db, NULL)) < 0) {
-	    return r;
-	}
-
-	/* fill in t */
-	newtxn(db, &t);
-
-	tp = &t;
-    } else {
-	tp = *tid;
-	update_lock(db, tp);
     }
 
     ptr = find_node(db, prefix, prefixlen, 0);
@@ -979,7 +1107,7 @@
 	    ino_t ino = db->map_ino;
 	    unsigned long sz = db->map_size;
 
-	    if (!tid) {
+	    if (!tidptr) {
 		/* release read lock */
 		if ((r = unlock(db)) < 0) {
 		    return r;
@@ -998,14 +1126,14 @@
 	    cb_r = cb(rock, KEY(ptr), KEYLEN(ptr), DATA(ptr), DATALEN(ptr));
 	    if (cb_r) break;
 
-	    if (!tid) {
+	    if (!tidptr) {
 		/* grab a r lock */
 		if ((r = read_lock(db)) < 0) {
 		    return r;
 		}
 	    } else {
 		/* make sure we're up to date */
-		update_lock(db, tp);
+		update_lock(db, *tidptr);
 	    }
 
 	    /* reposition */
@@ -1033,15 +1161,7 @@
 	}
     }
 
-    if (tid) {
-	if (!*tid) {
-	    /* return the txn structure */
-
-	    *tid = xmalloc(sizeof(struct txn));
-	    memcpy(*tid, tp, sizeof(struct txn));
-	    (*tid)->ismalloc = 1;
-	}
-    } else {
+    if (!tidptr) {
 	/* release read lock */
 	if ((r = unlock(db)) < 0) {
 	    return r;
@@ -1071,14 +1191,14 @@
 int mystore(struct db *db, 
 	    const char *key, int keylen,
 	    const char *data, int datalen,
-	    struct txn **tid, int overwrite)
+	    struct txn **tidptr, int overwrite)
 {
     const char *ptr;
     bit32 klen, dlen;
     struct iovec iov[50];
-    unsigned int lvl;
+    unsigned int lvl, i;
     int num_iov;
-    struct txn t, *tp;
+    struct txn *tid, *localtid = NULL;
     bit32 endpadding = (bit32) htonl(-1);
     bit32 zeropadding[4] = { 0, 0, 0, 0 };
     int updateoffsets[SKIPLIST_MAXLEVEL];
@@ -1086,49 +1206,38 @@
     int addrectype = htonl(ADD);
     int delrectype = htonl(DELETE);
     bit32 todelete;
-    bit32 newoffset;
-    int r, i;
+    bit32 newoffset, netnewoffset;
+    int r;
 
     assert(db != NULL);
     assert(key && keylen);
 
-    if (!tid || !*tid) {
-	/* grab a r/w lock */
-	if ((r = write_lock(db, NULL)) < 0) {
-	    return r;
-	}
-
-	/* is this file safe to append to?
-	 * 
-	 * If it isn't, we need to run recovery. */
-	if(SAFE_TO_APPEND(db))
-	{
-	    if((r = recovery(db, RECOVERY_FORCE | RECOVERY_CALLER_LOCKED)) < 0)
+    /* not keeping the transaction, just create one local to
+     * this function */
+    if (!tidptr) {
+	tidptr = &localtid;
+	}
+
+    /* make sure we're write locked and up to date */
+    if ((r = lock_or_refresh(db, tidptr)) < 0) {
 		return r;
 	}
 
-	/* fill in t */
-	newtxn(db, &t);
-
-	tp = &t;
-    } else {
-	tp = *tid;
-	update_lock(db, tp);
-    }
+    tid = *tidptr; /* consistent naming is nice */
 
     if (be_paranoid) {
-	assert(myconsistent(db, tp, 1) == 0);
+	assert(myconsistent(db, tid, 1) == 0);
     }
 
     num_iov = 0;
     
-    newoffset = tp->logend;
+    newoffset = tid->logend;
     ptr = find_node(db, key, keylen, updateoffsets);
     if (ptr != db->map_base && 
 	!db->compar(KEY(ptr), KEYLEN(ptr), key, keylen)) {
 	    
 	if (!overwrite) {
-	    myabort(db, tp);	/* releases lock */
+	    myabort(db, tid);	/* releases lock */
 	    return CYRUSDB_EXISTS;
 	} else {
 	    /* replace with an equal height node */
@@ -1174,17 +1283,7 @@
     klen = htonl(keylen);
     dlen = htonl(datalen);
     
-    newoffset = htonl(newoffset);
-
-    /* set pointers appropriately */
-    for (i = 0; i < lvl; i++) {
-	/* write pointer updates */
-	/* FORWARD(updates[i], i) = newoffset; */
-	lseek(db->fd, 
-	      PTR(db->map_base + updateoffsets[i], i) - db->map_base,
-	      SEEK_SET);
-	retry_write(db->fd, (char *) &newoffset, 4);
-    }
+    netnewoffset = htonl(newoffset);
 
     WRITEV_ADD_TO_IOVEC(iov, num_iov, (char *) &addrectype, 4);
     WRITEV_ADD_TO_IOVEC(iov, num_iov, (char *) &klen, 4);
@@ -1202,31 +1301,35 @@
     WRITEV_ADD_TO_IOVEC(iov, num_iov, (char *) newoffsets, 4 * lvl);
     WRITEV_ADD_TO_IOVEC(iov, num_iov, (char *) &endpadding, 4);
 
-    getsyncfd(db, tp);
-    lseek(tp->syncfd, tp->logend, SEEK_SET);
-    r = retry_writev(tp->syncfd, iov, num_iov);
+    getsyncfd(db, tid);
+    lseek(tid->syncfd, tid->logend, SEEK_SET);
+    r = retry_writev(tid->syncfd, iov, num_iov);
     if (r < 0) {
 	syslog(LOG_ERR, "DBERROR: retry_writev(): %m");
-	myabort(db, tp);
+	myabort(db, tid);
 	return CYRUSDB_IOERROR;
     }
-    tp->logend += r;		/* update where to write next */
-
-    if (tid) {
-	if (!*tid) {
-	    /* return the txn structure */
-
-	    *tid = xmalloc(sizeof(struct txn));
-	    memcpy(*tid, tp, sizeof(struct txn));
-	    (*tid)->ismalloc = 1;
+    tid->logend += r;		/* update where to write next */
+
+    /* update pointers after writing record so abort is guaranteed to
+     * see which records need reverting */
+    for (i = 0; i < lvl; i++) {
+	/* write pointer updates */
+	/* FORWARD(updates[i], i) = newoffset; */
+	lseek(db->fd,
+	      PTR(db->map_base + updateoffsets[i], i) - db->map_base,
+	      SEEK_SET);
+	retry_write(db->fd, (char *) &netnewoffset, 4);
 	}
 
 	if (be_paranoid) {
-	    assert(myconsistent(db, *tid, 1) == 0);
-	}
-    } else {
+	assert(myconsistent(db, tid, 1) == 0);
+	}
+
+    if (localtid) {
 	/* commit the store, which releases the write lock */
-	mycommit(db, tp);
+	r = mycommit(db, tid);
+	if (r) return r;
     }
     
     return 0;
@@ -1250,52 +1353,57 @@
 
 int mydelete(struct db *db, 
 	     const char *key, int keylen,
-	     struct txn **tid, int force __attribute__((unused)))
+	     struct txn **tidptr, int force __attribute__((unused)))
 {
     const char *ptr;
     int delrectype = htonl(DELETE);
     int updateoffsets[SKIPLIST_MAXLEVEL];
     bit32 offset;
     bit32 writebuf[2];
-    struct txn t, *tp;
-    int i;
+    struct txn *tid, *localtid = NULL;
+    unsigned i;
     int r;
 
-    if (!tid || !*tid) {
-	/* grab a r/w lock */
-	if ((r = write_lock(db, NULL)) < 0) {
-	    return r;
-	}
-
-	/* is this file safe to append to?
-	 * 
-	 * If it isn't, we need to run recovery. */
-	if(SAFE_TO_APPEND(db))
-	{
-	    if((r = recovery(db, RECOVERY_FORCE | RECOVERY_CALLER_LOCKED)) < 0)
+    /* not keeping the transaction, just create one local to
+     * this function */
+    if (!tidptr) {
+	tidptr = &localtid;
+	}
+
+    /* make sure we're write locked and up to date */
+    if ((r = lock_or_refresh(db, tidptr)) < 0) {
 		return r;
 	}
 
-	/* fill in t */
-	newtxn(db, &t);
-
-	tp = &t;
-    } else {
-	tp = *tid;
-	update_lock(db, tp);
-    }
+    tid = *tidptr; /* consistent naming is nice */
 
     if (be_paranoid) {
-	assert(myconsistent(db, tp, 1) == 0);
+	assert(myconsistent(db, tid, 1) == 0);
     }
 
     ptr = find_node(db, key, keylen, updateoffsets);
-    if (ptr == db->map_base ||
+    if (ptr != db->map_base &&
 	!db->compar(KEY(ptr), KEYLEN(ptr), key, keylen)) {
 	/* gotcha */
 	offset = ptr - db->map_base;
 
-	/* update pointers */
+	/* log the deletion */
+	getsyncfd(db, tid);
+	lseek(tid->syncfd, tid->logend, SEEK_SET);
+	writebuf[0] = delrectype;
+	writebuf[1] = htonl(offset);
+
+	/* update end-of-log */
+	r = retry_write(tid->syncfd, (char *) writebuf, 8);
+	if (r < 0) {
+	    syslog(LOG_ERR, "DBERROR: retry_write(): %m");
+	    myabort(db, tid);
+	    return CYRUSDB_IOERROR;
+	}
+	tid->logend += r;
+
+	/* update pointers after writing record so abort is guaranteed to
+	 * see which records need reverting */
 	for (i = 0; i < db->curlevel; i++) {
 	    int newoffset;
 
@@ -1308,32 +1416,15 @@
 		  SEEK_SET);
 	    retry_write(db->fd, (char *) &newoffset, 4);
 	}
-
-	/* log the deletion */
-	getsyncfd(db, tp);
-	lseek(tp->syncfd, tp->logend, SEEK_SET);
-	writebuf[0] = delrectype;
-	writebuf[1] = htonl(offset);
-
-	/* update end-of-log */
-	tp->logend += retry_write(tp->syncfd, (char *) writebuf, 8);
-    }
-
-    if (tid) {
-	if (!*tid) {
-	    /* return the txn structure */
-
-	    *tid = xmalloc(sizeof(struct txn));
-	    memcpy(*tid, tp, sizeof(struct txn));
-	    (*tid)->ismalloc = 1;
 	}
 
 	if (be_paranoid) {
-	    assert(myconsistent(db, *tid, 1) == 0);
-	}
-    } else {
+	assert(myconsistent(db, tid, 1) == 0);
+	}
+
+    if (localtid) {
 	/* commit the store, which releases the write lock */
-	mycommit(db, tp);
+	mycommit(db, tid);
     }
 
     return 0;
@@ -1345,6 +1436,8 @@
     int r = 0;
 
     assert(db && tid);
+
+    assert(db->current_txn == tid);
 
     update_lock(db, tid);
 
@@ -1384,13 +1477,16 @@
     }
 
  done:
+    if (!r)
+	db->current_txn = NULL;
+
     /* consider checkpointing */
     if (!r && tid->logend > (2 * db->logstart + SKIPLIST_MINREWRITE)) {
 	r = mycheckpoint(db, 1);
     }
     
     if (be_paranoid) {
-	assert(myconsistent(db, NULL, 1) == 0);
+	assert(myconsistent(db, db->current_txn, 1) == 0);
     }
 
     if (r) {
@@ -1411,11 +1507,9 @@
         /* must close this after releasing the lock */
         closesyncfd(db, tid);
 
-        /* free tid if needed */
-        if (tid->ismalloc) {
+        /* free tid */
             free(tid);
         }
-    }
 
     return r;
 }
@@ -1425,10 +1519,15 @@
     const char *ptr;
     int updateoffsets[SKIPLIST_MAXLEVEL];
     bit32 offset;
-    int i;
+    unsigned i;
     int r = 0;
 
     assert(db && tid);
+    
+    assert(db->current_txn == tid);
+
+    /* update the mmap so we can see the log entries we need to remove */
+    update_lock(db, tid);
     
     /* look at the log entries we've written, and undo their effects */
     while (tid->logstart != tid->logend) {
@@ -1511,9 +1610,9 @@
     closesyncfd(db, tid);
 
     /* free the tid */
-    if (tid->ismalloc) {
 	free(tid);
-    }
+
+    db->current_txn = NULL;
 
     return 0;
 }
@@ -1531,7 +1630,7 @@
     bit32 offset;
     int r = 0;
     int iorectype = htonl(INORDER);
-    int i;
+    unsigned i;
     time_t start = time(NULL);
 
     /* grab write lock (could be read but this prevents multiple checkpoints
@@ -1541,9 +1640,13 @@
 	if (r < 0) return r;
     } else {
 	/* we need the latest and greatest data */
+        assert(db->is_open && db->lock_status == WRITELOCKED);
 	map_refresh(db->fd, 0, &db->map_base, &db->map_len, MAP_UNKNOWN_LEN,
 		    db->fname, 0);
     }
+
+    /* can't be in a transaction */
+    assert(db->current_txn == NULL);
 
     if ((r = myconsistent(db, NULL, 1)) < 0) {
 	syslog(LOG_ERR, "db %s, inconsistent pre-checkpoint, bailing out",
@@ -1562,6 +1665,15 @@
 	return CYRUSDB_IOERROR;
     }
 
+    /* truncate it just in case! */
+    r = ftruncate(db->fd, 0);
+    if (r < 0) {
+	syslog(LOG_ERR, "DBERROR: skiplist checkpoint %s: ftruncate %m", fname);
+	if (!locked) unlock(db);
+	db->fd = oldfd;
+	return CYRUSDB_IOERROR;
+    }
+
     /* write dummy record */
     if (!r) {
 	int dsize = DUMMY_SIZE(db);
@@ -1661,6 +1773,7 @@
 
     /* create the header */
     db->logstart = lseek(db->fd, 0, SEEK_END);
+    db->last_recovery = time(NULL);
     r = write_header(db);
 
     /* sync new file */
@@ -1671,6 +1784,7 @@
     
     if (!r) {
 	/* get new lock */
+	db->lock_status = UNLOCKED; /* well, the new file is... */
 	r = write_lock(db, fname);
     }
 
@@ -1742,7 +1856,7 @@
 static int dump(struct db *db, int detail __attribute__((unused)))
 {
     const char *ptr, *end;
-    int i;
+    unsigned i;
 
     read_lock(db);
 
@@ -1808,12 +1922,14 @@
     const char *ptr;
     bit32 offset;
 
+    assert(db->current_txn == tid); /* could both be null */
+
     if (!locked) read_lock(db);
     else if (tid) update_lock(db, tid);
 
     offset = FORWARD(db->map_base + DUMMY_OFFSET(db), 0);
     while (offset != 0) {
-	int i;
+	unsigned i;
 
 	ptr = db->map_base + offset;
 
@@ -1824,8 +1940,9 @@
 		fprintf(stdout, 
 			"skiplist inconsistent: %04X: ptr %d is %04X; "
 			"eof is %04X\n", 
-			ptr - db->map_base,
+			(unsigned int) (ptr - db->map_base),
 			i, offset, (unsigned int) db->map_size);
+		if (!locked) unlock(db);
 		return CYRUSDB_INTERNAL;
 	    }
 
@@ -1839,9 +1956,10 @@
 		    fprintf(stdout, 
 			    "skiplist inconsistent: %04X: ptr %d is %04X; "
 			    "db->compar() = %d\n", 
-			    ptr - db->map_base,
+			    (unsigned int) (ptr - db->map_base),
 			    i,
 			    offset, cmp);
+		    if (!locked) unlock(db);
 		    return CYRUSDB_INTERNAL;
 		}
 	    }
@@ -1861,13 +1979,14 @@
     const char *ptr, *keyptr;
     int updateoffsets[SKIPLIST_MAXLEVEL];
     bit32 offset, offsetnet, myoff = 0;
-    int r = 0;
+    int r = 0, need_checkpoint = 0;
     time_t start = time(NULL);
-    int i;
+    unsigned i;
 
     if (!(flags & RECOVERY_CALLER_LOCKED) && (r = write_lock(db, NULL)) < 0) {
 	return r;
     }
+    assert(db->is_open && db->lock_status == WRITELOCKED);
 
     if ((r = read_header(db)) < 0) {
 	unlock(db);
@@ -1882,6 +2001,9 @@
 	return 0;
     }
 
+    /* can't run recovery inside a txn */
+    assert(db->current_txn == NULL);
+
     db->listsize = 0;
 
     ptr = DUMMY_PTR(db);
@@ -1926,20 +2048,13 @@
     
     /* reset the data that was written INORDER by the last checkpoint */
     offset = DUMMY_OFFSET(db) + DUMMY_SIZE(db);
-    while (!r && (offset < (bit32) db->logstart)) {
+    while (!r && (offset < db->map_size)
+	      && TYPE(db->map_base + offset) == INORDER) {
 	ptr = db->map_base + offset;
 	offsetnet = htonl(offset);
 
 	db->listsize++;
 
-	/* make sure this is INORDER */
-	if (TYPE(ptr) != INORDER) {
-	    syslog(LOG_ERR, "DBERROR: skiplist recovery: %04X should be INORDER",
-		   offset);
-	    r = CYRUSDB_IOERROR;
-	    continue;
-	}
-	    
 	/* xxx check \0 fill on key */
 
 	/* xxx check \0 fill on data */
@@ -1980,6 +2095,12 @@
 	}
     }
 
+    if (offset != db->logstart) {
+	syslog(LOG_NOTICE, "skiplist recovery %s: incorrect logstart %04X changed to %04X", 
+	       db->fname, db->logstart, offset);
+	db->logstart = offset; /* header will be committed later */
+    }
+
     /* zero out the remaining pointers */
     if (!r) {
 	for (i = 0; !r && i < db->maxlevel; i++) {
@@ -2013,6 +2134,19 @@
 		    db->fname, 0);
 
 	ptr = db->map_base + offset;
+
+	/* bugs in recovery truncates could have left some bogus zeros here */
+	if (TYPE(ptr) == 0) {
+	    int orig = offset;
+	    while (TYPE(ptr) == 0 && offset < db->map_size) {
+		offset += 4;
+		ptr = db->map_base + offset;
+	    }
+	    syslog(LOG_ERR, "skiplist recovery %s: skipped %d bytes of zeros at %04X",
+			    db->fname, offset - orig, orig);
+	    need_checkpoint = 1;
+	}
+
 	offsetnet = htonl(offset);
 
 	/* if this is a commit, we've processed everything in this txn */
@@ -2059,6 +2193,10 @@
 		       db->fname);
 		r = CYRUSDB_IOERROR;
 	    }
+
+	    /* set the map size back as well */
+	    db->map_size = offset;
+
 	    break;
 	}
 
@@ -2077,7 +2215,9 @@
 	    myoff = ntohl(*((bit32 *)(ptr + 4)));
 	    p = db->map_base + myoff;
 	    keyptr = find_node(db, KEY(p), KEYLEN(p), updateoffsets);
-	    if (keyptr == db->map_base) {
+	    if (keyptr == db->map_base ||
+		db->compar(KEY(p), KEYLEN(p), KEY(keyptr), KEYLEN(keyptr))) {
+		/* didn't find exactly this node */
 		keyptr = NULL;
 	    }
 	}
@@ -2102,23 +2242,23 @@
 	/* otherwise if DELETE, throw an error */
 	} else if (TYPE(ptr) == DELETE) {
 	    syslog(LOG_ERR, 
-		   "DBERROR: skiplist recovery %s: DELETE at %04X doesn't exist",
+		   "DBERROR: skiplist recovery %s: DELETE at %04X doesn't exist, skipping",
 		   db->fname, offset);
-	    r = CYRUSDB_IOERROR;
-
-	/* otherwise if ADD & found key, throw an error */
-	} else if (TYPE(ptr) == ADD && keyptr) {
-	    syslog(LOG_ERR, 
-		   "DBERROR: skiplist recovery %s: ADD at %04X exists", 
-		   db->fname, offset);
-	    r = CYRUSDB_IOERROR;
+	    need_checkpoint = 1;
 
 	/* otherwise insert it */
 	} else if (TYPE(ptr) == ADD) {
 	    unsigned int lvl;
 	    bit32 newoffsets[SKIPLIST_MAXLEVEL];
 
+	    if (keyptr) {
+		syslog(LOG_ERR, 
+		       "DBERROR: skiplist recovery %s: ADD at %04X exists, replacing", 
+		       db->fname, offset);
+		need_checkpoint = 1;
+	    } else {
 	    db->listsize++;
+	    }
 	    offsetnet = htonl(offset);
 
 	    lvl = LEVEL(ptr);
@@ -2128,10 +2268,36 @@
 		       db->fname, lvl, SKIPLIST_MAXLEVEL);
 		r = CYRUSDB_IOERROR;
 	    } else {
+		/* NOTE - in the bogus case where a record with the same key already
+		 * exists, there are three possible cases:
+		 * lvl == LEVEL(keyptr)
+		 *    * trivial: all to me, all mine to keyptr's FORWARD
+		 * lvl > LEVEL(keyptr)	 -
+		 *    * all updateoffsets values should point to me
+		 *    * up until LEVEL(keyptr) set to keyptr's next values
+		 *      (updateoffsets[i] should be keyptr in these cases)
+		 *      then point all my higher pointers are updateoffsets[i]'s
+		 *      FORWARD instead.
+		 * lvl < LEVEL(keyptr)
+		 *    * updateoffsets values up to lvl should point to me
+		 *    * all mine should point to keyptr's next values
+		 *    * from lvl up, all updateoffsets[i] should point to
+		 *      FORWARD(keyptr, i) instead.
+		 *
+		 * All of this fully unstitches keyptr from the chain and stitches
+		 * the current node in, regardless of height difference.  Man what
+		 * a pain!
+		 */
 		for (i = 0; i < lvl; i++) {
 		    /* set our next pointers */
+		    if (keyptr && i < LEVEL(keyptr)) {
+                        /* need to replace the matching record key */
+			newoffsets[i] = 
+			    htonl(FORWARD(keyptr, i));
+		    } else {
 		    newoffsets[i] = 
 			htonl(FORWARD(db->map_base + updateoffsets[i], i));
+		    }
 		    
 		    /* replace 'updateoffsets' to point to me */
 		    lseek(db->fd, 
@@ -2142,6 +2308,18 @@
 		/* write out newoffsets */
 		lseek(db->fd, FIRSTPTR(ptr) - db->map_base, SEEK_SET);
 		retry_write(db->fd, (char *) newoffsets, 4 * lvl);
+                
+		if (keyptr && lvl < LEVEL(keyptr)) {
+		    bit32 newoffsetnet;
+		    for (i = lvl; i < LEVEL(keyptr); i++) {
+			newoffsetnet = htonl(FORWARD(keyptr, i));
+			/* replace 'updateoffsets' to point onwards */
+			lseek(db->fd, 
+			      PTR(db->map_base + updateoffsets[i], i) - db->map_base,
+			      SEEK_SET);
+			retry_write(db->fd, (char *) &newoffsetnet, 4);
+		    }
+		}
 	    }
 	/* can't happen */
 	} else {
@@ -2179,6 +2357,10 @@
 	       "skiplist: recovered %s (%d record%s, %ld bytes) in %d second%s",
 	       db->fname, db->listsize, db->listsize == 1 ? "" : "s", 
 	       db->map_size, diff, diff == 1 ? "" : "s"); 
+    }
+
+    if (!r && need_checkpoint) {
+	r = mycheckpoint(db, 1);
     }
 
     if(r || !(flags & RECOVERY_CALLER_LOCKED)) {

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_sql.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_sql.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_sql.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/cyrusdb_sql.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,880 @@
+/*  cyrusdb_sql: SQL db backends
+ *
+ * Copyright (c) 1998-2004 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 at 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.
+ */
+
+/* $Id: cyrusdb_sql.c,v 1.1 2008/07/30 16:03:38 murch Exp $ */
+
+#include <config.h>
+
+#include <syslog.h>
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "cyrusdb.h"
+#include "exitcodes.h"
+#include "libcyr_cfg.h"
+#include "xmalloc.h"
+
+extern void fatal(const char *, int);
+
+typedef int exec_cb(void *rock,
+		    const char *key, int keylen,
+		    const char *data, int datalen);
+
+typedef struct sql_engine {
+    const char *name;
+    const char *binary_type;
+    void *(*sql_open)(char *host, char *port, int usessl,
+		      const char *user, const char *password,
+		      const char *database);
+    char *(*sql_escape)(void *conn, char **to,
+			const char *from, size_t fromlen);
+    int (*sql_begin_txn)(void *conn);
+    int (*sql_commit_txn)(void *conn);
+    int (*sql_rollback_txn)(void *conn);
+    int (*sql_exec)(void *conn, const char *cmd, exec_cb *cb, void *rock);
+    void (*sql_close)(void *conn);
+} sql_engine_t;
+
+struct db {
+    void *conn;     /* connection to database */
+    char *table;    /* table that we are operating on */
+    char *esc_key;  /* allocated buffer for escaped key */
+    char *esc_data; /* allocated buffer for escaped data */
+    char *data;     /* allocated buffer for fetched data */
+};
+
+struct txn {
+    char *lastkey;  /* allocated buffer for last SELECTed key */
+    size_t keylen;
+};
+
+static int dbinit = 0;
+static const sql_engine_t *dbengine = NULL;
+
+
+#ifdef HAVE_MYSQL
+#include <mysql.h>
+
+static void *_mysql_open(char *host, char *port, int usessl,
+			 const char *user, const char *password,
+			 const char *database)
+{
+    MYSQL *mysql;
+    
+    if (!(mysql = mysql_init(NULL))) {
+	syslog(LOG_ERR, "DBERROR: SQL backend could not execute mysql_init()");
+	return NULL;
+    }
+    
+    return mysql_real_connect(mysql, host, user, password, database,
+			      port ? strtoul(port, NULL, 10) : 0, NULL,
+			      usessl ? CLIENT_SSL : 0);
+}
+
+static char *_mysql_escape(void *conn, char **to,
+			   const char *from, size_t fromlen)
+{
+    size_t tolen;
+
+    *to = xrealloc(*to, 2 * fromlen + 1); /* +1 for NUL */
+
+    tolen = mysql_real_escape_string(conn, *to, from, fromlen);
+
+    return *to;
+}
+
+static int _mysql_exec(void *conn, const char *cmd, exec_cb *cb, void *rock)
+{
+    MYSQL_RES *result;
+    MYSQL_ROW row;
+    int len, r = 0;
+
+    syslog(LOG_DEBUG, "executing SQL cmd: %s", cmd);
+
+    len = strlen(cmd);
+    /* mysql_real_query() doesn't want a terminating ';' */
+    if (cmd[len-1] == ';') len--;
+
+    /* run the query */
+    if ((mysql_real_query(conn, cmd, len) < 0) ||
+	*mysql_error(conn)) {
+	syslog(LOG_ERR, "DBERROR: SQL query failed: %s", mysql_error(conn));
+	return CYRUSDB_INTERNAL;
+    }
+
+    /* see if we should expect some results */
+    if (!mysql_field_count(conn)) {
+	/* no results (BEGIN, COMMIT, ROLLBACK, CREATE, INSERT, UPDATE, DELETE) */
+	syslog(LOG_DEBUG, "no results from SQL cmd");
+	return 0;
+    }
+
+    /* get the results */
+    result = mysql_store_result(conn);
+    
+    /* process the results */
+    while (!r && (row = mysql_fetch_row(result))) {
+	unsigned long *length = mysql_fetch_lengths(result);
+	r = cb(rock, row[0], length[0], row[1], length[1]);
+    }
+
+    /* free result */
+    mysql_free_result(result);
+    
+    return r;
+}
+
+static int _mysql_begin_txn(void *conn)
+{
+    return _mysql_exec(conn,
+#if MYSQL_VERSION_ID >= 40011
+		       "START TRANSACTION",
+#else
+		       "BEGIN",
+#endif
+		       NULL, NULL);
+}
+
+static int _mysql_commit_txn(void *conn)
+{
+    return _mysql_exec(conn, "COMMIT", NULL, NULL);
+}
+
+static int _mysql_rollback_txn(void *conn)
+{
+    return _mysql_exec(conn, "ROLLBACK", NULL, NULL);
+}
+
+static void _mysql_close(void *conn)
+{
+    mysql_close(conn);
+}
+#endif /* HAVE_MYSQL */
+
+
+#ifdef HAVE_PGSQL
+#include <libpq-fe.h>
+
+#define sql_max(a, b) ((a) > (b) ? (a) : (b))
+#define sql_len(input) ((input) ? strlen(input) : 0)
+#define sql_exists(input) ((input) && (*input))
+
+static void *_pgsql_open(char *host, char *port, int usessl,
+			 const char *user, const char *password,
+			 const char *database)
+{
+    PGconn *conn = NULL;
+    char *conninfo, *p;
+
+    /* create the connection info string */
+    /* The 64 represents the number of characters taken by
+     * the keyword tokens, plus a small pad
+     */
+    p = conninfo = xzmalloc(64 + sql_len(host) + sql_len(port)
+			   + sql_len(user) + sql_len(password)
+			   + sql_len(database));
+
+    /* add each term that exists */
+    if (sql_exists(host)) p += sprintf(p, " host='%s'", host);
+    if (sql_exists(port)) p += sprintf(p, " port='%s'", port);
+    if (sql_exists(user)) p += sprintf(p, " user='%s'", user);
+    if (sql_exists(password)) p += sprintf(p, " password='%s'", password);
+    if (sql_exists(database)) p += sprintf(p, " dbname='%s'", database);
+    p += sprintf(p, " requiressl='%d'", usessl);
+
+    conn = PQconnectdb(conninfo);
+    free(conninfo);
+
+    if ((PQstatus(conn) != CONNECTION_OK)) {
+	syslog(LOG_ERR, "DBERROR: SQL backend: %s", PQerrorMessage(conn));
+	return NULL;
+    }
+
+    return conn;
+}
+
+static char *_pgsql_escape(void *conn __attribute__((unused)),
+			   char **to, const char *from, size_t fromlen)
+{
+    size_t tolen;
+
+    /* returned buffer MUST be freed by caller */
+    return PQescapeBytea((char *) from, fromlen, &tolen);
+}
+
+static int _pgsql_exec(void *conn, const char *cmd, exec_cb *cb, void *rock)
+{
+    PGresult *result;
+    int row_count, i, r = 0;
+    ExecStatusType status;
+
+    syslog(LOG_DEBUG, "executing SQL cmd: %s", cmd);
+
+    /* run the query */
+    result = PQexec(conn, cmd);
+
+    /* check the status */
+    status = PQresultStatus(result);
+    if (status == PGRES_COMMAND_OK) {
+	/* no results (BEGIN, COMMIT, ROLLBACK, CREATE, INSERT, UPDATE, DELETE) */
+	PQclear(result);
+	return 0;
+    }
+    else if (status != PGRES_TUPLES_OK) {
+	/* error */
+	syslog(LOG_DEBUG, "SQL backend: %s ", PQresStatus(status));
+	PQclear(result);
+	return CYRUSDB_INTERNAL;
+    }
+
+    row_count = PQntuples(result);
+    for (i = 0; !r && i < row_count; i++) {
+	char *key, *data;
+	size_t keylen, datalen;
+
+	key = PQunescapeBytea(PQgetvalue(result, i, 0), &keylen);
+	data = PQunescapeBytea(PQgetvalue(result, i, 1), &datalen);
+	r = cb(rock, key, keylen, data, datalen);
+	free(key); free(data);
+    }
+
+    /* free result */
+    PQclear(result);
+
+    return r;
+}
+
+static int _pgsql_begin_txn(void *conn)
+{
+    return _pgsql_exec(conn, "BEGIN;", NULL, NULL);
+}
+
+static int _pgsql_commit_txn(void *conn)
+{
+    return _pgsql_exec(conn, "COMMIT;", NULL, NULL);
+}
+
+static int _pgsql_rollback_txn(void *conn)
+{
+    return _pgsql_exec(conn, "ROLLBACK;", NULL, NULL);
+}
+
+static void _pgsql_close(void *conn)
+{
+    PQfinish(conn);
+}
+#endif /* HAVE_PGSQL */
+
+
+#ifdef HAVE_SQLITE
+#include <sqlite3.h>
+
+static void *_sqlite_open(char *host __attribute__((unused)),
+			  char *port __attribute__((unused)),
+			  int usessl __attribute__((unused)),
+			  const char *user __attribute__((unused)),
+			  const char *password __attribute__((unused)),
+			  const char *database)
+{
+    int rc;
+    sqlite3 *db;
+
+    rc = sqlite3_open(database, &db);
+    if (rc != SQLITE_OK) {
+	syslog(LOG_ERR, "DBERROR: SQL backend: %s", sqlite3_errmsg(db));
+	sqlite3_close(db);
+    }
+
+    return db;
+}
+
+static char *_sqlite_escape(void *conn __attribute__((unused)),
+			    char **to, const char *from, size_t fromlen)
+{
+    size_t tolen;
+#if 0
+    *to = xrealloc(*to, 2 + (257 * fromlen) / 254);
+
+    tolen = sqlite3_encode_binary(from, fromlen, *to);
+#else
+    *to = xrealloc(*to, fromlen + 1);
+    memcpy(*to, from, fromlen);
+    tolen = fromlen;
+    (*to)[tolen] = '\0';
+#endif
+    
+    return *to;
+}
+
+static int _sqlite_exec(void *conn, const char *cmd, exec_cb *cb, void *rock)
+{
+    int rc, r = 0;
+    sqlite3_stmt *stmt = NULL;
+    const char *tail;
+
+    syslog(LOG_DEBUG, "executing SQL cmd: %s", cmd);
+
+    /* compile the SQL cmd */
+    rc = sqlite3_prepare(conn, cmd, strlen(cmd), &stmt, &tail);
+    if (rc != SQLITE_OK) {
+	syslog(LOG_DEBUG, "SQL backend: %s ", sqlite3_errmsg(conn));
+	return CYRUSDB_INTERNAL;
+    }
+
+    /* process the results */
+    while (!r && (rc = sqlite3_step(stmt)) == SQLITE_ROW) {
+	const unsigned char *key = sqlite3_column_text(stmt, 0);
+	int keylen = sqlite3_column_bytes(stmt, 0);
+	const unsigned char *data = sqlite3_column_text(stmt, 1);
+	int datalen = sqlite3_column_bytes(stmt, 1);
+
+	r = cb(rock, (char *) key, keylen, (char *) data, datalen);
+    }
+
+    /* cleanup */
+    rc = sqlite3_finalize(stmt);
+    if (rc != SQLITE_OK) {
+	syslog(LOG_DEBUG, "SQL backend: %s ", sqlite3_errmsg(conn));
+	return CYRUSDB_INTERNAL;
+    }
+
+    return r;
+}
+
+static int _sqlite_begin_txn(void *conn)
+{
+    return _sqlite_exec(conn, "BEGIN TRANSACTION", NULL, NULL);
+}
+
+static int _sqlite_commit_txn(void *conn)
+{
+    return _sqlite_exec(conn, "COMMIT TRANSACTION", NULL, NULL);
+}
+
+static int _sqlite_rollback_txn(void *conn)
+{
+    return _sqlite_exec(conn, "ROLLBACK TRANSACTION", NULL, NULL);
+}
+
+static void _sqlite_close(void *conn)
+{
+    sqlite3_close(conn);
+}
+#endif /* HAVE_SQLITE */
+
+
+static const sql_engine_t sql_engines[] = {
+#ifdef HAVE_MYSQL
+    { "mysql", "BLOB", &_mysql_open, &_mysql_escape,
+      &_mysql_begin_txn, &_mysql_commit_txn, &_mysql_rollback_txn,
+      &_mysql_exec, &_mysql_close },
+#endif /* HAVE_MYSQL */
+#ifdef HAVE_PGSQL
+    { "pgsql", "BYTEA", &_pgsql_open, &_pgsql_escape,
+      &_pgsql_begin_txn, &_pgsql_commit_txn, &_pgsql_rollback_txn,
+      &_pgsql_exec, &_pgsql_close },
+#endif
+#ifdef HAVE_SQLITE
+    { "sqlite", "BLOB", &_sqlite_open, &_sqlite_escape,
+      &_sqlite_begin_txn, &_sqlite_commit_txn, &_sqlite_rollback_txn,
+      &_sqlite_exec, &_sqlite_close },
+#endif
+    { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+};
+
+
+static int init(const char *dbdir __attribute__((unused)),
+		int flags __attribute__((unused)))
+{
+    const char *engine_name;
+    int r = 0;
+
+    if (dbinit++) return 0;
+
+    engine_name = libcyrus_config_getstring(CYRUSOPT_SQL_ENGINE);
+
+    /* find the correct engine */
+    dbengine = sql_engines;
+    while (dbengine->name) {
+	if (!engine_name || !strcasecmp(engine_name, dbengine->name)) break;
+	dbengine++;
+    }
+
+    if (!dbengine->name) {
+	char errbuf[1024];
+	snprintf(errbuf, sizeof(errbuf),
+		 "SQL engine %s not supported", engine_name);
+	fatal(errbuf, EC_CONFIG);
+    }
+
+    if (!engine_name) {
+	syslog(LOG_DEBUG, "SQL backend defaulting to engine '%s'",
+	       dbengine->name);
+    }
+
+    dbinit = 1;
+
+    return r;
+}
+
+static int done(void)
+{
+    --dbinit;
+    return 0;
+}
+
+static int mysync(void)
+{
+    return 0;
+}
+
+static int myarchive(const char **fnames __attribute__((unused)),
+		     const char *dirname __attribute__((unused)))
+{
+    return 0;
+}
+
+static int myopen(const char *fname, int flags, struct db **ret)
+{
+    const char *database, *hostnames, *user, *passwd;
+    char *host_ptr, *host, *cur_host, *cur_port;
+    int usessl;
+    void *conn = NULL;
+    char *p, *table, cmd[1024];
+
+    /* make a connection to the database */
+    database = libcyrus_config_getstring(CYRUSOPT_SQL_DATABASE);
+    hostnames = libcyrus_config_getstring(CYRUSOPT_SQL_HOSTNAMES);
+    user = libcyrus_config_getstring(CYRUSOPT_SQL_USER);
+    passwd = libcyrus_config_getstring(CYRUSOPT_SQL_PASSWD);
+    usessl = libcyrus_config_getswitch(CYRUSOPT_SQL_USESSL);
+
+    /* loop around hostnames until we get a connection */
+    syslog(LOG_DEBUG, "SQL backend trying to connect to a host");
+    
+    /* create a working version of the hostnames */
+    host_ptr = hostnames ? xstrdup(hostnames) : NULL;
+
+    cur_host = host = host_ptr;
+    while (cur_host != NULL) {
+	host = strchr(host,',');
+	if (host != NULL) {  
+	    host[0] = '\0';
+
+	    /* loop till we find some text */
+	    while (!isalnum(host[0])) host++;
+	}
+	
+	syslog(LOG_DEBUG,
+	       "SQL backend trying to open db '%s' on host '%s'%s",
+	       database, cur_host, usessl ? " using SSL" : "");
+	
+	/* set the optional port */
+	if ((cur_port = strchr(cur_host, ':'))) *cur_port++ = '\0';
+	
+	conn = dbengine->sql_open(cur_host, cur_port, usessl,
+				  user, passwd, database);
+	if (conn) break;
+	
+	syslog(LOG_WARNING,
+	       "DBERROR: SQL backend could not connect to host %s", cur_host);
+	
+	cur_host = host;
+    }
+
+    if (host_ptr) free(host_ptr);
+
+    if (!conn) {
+	syslog(LOG_ERR, "DBERROR: could not open SQL database '%s'", database);
+	return CYRUSDB_IOERROR;
+    }
+
+    /* get the name of the table and CREATE it if necessary */
+
+    /* strip any path from the fname */
+    p = strrchr(fname, '/');
+    table = xstrdup(p ? ++p : fname);
+
+    /* convert '.' to '_' */
+    if ((p = strrchr(table, '.'))) *p = '_';
+
+    /* check if the table exists */
+    /* XXX is this the best way to do this? */
+    snprintf(cmd, sizeof(cmd), "SELECT * FROM %s LIMIT 0;", table);
+    if (dbengine->sql_exec(conn, cmd, NULL, NULL) &&
+	(flags & CYRUSDB_CREATE)) {
+	/* create the table */
+	snprintf(cmd, sizeof(cmd),
+		 "CREATE TABLE %s (dbkey %s NOT NULL, data %s);",
+		 table, dbengine->binary_type, dbengine->binary_type);
+	if (dbengine->sql_exec(conn, cmd, NULL, NULL)) {
+	    syslog(LOG_ERR, "DBERROR: SQL failed: %s", cmd);
+	    dbengine->sql_close(conn);
+	    return CYRUSDB_INTERNAL;
+	}
+    }
+
+    *ret = (struct db *) xzmalloc(sizeof(struct db));
+    (*ret)->conn = conn;
+    (*ret)->table = table;
+
+    return 0;
+}
+static int myclose(struct db *db)
+{
+    assert(db);
+
+    dbengine->sql_close(db->conn);
+    free(db->table);
+    if (db->esc_key) free(db->esc_key);
+    if (db->esc_data) free(db->esc_data);
+    if (db->data) free(db->data);
+    free(db);
+
+    return 0;
+}
+
+static struct txn *start_txn(struct db *db)
+{
+    /* start a transaction */
+    if (dbengine->sql_begin_txn(db->conn)) {
+	syslog(LOG_ERR, "DBERROR: failed to start txn on %s",
+	       db->table);
+	return NULL;
+    }
+    return xzmalloc(sizeof(struct txn));
+}
+
+struct select_rock {
+    int found;
+    struct txn *tid;
+    foreach_cb *goodp;
+    foreach_cb *cb;
+    void *rock;
+};
+
+static int select_cb(void *rock,
+		     const char *key, int keylen,
+		     const char *data, int datalen)
+{
+    struct select_rock *srock = (struct select_rock *) rock;
+    int r = CYRUSDB_OK;
+
+    /* if we're in a transaction, save this key */
+    if (srock->tid) {
+	srock->tid->lastkey = xrealloc(srock->tid->lastkey, keylen);
+	memcpy(srock->tid->lastkey, key, keylen);
+	srock->tid->keylen = keylen;
+    }
+
+    /* see if we want this entry */
+    if (!srock->goodp ||
+	srock->goodp(srock->rock, key, keylen, data, datalen)) {
+
+	srock->found = 1;
+
+	/* make callback */
+	if (srock->cb) r = srock->cb(srock->rock, key, keylen, data, datalen);
+    }
+
+    return r;
+}
+
+struct fetch_rock {
+    char **data;
+    int *datalen;
+};
+
+static int fetch_cb(void *rock,
+		    const char *key __attribute__((unused)),
+		    int keylen __attribute__((unused)),
+		    const char *data, int datalen)
+{
+    struct fetch_rock *frock = (struct fetch_rock *) rock;
+
+    if (frock->data) {
+	*(frock->data) = xrealloc(*(frock->data), datalen);
+	memcpy(*(frock->data), data, datalen);
+    }
+    if (frock->datalen) *(frock->datalen) = datalen;
+
+    return 0;
+}
+
+static int fetch(struct db *db, 
+		 const char *key, int keylen,
+		 const char **data, int *datalen,
+		 struct txn **tid)
+{
+    char cmd[1024], *esc_key;
+    struct fetch_rock frock = { &db->data, datalen };
+    struct select_rock srock = { 0, NULL, NULL, &fetch_cb, &frock };
+    int r;
+
+    if (data) *data = NULL;
+    if (datalen) *datalen = 0;
+
+    if (tid) {
+	if (!*tid && !(*tid = start_txn(db))) return CYRUSDB_INTERNAL;
+	srock.tid = *tid;
+    }
+
+    /* fetch the data */
+    esc_key = dbengine->sql_escape(db->conn, &db->esc_key, key, keylen);
+    snprintf(cmd, sizeof(cmd),
+	     "SELECT * FROM %s WHERE dbkey = '%s';", db->table, esc_key);
+    r = dbengine->sql_exec(db->conn, cmd, &select_cb, &srock);
+
+    if (esc_key != db->esc_key) free(esc_key);
+
+    if (r) {
+	syslog(LOG_ERR, "DBERROR: SQL failed %s", cmd);
+	if (tid) dbengine->sql_rollback_txn(db->conn);
+	return CYRUSDB_INTERNAL;
+    }
+
+    if (!srock.found) return CYRUSDB_NOTFOUND;
+
+    if (data) *data = db->data;
+
+    return 0;
+}
+
+static int foreach(struct db *db,
+		   char *prefix, int prefixlen,
+		   foreach_p *goodp,
+		   foreach_cb *cb, void *rock, 
+		   struct txn **tid)
+{
+    char cmd[1024], *esc_key = NULL;
+    struct select_rock srock = { 0, NULL, goodp, cb, rock };
+    int r;
+
+    if (tid) {
+	if (!*tid && !(*tid = start_txn(db))) return CYRUSDB_INTERNAL;
+	srock.tid = *tid;
+    }
+
+    /* fetch the data */
+    if (prefixlen) /* XXX hack for SQLite */
+	esc_key = dbengine->sql_escape(db->conn, &db->esc_key,
+				       prefix, prefixlen);
+    snprintf(cmd, sizeof(cmd),
+	     "SELECT * FROM %s WHERE dbkey LIKE '%s%%' ORDER BY dbkey;",
+	     db->table, esc_key ? esc_key : "");
+    r = dbengine->sql_exec(db->conn, cmd, &select_cb, &srock);
+
+    if (esc_key && esc_key != db->esc_key) free(esc_key);
+
+    if (r) {
+	syslog(LOG_ERR, "DBERROR: SQL failed %s", cmd);
+	if (tid) dbengine->sql_rollback_txn(db->conn);
+	return CYRUSDB_INTERNAL;
+    }
+
+    return 0;
+}
+
+static int mystore(struct db *db, 
+		   const char *key, int keylen,
+		   const char *data, int datalen,
+		   struct txn **tid, int overwrite)
+{
+    char cmd[1024], *esc_key;
+    int r = 0;
+
+    if (tid && !*tid && !(*tid = start_txn(db))) return CYRUSDB_INTERNAL;
+
+    esc_key = dbengine->sql_escape(db->conn, &db->esc_key, key, keylen);
+
+    if (!data) {
+	/* DELETE the entry */
+	snprintf(cmd, sizeof(cmd), "DELETE FROM %s WHERE dbkey = '%s';",
+		 db->table, esc_key);
+	r = dbengine->sql_exec(db->conn, cmd, NULL, NULL);
+
+	/* see if we just removed the previously SELECTed key */
+	if (!r && tid && *tid &&
+	    (*tid)->keylen == strlen(esc_key) &&
+	    !memcmp((*tid)->lastkey, esc_key, (*tid)->keylen)) {
+	    (*tid)->keylen = 0;
+	}
+    }
+    else {
+	/* INSERT/UPDATE the entry */
+	struct select_rock srock = { 0, NULL, NULL, NULL, NULL };
+
+	char *esc_data = dbengine->sql_escape(db->conn, &db->esc_data,
+					      data, datalen);
+
+	/* see if we just SELECTed this key in this transaction */
+	if (tid && *tid) {
+	    if ((*tid)->keylen == strlen(esc_key) &&
+		!memcmp((*tid)->lastkey, esc_key, (*tid)->keylen)) {
+		srock.found = 1;
+	    }
+	    srock.tid = *tid;
+	}
+
+	/* check if the entry exists */
+	if (!srock.found) {
+	    snprintf(cmd, sizeof(cmd),
+		     "SELECT * FROM %s WHERE dbkey = '%s';",
+		     db->table, esc_key);
+	    r = dbengine->sql_exec(db->conn, cmd, &select_cb, &srock);
+	}
+
+	if (!r && srock.found) {
+	    if (overwrite) {
+		/* already have this entry, UPDATE it */
+		snprintf(cmd, sizeof(cmd),
+			 "UPDATE %s SET data = '%s' WHERE dbkey = '%s';",
+			 db->table, esc_data, esc_key);
+		r = dbengine->sql_exec(db->conn, cmd, NULL, NULL);
+	    }
+	    else {
+		if (tid) dbengine->sql_rollback_txn(db->conn);
+		return CYRUSDB_EXISTS;
+	    }
+	}
+	else if (!r && !srock.found) {
+	    /* INSERT the new entry */
+	    snprintf(cmd, sizeof(cmd),
+		     "INSERT INTO %s VALUES ('%s', '%s');",
+		     db->table, esc_key, esc_data);
+	    r = dbengine->sql_exec(db->conn, cmd, NULL, NULL);
+	}
+
+	if (esc_data != db->esc_data) free(esc_data);
+    }
+
+    if (esc_key != db->esc_key) free(esc_key);
+
+    if (r) {
+	syslog(LOG_ERR, "DBERROR: SQL failed: %s", cmd);
+	if (tid) dbengine->sql_rollback_txn(db->conn);
+	return CYRUSDB_INTERNAL;
+    }
+
+    return 0;
+}
+
+static int create(struct db *db, 
+		  const char *key, int keylen,
+		  const char *data, int datalen,
+		  struct txn **tid)
+{
+    return mystore(db, key, keylen, data, datalen, tid, 0);
+}
+
+static int store(struct db *db, 
+		 const char *key, int keylen,
+		 const char *data, int datalen,
+		 struct txn **tid)
+{
+    return mystore(db, key, keylen, data, datalen, tid, 1);
+}
+
+static int delete(struct db *db, 
+		  const char *key, int keylen,
+		  struct txn **tid,
+		  int force __attribute__((unused)))
+{
+    return mystore(db, key, keylen, NULL, 0, tid, 1);
+}
+
+static int finish_txn(struct db *db, struct txn *tid, int commit)
+{
+    if (tid) {
+	int rc = commit ? dbengine->sql_commit_txn(db->conn) :
+	    dbengine->sql_rollback_txn(db->conn);
+
+	if (tid->lastkey) free(tid->lastkey);
+	free(tid);
+
+	if (rc) {
+	    syslog(LOG_ERR, "DBERROR: failed to %s txn on %s",
+		   commit ? "commit" : "abort", db->table);
+	    return CYRUSDB_INTERNAL;
+	}
+    }
+
+    return 0;
+}
+
+static int commit_txn(struct db *db, struct txn *tid)
+{
+    return finish_txn(db, tid, 1);
+}
+
+static int abort_txn(struct db *db, struct txn *tid)
+{
+    return finish_txn(db, tid, 0);
+}
+
+struct cyrusdb_backend cyrusdb_sql = 
+{
+    "sql",			/* name */
+
+    &init,
+    &done,
+    &mysync,
+    &myarchive,
+
+    &myopen,
+    &myclose,
+
+    &fetch,
+    &fetch,
+    &foreach,
+    &create,
+    &store,
+    &delete,
+
+    &commit_txn,
+    &abort_txn,
+
+    NULL,
+    NULL
+};

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/exitcodes.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/exitcodes.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/exitcodes.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/exitcodes.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* exitcodes.h -- wrapper around sysextis.h
- * $Id: exitcodes.h,v 1.5 2003/02/13 20:15:39 rjs3 Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: exitcodes.h,v 1.6 2008/03/24 17:43:08 murch Exp $
  */
 
 /* Sendmail has some weird ideas on what constitutes permenant failure.  On

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/ftruncate.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/ftruncate.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/ftruncate.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/ftruncate.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,7 @@
 /* ftruncate -- Replacement ftruncate() function
  * Does nothing
- $Id: ftruncate.c,v 1.8 2003/02/13 20:15:39 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,8 @@
  * 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.
+ *
+ * $Id: ftruncate.c,v 1.9 2008/03/24 17:43:08 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gai.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gai.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gai.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gai.h Mon Feb  9 12:49:22 2009
@@ -1,12 +1,11 @@
 /*
  * Mar  8, 2000 by Hajimu UMEMOTO <ume at mahoroba.org>
- * $Id: gai.h,v 1.6 2003/10/22 18:50:12 rjs3 Exp $
  *
  * This module is besed on ssh-1.2.27-IPv6-1.5 written by
  * KIKUCHI Takahiro <kick at kyoto.wide.ad.jp>
  */
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -22,14 +21,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -43,6 +43,8 @@
  * 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.
+ *
+ * $Id: gai.h,v 1.7 2008/03/24 17:43:08 murch Exp $
  */
 /*
  * fake library for ssh

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getaddrinfo.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getaddrinfo.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getaddrinfo.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getaddrinfo.c Mon Feb  9 12:49:22 2009
@@ -1,12 +1,11 @@
 /*
  * Mar  8, 2000 by Hajimu UMEMOTO <ume at mahoroba.org>
- * $Id: getaddrinfo.c,v 1.6 2003/10/22 18:50:12 rjs3 Exp $
  *
  * This module is besed on ssh-1.2.27-IPv6-1.5 written by
  * KIKUCHI Takahiro <kick at kyoto.wide.ad.jp>
  */
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -22,14 +21,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -43,6 +43,8 @@
  * 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.
+ *
+ * $Id: getaddrinfo.c,v 1.7 2008/03/24 17:43:08 murch Exp $
  */
 /*
  * fake library for ssh

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getdtablesize.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getdtablesize.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getdtablesize.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getdtablesize.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* getdtablesize.c -- Returns the maximum number of file descriptors allowed.
- $Id: getdtablesize.c,v 1.7 2003/02/13 20:15:40 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: getdtablesize.c,v 1.8 2008/03/24 17:43:08 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getnameinfo.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getnameinfo.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getnameinfo.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/getnameinfo.c Mon Feb  9 12:49:22 2009
@@ -1,12 +1,11 @@
 /*
  * Mar  8, 2000 by Hajimu UMEMOTO <ume at mahoroba.org>
- * $Id: getnameinfo.c,v 1.6 2003/10/22 18:50:12 rjs3 Exp $
  *
  * This module is besed on ssh-1.2.27-IPv6-1.5 written by
  * KIKUCHI Takahiro <kick at kyoto.wide.ad.jp>
  */
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -22,14 +21,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -43,6 +43,8 @@
  * 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.
+ *
+ * $Id: getnameinfo.c,v 1.7 2008/03/24 17:43:08 murch Exp $
  */
 /*
  * fake library for ssh

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/glob.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/glob.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/glob.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/glob.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* glob.c -- fast globbing routine using '*', '%', and '?'
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,11 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: glob.c,v 1.35 2008/03/24 17:43:08 murch Exp $
+ *
  * Author: Chris Newman
  * Start Date: 4/5/93
- */
-/*
- * $Id: glob.c,v 1.32 2006/11/30 17:11:22 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/glob.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/glob.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/glob.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/glob.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* glob.h -- fast globbing routine using '*', '%', and '?'
- $Id: glob.h,v 1.12 2003/02/13 20:15:40 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: glob.h,v 1.13 2008/03/24 17:43:09 murch Exp $
  *
  * Author: Chris Newman
  * Start Date: 4/5/93

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* gmtoff.h -- Get GMT offset
- $Id: gmtoff.h,v 1.6 2003/02/13 20:15:40 rjs3 Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: gmtoff.h,v 1.7 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef INCLUDED_GMTOFF_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff_gmtime.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff_gmtime.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff_gmtime.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff_gmtime.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* gmtoff_tm.c - Get offset from GMT by calling gmtime and subtracting
- $Id: gmtoff_gmtime.c,v 1.11 2003/10/22 18:50:12 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: gmtoff_gmtime.c,v 1.12 2008/03/24 17:43:09 murch Exp $
  */
+
 #include <config.h>
 
 /*

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff_tm.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff_tm.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff_tm.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/gmtoff_tm.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* gmtoff_tm.c - Get offset from GMT from the tm_gmtoff struct member
- $Id: gmtoff_tm.c,v 1.11 2006/11/30 17:11:22 murch Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: gmtoff_tm.c,v 1.12 2008/03/24 17:43:09 murch Exp $
  */
+
 #include <config.h>
 
 /*

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapoptions
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapoptions?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapoptions (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapoptions Mon Feb  9 12:49:22 2009
@@ -4,7 +4,7 @@
 /* .\" -*- nroff -*-
 .TH IMAPD.CONF 5 "Project Cyrus" CMU
 .\" 
-.\" Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+.\" Copyright (c) 1994-2008 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
@@ -20,15 +20,16 @@
 .\"
 .\" 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
+.\"    prior written permission. For permission or any 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 at andrew.cmu.edu
-.\"
+.\"      Center for Technology Transfer and Enterprise Creation
+.\"      4615 Forbes Avenue
+.\"      Suite 302
+.\"      Pittsburgh, PA  15213
+.\"      (412) 268-7393, fax: (412) 268-7395
+.\"      innovation at andrew.cmu.edu
+ *
 .\" 4. Redistributions of any form whatsoever must retain the following
 .\"    acknowledgment:
 .\"    "This product includes software developed by Computing Services
@@ -42,7 +43,8 @@
 .\" AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\" 
-.\" $Id: imapoptions,v 1.42 2007/02/07 18:58:07 murch Exp $
+.\" $Id: imapoptions,v 1.59 2008/10/08 17:18:12 wescraig Exp $
+
 .SH NAME
 imapd.conf \- IMAP configuration file
 .SH DESCRIPTION
@@ -58,6 +60,25 @@
 and \fIvalue\fR is the value that the configuration option is being
 set to.
 .PP
+Although there is no limit to the length of a line, a ``\\''
+(backslash) character may be used as the last character on a line to
+force it to continue on the next one.  No additional whitespace is
+inserted before or after the ``\\''.  Note that a line that is split
+using ``\\'' character(s) is still considered a single line.
+For example
+.IP
+\fIoption\fR:\\
+.br
+.in +1
+\fIvalue\fR1 \fIvalue\fR2 \\
+.br
+.in +1
+\fIvalue\fR3
+.PP
+is equivalent to
+.IP
+\fIoption\fR: \fIvalue\fR1 \fIvalue\fR2   \fIvalue\fR3
+.PP
 Blank lines and lines beginning with ``#'' are ignored.
 .PP
 For boolean and enumerated options, the values ``yes'', ``on'', ``t'',
@@ -100,7 +121,7 @@
    typically used on backend servers in a Murder so that users can
    subscribe to mailboxes that don't reside on their "home" server.
    This option can also be used as a workaround for IMAP clients which
-   don't play well with nonexistent or unselectable mailboxes (eg.
+   don't play well with nonexistent or unselectable mailboxes (e.g.,
    Microsoft Outlook). */
 
 { "allowanonymouslogin", 0, SWITCH }
@@ -112,8 +133,8 @@
 .PP
   Note that this command requires that SASL is compiled with APOP
   support, that the plaintext passwords are available in a SASL auxprop
-  backend (eg. sasldb), and that the system can provide enough entropy
-  (eg. from /dev/urandom) to create a challenge in the banner. */
+  backend (e.g., sasldb), and that the system can provide enough entropy
+  (e.g., from /dev/urandom) to create a challenge in the banner. */
 
 { "allownewnews", 0, SWITCH }
 /* Allow use of the NNTP NEWNEWS command.
@@ -121,7 +142,7 @@
   Note that this is a very expensive command and should only be
   enabled when absolutely necessary. */
 
-{ "allowplaintext", 1, SWITCH }
+{ "allowplaintext", 0, SWITCH }
 /* Allow the use of cleartext passwords on the wire. */
    
 { "allowusermoves", 0, SWITCH }
@@ -129,7 +150,7 @@
    or XFER.
 .PP
   Note that measures should be taken to make sure that the user being
-  moved is not logged in, and can not login during the move.  Failure
+  moved is not logged in, and cannot login during the move.  Failure
   to do so may result in the user's meta-data (seen state,
   subscriptions, etc) being corrupted or out of date. */
    
@@ -175,7 +196,7 @@
 
 { "client_timeout", 10, INT }
 /* Number of seconds to wait before returning a timeout failure when
-   performing a client connection (e.g. in a murder environment) */
+   performing a client connection (e.g., in a murder environment) */
 
 { "configdirectory", NULL, STRING }
 /* The pathname of the IMAP configuration directory.  This field is
@@ -197,13 +218,25 @@
 { "defaultpartition", "default", STRING }
 /* The partition name used by default for new mailboxes. */
 
+{ "deletedprefix", "DELETED", STRING }
+/* If "delete_mode" set to be "delayed", the prefix for the deleted
+   mailboxes hierarchy.  The hierarchy delimiter will be automatically
+   appended. */
+
+{ "delete_mode", "immediate", ENUM("immediate", "delayed") }
+/*  The manner in which mailboxes are deleted. "Immediate" mode is the
+    default behavior in which mailboxes are removed immediately.  In
+    "delayed" mode, mailboxes are renamed to a special hiearchy defined
+    by the "deletedprefix" option to be removed later by cyr_expire.
+*/
+
 { "deleteright", "c", STRING }
 /* Deprecated - only used for backwards compatibility with existing
    installations.  Lists the old RFC 2086 right which was used to
    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", "berkeley-hash", "berkeley-hash-nosync", "skiplist")}
+{ "duplicate_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql")}
 /* The cyrusdb backend to use for the duplicate delivery suppression
    and sieve. */
 
@@ -233,24 +266,30 @@
    Outlook, at the expense of a loss of performance/scalability. */
 
 { "foolstupidclients", 0, SWITCH }
-/* If enabled, only list the personal namespace when a LIST "*" is performed.
-   (it changes the request to a LIST "INBOX*" */
+/* If enabled, only list the personal namespace when a LIST "*" is performed
+   (it changes the request to a LIST "INBOX*"). */
 
 { "force_sasl_client_mech", NULL, STRING }
 /* Force preference of a given SASL mechanism for client side operations
-   (e.g. murder environments).  This is separate from (and overridden by)
+   (e.g., murder environments).  This is separate from (and overridden by)
    the ability to use the <host shortname>_mechs option to set preferred
    mechanisms for a specific host */
 
 { "fulldirhash", 0, SWITCH }
 /* If enabled, uses an improved directory hashing scheme which hashes
-   the entire username instead of using just the first letter.  This
-   changes hash algorithm used for quota and user directories and if
-   \fIhashimapspool\fR is enabled, the entire mail spool.
-.PP
-   Note that this option can NOT be changed on a live system.  The
+   on the entire username instead of using just the first letter as
+   the hash.  This changes hash algorithm used for quota and user
+   directories and if \fIhashimapspool\fR is enabled, the entire mail
+   spool.
+.PP
+   Note that this option CANNOT be changed on a live system.  The
    server must be quiesced and then the directories moved with the
    \fBrehash\fR utility. */
+
+{ "guid_mode", "off", ENUM("off", "sha1")}
+/* The method used to calculate Globally Unique IDentifiers of
+   messages (used by the replication engine).  The "sha1" method
+   calculates a SHA1 hash of the entire message */
 
 { "hashimapspool", 0, SWITCH }
 /* If enabled, the partitions will also be hashed, in addition to the
@@ -281,7 +320,7 @@
 { "imapidlepoll", 60, INT }
 /* The interval (in seconds) for polling for mailbox changes and
    ALERTs while running the IDLE command.  This option is used when
-   idled is not enabled or can not be contacted.  The minimum value is
+   idled is not enabled or cannot be contacted.  The minimum value is
    1.  A value of 0 will disable IDLE. */
 
 { "imapidresponse", 1, SWITCH }
@@ -295,7 +334,7 @@
    Using userid+ (with an empty namespace) will list only subscribed
    mailboxes. */ 
 
-{ "implicit_owner_rights", "lca", STRING }
+{ "implicit_owner_rights", "lkxa", STRING }
 /* The implicit Access Control List (ACL) for the owner of a mailbox. */
 
 # Commented out - there's no such thing as "@include", but we need
@@ -457,7 +496,7 @@
    set to 3. */
 
 { "lmtp_downcase_rcpt", 0, SWITCH }
-/* If enabled, lmtpd will convert the recipient address to lowercase
+/* If enabled, lmtpd will convert the recipient addresses to lowercase
    (up to a '+' character, if present). */
 
 { "lmtp_fuzzy_mailbox_match", 0, SWITCH }
@@ -503,6 +542,12 @@
 /* Maximum incoming LMTP message size.  If non-zero, lmtpd will reject
    messages larger than \fImaxmessagesize\fR bytes.  If set to 0, this
    will allow messages of any size (the default). */
+
+{ "maxquoted", 131072, INT }
+/* Maximum size of a single quoted string for the parser.  Default 128k */
+
+{ "maxword", 131072, INT }
+/* Maximum size of a single word for the parser.  Default 128k */
 
 { "mboxkey_db", "skiplist", STRINGLIST("berkeley", "skiplist") }
 /* The cyrusdb backend to use for mailbox keys. */
@@ -543,7 +588,7 @@
 { "md5_dir", NULL, STRING }
 /* Top level directory for MD5 store manipulated by make_md5. File
    structure within this directory is one file for each user on the system,
-   hashed on the first letter of the userid (e.g: /var/imap/md5/d/dpc22). */
+   hashed on the first letter of the userid (e.g., /var/imap/md5/d/dpc22). */
 
 { "md5_user_map", NULL, STRING }
 /* Map file (cdb) to allow partial make_md5 runs. Maps username to UID */
@@ -694,7 +739,7 @@
    connections before the minpoll restriction is triggered.  Additionally,
    one padding entry is recovered every \fIpopminpoll\fR minutes.
    This allows for the occasional polling rate faster than popminpoll, 
-   (i.e. for clients that require a send/receive to send mail) but still 
+   (i.e., for clients that require a send/receive to send mail) but still 
    enforces the rate long-term.  Default is 1 (disabled).
 .br
 .sp
@@ -748,6 +793,10 @@
    connections that these referrals would cause, thus resulting in a higher
    authentication load on the respective backend server. */
 
+{ "proxyd_disable_mailbox_referrals", 0, SWITCH }
+/* Set to true to disable the use of mailbox-referrals on the
+   proxy servers. */
+
 { "proxyservers", NULL, STRING }
 /* A list of users and groups that are allowed to proxy for other
    users, separated by spaces.  Any user listed in this will be
@@ -777,7 +826,7 @@
    strip the default realm from the userid (this does not affect the stripping
    of realms specified by the afspts_localrealms option) */
 
-{ "quota_db", "quotalegacy", STRINGLIST("flat", "berkeley", "berkeley-hash", "skiplist", "quotalegacy")}
+{ "quota_db", "quotalegacy", STRINGLIST("flat", "berkeley", "berkeley-hash", "skiplist", "sql", "quotalegacy")}
 /* The cyrusdb backend to use for quotas. */
 
 { "quotawarn", 90, INT }
@@ -785,7 +834,7 @@
    warnings. */
 
 { "quotawarnkb", 0, INT }
-/* The maximum amount of free space (in kB) in which to give a quota
+/* The maximum amount of free space (in kB) at which to give a quota
    warning (if this value is 0, or if the quota is smaller than this
    amount, than warnings are always given). */
 
@@ -845,6 +894,22 @@
    IMAP and LMTP daemons. If it is unset, then the result returned
    from gethostname(2) is used. */
    
+{ "serverinfo", "on", ENUM("off", "min", "on") }
+/* The server information to display in the greeting and capability
+   responses. Information is displayed as follows:
+.IP
+   "off" = no server information in the greeting or capabilities
+.br
+   "min" = \fIservername\fR in the greeting; no server information in the capabilities
+.br
+   "on" = \fIservername\fR and product version in the greeting;
+product version in the capabilities */
+
+{ "sha1_dir", NULL, STRING }
+/* Top level directory for SHA1 store manipulated by make_sha1. File
+   structure within this directory is one file for each user on the system,
+   hashed on the first letter of the userid (e.g: /var/imap/sha1/d/dpc22). */
+
 { "sharedprefix", "Shared Folders", STRING }
 /* If using the alternate IMAP namespace, the prefix for the shared
    namespace.  The hierarchy delimiter will be automatically appended. */
@@ -860,7 +925,7 @@
    previously installed script will be unaffected by this option and
    will continue to execute regardless of the extensions used.  This
    option has no effect on options that are disabled at compile time
-   (e.g. "regex"). */
+   (e.g., "regex"). */
 
 { "sieve_maxscriptsize", 32, INT }
 /* Maximum size (in kilobytes) any sieve script can be, enforced at
@@ -870,6 +935,19 @@
 /* Maximum number of sieve scripts any user may have, enforced at
    submission by timsieved(8). */
    
+{ "sieve_utf8fileinto", 0, SWITCH }
+/* If enabled, the sieve engine expects folder names for the
+   \fIfileinto\fR action in scripts to use UTF8 encoding.  Otherwise,
+   modified UTF7 encoding should be used. */ 
+
+{ "sieve_sasl_send_unsolicited_capability", 0, SWITCH }
+/* If enabled, timsieved will emit a capability response after a successful
+   SASL authentication, per draft-martin-managesieve-12.txt . */
+
+{ "sieve_sasl_expect_unsolicited_capability", 0, SWITCH }
+/* If enabled, timsieved will expect a capability response after a successful
+   SASL authentication, per draft-martin-mangesieve-12.txt . */
+
 { "sievedir", "/usr/sieve", STRING }
 /* If sieveusehomedir is false, this directory is searched for Sieve
    scripts. */
@@ -897,6 +975,24 @@
 /* If enabled, lmtpd returns temporary failures if the client does not
    successfully authenticate.  Otherwise lmtpd returns permanent failures
    (causing the mail to bounce immediately). */
+
+{ "sql_database", NULL, STRING }
+/* Name of the database which contains the cyrusdb table(s). */
+
+{ "sql_engine", NULL, STRINGLIST("mysql", "pgsql", "sqlite") }
+/* Name of the SQL engine to use. */
+
+{ "sql_hostnames", "", STRING }
+/* Comma separated list of SQL servers (in host[:port] format). */
+
+{ "sql_passwd", NULL, STRING }
+/* Password to use for authentication to the SQL server. */
+
+{ "sql_user", NULL, STRING }
+/* Username to use for authentication to the SQL server. */
+
+{ "sql_usessl", 0, SWITCH }
+/* If enabled, a secure connection will be made to the SQL server. */
 
 { "srvtab", "", STRING }
 /* The pathname of \fIsrvtab\fR file containing the server's private
@@ -912,6 +1008,12 @@
 { "subscription_db", "flat", STRINGLIST("flat", "berkeley", "berkeley-hash", "skiplist")}
 /* The cyrusdb backend to use for the subscriptions list. */
 
+{ "statuscache", 0, SWITCH }
+/* Enable/disable the imap status cache. */
+
+{ "statuscache_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist") }
+/* The cyrusdb backend to use for the imap status cache. */
+
 { "sync_authname", NULL, STRING }
 /* The authentication name to use when authenticating to a sync server. */
 
@@ -929,11 +1031,6 @@
    and nntpd(8).  The log {configdirectory}/sync/log is used by
    sync_client(8) for "rolling" replication. */
 
-{ "sync_machineid", -1, INT }
-/* Machine ID of this server which must be unique within a cluster.
-   Any negative number, the default, will disable the use of UUIDs for
-   replication. */
-
 { "sync_password", NULL, STRING }
 /* The default password to use when authenticating to a sync server. */
 
@@ -964,10 +1061,10 @@
 
 { "tls_ca_path", NULL, STRING }
 /* Path to directory with certificates of CAs.  This directory must
-   have filenames with the hashed value of the certificate (see
+   have filenames with the hashed value of the certificates (see
    openssl(XXX)). */
 
-{ "tlscache_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist")}
+{ "tlscache_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "berkeley-hash", "berkeley-hash-nosync", "skiplist", "sql")}
 /* The cyrusdb backend to use for the TLS cache. */
 
 { "tls_cert_file", NULL, STRING }
@@ -994,7 +1091,7 @@
 /* The umask value used by various Cyrus IMAP programs. */
 
 { "username_tolower", 1, SWITCH }
-/* Convert usernames to all lowercase before login/authenticate.  This
+/* Convert usernames to all lowercase before login/authentication.  This
    is useful with authentication backends which ignore case during
    username lookups (such as LDAP).  */
 

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapopts.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapopts.c?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapopts.c (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapopts.c Mon Feb  9 12:49:22 2009
@@ -1,0 +1,248 @@
+/* auto-generated by config2header 1.15 */
+
+/* DO NOT EDIT */
+
+/* THIS FILE AUTOMATICALLY GENERATED BY config2header 1.15 */
+
+#include <config.h>
+
+#include <sys/types.h>
+
+#ifdef HAVE_UNISTD_H
+
+#include <unistd.h>
+
+#endif
+
+#include <syslog.h>
+
+#include <stdlib.h>
+
+#include <string.h>
+
+#include "imapopts.h"
+
+
+
+struct imapopt_s imapopts[] =
+
+{
+
+  { IMAPOPT_ZERO, "", 0, { NULL }, OPT_NOTOPT, {  { NULL, IMAP_ENUM_ZERO } } },
+
+  { IMAPOPT_ADMINS, "admins", 0, {(void *)("")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_AFSPTS_LOCALREALMS, "afspts_localrealms", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_AFSPTS_MYCELL, "afspts_mycell", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_ALLOWALLSUBSCRIBE, "allowallsubscribe", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_ALLOWANONYMOUSLOGIN, "allowanonymouslogin", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_ALLOWAPOP, "allowapop", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_ALLOWNEWNEWS, "allownewnews", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_ALLOWPLAINTEXT, "allowplaintext", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_ALLOWUSERMOVES, "allowusermoves", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_ALTNAMESPACE, "altnamespace", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_ANNOTATION_DB, "annotation_db", 0, {(void*)("skiplist")}, OPT_STRINGLIST, { { "berkeley" , IMAP_ENUM_ZERO }, { "berkeley-hash" , IMAP_ENUM_ZERO }, { "skiplist" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_ANYONEUSERACL, "anyoneuseracl", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_AUTH_MECH, "auth_mech", 0, {(void*)("unix")}, OPT_STRINGLIST, { { "unix" , IMAP_ENUM_ZERO }, { "pts" , IMAP_ENUM_ZERO }, { "krb" , IMAP_ENUM_ZERO }, { "krb5" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_AUTOCREATEQUOTA, "autocreatequota", 0, {(void*)0}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_BERKELEY_CACHESIZE, "berkeley_cachesize", 0, {(void*)512}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_BERKELEY_LOCKS_MAX, "berkeley_locks_max", 0, {(void*)50000}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_BERKELEY_TXNS_MAX, "berkeley_txns_max", 0, {(void*)100}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_CLIENT_TIMEOUT, "client_timeout", 0, {(void*)10}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_CONFIGDIRECTORY, "configdirectory", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_DEBUG_COMMAND, "debug_command", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_DEFAULTACL, "defaultacl", 0, {(void *)("anyone lrs")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_DEFAULTDOMAIN, "defaultdomain", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_DEFAULTPARTITION, "defaultpartition", 0, {(void *)("default")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_DELETEDPREFIX, "deletedprefix", 0, {(void *)("DELETED")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_DELETE_MODE, "delete_mode", 0, {(void *)(IMAP_ENUM_DELETE_MODE_IMMEDIATE)}, OPT_ENUM, { { "immediate" , IMAP_ENUM_DELETE_MODE_IMMEDIATE }, { "delayed" , IMAP_ENUM_DELETE_MODE_DELAYED },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_DELETERIGHT, "deleteright", 0, {(void *)("c")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_DUPLICATE_DB, "duplicate_db", 0, {(void*)("berkeley-nosync")}, OPT_STRINGLIST, { { "berkeley" , IMAP_ENUM_ZERO }, { "berkeley-nosync" , IMAP_ENUM_ZERO }, { "berkeley-hash" , IMAP_ENUM_ZERO }, { "berkeley-hash-nosync" , IMAP_ENUM_ZERO }, { "skiplist" , IMAP_ENUM_ZERO }, { "sql" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_DUPLICATESUPPRESSION, "duplicatesuppression", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_EXPUNGE_MODE, "expunge_mode", 0, {(void *)(IMAP_ENUM_EXPUNGE_MODE_IMMEDIATE)}, OPT_ENUM, { { "immediate" , IMAP_ENUM_EXPUNGE_MODE_IMMEDIATE }, { "delayed" , IMAP_ENUM_EXPUNGE_MODE_DELAYED },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_FLUSHSEENSTATE, "flushseenstate", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_FOOLSTUPIDCLIENTS, "foolstupidclients", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_FORCE_SASL_CLIENT_MECH, "force_sasl_client_mech", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_FULLDIRHASH, "fulldirhash", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_GUID_MODE, "guid_mode", 0, {(void *)(IMAP_ENUM_GUID_MODE_OFF)}, OPT_ENUM, { { "off" , IMAP_ENUM_GUID_MODE_OFF }, { "sha1" , IMAP_ENUM_GUID_MODE_SHA1 },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_HASHIMAPSPOOL, "hashimapspool", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_IDLESOCKET, "idlesocket", 0, {(void *)("{configdirectory}/socket/idle")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_IGNOREREFERENCE, "ignorereference", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_IMAPIDLEPOLL, "imapidlepoll", 0, {(void*)60}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_IMAPIDRESPONSE, "imapidresponse", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_IMAPMAGICPLUS, "imapmagicplus", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_IMPLICIT_OWNER_RIGHTS, "implicit_owner_rights", 0, {(void *)("lkxa")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_IMPROVED_MBOXLIST_SORT, "improved_mboxlist_sort", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_AUTHZ, "ldap_authz", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_BASE, "ldap_base", 0, {(void *)("")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_BIND_DN, "ldap_bind_dn", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_DEREF, "ldap_deref", 0, {(void*)("never")}, OPT_STRINGLIST, { { "search" , IMAP_ENUM_ZERO }, { "find" , IMAP_ENUM_ZERO }, { "always" , IMAP_ENUM_ZERO }, { "never" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_FILTER, "ldap_filter", 0, {(void *)("(uid=%u)")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_GROUP_BASE, "ldap_group_base", 0, {(void *)("")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_GROUP_FILTER, "ldap_group_filter", 0, {(void *)("(cn=%u)")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_GROUP_SCOPE, "ldap_group_scope", 0, {(void*)("sub")}, OPT_STRINGLIST, { { "sub" , IMAP_ENUM_ZERO }, { "one" , IMAP_ENUM_ZERO }, { "base" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_ID, "ldap_id", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_MECH, "ldap_mech", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_MEMBER_ATTRIBUTE, "ldap_member_attribute", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_MEMBER_BASE, "ldap_member_base", 0, {(void *)("")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_MEMBER_FILTER, "ldap_member_filter", 0, {(void *)("(member=%D)")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_MEMBER_METHOD, "ldap_member_method", 0, {(void*)("attribute")}, OPT_STRINGLIST, { { "attribute" , IMAP_ENUM_ZERO }, { "filter" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_MEMBER_SCOPE, "ldap_member_scope", 0, {(void*)("sub")}, OPT_STRINGLIST, { { "sub" , IMAP_ENUM_ZERO }, { "one" , IMAP_ENUM_ZERO }, { "base" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_PASSWORD, "ldap_password", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_REALM, "ldap_realm", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_REFERRALS, "ldap_referrals", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_RESTART, "ldap_restart", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_SASL, "ldap_sasl", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_SASL_AUTHC, "ldap_sasl_authc", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_SASL_AUTHZ, "ldap_sasl_authz", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_SASL_MECH, "ldap_sasl_mech", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_SASL_PASSWORD, "ldap_sasl_password", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_SASL_REALM, "ldap_sasl_realm", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_SCOPE, "ldap_scope", 0, {(void*)("sub")}, OPT_STRINGLIST, { { "sub" , IMAP_ENUM_ZERO }, { "one" , IMAP_ENUM_ZERO }, { "base" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_SERVERS, "ldap_servers", 0, {(void *)("ldap://localhost/")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_SIZE_LIMIT, "ldap_size_limit", 0, {(void*)1}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_START_TLS, "ldap_start_tls", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_TIME_LIMIT, "ldap_time_limit", 0, {(void*)5}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_TIMEOUT, "ldap_timeout", 0, {(void*)5}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_TLS_CACERT_DIR, "ldap_tls_cacert_dir", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_TLS_CACERT_FILE, "ldap_tls_cacert_file", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_TLS_CERT, "ldap_tls_cert", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_TLS_CHECK_PEER, "ldap_tls_check_peer", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_TLS_CIPHERS, "ldap_tls_ciphers", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_TLS_KEY, "ldap_tls_key", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_URI, "ldap_uri", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LDAP_VERSION, "ldap_version", 0, {(void*)3}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LMTP_DOWNCASE_RCPT, "lmtp_downcase_rcpt", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LMTP_FUZZY_MAILBOX_MATCH, "lmtp_fuzzy_mailbox_match", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LMTP_OVER_QUOTA_PERM_FAILURE, "lmtp_over_quota_perm_failure", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LMTP_STRICT_QUOTA, "lmtp_strict_quota", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LMTPSOCKET, "lmtpsocket", 0, {(void *)("{configdirectory}/socket/lmtp")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LOGINREALMS, "loginrealms", 0, {(void *)("")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LOGINUSEACL, "loginuseacl", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_LOGTIMESTAMPS, "logtimestamps", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MAILNOTIFIER, "mailnotifier", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MAXMESSAGESIZE, "maxmessagesize", 0, {(void*)0}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MAXQUOTED, "maxquoted", 0, {(void*)131072}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MAXWORD, "maxword", 0, {(void*)131072}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MBOXKEY_DB, "mboxkey_db", 0, {(void*)("skiplist")}, OPT_STRINGLIST, { { "berkeley" , IMAP_ENUM_ZERO }, { "skiplist" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MBOXLIST_DB, "mboxlist_db", 0, {(void*)("skiplist")}, OPT_STRINGLIST, { { "flat" , IMAP_ENUM_ZERO }, { "berkeley" , IMAP_ENUM_ZERO }, { "berkeley-hash" , IMAP_ENUM_ZERO }, { "skiplist" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_METAPARTITION_FILES, "metapartition_files", 0, {(void *)(0)}, OPT_BITFIELD, { { "header" , IMAP_ENUM_METAPARTITION_FILES_HEADER }, { "index" , IMAP_ENUM_METAPARTITION_FILES_INDEX }, { "cache" , IMAP_ENUM_METAPARTITION_FILES_CACHE }, { "expunge" , IMAP_ENUM_METAPARTITION_FILES_EXPUNGE }, { "squat" , IMAP_ENUM_METAPARTITION_FILES_SQUAT },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_AUTHNAME, "mupdate_authname", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_CONFIG, "mupdate_config", 0, {(void *)(IMAP_ENUM_MUPDATE_CONFIG_STANDARD)}, OPT_ENUM, { { "standard" , IMAP_ENUM_MUPDATE_CONFIG_STANDARD }, { "unified" , IMAP_ENUM_MUPDATE_CONFIG_UNIFIED }, { "replicated" , IMAP_ENUM_MUPDATE_CONFIG_REPLICATED },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MD5_DIR, "md5_dir", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MD5_USER_MAP, "md5_user_map", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUNGE8BIT, "munge8bit", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_CONNECTIONS_MAX, "mupdate_connections_max", 0, {(void*)128}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_PASSWORD, "mupdate_password", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_PORT, "mupdate_port", 0, {(void*)3905}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_REALM, "mupdate_realm", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_RETRY_DELAY, "mupdate_retry_delay", 0, {(void*)20}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_SERVER, "mupdate_server", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_USERNAME, "mupdate_username", 0, {(void *)("")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_WORKERS_MAX, "mupdate_workers_max", 0, {(void*)50}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_WORKERS_MAXSPARE, "mupdate_workers_maxspare", 0, {(void*)10}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_WORKERS_MINSPARE, "mupdate_workers_minspare", 0, {(void*)2}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_MUPDATE_WORKERS_START, "mupdate_workers_start", 0, {(void*)5}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_NETSCAPEURL, "netscapeurl", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_NEWSMASTER, "newsmaster", 0, {(void *)("news")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_NEWSPEER, "newspeer", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_NEWSPOSTUSER, "newspostuser", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_NEWSPREFIX, "newsprefix", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_NNTPTIMEOUT, "nntptimeout", 0, {(void*)3}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_NOTIFYSOCKET, "notifysocket", 0, {(void *)("{configdirectory}/socket/notify")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PLAINTEXTLOGINPAUSE, "plaintextloginpause", 0, {(void*)0}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PLAINTEXTLOGINALERT, "plaintextloginalert", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_POPEXPIRETIME, "popexpiretime", 0, {(void*)-1}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_POPMINPOLL, "popminpoll", 0, {(void*)0}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_POPSUBFOLDERS, "popsubfolders", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_POPPOLLPADDING, "poppollpadding", 0, {(void*)1}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_POPTIMEOUT, "poptimeout", 0, {(void*)10}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_POPUSEACL, "popuseacl", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_POSTMASTER, "postmaster", 0, {(void *)("postmaster")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_POSTSPEC, "postspec", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_POSTUSER, "postuser", 0, {(void *)("")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PROXY_AUTHNAME, "proxy_authname", 0, {(void *)("proxy")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PROXY_PASSWORD, "proxy_password", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PROXY_REALM, "proxy_realm", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PROXYD_ALLOW_STATUS_REFERRAL, "proxyd_allow_status_referral", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PROXYD_DISABLE_MAILBOX_REFERRALS, "proxyd_disable_mailbox_referrals", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PROXYSERVERS, "proxyservers", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PTS_MODULE, "pts_module", 0, {(void*)("afskrb")}, OPT_STRINGLIST, { { "afskrb" , IMAP_ENUM_ZERO }, { "ldap" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PTLOADER_SOCK, "ptloader_sock", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PTSCACHE_DB, "ptscache_db", 0, {(void*)("berkeley")}, OPT_STRINGLIST, { { "berkeley" , IMAP_ENUM_ZERO }, { "berkeley-hash" , IMAP_ENUM_ZERO }, { "skiplist" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PTSCACHE_TIMEOUT, "ptscache_timeout", 0, {(void*)10800}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PTSKRB5_CONVERT524, "ptskrb5_convert524", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_PTSKRB5_STRIP_DEFAULT_REALM, "ptskrb5_strip_default_realm", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_QUOTA_DB, "quota_db", 0, {(void*)("quotalegacy")}, OPT_STRINGLIST, { { "flat" , IMAP_ENUM_ZERO }, { "berkeley" , IMAP_ENUM_ZERO }, { "berkeley-hash" , IMAP_ENUM_ZERO }, { "skiplist" , IMAP_ENUM_ZERO }, { "sql" , IMAP_ENUM_ZERO }, { "quotalegacy" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_QUOTAWARN, "quotawarn", 0, {(void*)90}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_QUOTAWARNKB, "quotawarnkb", 0, {(void*)0}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_REJECT8BIT, "reject8bit", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_RFC2046_STRICT, "rfc2046_strict", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_RFC3028_STRICT, "rfc3028_strict", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SASL_MAXIMUM_LAYER, "sasl_maximum_layer", 0, {(void*)256}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SASL_MINIMUM_LAYER, "sasl_minimum_layer", 0, {(void*)0}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SEENSTATE_DB, "seenstate_db", 0, {(void*)("skiplist")}, OPT_STRINGLIST, { { "flat" , IMAP_ENUM_ZERO }, { "berkeley" , IMAP_ENUM_ZERO }, { "berkeley-hash" , IMAP_ENUM_ZERO }, { "skiplist" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SENDMAIL, "sendmail", 0, {(void *)("/usr/lib/sendmail")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SERVERNAME, "servername", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SERVERINFO, "serverinfo", 0, {(void *)(IMAP_ENUM_SERVERINFO_ON)}, OPT_ENUM, { { "off" , IMAP_ENUM_SERVERINFO_OFF }, { "min" , IMAP_ENUM_SERVERINFO_MIN }, { "on" , IMAP_ENUM_SERVERINFO_ON },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SHA1_DIR, "sha1_dir", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SHAREDPREFIX, "sharedprefix", 0, {(void *)("Shared Folders")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SIEVE_ALLOWREFERRALS, "sieve_allowreferrals", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SIEVE_EXTENSIONS, "sieve_extensions", 0, {(void *)(IMAP_ENUM_SIEVE_EXTENSIONS_FILEINTO|IMAP_ENUM_SIEVE_EXTENSIONS_REJECT|IMAP_ENUM_SIEVE_EXTENSIONS_VACATION|IMAP_ENUM_SIEVE_EXTENSIONS_IMAPFLAGS|IMAP_ENUM_SIEVE_EXTENSIONS_NOTIFY|IMAP_ENUM_SIEVE_EXTENSIONS_ENVELOPE|IMAP_ENUM_SIEVE_EXTENSIONS_RELATIONAL|IMAP_ENUM_SIEVE_EXTENSIONS_REGEX|IMAP_ENUM_SIEVE_EXTENSIONS_SUBADDRESS|IMAP_ENUM_SIEVE_EXTENSIONS_COPY|0)}, OPT_BITFIELD, { { "fileinto" , IMAP_ENUM_SIEVE_EXTENSIONS_FILEINTO }, { "reject" , IMAP_ENUM_SIEVE_EXTENSIONS_REJECT }, { "vacation" , IMAP_ENUM_SIEVE_EXTENSIONS_VACATION }, { "imapflags" , IMAP_ENUM_SIEVE_EXTENSIONS_IMAPFLAGS }, { "notify" , IMAP_ENUM_SIEVE_EXTENSIONS_NOTIFY }, { "include" , IMAP_ENUM_SIEVE_EXTENSIONS_INCLUDE }, { "envelope" , IMAP_ENUM_SIEVE_EXTENSIONS_ENVELOPE }, { "body" , IMAP_ENUM_SIEVE_EXTENSIONS_BODY }, { "relational" , IMAP_ENUM_SIEVE_EXTENSIONS_RELATIONAL }, { "regex" , IMAP_ENUM_SIEVE_EXTENSIONS_REGEX }, { "subaddress" , IMAP_ENUM_SIEVE_EXTENSIONS_SUBADDRESS }, { "copy" , IMAP_ENUM_SIEVE_EXTENSIONS_COPY },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SIEVE_MAXSCRIPTSIZE, "sieve_maxscriptsize", 0, {(void*)32}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SIEVE_MAXSCRIPTS, "sieve_maxscripts", 0, {(void*)5}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SIEVE_UTF8FILEINTO, "sieve_utf8fileinto", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SIEVE_SASL_SEND_UNSOLICITED_CAPABILITY, "sieve_sasl_send_unsolicited_capability", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SIEVE_SASL_EXPECT_UNSOLICITED_CAPABILITY, "sieve_sasl_expect_unsolicited_capability", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SIEVEDIR, "sievedir", 0, {(void *)("/usr/sieve")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SIEVENOTIFIER, "sievenotifier", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SIEVEUSEHOMEDIR, "sieveusehomedir", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SINGLEINSTANCESTORE, "singleinstancestore", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SKIPLIST_UNSAFE, "skiplist_unsafe", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SOFT_NOAUTH, "soft_noauth", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SQL_DATABASE, "sql_database", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SQL_ENGINE, "sql_engine", 0, {(void*)(NULL)}, OPT_STRINGLIST, { { "mysql" , IMAP_ENUM_ZERO }, { "pgsql" , IMAP_ENUM_ZERO }, { "sqlite" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SQL_HOSTNAMES, "sql_hostnames", 0, {(void *)("")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SQL_PASSWD, "sql_passwd", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SQL_USER, "sql_user", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SQL_USESSL, "sql_usessl", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SRVTAB, "srvtab", 0, {(void *)("")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SUBMITSERVERS, "submitservers", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SUBSCRIPTION_DB, "subscription_db", 0, {(void*)("flat")}, OPT_STRINGLIST, { { "flat" , IMAP_ENUM_ZERO }, { "berkeley" , IMAP_ENUM_ZERO }, { "berkeley-hash" , IMAP_ENUM_ZERO }, { "skiplist" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_STATUSCACHE, "statuscache", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_STATUSCACHE_DB, "statuscache_db", 0, {(void*)("berkeley-nosync")}, OPT_STRINGLIST, { { "berkeley" , IMAP_ENUM_ZERO }, { "berkeley-nosync" , IMAP_ENUM_ZERO }, { "berkeley-hash" , IMAP_ENUM_ZERO }, { "berkeley-hash-nosync" , IMAP_ENUM_ZERO }, { "skiplist" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SYNC_AUTHNAME, "sync_authname", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SYNC_BATCH_SIZE, "sync_batch_size", 0, {(void*)0}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SYNC_HOST, "sync_host", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SYNC_LOG, "sync_log", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SYNC_PASSWORD, "sync_password", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SYNC_REALM, "sync_realm", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SYNC_REPEAT_INTERVAL, "sync_repeat_interval", 0, {(void*)1}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SYNC_SHUTDOWN_FILE, "sync_shutdown_file", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_SYSLOG_PREFIX, "syslog_prefix", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_TEMP_PATH, "temp_path", 0, {(void *)("/tmp")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_TIMEOUT, "timeout", 0, {(void*)30}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_TLS_CA_FILE, "tls_ca_file", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_TLS_CA_PATH, "tls_ca_path", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_TLSCACHE_DB, "tlscache_db", 0, {(void*)("berkeley-nosync")}, OPT_STRINGLIST, { { "berkeley" , IMAP_ENUM_ZERO }, { "berkeley-nosync" , IMAP_ENUM_ZERO }, { "berkeley-hash" , IMAP_ENUM_ZERO }, { "berkeley-hash-nosync" , IMAP_ENUM_ZERO }, { "skiplist" , IMAP_ENUM_ZERO }, { "sql" , IMAP_ENUM_ZERO },  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_TLS_CERT_FILE, "tls_cert_file", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_TLS_CIPHER_LIST, "tls_cipher_list", 0, {(void *)("DEFAULT")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_TLS_KEY_FILE, "tls_key_file", 0, {(void *)(NULL)}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_TLS_REQUIRE_CERT, "tls_require_cert", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_TLS_SESSION_TIMEOUT, "tls_session_timeout", 0, {(void*)1440}, OPT_INT, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_UMASK, "umask", 0, {(void *)("077")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_USERNAME_TOLOWER, "username_tolower", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_USERPREFIX, "userprefix", 0, {(void *)("Other Users")}, OPT_STRING, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_UNIX_GROUP_ENABLE, "unix_group_enable", 0, {(void*)1}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_UNIXHIERARCHYSEP, "unixhierarchysep", 0, {(void*)0}, OPT_SWITCH, {  { NULL, IMAP_ENUM_ZERO } } },
+  { IMAPOPT_VIRTDOMAINS, "virtdomains", 0, {(void *)(IMAP_ENUM_VIRTDOMAINS_OFF)}, OPT_ENUM, { { "off" , IMAP_ENUM_VIRTDOMAINS_OFF }, { "userid" , IMAP_ENUM_VIRTDOMAINS_USERID }, { "on" , IMAP_ENUM_VIRTDOMAINS_ON },  { NULL, IMAP_ENUM_ZERO } } },
+
+  { IMAPOPT_LAST, NULL, 0, { NULL }, OPT_NOTOPT, {  { NULL, IMAP_ENUM_ZERO } } }
+
+};
+
+
+
+/* c code goes here */
+
+
+

Added: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapopts.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapopts.h?rev=768&root=cyrus22&view=auto
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapopts.h (added)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapopts.h Mon Feb  9 12:49:22 2009
@@ -1,0 +1,326 @@
+/* auto-generated by config2header 1.15 */
+#ifndef INCLUDED_IMAPOPTS_H
+#define INCLUDED_IMAPOPTS_H
+
+enum opttype {
+  OPT_BITFIELD,
+  OPT_STRINGLIST,
+  OPT_ENUM,
+  OPT_SWITCH,
+  OPT_INT,
+  OPT_STRING,
+  OPT_NOTOPT
+};
+
+
+enum imapopt {
+
+  IMAPOPT_ZERO = 0,
+
+  IMAPOPT_ADMINS,
+  IMAPOPT_AFSPTS_LOCALREALMS,
+  IMAPOPT_AFSPTS_MYCELL,
+  IMAPOPT_ALLOWALLSUBSCRIBE,
+  IMAPOPT_ALLOWANONYMOUSLOGIN,
+  IMAPOPT_ALLOWAPOP,
+  IMAPOPT_ALLOWNEWNEWS,
+  IMAPOPT_ALLOWPLAINTEXT,
+  IMAPOPT_ALLOWUSERMOVES,
+  IMAPOPT_ALTNAMESPACE,
+  IMAPOPT_ANNOTATION_DB,
+  IMAPOPT_ANYONEUSERACL,
+  IMAPOPT_AUTH_MECH,
+  IMAPOPT_AUTOCREATEQUOTA,
+  IMAPOPT_BERKELEY_CACHESIZE,
+  IMAPOPT_BERKELEY_LOCKS_MAX,
+  IMAPOPT_BERKELEY_TXNS_MAX,
+  IMAPOPT_CLIENT_TIMEOUT,
+  IMAPOPT_CONFIGDIRECTORY,
+  IMAPOPT_DEBUG_COMMAND,
+  IMAPOPT_DEFAULTACL,
+  IMAPOPT_DEFAULTDOMAIN,
+  IMAPOPT_DEFAULTPARTITION,
+  IMAPOPT_DELETEDPREFIX,
+  IMAPOPT_DELETE_MODE,
+  IMAPOPT_DELETERIGHT,
+  IMAPOPT_DUPLICATE_DB,
+  IMAPOPT_DUPLICATESUPPRESSION,
+  IMAPOPT_EXPUNGE_MODE,
+  IMAPOPT_FLUSHSEENSTATE,
+  IMAPOPT_FOOLSTUPIDCLIENTS,
+  IMAPOPT_FORCE_SASL_CLIENT_MECH,
+  IMAPOPT_FULLDIRHASH,
+  IMAPOPT_GUID_MODE,
+  IMAPOPT_HASHIMAPSPOOL,
+  IMAPOPT_IDLESOCKET,
+  IMAPOPT_IGNOREREFERENCE,
+  IMAPOPT_IMAPIDLEPOLL,
+  IMAPOPT_IMAPIDRESPONSE,
+  IMAPOPT_IMAPMAGICPLUS,
+  IMAPOPT_IMPLICIT_OWNER_RIGHTS,
+  IMAPOPT_IMPROVED_MBOXLIST_SORT,
+  IMAPOPT_LDAP_AUTHZ,
+  IMAPOPT_LDAP_BASE,
+  IMAPOPT_LDAP_BIND_DN,
+  IMAPOPT_LDAP_DEREF,
+  IMAPOPT_LDAP_FILTER,
+  IMAPOPT_LDAP_GROUP_BASE,
+  IMAPOPT_LDAP_GROUP_FILTER,
+  IMAPOPT_LDAP_GROUP_SCOPE,
+  IMAPOPT_LDAP_ID,
+  IMAPOPT_LDAP_MECH,
+  IMAPOPT_LDAP_MEMBER_ATTRIBUTE,
+  IMAPOPT_LDAP_MEMBER_BASE,
+  IMAPOPT_LDAP_MEMBER_FILTER,
+  IMAPOPT_LDAP_MEMBER_METHOD,
+  IMAPOPT_LDAP_MEMBER_SCOPE,
+  IMAPOPT_LDAP_PASSWORD,
+  IMAPOPT_LDAP_REALM,
+  IMAPOPT_LDAP_REFERRALS,
+  IMAPOPT_LDAP_RESTART,
+  IMAPOPT_LDAP_SASL,
+  IMAPOPT_LDAP_SASL_AUTHC,
+  IMAPOPT_LDAP_SASL_AUTHZ,
+  IMAPOPT_LDAP_SASL_MECH,
+  IMAPOPT_LDAP_SASL_PASSWORD,
+  IMAPOPT_LDAP_SASL_REALM,
+  IMAPOPT_LDAP_SCOPE,
+  IMAPOPT_LDAP_SERVERS,
+  IMAPOPT_LDAP_SIZE_LIMIT,
+  IMAPOPT_LDAP_START_TLS,
+  IMAPOPT_LDAP_TIME_LIMIT,
+  IMAPOPT_LDAP_TIMEOUT,
+  IMAPOPT_LDAP_TLS_CACERT_DIR,
+  IMAPOPT_LDAP_TLS_CACERT_FILE,
+  IMAPOPT_LDAP_TLS_CERT,
+  IMAPOPT_LDAP_TLS_CHECK_PEER,
+  IMAPOPT_LDAP_TLS_CIPHERS,
+  IMAPOPT_LDAP_TLS_KEY,
+  IMAPOPT_LDAP_URI,
+  IMAPOPT_LDAP_VERSION,
+  IMAPOPT_LMTP_DOWNCASE_RCPT,
+  IMAPOPT_LMTP_FUZZY_MAILBOX_MATCH,
+  IMAPOPT_LMTP_OVER_QUOTA_PERM_FAILURE,
+  IMAPOPT_LMTP_STRICT_QUOTA,
+  IMAPOPT_LMTPSOCKET,
+  IMAPOPT_LOGINREALMS,
+  IMAPOPT_LOGINUSEACL,
+  IMAPOPT_LOGTIMESTAMPS,
+  IMAPOPT_MAILNOTIFIER,
+  IMAPOPT_MAXMESSAGESIZE,
+  IMAPOPT_MAXQUOTED,
+  IMAPOPT_MAXWORD,
+  IMAPOPT_MBOXKEY_DB,
+  IMAPOPT_MBOXLIST_DB,
+  IMAPOPT_METAPARTITION_FILES,
+  IMAPOPT_MUPDATE_AUTHNAME,
+  IMAPOPT_MUPDATE_CONFIG,
+  IMAPOPT_MD5_DIR,
+  IMAPOPT_MD5_USER_MAP,
+  IMAPOPT_MUNGE8BIT,
+  IMAPOPT_MUPDATE_CONNECTIONS_MAX,
+  IMAPOPT_MUPDATE_PASSWORD,
+  IMAPOPT_MUPDATE_PORT,
+  IMAPOPT_MUPDATE_REALM,
+  IMAPOPT_MUPDATE_RETRY_DELAY,
+  IMAPOPT_MUPDATE_SERVER,
+  IMAPOPT_MUPDATE_USERNAME,
+  IMAPOPT_MUPDATE_WORKERS_MAX,
+  IMAPOPT_MUPDATE_WORKERS_MAXSPARE,
+  IMAPOPT_MUPDATE_WORKERS_MINSPARE,
+  IMAPOPT_MUPDATE_WORKERS_START,
+  IMAPOPT_NETSCAPEURL,
+  IMAPOPT_NEWSMASTER,
+  IMAPOPT_NEWSPEER,
+  IMAPOPT_NEWSPOSTUSER,
+  IMAPOPT_NEWSPREFIX,
+  IMAPOPT_NNTPTIMEOUT,
+  IMAPOPT_NOTIFYSOCKET,
+  IMAPOPT_PLAINTEXTLOGINPAUSE,
+  IMAPOPT_PLAINTEXTLOGINALERT,
+  IMAPOPT_POPEXPIRETIME,
+  IMAPOPT_POPMINPOLL,
+  IMAPOPT_POPSUBFOLDERS,
+  IMAPOPT_POPPOLLPADDING,
+  IMAPOPT_POPTIMEOUT,
+  IMAPOPT_POPUSEACL,
+  IMAPOPT_POSTMASTER,
+  IMAPOPT_POSTSPEC,
+  IMAPOPT_POSTUSER,
+  IMAPOPT_PROXY_AUTHNAME,
+  IMAPOPT_PROXY_PASSWORD,
+  IMAPOPT_PROXY_REALM,
+  IMAPOPT_PROXYD_ALLOW_STATUS_REFERRAL,
+  IMAPOPT_PROXYD_DISABLE_MAILBOX_REFERRALS,
+  IMAPOPT_PROXYSERVERS,
+  IMAPOPT_PTS_MODULE,
+  IMAPOPT_PTLOADER_SOCK,
+  IMAPOPT_PTSCACHE_DB,
+  IMAPOPT_PTSCACHE_TIMEOUT,
+  IMAPOPT_PTSKRB5_CONVERT524,
+  IMAPOPT_PTSKRB5_STRIP_DEFAULT_REALM,
+  IMAPOPT_QUOTA_DB,
+  IMAPOPT_QUOTAWARN,
+  IMAPOPT_QUOTAWARNKB,
+  IMAPOPT_REJECT8BIT,
+  IMAPOPT_RFC2046_STRICT,
+  IMAPOPT_RFC3028_STRICT,
+  IMAPOPT_SASL_MAXIMUM_LAYER,
+  IMAPOPT_SASL_MINIMUM_LAYER,
+  IMAPOPT_SEENSTATE_DB,
+  IMAPOPT_SENDMAIL,
+  IMAPOPT_SERVERNAME,
+  IMAPOPT_SERVERINFO,
+  IMAPOPT_SHA1_DIR,
+  IMAPOPT_SHAREDPREFIX,
+  IMAPOPT_SIEVE_ALLOWREFERRALS,
+  IMAPOPT_SIEVE_EXTENSIONS,
+  IMAPOPT_SIEVE_MAXSCRIPTSIZE,
+  IMAPOPT_SIEVE_MAXSCRIPTS,
+  IMAPOPT_SIEVE_UTF8FILEINTO,
+  IMAPOPT_SIEVE_SASL_SEND_UNSOLICITED_CAPABILITY,
+  IMAPOPT_SIEVE_SASL_EXPECT_UNSOLICITED_CAPABILITY,
+  IMAPOPT_SIEVEDIR,
+  IMAPOPT_SIEVENOTIFIER,
+  IMAPOPT_SIEVEUSEHOMEDIR,
+  IMAPOPT_SINGLEINSTANCESTORE,
+  IMAPOPT_SKIPLIST_UNSAFE,
+  IMAPOPT_SOFT_NOAUTH,
+  IMAPOPT_SQL_DATABASE,
+  IMAPOPT_SQL_ENGINE,
+  IMAPOPT_SQL_HOSTNAMES,
+  IMAPOPT_SQL_PASSWD,
+  IMAPOPT_SQL_USER,
+  IMAPOPT_SQL_USESSL,
+  IMAPOPT_SRVTAB,
+  IMAPOPT_SUBMITSERVERS,
+  IMAPOPT_SUBSCRIPTION_DB,
+  IMAPOPT_STATUSCACHE,
+  IMAPOPT_STATUSCACHE_DB,
+  IMAPOPT_SYNC_AUTHNAME,
+  IMAPOPT_SYNC_BATCH_SIZE,
+  IMAPOPT_SYNC_HOST,
+  IMAPOPT_SYNC_LOG,
+  IMAPOPT_SYNC_PASSWORD,
+  IMAPOPT_SYNC_REALM,
+  IMAPOPT_SYNC_REPEAT_INTERVAL,
+  IMAPOPT_SYNC_SHUTDOWN_FILE,
+  IMAPOPT_SYSLOG_PREFIX,
+  IMAPOPT_TEMP_PATH,
+  IMAPOPT_TIMEOUT,
+  IMAPOPT_TLS_CA_FILE,
+  IMAPOPT_TLS_CA_PATH,
+  IMAPOPT_TLSCACHE_DB,
+  IMAPOPT_TLS_CERT_FILE,
+  IMAPOPT_TLS_CIPHER_LIST,
+  IMAPOPT_TLS_KEY_FILE,
+  IMAPOPT_TLS_REQUIRE_CERT,
+  IMAPOPT_TLS_SESSION_TIMEOUT,
+  IMAPOPT_UMASK,
+  IMAPOPT_USERNAME_TOLOWER,
+  IMAPOPT_USERPREFIX,
+  IMAPOPT_UNIX_GROUP_ENABLE,
+  IMAPOPT_UNIXHIERARCHYSEP,
+  IMAPOPT_VIRTDOMAINS,
+
+  IMAPOPT_LAST
+
+};
+
+
+
+enum enum_value {
+
+  IMAP_ENUM_ZERO = 0,
+
+  IMAP_ENUM_DELETE_MODE_IMMEDIATE = 0,
+  IMAP_ENUM_DELETE_MODE_DELAYED,
+  IMAP_ENUM_EXPUNGE_MODE_IMMEDIATE = 0,
+  IMAP_ENUM_EXPUNGE_MODE_DELAYED,
+  IMAP_ENUM_GUID_MODE_OFF = 0,
+  IMAP_ENUM_GUID_MODE_SHA1,
+  IMAP_ENUM_METAPARTITION_FILES_HEADER = (1<<0),
+  IMAP_ENUM_METAPARTITION_FILES_INDEX = (1<<1),
+  IMAP_ENUM_METAPARTITION_FILES_CACHE = (1<<2),
+  IMAP_ENUM_METAPARTITION_FILES_EXPUNGE = (1<<3),
+  IMAP_ENUM_METAPARTITION_FILES_SQUAT = (1<<4),
+  IMAP_ENUM_MUPDATE_CONFIG_STANDARD = 0,
+  IMAP_ENUM_MUPDATE_CONFIG_UNIFIED,
+  IMAP_ENUM_MUPDATE_CONFIG_REPLICATED,
+  IMAP_ENUM_SERVERINFO_OFF = 0,
+  IMAP_ENUM_SERVERINFO_MIN,
+  IMAP_ENUM_SERVERINFO_ON,
+  IMAP_ENUM_SIEVE_EXTENSIONS_FILEINTO = (1<<0),
+  IMAP_ENUM_SIEVE_EXTENSIONS_REJECT = (1<<1),
+  IMAP_ENUM_SIEVE_EXTENSIONS_VACATION = (1<<2),
+  IMAP_ENUM_SIEVE_EXTENSIONS_IMAPFLAGS = (1<<3),
+  IMAP_ENUM_SIEVE_EXTENSIONS_NOTIFY = (1<<4),
+  IMAP_ENUM_SIEVE_EXTENSIONS_INCLUDE = (1<<5),
+  IMAP_ENUM_SIEVE_EXTENSIONS_ENVELOPE = (1<<6),
+  IMAP_ENUM_SIEVE_EXTENSIONS_BODY = (1<<7),
+  IMAP_ENUM_SIEVE_EXTENSIONS_RELATIONAL = (1<<8),
+  IMAP_ENUM_SIEVE_EXTENSIONS_REGEX = (1<<9),
+  IMAP_ENUM_SIEVE_EXTENSIONS_SUBADDRESS = (1<<10),
+  IMAP_ENUM_SIEVE_EXTENSIONS_COPY = (1<<11),
+  IMAP_ENUM_VIRTDOMAINS_OFF = 0,
+  IMAP_ENUM_VIRTDOMAINS_USERID,
+  IMAP_ENUM_VIRTDOMAINS_ON
+
+};
+
+
+
+union config_value {
+
+    void *dummy;
+
+    const char *s;	/* OPT_STRING, OPT_STRINGLIST */
+
+    long i;		/* OPT_INT */
+
+    long b;		/* OPT_SWITCH */
+
+    enum enum_value e;	/* OPT_ENUM */
+
+    unsigned long x;	/* OPT_BITFIELD */
+
+};
+
+
+
+struct enum_option_s {
+
+    const char *name;
+
+    const enum enum_value val;
+
+};
+
+
+
+#define MAX_ENUM_OPTS 12
+
+struct imapopt_s {
+
+    const enum imapopt opt;
+
+    const char *optname;
+
+    int seen;
+
+    union config_value val;
+
+    const enum opttype t;
+
+    const struct enum_option_s enum_options[MAX_ENUM_OPTS+1];
+
+};
+
+
+
+extern struct imapopt_s imapopts[];
+
+
+
+#endif /* INCLUDED_IMAPOPTIONS_H */
+

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapurl.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapurl.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapurl.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapurl.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * derived from chris newman's code */
-
-/* $Id: imapurl.c,v 1.12 2006/11/30 17:11:22 murch Exp $ */
+ * $Id: imapurl.c,v 1.16 2008/09/22 12:58:35 murch Exp $
+ *
+ * derived from chris newman's code
+ */
 
 #include <stdio.h>
 #include <string.h>
@@ -197,7 +199,7 @@
  *  dst should be about twice the length of src to deal with non-hex
  *  coded URLs
  */
-static int URLtoMailbox(char *dst, char *src)
+int URLtoMailbox(char *dst, char *src)
 {
     unsigned int utf8pos = 0, utf8total, i, c, utf7mode, bitstogo, utf16flag;
     unsigned long ucs4 = 0, bitbuf = 0;
@@ -367,7 +369,7 @@
     int step = 0;  /* used to force correct ordering of url parts */
 
     memset(url, 0, sizeof(struct imapurl));
-    url->freeme = xmalloc(3 * strlen(s) + 3); /* space for copy of URL +
+    url->freeme = xmalloc(6 * strlen(s) + 3); /* space for copy of URL +
 						 decoded mailbox */
     src = strcpy(url->freeme, s);
 
@@ -385,7 +387,6 @@
 	char *se;
 	char *at;
 	char *mbox = NULL;
-	char *opt;
 	
 	if (!strncmp(src, "imap://", 7)) { /* absolute URL */
 	    src += 7; /* skip imap:// */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapurl.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapurl.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapurl.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imapurl.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: imapurl.h,v 1.8 2008/03/24 17:43:09 murch Exp $
  */
-
-/* $Id: imapurl.h,v 1.6 2006/11/30 17:11:22 murch Exp $ */
 
 #ifndef IMAPURL_H
 #define IMAPURL_H
@@ -74,6 +74,8 @@
  *  coded URLs; server should be as large as src.
  */
 int imapurl_fromURL(struct imapurl *url, const char *src);
+int URLtoMailbox(char *dst, char *src);
+#define UTF8_to_mUTF7(dst, src) URLtoMailbox(dst, src)
 
 /* Convert an IMAP mailbox to a URL path
  *  dst needs to have roughly 4 times the storage space of mailbox

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imclient.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imclient.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imclient.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imclient.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* imclient.c -- Streaming IMxP client library
  *
- * $Id: imclient.c,v 1.88 2007/02/05 18:43:26 jeaton Exp $
- *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,10 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: imclient.c,v 1.93 2008/03/24 17:43:09 murch Exp $
  */
+
 #include <config.h>
-#include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
@@ -76,6 +75,7 @@
 #include <openssl/ssl.h>
 #endif /* HAVE_SSL */
 
+#include "assert.h"
 #include "exitcodes.h"
 #include "xmalloc.h"
 #include "xstrlcpy.h"
@@ -1422,10 +1422,12 @@
     } while ((r != 0) && (mtried));
 
     if (r == 0) {
-	const int *ptr;
-
-	sasl_getprop(imclient->saslconn, SASL_MAXOUTBUF, (const void **) &ptr);
-	imclient->maxplain = *ptr < IMCLIENT_BUFSIZE ? *ptr : IMCLIENT_BUFSIZE;
+	const void *maxp;
+	unsigned int max;
+
+	sasl_getprop(imclient->saslconn, SASL_MAXOUTBUF, &maxp);
+	max = *((const unsigned int *) maxp);
+	imclient->maxplain = max < IMCLIENT_BUFSIZE ? max : IMCLIENT_BUFSIZE;
     }
 
     free(mlist);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imclient.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imclient.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imclient.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imclient.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* imclient.h -- Streaming IMxP client library
- * $Id: imclient.h,v 1.28 2006/11/30 17:11:22 murch Exp $
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: imclient.h,v 1.30 2008/04/15 18:06:29 murch Exp $
  */
 
 #ifndef INCLUDED_IMCLIENT_H
@@ -88,7 +88,7 @@
 				 int minssf, 
 				 int maxssf);
 
-extern int imclient_have_tls (void);
+extern int imclient_havetls (void);
 
 extern int imclient_starttls(struct imclient *imclient,
 			     char *cert_file, 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imparse.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imparse.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imparse.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imparse.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* imparse.c -- IMxP client-side parsing routines
- $Id: imparse.c,v 1.12 2003/02/13 20:15:40 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
- */
+ * $Id: imparse.c,v 1.13 2008/03/24 17:43:09 murch Exp $
+ */
+
 #include <config.h>
 #include <stdio.h>
 #include <ctype.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imparse.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imparse.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imparse.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/imparse.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* imparse.h -- IMxP client-side parsing routines
- * $Id: imparse.h,v 1.7 2003/02/13 20:15:40 rjs3 Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: imparse.h,v 1.8 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef INCLUDED_IMPARSE_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/iptostring.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/iptostring.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/iptostring.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/iptostring.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: iptostring.c,v 1.9 2008/03/24 17:43:09 murch Exp $
  */
-
-/* $Id: iptostring.c,v 1.8 2006/11/30 17:11:22 murch Exp $ */
 
 #include <config.h>
 #include <stdlib.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/iptostring.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/iptostring.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/iptostring.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/iptostring.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: iptostring.h,v 1.4 2008/03/24 17:43:09 murch Exp $
  */
-
-/* $Id: iptostring.h,v 1.3 2003/02/13 20:15:40 rjs3 Exp $ */
 
 #ifndef IPTOSTRING_H
 #define IPTOSTRING_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libconfig.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libconfig.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libconfig.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libconfig.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /* libconfig.c -- imapd.conf handling
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,13 +39,11 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: libconfig.c,v 1.21 2008/09/23 17:34:38 murch Exp $
  */
 
-/* $Id: libconfig.c,v 1.12 2007/01/05 19:54:20 jeaton Exp $ */
-
 #include <config.h>
 
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -53,6 +53,7 @@
 #include <netinet/in.h>
 #include <sys/stat.h>
 
+#include "assert.h"
 #include "hash.h"
 #include "libconfig.h"
 #include "imapopts.h"
@@ -71,12 +72,15 @@
 const char *config_dir = NULL;		 /* ie /var/imap */
 const char *config_defpartition = NULL;  /* /var/spool/imap */
 const char *config_servername= NULL;	 /* gethostname() */
+enum enum_value config_serverinfo;	 /* on */
 const char *config_mupdate_server = NULL;/* NULL */
 const char *config_defdomain = NULL;     /* NULL */
 const char *config_ident = NULL;         /* the service name */
 int config_hashimapspool;	  /* f */
 enum enum_value config_virtdomains;	          /* f */
 enum enum_value config_mupdate_config;	/* IMAP_ENUM_MUPDATE_CONFIG_STANDARD */
+int config_maxword;
+int config_maxquoted;
 
 /* declared in each binary that uses libconfig */
 extern const int config_need_data;
@@ -160,6 +164,12 @@
 
     /* Return what we got or the default */
     return ret ? ret : def;
+}
+
+void config_foreachoverflowstring(void (*func)(const char *, const char *, void *),
+				  void *rock)
+{
+    hash_enumerate(&confighash, (void (*)(char *, void *, void *)) func, rock);
 }
 
 const char *config_partitiondir(const char *partition)
@@ -274,61 +284,95 @@
     config_virtdomains = config_getenum(IMAPOPT_VIRTDOMAINS);
     config_defdomain = config_getstring(IMAPOPT_DEFAULTDOMAIN);
 
-    /* look up the hostname we should present to the user */
+    /* look up the hostname and info we should present to the user */
     config_servername = config_getstring(IMAPOPT_SERVERNAME);
     if (!config_servername) {
 	config_servername = xmalloc(sizeof(char) * 256);
 	gethostname((char *) config_servername, 256);
     }
+    config_serverinfo = config_getenum(IMAPOPT_SERVERINFO);
 
     config_mupdate_server = config_getstring(IMAPOPT_MUPDATE_SERVER);
 
     if (config_mupdate_server) {
 	config_mupdate_config = config_getenum(IMAPOPT_MUPDATE_CONFIG);
     }
-}
+
+    /* set some limits */
+    config_maxquoted = config_getint(IMAPOPT_MAXQUOTED);
+    config_maxword = config_getint(IMAPOPT_MAXWORD);
+}
+
+#define GROWSIZE 4096
 
 void config_read_file(const char *filename)
 {
     FILE *infile;
     enum imapopt opt = IMAPOPT_ZERO;
     int lineno = 0;
-    char buf[4096], errbuf[1024];
+    char *buf, errbuf[1024];
+    unsigned bufsize, len;
     char *p, *q, *key, *fullkey, *srvkey, *val, *newval;
     int service_specific;
     int idlen = (config_ident ? strlen(config_ident) : 0);
 
+    bufsize = GROWSIZE;
+    buf = xmalloc(bufsize);
+
     /* read in config file */
     infile = fopen(filename, "r");
     if (!infile) {
-	strlcpy(buf, CYRUS_PATH, sizeof(buf));
-	strlcat(buf, filename, sizeof(buf));
+	strlcpy(buf, CYRUS_PATH, bufsize);
+	strlcat(buf, filename, bufsize);
 	infile = fopen(buf, "r");
     }
     if (!infile) {
-	snprintf(buf, sizeof(buf), "can't open configuration file %s: %s",
+	snprintf(buf, bufsize, "can't open configuration file %s: %s",
 		 filename, error_message(errno));
 	fatal(buf, EC_CONFIG);
     }
 
     /* check to see if we've already read this file */
     if (hash_lookup(filename, &includehash)) {
-	snprintf(buf, sizeof(buf), "configuration file %s included twice",
+	snprintf(buf, bufsize, "configuration file %s included twice",
 		 filename);
 	fatal(buf, EC_CONFIG);
-	return;
     }
     else {
 	hash_insert(filename, (void*) 0xDEADBEEF, &includehash);
     }
     
-    while (fgets(buf, sizeof(buf), infile)) {
+    len = 0;
+    while (fgets(buf+len, bufsize-len, infile)) {
+	if (buf[len]) {
+	    len = strlen(buf);
+	    if (buf[len-1] == '\n') {
+		/* end of line */
+		buf[--len] = '\0';
+
+		if (len && buf[len-1] == '\\') {
+		    /* line continuation */
+		    len--;
+		    lineno++;
+		    continue;
+		}
+	    }
+	    else if (!feof(infile) && len == bufsize-1) {
+		/* line is longer than the buffer */
+		bufsize += GROWSIZE;
+		buf = xrealloc(buf, bufsize);
+		continue;
+	    }
+	}
+	len = 0;
 	lineno++;
 
 	service_specific = 0;
 	
-	if (buf[0] && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] =3D '\0';
+	/* remove leading whitespace */
 	for (p = buf; *p && isspace((int) *p); p++);
+
+	/* skip comments */
 	if (!*p || *p == '#') continue;
 
 	fullkey = key = p;
@@ -345,6 +389,7 @@
 	}
 	*p++ = '\0';
 	
+	/* remove leading whitespace */
 	while (*p && isspace((int) *p)) p++;
 	
 	/* remove trailing whitespace */
@@ -530,6 +575,7 @@
 
 		    /* find the start of the next value */
 		    for (p = q; *p && isspace((int) *p); p++);
+		    q = p;
 		}
 
 		break;
@@ -567,4 +613,5 @@
 	}
     }
     fclose(infile);
-}
+    free(buf);
+}

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libconfig.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libconfig.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libconfig.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libconfig.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* libconfig.h -- Header for imapd.conf processing
- * $Id: libconfig.h,v 1.5 2006/11/30 17:11:22 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: libconfig.h,v 1.9 2008/09/23 17:34:38 murch Exp $
  */
 
 #ifndef INCLUDED_LIBCONFIG_H
@@ -58,6 +60,8 @@
 /* these work on additional strings that are not defined in the
  * imapoptions table */
 extern const char *config_getoverflowstring(const char *key, const char *def);
+extern void config_foreachoverflowstring(
+    void (*func)(const char *, const char *, void *), void *rock);
 extern const char *config_partitiondir(const char *partition);
 extern const char *config_metapartitiondir(const char *partition);
 
@@ -66,6 +70,7 @@
 extern const char *config_dir;
 extern const char *config_defpartition;
 extern const char *config_servername;
+extern enum enum_value config_serverinfo;
 extern const char *config_mupdate_server;
 extern const char *config_defdomain;
 extern const char *config_ident;
@@ -73,6 +78,8 @@
 extern int config_implicitrights;
 extern enum enum_value config_virtdomains;
 extern enum enum_value config_mupdate_config;
+extern int config_maxquoted;
+extern int config_maxword;
 
 /* config requirement flags */
 #define CONFIG_NEED_PARTITION_DATA (1<<0)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libcyr_cfg.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libcyr_cfg.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libcyr_cfg.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libcyr_cfg.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* libcyr_cfg.c -- configuration interface to libcyrus
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,18 +39,16 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: libcyr_cfg.c,v 1.16 2008/07/30 16:03:38 murch Exp $
  */
-/*
- * $Id: libcyr_cfg.c,v 1.13 2006/11/30 17:11:22 murch Exp $
- */
 
 #include <config.h>
 
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <syslog.h>
 
+#include "assert.h"
 #include "libcyr_cfg.h"
 #include "cyrusdb.h"
 
@@ -126,6 +125,30 @@
     { CYRUSOPT_DELETERIGHT,
       CFGVAL(const char *, "c"),
       CYRUS_OPT_STRING },
+
+    { CYRUSOPT_SQL_DATABASE,
+      CFGVAL(const char *, NULL),
+      CYRUS_OPT_STRING },
+
+    { CYRUSOPT_SQL_ENGINE,
+      CFGVAL(const char *, "mysql"),
+      CYRUS_OPT_STRING },
+
+    { CYRUSOPT_SQL_HOSTNAMES,
+      CFGVAL(const char *, ""),
+      CYRUS_OPT_STRING },
+
+    { CYRUSOPT_SQL_USER,
+      CFGVAL(const char *, NULL),
+      CYRUS_OPT_STRING },
+
+    { CYRUSOPT_SQL_PASSWD,
+      CFGVAL(const char *, NULL),
+      CYRUS_OPT_STRING },
+
+    { CYRUSOPT_SQL_USESSL,
+      CFGVAL(long, 0),
+      CYRUS_OPT_SWITCH },
 
     { CYRUSOPT_LAST, { NULL }, CYRUS_OPT_NOTOPT }
 };

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libcyr_cfg.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libcyr_cfg.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libcyr_cfg.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/libcyr_cfg.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* libcyr_cfg.h -- configuration interface to libcyrus
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: libcyr_cfg.h,v 1.10 2006/11/30 17:11:22 murch Exp $
+ * $Id: libcyr_cfg.h,v 1.12 2008/07/30 16:03:39 murch Exp $
  */
 
 #ifndef INCLUDED_LIBCYR_CFG_H
@@ -101,6 +100,18 @@
     CYRUSOPT_BERKELEY_TXNS_MAX,
     /* RFC 2086 right which allows DELETE ("c") */
     CYRUSOPT_DELETERIGHT,
+    /* SQL database */
+    CYRUSOPT_SQL_DATABASE,
+    /* SQL engine ("mysql") */
+    CYRUSOPT_SQL_ENGINE,
+    /* SQL hostname(s) ("") */
+    CYRUSOPT_SQL_HOSTNAMES,
+    /* SQL username */
+    CYRUSOPT_SQL_USER,
+    /* SQL password */
+    CYRUSOPT_SQL_PASSWD,
+    /* Secure SQL connection (OFF) */
+    CYRUSOPT_SQL_USESSL,
 
     CYRUSOPT_LAST
     

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* lock.h -- file locking primitives
- $Id: lock.h,v 1.7 2003/02/13 20:15:40 rjs3 Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: lock.h,v 1.8 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef INCLUDED_LOCK_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock_fcntl.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock_fcntl.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock_fcntl.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock_fcntl.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* lock_fcntl.c -- Lock files using fcntl()
- $Id: lock_fcntl.c,v 1.16 2003/02/13 20:15:40 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
- */
+ * $Id: lock_fcntl.c,v 1.17 2008/03/24 17:43:09 murch Exp $
+ */
+
 #include <config.h>
 #include <sys/types.h>
 #include <sys/stat.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock_flock.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock_flock.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock_flock.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/lock_flock.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* lock_flock.c -- Lock files using flock()
- $Id: lock_flock.c,v 1.15 2003/02/13 20:15:41 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: lock_flock.c,v 1.16 2008/03/24 17:43:09 murch Exp $
  */
+
 #include <config.h>
 #include <sys/file.h>
 #include <sys/stat.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* map.h -- memory mapping functions
- * $Id: map.h,v 1.12 2003/10/22 18:50:12 rjs3 Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: map.h,v 1.13 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef INCLUDED_MAP_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_nommap.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_nommap.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_nommap.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_nommap.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* map_nommap.c -- dummy memory-mapping routines.
- * $Id: map_nommap.c,v 1.23 2003/10/22 18:50:12 rjs3 Exp $
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: map_nommap.c,v 1.24 2008/03/24 17:43:09 murch Exp $
  */
+
 #include <config.h>
 #include <stdio.h>
 #include <sys/types.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_shared.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_shared.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_shared.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_shared.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* map_shared.c -- memory-mapping routines.
- * $Id: map_shared.c,v 1.21 2003/10/22 18:50:12 rjs3 Exp $
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: map_shared.c,v 1.22 2008/03/24 17:43:09 murch Exp $
  */
+
 #include <config.h>
 #include <stdio.h>
 #include <sys/types.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_stupidshared.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_stupidshared.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_stupidshared.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/map_stupidshared.c Mon Feb  9 12:49:22 2009
@@ -1,11 +1,6 @@
 /* map_stupidshared.c -- memory-mapping routines working around DEC stupidity.
  *
- * This file is like map_shared.c, but doesn't use any "SLOP", since
- * "Digital Unix" doesn't permit mapping a region past the end of a file.
- *
- * $Id: map_stupidshared.c,v 1.14 2003/10/22 18:50:12 rjs3 Exp $
- * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -21,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -43,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: map_stupidshared.c,v 1.15 2008/03/24 17:43:09 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/memmove.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/memmove.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/memmove.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/memmove.c Mon Feb  9 12:49:22 2009
@@ -1,9 +1,7 @@
 /* memmove.c -- replacement memmove() routine
  * Only handles overlapping strings when moving data upwards
- 
- $Id: memmove.c,v 1.8 2003/02/13 20:15:41 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,6 +39,8 @@
  * 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.
+ *
+ * $Id: memmove.c,v 1.9 2008/03/24 17:43:09 murch Exp $
  */
 
 void *memmove(s, ct, n)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkchartable.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkchartable.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkchartable.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkchartable.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* mkchartable.c -- Generate character set mapping table
  *
- * $Id: mkchartable.c,v 1.25 2003/05/14 18:56:34 rjs3 Exp $
- *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: mkchartable.c,v 1.27 2008/03/24 17:43:09 murch Exp $
  */
 
 #include <config.h>
@@ -195,6 +195,9 @@
     printf("    { \"iso-8859-15\", chartables_iso_8859_15 },\n");
     printf("    { \"windows-1252\", chartables_windows_1252 },\n");
     printf("    { \"windows-1256\", chartables_windows_1256 },\n");
+    printf("    { \"windows-1250\", chartables_windows_1250 },\n");
+    printf("    { \"windows-1251\", chartables_windows_1251 },\n");
+    printf("    { \"windows-1255\", chartables_windows_1255 },\n");
     printf("    /* New character sets should only be added to end so that\n");
     printf("     * cache files stay with valid information */\n");
     printf("};\n");

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkgmtime.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkgmtime.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkgmtime.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkgmtime.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mkgmtime.c - make time corresponding to a GMT timeval struct
- $Id: mkgmtime.c,v 1.10 2003/10/22 18:50:12 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: mkgmtime.c,v 1.11 2008/03/24 17:43:09 murch Exp $
  */
 /*
  * Copyright (c) 1987, 1989, 1993

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkgmtime.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkgmtime.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkgmtime.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mkgmtime.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mkgmtime.h -- make a time_t from a gmtime struct tm
- $Id: mkgmtime.h,v 1.5 2003/02/13 20:15:41 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: mkgmtime.h,v 1.6 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef INCLUDED_MKGMTIME_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mpool.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mpool.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mpool.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mpool.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mpool.c memory pool management
  *
- * $Id: mpool.c,v 1.16 2006/11/30 17:11:22 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: mpool.c,v 1.18 2008/03/24 17:43:09 murch Exp $
  */
 
 #include <config.h>
@@ -51,10 +53,10 @@
 #include <ctype.h>
 #include <signal.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <syslog.h>
 #include <errno.h>
 
+#include "assert.h"
 #include "mpool.h"
 #include "xmalloc.h"
 #include "exitcodes.h"

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mpool.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mpool.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mpool.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/mpool.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* mpool.h memory pool management
  *
- * $Id: mpool.h,v 1.12 2006/11/30 17:11:22 murch Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: mpool.h,v 1.13 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef _MPOOL_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* nonblock.h -- Set nonbolocking mode on file descriptor
- * $Id: nonblock.h,v 1.8 2003/10/22 18:50:12 rjs3 Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: nonblock.h,v 1.9 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef INCLUDED_NONBLOCK_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock_fcntl.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock_fcntl.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock_fcntl.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock_fcntl.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* nonblock_fcntl.c -- Set nonblocking mode using fcntl()
- * $Id: nonblock_fcntl.c,v 1.15 2003/10/22 18:50:12 rjs3 Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: nonblock_fcntl.c,v 1.16 2008/03/24 17:43:09 murch Exp $
  */
+
 #include <config.h>
 #include <sys/types.h>
 #include <sys/file.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock_ioctl.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock_ioctl.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock_ioctl.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/nonblock_ioctl.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* nonblock_fcntl.c -- Set nonblocking mode using ioctl()
- * $Id: nonblock_ioctl.c,v 1.11 2003/10/22 18:50:12 rjs3 Exp $
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: nonblock_ioctl.c,v 1.12 2008/03/24 17:43:09 murch Exp $
  */
+
 #include <config.h>
 #include <sys/ioctl.h>
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/parseaddr.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/parseaddr.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/parseaddr.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/parseaddr.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* parseaddr.c -- RFC 822 address parser
- * $Id: parseaddr.c,v 1.17 2003/02/13 20:15:41 rjs3 Exp $
- *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: parseaddr.c,v 1.18 2008/03/24 17:43:09 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/parseaddr.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/parseaddr.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/parseaddr.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/parseaddr.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* parseaddr.h -- RFC 822 address parser
- $Id: parseaddr.h,v 1.8 2003/02/13 20:15:41 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: parseaddr.h,v 1.9 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef INCLUDED_PARSEADDR_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/prot.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/prot.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/prot.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/prot.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* prot.c -- stdio-like module that handles SASL protection mechanisms
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
- */
-/*
- * $Id: prot.c,v 1.89 2007/01/09 16:50:31 murch Exp $
+ * $Id: prot.c,v 1.94 2008/03/24 17:43:09 murch Exp $
  */
 
 #include <config.h>
@@ -67,6 +65,7 @@
 
 #include "assert.h"
 #include "exitcodes.h"
+#include "libcyr_cfg.h"
 #include "map.h"
 #include "nonblock.h"
 #include "prot.h"
@@ -162,7 +161,7 @@
 struct protstream *s;
 sasl_conn_t *conn;
 {
-    const int *ssfp;
+    const void *ssfp;
     int result;
 
     if (s->write && s->ptr != s->buf) {
@@ -173,20 +172,20 @@
    
     s->conn = conn;
 
-    result = sasl_getprop(conn, SASL_SSF, (const void **) &ssfp);
+    result = sasl_getprop(conn, SASL_SSF, &ssfp);
     if (result != SASL_OK) {
 	return -1;
     }
-    s->saslssf = *ssfp;
+    s->saslssf = *((const int *) ssfp);
 
     if (s->write) {
 	int result;
-	const unsigned int *maxp;
+	const void *maxp;
 	unsigned int max;
 
 	/* ask SASL for layer max */
-	result = sasl_getprop(conn, SASL_MAXOUTBUF, (const void **) &maxp);
-	max = *maxp;
+	result = sasl_getprop(conn, SASL_MAXOUTBUF, &maxp);
+	max = *((const unsigned int *) maxp);
 	if (result != SASL_OK) {
 	    return -1;
 	}
@@ -646,7 +645,6 @@
     unsigned left = s->ptr - s->buf;
 
     assert(s->write);
-    assert(s->cnt >= 0);
 
     /* Is this protstream finished? */
     if (s->eof || s->error) {
@@ -777,7 +775,7 @@
 	    
 	    if(s->big_buffer == PROT_NO_FD) {
 		/* open new bigbuffer */
-		int fd = create_tempfile();
+		int fd = create_tempfile(libcyrus_config_getstring(CYRUSOPT_TEMP_PATH));
 		if(fd == -1) {
 		    s->error = xstrdup(strerror(errno));
 		    goto done;
@@ -1022,7 +1020,7 @@
     struct protstream *s, *timeout_prot = NULL;
     struct protgroup *retval = NULL;
     int max_fd, found_fds = 0;
-    int i;
+    unsigned i;
     fd_set rfds;
     int have_readtimeout = 0;
     struct timeval my_timeout;
@@ -1239,7 +1237,7 @@
 
 void protgroup_insert(struct protgroup *group, struct protstream *item) 
 {
-    int i, empty;
+    unsigned i, empty;
 
     assert(group);
     assert(item);
@@ -1262,7 +1260,7 @@
 
 void protgroup_delete(struct protgroup *group, struct protstream *item) 
 {
-    int i;
+    unsigned i;
 
     assert(group);
     assert(item);
@@ -1299,7 +1297,8 @@
 {
     assert(!s->write);
 
-    if (s->cnt-- > 0) {
+    if (s->cnt > 0) {
+	--s->cnt;
 	return *(s->ptr)++;
     } else {
 	return prot_fill(s);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/prot.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/prot.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/prot.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/prot.h Mon Feb  9 12:49:22 2009
@@ -1,9 +1,7 @@
 /* prot.h -- stdio-like module that handles buffering, SASL, and TLS
  *           details for I/O over sockets
  *
- * $Id: prot.h,v 1.43 2006/11/30 17:11:22 murch Exp $
- *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -19,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -41,6 +40,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: prot.h,v 1.46 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef INCLUDED_PROT_H
@@ -69,9 +69,9 @@
 struct protstream {
     /* The Buffer */
     unsigned char *buf;
-    int buf_size;
+    unsigned buf_size;
     unsigned char *ptr; /* The end of data in the buffer */
-    int cnt; /* Space Remaining in buffer */
+    unsigned cnt; /* Space Remaining in buffer */
 
     /* File Descriptors */
     int fd;         /* The Socket */
@@ -136,7 +136,7 @@
 extern int prot_ungetc(int c, struct protstream *s);
 extern int prot_putc(int c, struct protstream *s);
 
-#define prot_getc(s) ((s)->cnt-- > 0 ? (int)*(s)->ptr++ : prot_fill(s))
+#define prot_getc(s) ((s)->cnt > 0 ? (--(s)->cnt, (int)*(s)->ptr++) : prot_fill(s))
 #define prot_ungetc(c, s) ((s)->cnt++, (*--(s)->ptr = (c)))
 #define prot_putc(c, s) ((*(s)->ptr++ = (c)), --(s)->cnt == 0 ? prot_flush_internal(s,0) : 0)
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/retry.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/retry.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/retry.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/retry.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* retry.c -- keep trying write system calls
- * $Id: retry.c,v 1.23 2006/11/30 17:11:22 murch Exp $
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- *
+ * $Id: retry.c,v 1.25 2008/03/24 17:43:09 murch Exp $
  */
 
 #include <config.h>
@@ -56,7 +56,7 @@
  * Keep calling the read() system call with 'fd', 'buf', and 'nbyte'
  * until all the data is read in or an error occurs.
  */
-int retry_read(int fd, char *buf, size_t nbyte)
+int retry_read(int fd, void *buf, size_t nbyte)
 {
     int n;
     int nread = 0;
@@ -88,7 +88,7 @@
  * Keep calling the write() system call with 'fd', 'buf', and 'nbyte'
  * until all the data is written out or an error occurs.
  */
-int retry_write(int fd, const char *buf, size_t nbyte)
+int retry_write(int fd, const void *buf, size_t nbyte)
 {
     int n;
     int written = 0;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/retry.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/retry.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/retry.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/retry.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* retry.h -- Keep retrying write system calls
- * $Id: retry.h,v 1.12 2003/10/22 18:50:12 rjs3 Exp $
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: retry.h,v 1.14 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef INCLUDED_RETRY_H
@@ -54,8 +55,8 @@
 
 #include <sys/uio.h>
 
-extern int retry_read P((int fd, char *buf, size_t nbyte));
-extern int retry_write P((int fd, const char *buf, size_t nbyte));
+extern int retry_read P((int fd, void *buf, size_t nbyte));
+extern int retry_write P((int fd, const void *buf, size_t nbyte));
 extern int retry_writev P((int fd, struct iovec *iov, int iovcnt));
 
 /* add a buffer 's' of length 'len' to iovec 'iov' */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/rfc822date.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/rfc822date.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/rfc822date.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/rfc822date.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* rfc822date.c -- Generate an 822 date
- $Id: rfc822date.c,v 1.6 2003/10/22 18:50:12 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: rfc822date.c,v 1.7 2008/03/24 17:43:09 murch Exp $
  */
 
 #include <stdio.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/rfc822date.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/rfc822date.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/rfc822date.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/rfc822date.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* rfc822date.h -- Generate an 822 date
- $Id: rfc822date.h,v 1.3 2003/02/13 20:15:42 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: rfc822date.h,v 1.4 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef INCLUDED_RFC822DATE_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strcasecmp.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strcasecmp.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strcasecmp.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strcasecmp.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* strcasecmp.c -- replacement strcasecmp() & strncasecmp() routines
- $Id: strcasecmp.c,v 1.6 2003/02/13 20:15:42 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: strcasecmp.c,v 1.9 2008/03/24 17:43:09 murch Exp $
  *
  * Author: Chris Newman
  * Start Date: 4/6/93

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strerror.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strerror.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strerror.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strerror.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* strerror.c -- replacement strerror() routine
- $Id: strerror.c,v 1.6 2003/02/13 20:15:42 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: strerror.c,v 1.7 2008/03/24 17:43:09 murch Exp $
  */
 
 extern int sys_nerr;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strhash.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strhash.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strhash.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strhash.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* strhash.c string hashing
  *
- * $Id: strhash.c,v 1.2 2003/10/22 18:03:05 rjs3 Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: strhash.c,v 1.4 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifdef HAVE_UNISTD_H
@@ -49,10 +51,10 @@
 #include <ctype.h>
 #include <signal.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <syslog.h>
 #include <errno.h>
 
+#include "assert.h"
 #include "strhash.h"
 
 unsigned strhash(const char *string)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strhash.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strhash.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strhash.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/strhash.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* strhash.h string hashing
  *
- * $Id: strhash.h,v 1.2 2003/10/22 18:03:05 rjs3 Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: strhash.h,v 1.3 2008/03/24 17:43:09 murch Exp $
  */
 
 #ifndef _STRHASH_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/sysexits.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/sysexits.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/sysexits.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/sysexits.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: sysexits.h,v 1.5 2008/03/24 17:43:09 murch Exp $
  */
-
-/* $Id: sysexits.h,v 1.4 2003/02/13 20:15:42 rjs3 Exp $ */
 
 /*
  * Copyright (c) 1987, 1993

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/test/cyrusdb.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/test/cyrusdb.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/test/cyrusdb.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/test/cyrusdb.c Mon Feb  9 12:49:22 2009
@@ -70,15 +70,15 @@
 	    char *fname = buf + 5;
 
 	    if (db) { /* close it */
-		TRY(DB->close(db));
+		TRY((DB->close)(db));
 	    }
-	    TRY(DB->open(fname, 1, &db));
+	    TRY((DB->open)(fname, 1, &db));
 
 	    printf("ok\n");
 	} else if (!db) {
 	    TRY(db == NULL);
 	} else if (!strncasecmp(buf, "close", 5)) {
-	    TRY(DB->close(db));
+	    TRY((DB->close)(db));
 	    db = NULL;
 	    printf("ok\n");
 	} else if (!strncasecmp(buf, "put ", 4)) {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/test/rnddb.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/test/rnddb.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/test/rnddb.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/test/rnddb.c Mon Feb  9 12:49:22 2009
@@ -133,7 +133,7 @@
 	srand(atoi(argv[2]));
     }
 
-    TRY(DB->open("scratch", &db));
+    TRY((DB->open)("scratch", &db));
 
     if (DB->consistent) {
 	TRY(DB->consistent(db));
@@ -291,7 +291,7 @@
 #endif
     }
 
-    TRY(DB->close(db));
+    TRY((DB->close)(db));
     TRY(DB->done());
 
     do_report();

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/util.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/util.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/util.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/util.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* util.c -- general utility functions
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,9 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*
- * $Id: util.c,v 1.31 2006/11/30 17:11:22 murch Exp $
+ * $Id: util.c,v 1.37 2008/03/24 17:43:09 murch Exp $
  */
 
 #include <config.h>
@@ -48,6 +47,8 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <errno.h>
+#include <grp.h>
+#include <pwd.h>
 #include <string.h>
 #include <stdlib.h>
 #include <syslog.h>
@@ -61,7 +62,6 @@
 #include <errno.h>
 
 #include "exitcodes.h"
-#include "libcyr_cfg.h"
 #include "util.h"
 #include "xmalloc.h"
 
@@ -249,11 +249,11 @@
  *  directory.  Stop before the first dot.  Caller is responsible
  *  for skipping any prefix of the name.
  */
-int dir_hash_c(const char *name)
+int dir_hash_c(const char *name, int full)
 {
     int c;
 
-    if (libcyrus_config_getswitch(CYRUSOPT_FULLDIRHASH)) {
+    if (full) {
 	unsigned char *pt;
 	unsigned int n;
 	enum {
@@ -315,14 +315,13 @@
  * directory listing (but you won't have to worry about cleaning up
  * after it)
  */
-int create_tempfile() 
+int create_tempfile(const char *path) 
 {
     int fd;
     char pattern[2048];
-    const char *path = libcyrus_config_getstring(CYRUSOPT_TEMP_PATH);
 
     if(snprintf(pattern, sizeof(pattern), "%s/cyrus_tmpfile_XXXXXX",
-		path) >= sizeof(pattern)){
+		path) >= (int) sizeof(pattern)){
 	fatal("temporary file pathname is too long in prot_flush",
 	      EC_TEMPFAIL);
     }
@@ -362,3 +361,42 @@
 
     return 0;
 }
+
+int become_cyrus(void)
+{
+    struct passwd *p;
+    int newuid, newgid;
+    int result;
+    static int uid = 0;
+
+    if (uid) return setuid(uid);
+
+    p = getpwnam(CYRUS_USER);
+    if (p == NULL) {
+	syslog(LOG_ERR, "no entry in /etc/passwd for user %s", CYRUS_USER);
+	return -1;
+    }
+
+    /* Save these in case initgroups does a getpw*() */
+    newuid = p->pw_uid;
+    newgid = p->pw_gid;
+
+    if (initgroups(CYRUS_USER, newgid)) {
+        syslog(LOG_ERR, "unable to initialize groups for user %s: %s",
+	       CYRUS_USER, strerror(errno));
+        return -1;
+    }
+
+    if (setgid(newgid)) {
+        syslog(LOG_ERR, "unable to set group id to %d for user %s: %s",
+              newgid, CYRUS_USER, strerror(errno));
+        return -1;
+    }
+
+    result = setuid(newuid);
+
+    /* Only set static uid if successful, else future calls won't reset gid */
+    if (result == 0)
+        uid = newuid;
+    return result;
+}

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/util.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/util.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/util.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/util.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* util.h -- general utility functions
- * $Id: util.h,v 1.20 2007/01/09 17:04:10 murch Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: util.h,v 1.25 2008/03/24 17:43:09 murch Exp $
  *
  * Author: Chris Newman
  * Start Date: 4/6/93
@@ -89,12 +91,12 @@
  *  directory.  Caller is responsible for skipping any prefix
  *  of the name.
  */
-extern int dir_hash_c(const char *name);
+extern int dir_hash_c(const char *name, int full);
 
 /* 
  * create an [unlinked] temporary file and return the file descriptor.
  */
-extern int create_tempfile();
+extern int create_tempfile(const char *path);
 
 /* Close a network filedescriptor the "safe" way */
 extern int cyrus_close_sock(int fd);
@@ -107,6 +109,8 @@
  */
 extern int cyrus_mkdir(const char *path, mode_t mode);
 
+extern int become_cyrus(void);
+
 /* Some systems have very inefficient implementations of isdigit,
  * and we use it in a lot of inner loops
  */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/wildmat.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/wildmat.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/wildmat.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/wildmat.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* wildmat.h - NNTP wildmat processing functions
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,11 +39,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: wildmat.c,v 1.3 2008/03/24 17:43:09 murch Exp $
  */
 
-
-/*  $Revision: 1.2 $
- *  $Id: wildmat.c,v 1.2 2003/10/22 18:03:05 rjs3 Exp $
+/*
 **
 **  Do shell-style pattern matching for ?, \, [], and * characters.
 **  Might not be robust in face of malformed patterns; e.g., "foo[a-"

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/wildmat.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/wildmat.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/wildmat.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/wildmat.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* wildmat.h - NNTP wildmat processing functions
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: wildmat.h,v 1.2 2003/10/22 18:03:05 rjs3 Exp $
+ * $Id: wildmat.h,v 1.3 2008/03/24 17:43:10 murch Exp $
  */
 
 #ifndef INCLUDED_WILDMAT_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xmalloc.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xmalloc.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xmalloc.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xmalloc.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* xmalloc.c -- Allocation package that calls fatal() when out of memory
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,10 +38,10 @@
  * 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.
+ *
+ * $Id: xmalloc.c,v 1.32 2008/03/24 17:43:10 murch Exp $
  */
-/*
- * $Id: xmalloc.c,v 1.31 2006/11/30 17:11:22 murch Exp $
- */
+
 #include <config.h>
 #include <stdio.h>
 #include <stdlib.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xmalloc.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xmalloc.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xmalloc.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xmalloc.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* xmalloc.h -- Allocation package that calls fatal() when out of memory
- * $Id: xmalloc.h,v 1.27 2006/11/30 17:11:22 murch Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: xmalloc.h,v 1.28 2008/03/24 17:43:10 murch Exp $
  */
 
 #ifndef INCLUDED_XMALLOC_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcat.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcat.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcat.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcat.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* xmalloc.c -- Allocation package that calls fatal() when out of memory
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,10 +38,10 @@
  * 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.
+ *
+ * $Id: xstrlcat.c,v 1.3 2008/04/04 12:46:35 murch Exp $
  */
-/*
- * $Id: xstrlcat.c,v 1.2 2006/11/30 17:11:22 murch Exp $
- */
+
 #include "xstrlcat.h"
 
 #ifndef HAVE_STRLCAT

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcat.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcat.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcat.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcat.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* xmalloc.h -- Allocation package that calls fatal() when out of memory
- * $Id: xstrlcat.h,v 1.2 2006/11/30 17:11:22 murch Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: xstrlcat.h,v 1.3 2008/03/24 17:43:10 murch Exp $
  */
 
 #ifndef INCLUDED_XSTRLCAT_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcpy.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcpy.c?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcpy.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcpy.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* xmalloc.c -- Allocation package that calls fatal() when out of memory
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,10 +38,10 @@
  * 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.
+ *
+ * $Id: xstrlcpy.c,v 1.3 2008/03/24 17:43:10 murch Exp $
  */
-/*
- * $Id: xstrlcpy.c,v 1.2 2006/11/30 17:11:22 murch Exp $
- */
+
 #include "xstrlcpy.h"
 
 #include "exitcodes.h"

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcpy.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcpy.h?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcpy.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/lib/xstrlcpy.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* xmalloc.h -- Allocation package that calls fatal() when out of memory
- * $Id: xstrlcpy.h,v 1.2 2006/11/30 17:11:22 murch Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: xstrlcpy.h,v 1.3 2008/03/24 17:43:10 murch Exp $
  */
 
 #ifndef INCLUDED_XSTRLCPY_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,7 +1,8 @@
 # Makefile for makedepend
 #
 # @configure_input@
-# Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+#
+# Copyright (c) 1994-2008 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
@@ -17,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -39,6 +41,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 # 
+# $Id: Makefile.in,v 1.8 2008/04/04 12:46:46 murch Exp $
 # 
 srcdir = @srcdir@
 VPATH = @srcdir@

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/configure
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/configure?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/configure (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/configure Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+#
+# Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -36,6 +38,8 @@
 # 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.
+#
+# $Id: configure,v 1.3 2008/04/04 12:46:46 murch Exp $
 #
 # Guess values for system-dependent variables and create Makefiles.
 # Generated automatically using autoconf version 2.3 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/cppsetup.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/cppsetup.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/cppsetup.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/cppsetup.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,7 @@
 /* $XConsortium: cppsetup.c,v 1.13 94/04/17 20:10:32 gildea Exp $ */
 
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +40,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: cppsetup.c,v 1.4 2008/04/04 12:46:47 murch Exp $
  */
 /*
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/def.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/def.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/def.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/def.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,7 @@
 /* $XConsortium: def.h,v 1.25 94/04/17 20:10:33 gildea Exp $ */
 
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +40,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: def.h,v 1.4 2008/04/04 12:46:47 murch Exp $
  */
 /*
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/ifparser.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/ifparser.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/ifparser.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/ifparser.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,7 @@
 /*
  * $XConsortium: ifparser.c,v 1.7 94/01/18 21:30:50 rws Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,6 +39,8 @@
  * 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.
+ *
+ * $Id: ifparser.c,v 1.4 2008/04/04 12:46:47 murch Exp $
  *
  *
  * Copyright 1992 Network Computing Devices, Inc.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/ifparser.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/ifparser.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/ifparser.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/ifparser.h Mon Feb  9 12:49:22 2009
@@ -1,6 +1,7 @@
 /*
  * $XConsortium: ifparser.h,v 1.1 92/08/22 13:05:39 rws Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,6 +39,8 @@
  * 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.
+ *
+ * $Id: ifparser.h,v 1.4 2008/04/04 12:46:48 murch Exp $
  *
  *
  * Copyright 1992 Network Computing Devices, Inc.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/include.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/include.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/include.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/include.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,7 @@
 /* $XConsortium: include.c,v 1.16 94/04/17 20:10:34 gildea Exp $ */
 
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +40,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: include.c,v 1.4 2008/04/04 12:46:48 murch Exp $
  */
 /*
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/install-sh
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/install-sh?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/install-sh (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/install-sh Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -37,6 +38,8 @@
 # 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.
+#
+# $Id: install-sh,v 1.3 2008/04/04 12:46:49 murch Exp $
 #
 # install - install a program, script, or datafile
 # This comes from X11R5.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/main.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/main.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/main.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/main.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* $XConsortium: main.c,v 1.83 94/04/17 20:10:36 gildea Exp $ */
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,8 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: main.c,v 1.6 2008/04/04 12:46:49 murch Exp $
  */
-
 /*
 
 Copyright (c) 1993, 1994  X Consortium

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/parse.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/parse.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/parse.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/parse.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* $XConsortium: parse.c,v 1.30 94/04/17 20:10:38 gildea Exp $ */
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,8 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: parse.c,v 1.4 2008/04/04 12:46:49 murch Exp $
  */
-
 /*
 
 Copyright (c) 1993, 1994  X Consortium

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/pr.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/pr.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/pr.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/makedepend/pr.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* $XConsortium: pr.c,v 1.17 94/04/17 20:10:38 gildea Exp $ */
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: pr.c,v 1.4 2008/04/04 12:46:49 murch Exp $
  */
 /*
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,9 +1,6 @@
 # Makefile for the Cyrus controlling process
-# $Id: Makefile.in,v 1.22 2006/11/30 17:11:23 murch Exp $
 # 
-# @configure_input@
-#
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -19,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -41,6 +39,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: Makefile.in,v 1.24 2008/03/24 17:47:41 murch Exp $
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -86,8 +85,8 @@
 	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) \
 	$<
 
-master: master.o masterconf.o message_uuid_master.o cyrusMasterMIB.o ../lib/lock_ at WITH_LOCK@.o
-	$(CC) $(LDFLAGS) -o master master.o masterconf.o message_uuid_master.o cyrusMasterMIB.o ../lib/lock_ at WITH_LOCK@.o $(LIBS) $(DEPLIBS)
+master: master.o masterconf.o cyrusMasterMIB.o ../lib/lock_ at WITH_LOCK@.o
+	$(CC) $(LDFLAGS) -o master master.o masterconf.o cyrusMasterMIB.o ../lib/lock_ at WITH_LOCK@.o $(LIBS) $(DEPLIBS)
 
 clean:
 	rm -f *.o *.a Makefile.bak $(PROGS)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/master.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/master.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/master.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/master.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* master.c -- IMAP master process to handle recovery, checkpointing, spawning
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: master.c,v 1.112 2008/10/08 13:12:41 wescraig Exp $
  */
-
-/* $Id: master.c,v 1.104 2006/11/30 17:11:23 murch Exp $ */
 
 #include <config.h>
 
@@ -48,7 +49,6 @@
 #include <string.h>
 #include <time.h>
 #include <sys/time.h>
-#include <grp.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #ifdef HAVE_UNISTD_H
@@ -59,7 +59,6 @@
 #endif
 #include <fcntl.h>
 #include <signal.h>
-#include <pwd.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <syslog.h>
@@ -93,6 +92,11 @@
 
   #include "cyrusMasterMIB.h"
 
+
+  /* Use our own definitions for these */
+  #undef TOUPPER
+  #undef TOLOWER
+
 #elif defined(HAVE_UCDSNMP)
   #include <ucd-snmp/ucd-snmp-config.h>
   #include <ucd-snmp/ucd-snmp-includes.h>
@@ -110,10 +114,8 @@
 #include "service.h"
 
 #include "lock.h"
-
+#include "util.h"
 #include "xmalloc.h"
-
-#include "message_uuid_master.h"
 
 enum {
     become_cyrus_early = 1,
@@ -124,7 +126,6 @@
 static int verbose = 0;
 static int listen_queue_backlog = 32;
 static int pidfd = -1;
-static int have_uuid = 0;
 
 const char *MASTER_CONFIG_FILENAME = DEFAULT_MASTER_CONFIG_FILENAME;
 
@@ -188,45 +189,6 @@
     if(a->exec) free((char**)a->exec);
     if(a->name) free((char*)a->name);
     free(a);
-}
-
-int become_cyrus(void)
-{
-    struct passwd *p;
-    int newuid, newgid;
-    int result;
-    static int uid = 0;
-
-    if (uid) return setuid(uid);
-
-    p = getpwnam(CYRUS_USER);
-    if (p == NULL) {
-	syslog(LOG_ERR, "no entry in /etc/passwd for user %s", CYRUS_USER);
-	return -1;
-    }
-
-    /* Save these in case initgroups does a getpw*() */
-    newuid = p->pw_uid;
-    newgid = p->pw_gid;
-
-    if (initgroups(CYRUS_USER, newgid)) {
-        syslog(LOG_ERR, "unable to initialize groups for user %s: %s",
-	       CYRUS_USER, strerror(errno));
-        return -1;
-    }
-
-    if (setgid(newgid)) {
-        syslog(LOG_ERR, "unable to set group id to %d for user %s: %s",
-              newgid, CYRUS_USER, strerror(errno));
-        return -1;
-    }
-
-    result = setuid(newuid);
-
-    /* Only set static uid if successful, else future calls won't reset gid */
-    if (result == 0)
-        uid = newuid;
-    return result;
 }
 
 void get_prog(char *path, unsigned size, char *const *cmd)
@@ -601,9 +563,6 @@
     struct centry *c;
     struct service * const s = &Services[si];
     time_t now = time(NULL);
-    struct message_uuid uuid_prefix;
-    char *uuid_prefix_text;
-    static char uuid_env[100];
 
     if (!s->name) {
 	fatal("Serious software bug found: spawn_service() called on unnamed service!",
@@ -650,21 +609,6 @@
 	return;
     }
 
-    if (s->provide_uuid) {
-        if (!message_uuid_master_next_child(&uuid_prefix)) {
-            syslog(LOG_ERR, "Failed to generate UUID for %s", s->name);
-            message_uuid_set_null(&uuid_prefix);
-        }
-
-        if (!message_uuid_master_checksum(&uuid_prefix)) {
-            syslog(LOG_ERR, "Failed to checksum UUID for %s", s->name);
-            message_uuid_set_null(&uuid_prefix);
-        }
-
-        uuid_prefix_text = message_uuid_text(&uuid_prefix);
-    } else
-        uuid_prefix_text = NULL;
-
     switch (p = fork()) {
     case -1:
 	syslog(LOG_ERR, "can't fork process to run service %s: %m", s->name);
@@ -707,13 +651,6 @@
 	putenv(name_env);
 	snprintf(name_env2, sizeof(name_env2), "CYRUS_ID=%d", s->associate);
 	putenv(name_env2);
-
-	/* add UUID prefix to environment */
-	if (s->provide_uuid) {
-	    snprintf(uuid_env, sizeof(uuid_env), "CYRUS_UUID_PREFIX=%s",
-		     uuid_prefix_text);
-	    putenv(uuid_env);
-	}
 
 	execv(path, s->exec);
 	syslog(LOG_ERR, "couldn't exec %s: %m", path);
@@ -930,6 +867,9 @@
 			   "service %s pid %d in UNKNOWN state: exited",
 			   SERVICENAME(s->name), pid);
 		    break;
+		default:
+		    /* Shouldn't get here */
+		    break;
 		} 
 	    } else {
 	    	/* children from spawn_schedule (events) or
@@ -1025,7 +965,7 @@
     }
 }
 
-static volatile int gotsigchld = 0;
+static volatile sig_atomic_t gotsigchld = 0;
 
 void sigchld_handler(int sig __attribute__((unused)))
 {
@@ -1187,6 +1127,9 @@
 	    c->service_state = SERVICE_STATE_READY;
 	    s->ready_workers++;
 	    break;
+	default:
+	    /* Shouldn't get here */
+	    break;
 	}
 	break;
 
@@ -1213,6 +1156,9 @@
 		       SERVICENAME(s->name), c->pid);
 	    c->service_state = SERVICE_STATE_BUSY;
 	    s->ready_workers--;
+	    break;
+	default:
+	    /* Shouldn't get here */
 	    break;
 	}
 	break;
@@ -1244,6 +1190,9 @@
 	    c->service_state = SERVICE_STATE_BUSY;
 	    s->nconnections++;
 	    s->ready_workers--;
+	default:
+	    /* Shouldn't get here */
+	    break;
 	}
 	break;
 	
@@ -1274,6 +1223,9 @@
 	    syslog(LOG_ERR,
 		   "service %s pid %d in UNKNOWN state: serving one more multi-threaded connection, forced to READY state",
 		   SERVICENAME(s->name), c->pid);
+	    break;
+	default:
+	    /* Shouldn't get here */
 	    break;
 	}
 	break;
@@ -1347,7 +1299,6 @@
     rlim_t maxfds = (rlim_t) masterconf_getint(e, "maxfds", 256);
     int reconfig = 0;
     int i, j;
-    int provide_uuid = have_uuid && masterconf_getswitch(e, "provide_uuid", 0);
 
     if(babysit && prefork == 0) prefork = 1;
     if(babysit && maxforkrate == 0) maxforkrate = 10; /* reasonable safety */
@@ -1427,7 +1378,6 @@
 
     Services[i].maxforkrate = maxforkrate;
     Services[i].maxfds = maxfds;
-    Services[i].provide_uuid = provide_uuid;
 
     if (!strcmp(Services[i].proto, "tcp") ||
 	!strcmp(Services[i].proto, "tcp4") ||
@@ -1456,7 +1406,6 @@
 		Services[j].desired_workers = Services[i].desired_workers;
 		Services[j].babysit = Services[i].babysit;
 		Services[j].max_workers = Services[i].max_workers;
-		Services[j].provide_uuid = Services[i].provide_uuid;
 	    }
 	}
     }
@@ -1954,12 +1903,6 @@
 	}
     }
 
-    have_uuid = (config_getint(IMAPOPT_SYNC_MACHINEID) >= 0);
-    if (have_uuid && !message_uuid_master_init()) {
-        syslog(LOG_ERR, "Couldn't initialise UUID subsystem");
-        exit(EX_OSERR);
-    }
-    
     /* init ctable janitor */
     init_janitor();
     
@@ -2016,7 +1959,6 @@
 		Services[i].nactive = 0;
 		Services[i].nconnections = 0;
 		Services[i].associate = 0;
-                Services[i].provide_uuid = 0;
 
 		if (Services[i].stat[0] > 0) close(Services[i].stat[0]);
 		if (Services[i].stat[1] > 0) close(Services[i].stat[1]);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/master.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/master.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/master.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/master.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,7 @@
 #ifndef HAVE_MASTER_H
 #define HAVE_MASTER_H
 
-/* $Id: master.h,v 1.14 2006/11/30 17:11:23 murch Exp $ */
+/* $Id: master.h,v 1.15 2007/09/24 12:48:32 murch Exp $ */
 
 #include <config.h>
 #include <sys/resource.h> /* for rlim_t */
@@ -15,7 +15,6 @@
     char *proto;		/* protocol to accept */
     char *const *exec;		/* command (with args) to execute */
     int babysit;		/* babysit this service? */
-    int provide_uuid;           /* Service assigns UUIDS */
     
     /* multiple address family support */
     int associate;		/* are we primary or additional instance? */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/masterconf.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/masterconf.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/masterconf.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/masterconf.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* masterconfig.c -- Configuration routines for master process
- * $Id: masterconf.c,v 1.13 2006/11/30 17:11:23 murch Exp $
  * 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,7 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: masterconf.c,v 1.14 2008/03/24 17:47:41 murch Exp $
  */
+
 #include <config.h>
 
 #include <stdio.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/masterconf.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/masterconf.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/masterconf.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/masterconf.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* config.h -- Configuration routines
- $Id: masterconf.h,v 1.6 2003/10/22 18:50:14 rjs3 Exp $
- 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: masterconf.h,v 1.7 2008/03/24 17:47:41 murch Exp $
  */
 
 #ifndef INCLUDED_MASTERCONF_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service-thread.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service-thread.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service-thread.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service-thread.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* service-thread.c -- skeleton for Cyrus service; calls the real main
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,10 @@
  * 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.
+ *
+ * $Id: service-thread.c,v 1.21 2008/03/24 17:47:41 murch Exp $
  */
 
-/* $Id: service-thread.c,v 1.20 2006/11/30 17:11:23 murch Exp $ */
 #include <config.h>
 
 #include <stdio.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 /* service.c -- skeleton for Cyrus service; calls the real main
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,9 @@
  * 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.
+ *
+ * $Id: service.c,v 1.59 2008/03/24 17:47:41 murch Exp $
  */
-
-/* $Id: service.c,v 1.57 2007/02/05 18:57:24 jeaton Exp $ */
 
 #include <config.h>
 
@@ -252,7 +253,7 @@
     int max_use = MAX_USE;
     int reuse_timeout = REUSE_TIMEOUT;
     int soctype;
-    int typelen = sizeof(soctype);
+    socklen_t typelen = sizeof(soctype);
     int newargc = 0;
     char **newargv = (char **) xmalloc(ARGV_GROW * sizeof(char *));
     int id;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/master/service.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -36,9 +37,9 @@
  * 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.
+ *
+ * $Id: service.h,v 1.18 2008/04/15 18:06:30 murch Exp $
  */
-
-/* $Id: service.h,v 1.16 2003/10/22 18:50:14 rjs3 Exp $ */
 
 #ifndef SERVICE_H
 #define SERVICE_H
@@ -58,7 +59,7 @@
 extern int service_init(int argc, char **argv, char **envp);
 extern int service_main(int argc, char **argv, char **envp);
 extern int service_main_fd(int fd, int argc, char **argv, char **envp);
-extern int service_abort(int error);
+extern void service_abort(int error);
 
 enum {
     MAX_USE = 250,

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,7 +1,8 @@
 # Makefile for netnews tools useful with cyrus
 #
 # @configure_input@
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+#
+# Copyright (c) 1994-2008 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
@@ -17,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -39,8 +41,8 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: Makefile.in,v 1.10 2006/11/30 17:11:23 murch Exp $
-# 
+# $Id: Makefile.in,v 1.11 2008/03/24 19:06:32 murch Exp $
+
 srcdir = @srcdir@
 VPATH = @srcdir@
 
@@ -49,7 +51,7 @@
 RANLIB = @RANLIB@
 
 DEFS = @DEFS@
-CPPFLAGS = -I.. -I$(srcdir) -I$(srcdir)/../lib -I$(srcdir)/../et @CPPFLAGS@
+CPPFLAGS = -I.. -I$(srcdir) -I$(srcdir)/../lib -I$(srcdir)/../com_err/et @CPPFLAGS@
 LIBS =  @IMAP_LIBS@ @LIB_RT@
 DEPLIBS = ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@ 
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/macros.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/macros.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/macros.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/macros.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
-/*  $Revision: 1.7 $
- *  $Id: macros.h,v 1.7 2003/10/22 18:50:15 rjs3 Exp $
+/* Here be some useful macros.
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,9 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
-**  Here be some useful macros.
-*/
-
+ * $Id: macros.h,v 1.8 2008/03/24 19:06:32 murch Exp $
+ */
 
 /*
 **  Memory allocation.  Wrappers around wrapper functions.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/readconfig.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/readconfig.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/readconfig.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/readconfig.c Mon Feb  9 12:49:22 2009
@@ -1,11 +1,8 @@
-/*
- *
- *  The code for reading expire.ctl files (most of this file) was borrowed from innd
+/* The code for reading expire.ctl files (most of this file)
+ * was borrowed from innd
  *   Minor modifications to that code were made
- */
-
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -21,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -43,9 +41,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: readconfig.c,v 1.9 2008/03/24 19:06:32 murch Exp $
  */
-
-/* $Id: readconfig.c,v 1.8 2003/10/22 18:50:15 rjs3 Exp $ */
 
 /*   Copyright 1991 Rich Salz.
  *   All rights reserved.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/readconfig.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/readconfig.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/readconfig.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/readconfig.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: readconfig.h,v 1.5 2008/03/24 19:06:32 murch Exp $
  */
-
-/* $Id: readconfig.h,v 1.4 2003/02/13 20:15:47 rjs3 Exp $ */
 
 #ifndef READCONFIG_H
 #define READCONFIG_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/remotepurge.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/remotepurge.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/remotepurge.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/netnews/remotepurge.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
-/*
- * Remotely purge old/too big articles
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* Remotely purge old/too big articles
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,9 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: remotepurge.c,v 1.19 2008/03/24 19:06:32 murch Exp $
  */
-
-/* $Id: remotepurge.c,v 1.18 2003/02/13 20:15:47 rjs3 Exp $ */
 
 #include <config.h>
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,8 +1,8 @@
 # Makefile.in - notifyd makefile
-# $Id: Makefile.in,v 1.11 2006/11/30 17:11:23 murch Exp $
+#
 # @configure_input@
 # 
-# Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -18,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -40,6 +41,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: Makefile.in,v 1.12 2008/03/24 19:59:32 murch Exp $
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/exitcodes.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/exitcodes.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/exitcodes.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/exitcodes.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* exitcodes.h -- wrapper around sysextis.h
- * $Id: exitcodes.h,v 1.2 2003/02/13 20:15:48 rjs3 Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: exitcodes.h,v 1.3 2008/03/24 19:59:32 murch Exp $
  */
 
 /* Sendmail has some weird ideas on what constitutes permenant failure.  On

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_log.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_log.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_log.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_log.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* notify_log.c -- syslog notification method
- * Ken Murchison
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: notify_log.c,v 1.7 2003/10/22 18:50:16 rjs3 Exp $
+ * $Id: notify_log.c,v 1.8 2008/03/24 19:59:32 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_log.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_log.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_log.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_log.h Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* notify_log.h -- syslog notification method
- * Ken Murchison
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: notify_log.h,v 1.5 2003/02/13 20:15:48 rjs3 Exp $
+ * $Id: notify_log.h,v 1.6 2008/03/24 19:59:32 murch Exp $
  */
 
 #ifndef _NOTIFY_LOG_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_mailto.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_mailto.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_mailto.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_mailto.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* notify_mailto.c -- email notification method
- * Ken Murchison
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: notify_mailto.c,v 1.12 2006/11/30 17:11:23 murch Exp $
+ * $Id: notify_mailto.c,v 1.14 2008/10/09 15:19:55 murch Exp $
  */
 
 #include <config.h>
@@ -110,8 +109,8 @@
 	return strdup("NO mailto could not spawn sendmail process");
 
     t = time(NULL);
-    snprintf(outmsgid, sizeof(outmsgid), "<cmu-sieve-%u-%lu-%d@%s>", 
-	     sm_pid, t, global_outgoing_count++, config_servername);
+    snprintf(outmsgid, sizeof(outmsgid), "<cmu-sieve-%d-%lu-%d@%s>", 
+	     (int) sm_pid, t, global_outgoing_count++, config_servername);
     
     fprintf(sm, "Message-ID: %s\r\n", outmsgid);
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_mailto.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_mailto.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_mailto.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_mailto.h Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* notify_mailto.h -- email notification method
- * Ken Murchison
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: notify_mailto.h,v 1.5 2003/02/13 20:15:48 rjs3 Exp $
+ * $Id: notify_mailto.h,v 1.6 2008/03/24 19:59:32 murch Exp $
  */
 
 #ifndef _NOTIFY_MAILTO_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_null.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_null.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_null.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_null.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* notify_null.c -- NULL notification method
- * Ken Murchison
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: notify_null.c,v 1.6 2003/02/13 20:15:48 rjs3 Exp $
+ * $Id: notify_null.c,v 1.7 2008/03/24 19:59:32 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_null.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_null.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_null.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_null.h Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* notify_null.h -- NULL notification method
- * Ken Murchison
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: notify_null.h,v 1.5 2003/02/13 20:15:48 rjs3 Exp $
+ * $Id: notify_null.h,v 1.6 2008/03/24 19:59:32 murch Exp $
  */
 
 #ifndef _NOTIFY_NULL_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_zephyr.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_zephyr.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_zephyr.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_zephyr.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* notify_zephyr.c -- zephyr notification method
- * Ken Murchison
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: notify_zephyr.c,v 1.5 2006/11/30 17:11:23 murch Exp $
+ * $Id: notify_zephyr.c,v 1.6 2008/03/24 19:59:32 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_zephyr.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_zephyr.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_zephyr.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notify_zephyr.h Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* notify_zephyr.h -- zephyr notification method
- * Ken Murchison
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: notify_zephyr.h,v 1.3 2003/02/13 20:15:48 rjs3 Exp $
+ * $Id: notify_zephyr.h,v 1.4 2008/03/24 19:59:32 murch Exp $
  */
 
 #ifndef _NOTIFY_ZEPHYR_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifyd.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifyd.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifyd.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifyd.c Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* notifyd.c -- main file for notifyd (notify script notification program)
- * Ken Murchison
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: notifyd.c,v 1.20 2006/11/30 17:11:23 murch Exp $
+ * $Id: notifyd.c,v 1.21 2008/03/24 19:59:32 murch Exp $
  */
 
 #ifdef HAVE_CONFIG_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifyd.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifyd.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifyd.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifyd.h Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 /* notifyd.h -- notification method definitions
- * Ken Murchison
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -40,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: notifyd.h,v 1.2 2003/02/13 20:15:48 rjs3 Exp $
+ * $Id: notifyd.h,v 1.3 2008/03/24 19:59:32 murch Exp $
  */
 
 #include <config.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifytest.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifytest.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifytest.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/notifytest.c Mon Feb  9 12:49:22 2009
@@ -1,10 +1,6 @@
 /* notifytest.c: notifyd test utility
- * Ken Murchison
- * Rob Siemborski
- * $Id: notifytest.c,v 1.10 2003/02/13 20:15:48 rjs3 Exp $
- */
-/* 
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -20,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -41,6 +38,8 @@
  * 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.
+ *
+ * $Id: notifytest.c,v 1.11 2008/03/24 19:59:32 murch Exp $
  */
 
 #ifdef HAVE_CONFIG_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/version.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/version.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/version.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/notifyd/version.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* version.h: the version number
  *
- * $Id: version.h,v 1.2 2003/02/13 20:15:48 rjs3 Exp $
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: version.h,v 1.3 2008/03/24 19:59:32 murch Exp $
  */
 
 #define _NOTIFYD_VERSION "0.9"

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,9 +1,8 @@
 # SIEVE Makefile for cyrus software
-# $Id: Makefile.in,v 1.14 2003/10/22 18:50:17 rjs3 Exp $
 #
 # @configure_input@
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -40,6 +40,8 @@
 # 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.
+# 
+# $Id: Makefile.in,v 1.16 2008/04/04 12:47:07 murch Exp $
 # 
 
 SUBDIRS = @PERL_SUBDIRS@
@@ -77,7 +79,7 @@
 	@for d in  $(SUBDIRS); \
 	do \
 		(cd $$d; echo "### Making" all "in" `pwd`;	\
-			if [ -f Makefile.PL ]; then \
+			if [ -f Makefile.PL -a ! -f Makefile ]; then \
 			   LIB_RT="$(LIB_RT)" \
 			   BDB_LIB="$(BDB_LIB)" BDB_INC="$(BDB_INC)" \
 			   OPENSSL_LIB="$(OPENSSL_LIB)" OPENSSL_INC="$(OPENSSL_INC)" \

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP.pm
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP.pm?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP.pm (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP.pm Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -37,7 +38,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: IMAP.pm,v 1.23 2006/11/30 17:11:23 murch Exp $
+# $Id: IMAP.pm,v 1.24 2008/04/04 12:47:08 murch Exp $
 
 package Cyrus::IMAP;
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP.xs
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP.xs?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP.xs (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP.xs Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: IMAP.xs,v 1.28 2008/04/04 12:47:09 murch Exp $
  */
-
-/* $Id: IMAP.xs,v 1.25 2006/11/30 17:11:23 murch Exp $ */
 
 /*
  * Perl interface to the Cyrus imclient routines.  This enables the
@@ -115,7 +116,6 @@
 		    struct imclient_reply *reply)
 {
   dSP;
-  dTARG;
   SV* rv;
   struct xsccb *rock = (struct xsccb *) prock;
 
@@ -138,7 +138,7 @@
   if (reply->msgno != -1) {
     char tmp[100];
     XPUSHs(sv_2mortal(newSVpv("-msgno", 0)));
-    sprintf(tmp,"%d",reply->msgno);
+    sprintf(tmp,"%ld",reply->msgno);
     XPUSHs(sv_2mortal(newSVpv(tmp, 0)));
   }
   PUTBACK;
@@ -320,7 +320,7 @@
 	struct xscb *nx;
 CODE:
 /* fprintf(stderr, "!DESTROY %p %d\n", client, client->cnt); */
-	if (!--client->cnt) {
+	if (!client->cnt--) {
 /* printf("closing\n"); */
 	  imclient_close(client->imclient);
 	  while (client->cb) {
@@ -440,7 +440,6 @@
         char* CApath
 PREINIT:
 	int rc;
-	int tls_layer;
 CODE:
 	ST(0) = sv_newmortal();
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP/Admin.pm
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP/Admin.pm?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP/Admin.pm (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP/Admin.pm Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -37,7 +38,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: Admin.pm,v 1.49 2006/11/30 17:11:23 murch Exp $
+# $Id: Admin.pm,v 1.51 2008/04/04 12:47:11 murch Exp $
 
 package Cyrus::IMAP::Admin;
 use strict;
@@ -785,8 +786,9 @@
 
   my %values = ( "comment" => "/comment",
 		 "condstore" => "/vendor/cmu/cyrus-imapd/condstore",
+		 "expire" => "/vendor/cmu/cyrus-imapd/expire",
 		 "news2mail" => "/vendor/cmu/cyrus-imapd/news2mail",
-		 "expire" => "/vendor/cmu/cyrus-imapd/expire",
+		 "sharedseen" => "/vendor/cmu/cyrus-imapd/sharedseen",
 		 "sieve" => "/vendor/cmu/cyrus-imapd/sieve",
 		 "squat" => "/vendor/cmu/cyrus-imapd/squat" );
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP/Shell.pm
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP/Shell.pm?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP/Shell.pm (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/IMAP/Shell.pm Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -37,7 +38,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: Shell.pm,v 1.38 2006/11/30 17:11:24 murch Exp $
+# $Id: Shell.pm,v 1.43 2008/04/04 13:44:49 murch Exp $
 #
 # A shell framework for Cyrus::IMAP::Admin
 #
@@ -126,7 +127,7 @@
 		  [\&_sc_info, '[mailbox]',
 		   'display mailbox/server metadata'],
 		mboxcfg =>
-		  [\&_sc_mboxcfg, 'mailbox [comment|condstore|news2mail|expire|sieve|squat] value',
+		  [\&_sc_mboxcfg, 'mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value',
 		   'configure mailbox'],
 		mboxconfig => 'mboxcfg',
 		reconstruct =>
@@ -698,13 +699,25 @@
       my $flags = $mbx->[1];
       next if($flags =~ /(\\noselect|\\nonexistent|\\placeholder)/i);
       $lfh->[1]->print($name,":\n");
-      $nargv[0] = $name;
-      if(showacl(2, at nargv) != 0) {
-	return 1;
+      my %acl = $$cyrref->listaclmailbox($name);
+      if (defined $$cyrref->error) {
+         $lfh->[2]->print($$cyrref->error, "\n");
+         next;
       }
+      foreach my $acl (keys %acl) {
+        $lfh->[1]->print("  ", $acl, " ", $acl{$acl}, "\n");
+      }
     }
   } else {
-    return showacl(0, at nargv);
+    my %acl = $$cyrref->listaclmailbox(@nargv);
+    if (defined $$cyrref->error) {
+       $lfh->[2]->print($$cyrref->error, "\n");
+       return 1;
+    }
+
+    foreach my $acl (keys %acl) {
+      $lfh->[1]->print($acl, " ", $acl{$acl}, "\n");
+    }
   }
   return 0;
 }
@@ -777,7 +790,7 @@
       $want = '-service';
       next;
     }
-    if (Cyrus::IMAP::imclient_havetls()) {
+    if (Cyrus::IMAP::havetls()) {
       if ($opt ne '' && '-tlskey' =~ /^\Q$opt/ || $opt eq '--tlskey') {
 	$want = '-tlskey';
 	next;
@@ -802,7 +815,7 @@
   }
   push(@nargv, @argv);
   if (@nargv > 1) {
-    if (Cyrus::IMAP::imclient_havetls()) {
+    if (Cyrus::IMAP::havetls()) {
       die "usage: authenticate [-minssf N] [-maxssf N] [-mechanisms STR]\n".
           "                    [-service name] [-tlskey keyfile] [-notls] [user]\n";
     } else {
@@ -1424,7 +1437,7 @@
   while (defined ($opt = shift(@argv))) {
     last if $opt eq '--';
     if ($opt =~ /^-/) {
-      die "usage: mboxconfig mailbox [comment|condstore|news2mail|expire|sieve|squat] value\n";
+      die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value\n";
     }
     else {
       push(@nargv, $opt);
@@ -1433,7 +1446,7 @@
   }
   push(@nargv, @argv);
   if (@nargv < 2) {
-    die "usage: mboxconfig mailbox [comment|condstore|news2mail|expire|sieve|squat] value\n";
+    die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value\n";
   }
   if (!$cyrref || !$$cyrref) {
     die "mboxconfig: no connection to server\n";
@@ -1671,6 +1684,17 @@
 
 Sets the number of days after which messages will be expired from the mailbox.
 
+=item C<news2mail>
+
+Sets an email address to which messages injected into the server via NNTP 
+will be sent.
+
+=item C<sharedseen>
+
+Enables the use of a shared \Seen flag on messages rather than a
+per-user \Seen flag.  The 's' right in the mailbox ACL still controls
+whether a user can set the shared \Seen flag.
+
 =item C<sieve>
 
 Indicates the name of the global sieve script that should be run when
@@ -1680,11 +1704,6 @@
 =item C<squat>
 
 Indicates that the mailbox should have a squat index created for it.
-
-=item C<news2mail>
-
-Sets an email address to which messages injected into the server via NNTP 
-will be sent.
 
 =back 
 
@@ -1789,8 +1808,8 @@
 
 =item C<motd>
 
-Sets a "message of the day".  The message gets displayed as an ALERT after
-authentication.
+Sets a "message of the day".  The message gets displayed as an ALERT upon
+connection.
 
 =item C<comment>
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/Makefile.PL
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/Makefile.PL?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/Makefile.PL (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/Makefile.PL Mon Feb  9 12:49:22 2009
@@ -36,7 +36,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: Makefile.PL,v 1.18 2006/11/30 17:11:23 murch Exp $
+# $Id: Makefile.PL,v 1.19 2007/10/17 20:06:33 murch Exp $
 
 use ExtUtils::MakeMaker;
 use Config;
@@ -66,6 +66,6 @@
     'MYEXTLIB'  => '../../lib/libcyrus.a ../../lib/libcyrus_min.a',
     'LIBS'	=> ["$BDB_LIB $SASL_LIB $OPENSSL_LIB $LIB_RT -lssl -lcrypto"],
     'DEFINE'	=> '-DPERL_POLLUTE',    # e.g., '-DHAVE_SOMETHING' 
-    'INC'	=> "-I../../lib -I../.. -I../../et $SASL_INC $OPENSSL_INC", 
+    'INC'	=> "-I../../lib -I../.. -I../../com_err/et $SASL_INC $OPENSSL_INC", 
     'EXE_FILES' => [cyradm],
 );

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/cyradm.sh
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/cyradm.sh?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/cyradm.sh (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/cyradm.sh Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #! /bin/sh
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -38,8 +39,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-#
-# $Id: cyradm.sh,v 1.18 2006/11/30 17:11:23 murch Exp $
+# $Id: cyradm.sh,v 1.20 2008/04/04 12:47:10 murch Exp $
 case "x$BASH_VERSION" in
 x) exec perl -MCyrus::IMAP::Shell -e shell -- ${1+"$@"} ;;
 *) exec perl -MCyrus::IMAP::Shell -e shell -- "$@" ;;
@@ -220,6 +220,17 @@
 
 Sets the number of days after which messages will be expired from the mailbox.
 
+=item C<news2mail>
+
+Sets an email address to which messages injected into the server via NNTP 
+will be sent.
+
+=item C<sharedseen>
+
+Enables the use of a shared \Seen flag on messages rather than a
+per-user \Seen flag.  The 's' right in the mailbox ACL still controls
+whether a user can set the shared \Seen flag.
+
 =item C<sieve>
 
 Indicates the name of the global sieve script that should be run when
@@ -229,11 +240,6 @@
 =item C<squat>
 
 Indicates that the mailbox should have a squat index created for it.
-
-=item C<news2mail>
-
-Sets an email address to which messages injected into the server via NNTP 
-will be sent.
 
 =back 
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/cyrperl.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/cyrperl.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/cyrperl.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/cyrperl.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,8 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: cyrperl.h,v 1.8 2008/04/04 12:47:10 murch Exp $
  */
-/* $Id: cyrperl.h,v 1.7 2003/02/13 20:15:49 rjs3 Exp $ */
 /*
  * Internal callback rock, used to invoke arbitrary Perl code via a CODE
  * reference ( \&sub ).  Allocate with Perl's New(), free with Safefree().

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/auditmbox.pl
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/auditmbox.pl?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/auditmbox.pl (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/auditmbox.pl Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #! /usr/bin/perl -w
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -38,7 +39,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: auditmbox.pl,v 1.5 2006/11/30 17:11:24 murch Exp $
+# $Id: auditmbox.pl,v 1.6 2008/04/04 12:47:12 murch Exp $
 #
 # This script WON'T work for you.  Guaranteed.
 # It checks CMU ECE policy, and your policy *will* be different.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/imapcollate.pl
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/imapcollate.pl?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/imapcollate.pl (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/imapcollate.pl Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #! /usr/bin/perl -w
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -38,7 +39,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: imapcollate.pl,v 1.5 2002/05/25 19:57:50 leg Exp $
+# $Id: imapcollate.pl,v 1.6 2008/04/04 12:47:13 murch Exp $
 
 use Getopt::Long;
 use Cyrus::IMAP;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/imapdu.pl
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/imapdu.pl?rev=768&root=cyrus22&r1=767&r2=
3D768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/imapdu.pl (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/examples/imapdu.pl Mon Feb  9 12:49:22 2009
@@ -1,8 +1,6 @@
 #! /usr/local/bin/perl -w
 #
-# $Id: imapdu.pl,v 1.8 2001/11/30 19:30:45 leg Exp $
-# 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -18,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -40,6 +39,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: imapdu.pl,v 1.9 2008/04/04 12:47:14 murch Exp $
 
 use strict;
 use Getopt::Long;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/t/01-imclient.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/t/01-imclient.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/t/01-imclient.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/t/01-imclient.t Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -37,7 +38,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: 01-imclient.t,v 1.4 2002/05/25 19:57:50 leg Exp $
+# $Id: 01-imclient.t,v 1.5 2008/04/04 12:47:14 murch Exp $
 #
 # Before `make install' is performed this script should be runnable with
 # `make test'. After `make install' it should work as `perl test.pl'

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/t/02-admin.t
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/t/02-admin.t?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/t/02-admin.t (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/t/02-admin.t Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -37,7 +38,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: 02-admin.t,v 1.4 2002/05/25 19:57:50 leg Exp $
+# $Id: 02-admin.t,v 1.5 2008/04/04 12:47:15 murch Exp $
 #
 # Before `make install' is performed this script should be runnable with
 # `make test'. After `make install' it should work as `perl test.pl'

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/xsutil.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/xsutil.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/xsutil.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/perl/imap/xsutil.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,8 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: xsutil.c,v 1.6 2008/04/04 12:47:10 murch Exp $
  */
-/* $Id: xsutil.c,v 1.5 2003/02/13 20:15:49 rjs3 Exp $ */
 /*
  * Various C functions in support of the Cyrus Perl interface.
  */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/Makefile.in Mon Feb  9 12:49:22 2009
@@ -2,8 +2,7 @@
 # 
 # @configure_input@
 # 
-# 
-# Copyright (c) 1996-2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -41,8 +41,8 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: Makefile.in,v 1.29 2006/11/30 17:11:24 murch Exp $
-# 
+# $Id: Makefile.in,v 1.30 2008/03/24 18:34:22 murch Exp $
+
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/afskrb.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/afskrb.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/afskrb.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/afskrb.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
-/* afskrb.c - AFS PTS Group (Kerberos Canonicalization) Backend to ptloader */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* afskrb.c - AFS PTS Group (Kerberos Canonicalization) Backend to ptloader
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: afskrb.c,v 1.16 2008/03/24 18:34:22 murch Exp $
  */
-
-static char rcsid[] =
-      "$Id: afskrb.c,v 1.14 2007/02/05 18:58:27 jeaton Exp $";
 
 #include <config.h>
 #include "ptloader.h"
@@ -158,13 +157,16 @@
 	syslog(LOG_DEBUG, "afspts_canonifyid stripped: %s", identifier2);
     }
 
-    if (krb5_init_context(&context))
+    if (krb5_init_context(&context)) {
+        syslog(LOG_ERR, "afspts_canonifyid krb5_init_context failed");
 	return NULL;
+    }
 
     if (krb5_parse_name(context,identifier2,&princ))
     {
 	krb5_free_context(context);
         free(identifier2);
+        syslog(LOG_ERR, "afspts_canonifyid krb5_parse_name failed");
 	return NULL;
     }
     free(identifier2);
@@ -175,6 +177,7 @@
 	{
 	    krb5_free_principal(context,princ);
 	    krb5_free_context(context);
+            syslog(LOG_ERR, "afspts_canonifyid krb5_get_default_realm failed");
 	    return NULL;
 	}
 	
@@ -185,6 +188,7 @@
 	    krb5_free_principal(context,princ);
 	    krb5_free_context(context);
 	    free(realm);
+            syslog(LOG_ERR, "afspts_canonifyid krb5_build_principal failed");
 	    return NULL;
 	}
 	
@@ -218,6 +222,7 @@
 	{
 	    krb5_free_principal(context,princ);
 	    krb5_free_context(context);
+            syslog(LOG_ERR, "afspts_canonifyid krb5_unparse_name failed");
 	    return NULL;
         }
     }
@@ -459,6 +464,11 @@
     int i, rc;
     struct auth_state *newstate;
 
+    if (canon_id == NULL) {
+       syslog(LOG_ERR, "afspts_canonifyid failed for %s", identifier);
+       return NULL;
+    }
+
     *reply = NULL;
     size = strlen(canon_id);
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ldap.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ldap.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ldap.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ldap.c Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
-/* ldap.c - LDAP Backend to ptloader */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+/* ldap.c - LDAP Backend to ptloader
+ *
+ * Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,10 +39,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: ldap.c,v 1.15 2008/04/10 18:03:47 wescraig Exp $
  */
-
-static char rcsid[] =
-      "$Id: ldap.c,v 1.10 2006/11/30 17:11:24 murch Exp $";
 
 #include <config.h>
 #include "ptloader.h"
@@ -60,6 +59,9 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/uio.h>
+
+/* Functions like ldap_bind() have been deprecated in OpenLDAP 2.3 */
+#define LDAP_DEPRECATED 1
 
 #include <ldap.h>
 #include <lber.h>
@@ -856,8 +858,14 @@
             return PTSM_FAIL;
         }
 
+	/*
+	 * We don't want to return the *first* entry found, we want to return
+	 * the *only* entry found.
+	 */
+	if ( ldap_count_entries(ptsm->ld, res) == 1 ) {
         if ( (entry = ldap_first_entry(ptsm->ld, res)) != NULL )
             *ret = ldap_get_dn(ptsm->ld, entry);
+	}
 
         ldap_msgfree(res);
         res = NULL;
@@ -877,8 +885,7 @@
     char *dn = NULL;
     LDAPMessage *res = NULL;
     LDAPMessage *entry = NULL;
-    char *attr = NULL, **vals = NULL;
-    BerElement *ber = NULL;
+    char **vals = NULL;
     int rc;
     char *attrs[] = {(char *)ptsm->member_attribute,NULL};
 
@@ -907,17 +914,11 @@
     }
 
     if ((entry = ldap_first_entry(ptsm->ld, res)) != NULL) {
-        for (attr = ldap_first_attribute(ptsm->ld, entry, &ber); attr != NULL; 
-            attr = ldap_next_attribute(ptsm->ld, entry, ber)) {
             int i, numvals;
 
-            vals = ldap_get_values(ptsm->ld, entry, attr);
-            if (vals == NULL)
-                continue;
-
-            for (i = 0; vals[i] != NULL; i++)
-                numvals = i;
-            numvals++;
+	vals = ldap_get_values(ptsm->ld, entry, (char *)ptsm->member_attribute);
+	if (vals != NULL) {
+	    numvals = ldap_count_values( vals );
 
             *dsize = sizeof(struct auth_state) +
                      (numvals * sizeof(struct auth_ident));
@@ -929,7 +930,7 @@
             }
             (*newstate)->ngroups = numvals;
 
-            for (i = 0; vals[i] != NULL; i++) {
+	    for (i = 0; i < numvals; i++) {
 		int j;
                 strcpy((*newstate)->groups[i].id, "group:");
 		for(j =0; j < strlen(vals[i]); j++) {
@@ -943,8 +944,6 @@
 
             ldap_value_free(vals);
             vals = NULL;
-            ldap_memfree(attr);
-            attr = NULL;
         }
     }
 
@@ -972,10 +971,6 @@
         ldap_msgfree(res);
     if (vals)
         ldap_value_free(vals);
-    if (attr)
-        ldap_memfree(attr);
-    if (ber)
-        ber_free(ber, 0);
     if (dn)
         free(dn);
 
@@ -994,8 +989,7 @@
     int i; int n;
     LDAPMessage *res = NULL;
     LDAPMessage *entry = NULL;
-    char *attr = NULL, **vals = NULL;
-    BerElement *ber = NULL;
+    char **vals = NULL;
     char *attrs[] = {(char *)ptsm->member_attribute,NULL};
     char *dn = NULL;
 
@@ -1057,18 +1051,25 @@
 
     for (i = 0, entry = ldap_first_entry(ptsm->ld, res); entry != NULL;
          i++, entry = ldap_next_entry(ptsm->ld, entry)) {
-        for (attr = ldap_first_attribute(ptsm->ld, entry, &ber); attr != NULL; 
-            attr = ldap_next_attribute(ptsm->ld, entry, ber)) {
-
-            vals = ldap_get_values(ptsm->ld, entry, attr);
+
+	vals = ldap_get_values(ptsm->ld, entry, (char *)ptsm->member_attribute);
             if (vals == NULL)
                 continue;
 
-	    int j;
+	if ( ldap_count_values( vals ) != 1 ) {
+	    *reply = "too many values";
+	    rc = PTSM_FAIL;
+	    ldap_value_free(vals);
+	    vals = NULL;
+	    goto done;
+	}
+
 	    strcpy((*newstate)->groups[i].id, "group:");
-	    for(j =0; j < strlen(vals[i]); j++) {
-	      if(isupper(vals[i][j]))
-		vals[i][j]=tolower(vals[i][j]);
+
+	int j;
+	for(j =0; j < strlen(vals[0]); j++) {
+	  if(isupper(vals[0][j]))
+	    vals[0][j]=tolower(vals[0][j]);
 	    }
 
             strlcat((*newstate)->groups[i].id, vals[0], 
@@ -1077,9 +1078,6 @@
 
             ldap_value_free(vals);
             vals = NULL;
-            ldap_memfree(attr);
-            attr = NULL;
-        }
     }
 
     rc = PTSM_OK;
@@ -1088,9 +1086,6 @@
 
     if (res)
         ldap_msgfree(res);
-    if (ber)
-        ber_free(ber, 0);
-    ber = NULL;
     if (dn)
         free(dn);
     if (filter)
@@ -1113,7 +1108,7 @@
     int i; int n;
     LDAPMessage *res = NULL;
     LDAPMessage *entry = NULL;
-    char *attr = NULL, **vals = NULL;
+    char **vals = NULL;
     char *attrs[] = {NULL};
 
     if (strncmp(canon_id, "group:", 6))  { // Sanity check

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptdump.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptdump.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptdump.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptdump.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,7 +38,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: ptdump.c,v 1.15 2008/03/24 18:34:22 murch Exp $
  */
+
 #include <config.h>
 #include <stdio.h>
 #include <string.h>
@@ -47,8 +50,6 @@
 #include "cyrusdb.h"
 #include "global.h"
 #include "libconfig.h"
-
-static char rcsid[] = "$Id: ptdump.c,v 1.13 2006/11/30 17:11:24 murch Exp $";
 
 int config_need_data = 0;
 
@@ -100,7 +101,7 @@
     /* open database */
     strcpy(fnamebuf, config_dir);
     strcat(fnamebuf, PTS_DBFIL);
-    r = config_ptscache_db->open(fnamebuf, CYRUSDB_CREATE, &ptdb);
+    r = (config_ptscache_db->open)(fnamebuf, CYRUSDB_CREATE, &ptdb);
     if(r != CYRUSDB_OK) {
 	fprintf(stderr,"error opening %s (%s)", fnamebuf,
 	       cyrusdb_strerror(r));
@@ -110,7 +111,7 @@
     /* iterate through db, wiping expired entries */
     config_ptscache_db->foreach(ptdb, "", 0, NULL, dump_cb, ptdb, NULL);
 
-    config_ptscache_db->close(ptdb);
+    (config_ptscache_db->close)(ptdb);
 
     cyrus_done();
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptexpire.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptexpire.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptexpire.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptexpire.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,6 +38,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: ptexpire.c,v 1.22 2008/03/24 18:34:22 murch Exp $
  */
 
 /* This program purges old entries from the database. It holds an exclusive
@@ -69,7 +71,7 @@
 #include "lock.h"
 #include "xmalloc.h"
 
-static char rcsid[] = "$Id: ptexpire.c,v 1.19 2006/11/30 17:11:24 murch Exp $";
+static char rcsid[] = "$Id: ptexpire.c,v 1.22 2008/03/24 18:34:22 murch Exp $";
 
 /* global */
 time_t timenow;
@@ -112,7 +114,9 @@
     int r;
     char *alt_config = NULL;
 
-    if (geteuid() == 0) fatal("must run as the Cyrus user", EC_USAGE);
+    if ((geteuid()) == 0 && (become_cyrus() != 0)) {
+	fatal("must run as the Cyrus user", EC_USAGE);
+    }
     
     openlog("ptexpire", LOG_PID, SYSLOG_FACILITY);
 
@@ -146,7 +150,7 @@
     /* open database */
     strcpy(fnamebuf, config_dir);
     strcat(fnamebuf, PTS_DBFIL);
-    r = config_ptscache_db->open(fnamebuf, CYRUSDB_CREATE, &ptdb);
+    r = (config_ptscache_db->open)(fnamebuf, CYRUSDB_CREATE, &ptdb);
     if(r != CYRUSDB_OK) {
 	syslog(LOG_ERR, "error opening %s (%s)", fnamebuf,
 	       cyrusdb_strerror(r));
@@ -156,7 +160,7 @@
     /* iterate through db, wiping expired entries */
     config_ptscache_db->foreach(ptdb, "", 0, expire_p, expire_cb, ptdb, NULL);
 
-    config_ptscache_db->close(ptdb);
+    (config_ptscache_db->close)(ptdb);
 
     cyrus_done();
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptextract.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptextract.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptextract.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptextract.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: ptextract.c,v 1.5 2008/03/24 18:34:22 murch Exp $
  */
-
-/* $Id: ptextract.c,v 1.4 2003/02/13 20:15:56 rjs3 Exp $ */
 
 #include <sys/types.h>
 #include <krb.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptloader.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptloader.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptloader.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptloader.c Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* ptloader.c -- group loader daemon
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: ptloader.c,v 1.49 2008/09/04 20:44:08 wescraig Exp $
  */
 
 #include <config.h>
@@ -66,9 +67,6 @@
 #include "xmalloc.h"
 #include "ptloader.h"
 
-static char rcsid[] __attribute__((unused)) = 
-      "$Id: ptloader.c,v 1.44 2007/01/09 21:25:04 jeaton Exp $";
-
 struct pts_module *pts_modules[] = {
 #ifdef HAVE_LDAP
     &pts_ldap,
@@ -148,7 +146,7 @@
     /* set signal handlers */
     signal(SIGPIPE, SIG_IGN);
 
-    syslog(LOG_NOTICE, "starting: $Id: ptloader.c,v 1.44 2007/01/09 21:25:04 jeaton Exp $");
+    syslog(LOG_NOTICE, "starting: $Id: ptloader.c,v 1.49 2008/09/04 20:44:08 wescraig Exp $");
 
     while ((opt = getopt(argc, argv, "d:")) != EOF) {
 	switch (opt) {
@@ -167,7 +165,7 @@
 
     strcpy(fnamebuf, config_dir);
     strcat(fnamebuf, PTS_DBFIL);
-    r = DB->open(fnamebuf, CYRUSDB_CREATE, &ptsdb);
+    r = (DB->open)(fnamebuf, CYRUSDB_CREATE, &ptsdb);
     if (r != 0) {
 	syslog(LOG_ERR, "DBERROR: opening %s: %s", fnamebuf,
 	       cyrusdb_strerror(ret));
@@ -184,7 +182,7 @@
 {
     int r;
 
-    r = DB->close(ptsdb);
+    r = (DB->close)(ptsdb);
     if (r) {
 	syslog(LOG_ERR, "DBERROR: error closing ptsdb: %s",
 	       cyrusdb_strerror(r));
@@ -205,7 +203,6 @@
 		    char **argv __attribute__((unused)),
 		    char **envp __attribute__((unused)))
 {
-    char keyinhex[512];
     const char *reply = NULL;
     char user[PTS_DB_KEYSIZE];
     int rc, dsize;
@@ -234,16 +231,14 @@
 
     memset(&user, 0, sizeof(user));
     if (read(c, &user, size) < 0) {
-        syslog(LOG_ERR, "socket(user; size = %d; key = %s): %m", 
-	       size, keyinhex);
+        syslog(LOG_ERR, "socket(user; size = %d): %m", size);
         reply = "Error reading request (user)";
         goto sendreply;
     }
 
     if (ptclient_debug) {
-	syslog(LOG_DEBUG, "user %s, cacheid %s", user, keyinhex);
-    }
-
+	syslog(LOG_DEBUG, "user %s", user);
+    }
 
     newstate = ptsmodule_make_authstate(user, size, &reply, &dsize);
 
@@ -254,10 +249,15 @@
 	
 	/* and we're done */
 	reply = "OK";
+    } else {
+        /* Failure */
+	if ( reply == NULL ) {
+	    reply = "Error making authstate";
+	}
     }
 
  sendreply:
-    if (retry_write(c, reply, strlen(reply)) <0) {
+    if (retry_write(c, reply, strlen(reply) + 1) <0) {
 	syslog(LOG_WARNING, "retry_write: %m");
     }
     close(c);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptloader.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptloader.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptloader.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/ptloader.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* ptloader.h -- Site authorization module
- * $Id: ptloader.h,v 1.2 2006/11/30 17:11:24 murch Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -39,6 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: ptloader.h,v 1.3 2008/03/24 18:34:22 murch Exp $
  */
 
 #ifndef INCLUDED_PTLOADER_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/test.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/test.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/test.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/test.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: test.c,v 1.7 2008/03/24 18:34:22 murch Exp $
  */
-
-/* $Id: test.c,v 1.6 2003/10/22 18:50:29 rjs3 Exp $ */
 
 #include <stdio.h>
 #include <sys/syslog.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/test2.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/test2.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/test2.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/ptclient/test2.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: test2.c,v 1.7 2008/03/24 18:34:22 murch Exp $
  */
-
-/* $Id: test2.c,v 1.6 2003/10/22 18:50:29 rjs3 Exp $ */
 
 #include <stdio.h>
 #include <sys/syslog.h>

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/snmp/snmpgen
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/snmp/snmpgen?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/snmp/snmpgen (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/snmp/snmpgen Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -38,9 +39,10 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: snmpgen,v 1.20 2008/03/24 20:10:50 murch Exp $
+
 exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 #!perl -w
-# $Id: snmpgen,v 1.19 2006/11/30 17:11:25 murch Exp $
 
 if ($] !~ /^5\..*/) {
   # uh-oh. this isn't perl 5.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/Makefile.in Mon Feb  9 12:49:22 2009
@@ -2,7 +2,7 @@
 #
 # @configure_input@
 #
-# Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -18,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -40,7 +41,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
-# 
+# $Id: Makefile.in,v 1.11 2008/03/24 20:15:59 murch Exp $
 
 srcdir = @srcdir@
 VPATH = @srcdir@

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/logger.1
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/logger.1?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/logger.1 (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/logger.1 Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 .\" 
-.\" Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+.\" Copyright (c) 1994-2008 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
@@ -15,15 +15,16 @@
 .\"
 .\" 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
+.\"    prior written permission. For permission or any 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 at andrew.cmu.edu
-.\"
+.\"      Center for Technology Transfer and Enterprise Creation
+.\"      4615 Forbes Avenue
+.\"      Suite 302
+.\"      Pittsburgh, PA  15213
+.\"      (412) 268-7393, fax: (412) 268-7395
+.\"      innovation at andrew.cmu.edu
+ *
 .\" 4. Redistributions of any form whatsoever must retain the following
 .\"    acknowledgment:
 .\"    "This product includes software developed by Computing Services
@@ -37,7 +38,8 @@
 .\" AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\" 
-.\" $Revision: 1.2 $
+.\" $Id: logger.1,v 1.3 2008/03/24 20:15:59 murch Exp $
+.\"
 .\"  Modified by Rich $alz <rsalz at osf.org> to be more portable to older
 .\"  systems.
 .\" Copyright (c) 1983, 1990 The Regents of the University of California.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/logger.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/logger.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/logger.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/logger.c Mon Feb  9 12:49:22 2009
@@ -1,9 +1,9 @@
-/*  $Revision: 1.3 $
+/*  $Revision: 1.4 $
 **  Modified by Rich $alz <rsalz at osf.org> to be more portable to older
 **  systems.
 */
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -19,14 +19,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -41,6 +42,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: logger.c,v 1.4 2008/03/24 20:15:59 murch Exp $
  */
 /*
  * Copyright (c) 1983 Regents of the University of California.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslog.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslog.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslog.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslog.h Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -15,14 +15,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,9 +38,10 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: syslog.h,v 1.4 2008/03/24 20:15:59 murch Exp $
  */
 
-/* $Revision: 1.3 $
+/* $Revision: 1.4 $
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
  * All rights reserved.
  *

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslogd.8
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslogd.8?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslogd.8 (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslogd.8 Mon Feb  9 12:49:22 2009
@@ -1,5 +1,5 @@
 .\" 
-.\" Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+.\" Copyright (c) 1994-2008 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
@@ -15,15 +15,16 @@
 .\"
 .\" 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
+.\"    prior written permission. For permission or any 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 at andrew.cmu.edu
-.\"
+.\"      Center for Technology Transfer and Enterprise Creation
+.\"      4615 Forbes Avenue
+.\"      Suite 302
+.\"      Pittsburgh, PA  15213
+.\"      (412) 268-7393, fax: (412) 268-7395
+.\"      innovation at andrew.cmu.edu
+ *
 .\" 4. Redistributions of any form whatsoever must retain the following
 .\"    acknowledgment:
 .\"    "This product includes software developed by Computing Services
@@ -37,7 +38,8 @@
 .\" AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\" 
-.\" $Revision: 1.2 $
+.\" $Id: syslogd.8,v 1.3 2008/03/24 20:15:59 murch Exp $
+.\"
 .\" Copyright (c) 1983, 1986 The Regents of the University of California.
 .\" All rights reserved.
 .\"

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslogd.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslogd.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslogd.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/syslog/syslogd.c Mon Feb  9 12:49:22 2009
@@ -1,5 +1,6 @@
 /*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -15,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -37,8 +39,9 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- */
-/*  $Revision: 1.3 $
+ * $Id: syslogd.c,v 1.4 2008/03/24 20:15:59 murch Exp $
+ */
+/*
 **  This file has been modified to get it to compile more easily
 **  on pre-4.4BSD (e.g., SysVr4 :-) systems.  Rich $alz, June 1991.
 */

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/Makefile.in
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/Makefile.in?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/Makefile.in (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/Makefile.in Mon Feb  9 12:49:22 2009
@@ -1,8 +1,8 @@
 # Makefile.in - timsieved makefile
-# $Id: Makefile.in,v 1.26 2006/11/30 17:11:25 murch Exp $
+#
 # @configure_input@
 # 
-# Copyright (c) 1998-2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -18,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -40,6 +41,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: Makefile.in,v 1.28 2008/03/24 20:20:57 murch Exp $
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -95,10 +97,10 @@
 	 $(SERVICE) $(OBJS) $(DEPLIBS) $(IMAP_LIBS) $(LIBS) $(LIB_WRAP)
 
 clean:
-	rm -f *.o *.a Makefile.bak makedepend.log
+	rm -f timsieved *~ *.o *.a Makefile.bak makedepend.log
 
 distclean: clean
-	rm -f Makefile timsieved
+	rm -f Makefile
 
 depend:
 	${MAKEDEPEND} $(CPPFLAGS) $(DEFS) -I$(srcdir) $(CFLAGS) *.c $(srcdir)/*.c 1>makedepend.log 2>&1

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/actions.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/actions.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/actions.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/actions.c Mon Feb  9 12:49:22 2009
@@ -1,9 +1,7 @@
 /* actions.c -- executes the commands for timsieved
  * Tim Martin
- * $Id: actions.c,v 1.40 2006/11/30 17:11:25 murch Exp $
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -41,6 +40,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: actions.c,v 1.45 2008/10/08 15:47:08 murch Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -69,6 +69,8 @@
 #include "global.h"
 #include "libconfig.h"
 #include "xmalloc.h"
+#include "xstrlcat.h"
+#include "xstrlcpy.h"
 #include "sieve_interface.h"
 
 #include "codes.h"
@@ -83,7 +85,7 @@
 extern int sieved_userisadmin;
 char *sieve_dir = NULL;
 
-const static char *sieved_userid = NULL;
+static const char *sieved_userid = NULL;
 
 int actions_init(void)
 {
@@ -124,7 +126,7 @@
   len = strlcpy(sieve_dir, foo, size);
 
   if (domain) {
-      char dhash = (char) dir_hash_c(domain);
+      char dhash = (char) dir_hash_c(domain, config_fulldirhash);
       len += snprintf(sieve_dir+len, size-len, "%s%c/%s",
 		      FNAME_DOMAINDIR, dhash, domain);
   }
@@ -133,7 +135,7 @@
       strlcat(sieve_dir, "/global", size);
   }
   else {
-      char hash = (char) dir_hash_c(user);
+      char hash = (char) dir_hash_c(user, config_fulldirhash);
       snprintf(sieve_dir+len, size-len, "/%c/%s", hash, user);
   }
 
@@ -188,11 +190,11 @@
 		config_mupdate_server ? " (Murder)" : "", CYRUS_VERSION);
     
     /* SASL */
-    if (!authenticated &&
+    if (authenticated != 1 &&
 	sasl_listmech(saslconn, NULL, 
 		    "\"SASL\" \"", " ", "\"\r\n",
 		    &sasllist,
-		    NULL, &mechcount) == SASL_OK && mechcount > 0)
+		      NULL, &mechcount) == SASL_OK/* && mechcount > 0*/)
     {
       prot_printf(conn,"%s",sasllist);
     }
@@ -277,7 +279,7 @@
 {
     DIR *dp;
     struct dirent *dir;
-    int length;
+    size_t length;
     int number=0;
     char myname[1024];
     
@@ -371,7 +373,8 @@
 
   if (result != TIMSIEVE_OK) {
       if (errstr && *errstr) { 
-	  prot_printf(conn, "NO {%d}\r\n%s\r\n", strlen(errstr), errstr);
+	  prot_printf(conn, "NO {" SIZE_T_FMT "}\r\n%s\r\n",
+		      strlen(errstr), errstr);
 	  free(errstr);
       } else {
 	  if (errstr) free(errstr);
@@ -519,7 +522,7 @@
 {
     DIR *dp;
     struct dirent *dir;
-    int length;
+    size_t length;
 
     /* open the directory */
     dp=opendir(".");

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/actions.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/actions.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/actions.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/actions.h Mon Feb  9 12:49:22 2009
@@ -1,10 +1,8 @@
 /* actions.h -- executes the commands (creating, deleting scripts etc..) for timsieved
  * Tim Martin
  * 9/21/99
- * $Id: actions.h,v 1.11 2003/06/24 15:34:00 ken3 Exp $
-*/
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -20,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -42,6 +41,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: actions.h,v 1.12 2008/03/24 20:20:57 murch Exp $
  */
 
 #ifndef _ACTIONS_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/codes.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/codes.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/codes.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/codes.h Mon Feb  9 12:49:22 2009
@@ -1,10 +1,8 @@
 /* codes.h -- error codes functions in timsieved may return
  * Tim Martin
  * 9/21/99
- * $Id: codes.h,v 1.6 2003/02/13 20:15:58 rjs3 Exp $
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -20,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -42,6 +41,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: codes.h,v 1.7 2008/03/24 20:20:57 murch Exp $
  */
 
 #ifndef _CODES_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/exitcodes.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/exitcodes.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/exitcodes.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/exitcodes.h Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 /* exitcodes.h -- wrapper around sysextis.h
- * $Id: exitcodes.h,v 1.4 2003/02/13 20:15:59 rjs3 Exp $
  *
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ * Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -38,6 +38,8 @@
  * 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.
+ *
+ * $Id: exitcodes.h,v 1.5 2008/03/24 20:20:57 murch Exp $
  */
 
 /* Sendmail has some weird ideas on what constitutes permenant failure.  On

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/lex.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/lex.c?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/lex.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/lex.c Mon Feb  9 12:49:22 2009
@@ -1,10 +1,8 @@
 /* lex.c -- lexer for timsieved
  * Tim Martin
  * 9/21/99
- * $Id: lex.c,v 1.25 2006/11/30 17:11:25 murch Exp $
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -20,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -42,6 +41,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: lex.c,v 1.28 2008/03/24 20:20:57 murch Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -132,7 +132,7 @@
   lexer_state = LEXER_STATE_RECOVER;
 }
 
-int maxscriptsize=0;
+unsigned long maxscriptsize=0;
 char *buffer;
 
 int lex_init(void)
@@ -176,8 +176,8 @@
     ch=prot_getc(stream);
 
     if (ch==EOF) {
-	/* Lost conenction -- treat like a logout */
-	return LOGOUT;
+	/* Lost connection */
+	return EOF;
     }
 
     switch (lexer_state)
@@ -295,7 +295,7 @@
 	}
       } else {
 	/* just read the chars and throw them away */
-	int lup;
+	unsigned long lup;
 
 	for (lup=0;lup<count;lup++)
 	  prot_getc(stream);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/lex.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/lex.h?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/lex.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/lex.h Mon Feb  9 12:49:22 2009
@@ -1,10 +1,8 @@
 /* lex.h -- lexer for timsieved
  * Tim Martin
  * 9/21/99
- * $Id: lex.h,v 1.11 2003/02/13 20:15:59 rjs3 Exp $
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -20,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -42,8 +41,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: lex.h,v 1.12 2008/03/24 20:20:57 murch Exp $
  */
-
 
 #ifndef _LEX_H_
 #define _LEX_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/mystring.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/mystring.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/mystring.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/mystring.h Mon Feb  9 12:49:22 2009
@@ -1,10 +1,8 @@
 /* mystring.h -- base datatype used by timsieved
  * Tim Martin
  * 9/21/99
- * $Id: mystring.h,v 1.6 2003/02/13 20:15:59 rjs3 Exp $
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -20,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -42,8 +41,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: mystring.h,v 1.7 2008/03/24 20:20:57 murch Exp $
  */
-
 
 #include "codes.h"
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/parser.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/parser.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/parser.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/parser.c Mon Feb  9 12:49:22 2009
@@ -1,10 +1,8 @@
 /* parser.c -- parser used by timsieved
  * Tim Martin
  * 9/21/99
- * $Id: parser.c,v 1.41 2006/11/30 17:11:25 murch Exp $
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -20,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -42,6 +41,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: parser.c,v 1.51 2008/10/08 17:18:13 wescraig Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -64,6 +64,7 @@
 #include "mboxname.h"
 #include "mboxlist.h"
 #include "xmalloc.h"
+#include "xstrlcpy.h"
 #include "prot.h"
 #include "tls.h"
 #include "lex.h"
@@ -87,6 +88,7 @@
 /* our tls connection, if any */
 static SSL *tls_conn = NULL;
 #endif /* HAVE_SSL */
+extern int sieved_timeout;
 
 /* from elsewhere */
 void fatal(const char *s, int code);
@@ -99,6 +101,34 @@
 static int cmd_authenticate(struct protstream *sieved_out, struct protstream *sieved_in,
 			    mystring_t *mechanism_name, mystring_t *initial_challenge, const char **errmsg);
 static int cmd_starttls(struct protstream *sieved_out, struct protstream *sieved_in);
+
+static char *sieve_parsesuccess(char *str, const char **status)
+{
+    char *success = NULL, *tmp;
+
+    if (!strncmp(str, "OK (", 4) &&
+	(tmp = strstr(str+4, "SASL \"")) != NULL) {
+	success = tmp+6; /* skip SASL " */
+	tmp = strstr(success, "\"");
+	*tmp = '\0'; /* clip " */
+    }
+
+    if (status) *status = NULL;
+    return success;
+}
+
+static struct protocol_t sieve_protocol =
+{ "sieve", SIEVE_SERVICE_NAME,
+  { 1, "OK" },
+  { "CAPABILITY", NULL, "OK", NULL,
+    { { "\"SASL\" ", CAPA_AUTH },
+      { "\"STARTTLS\"", CAPA_STARTTLS },
+      { NULL, 0 } } },
+  { "STARTTLS", "OK", "NO", 1 },
+  { "AUTHENTICATE", INT_MAX, 1, "OK", "NO", NULL, "*", &sieve_parsesuccess, 1 },
+  { NULL, NULL, NULL },
+  { "LOGOUT", NULL, "OK" }
+};
 
 /* Returns TRUE if we are done */
 int parser(struct protstream *sieved_out, struct protstream *sieved_in)
@@ -139,6 +169,13 @@
 
   switch (token)
   {
+  case EOF:
+      /* timlex() will return EOF when the remote disconnects badly */
+      syslog(LOG_WARNING, "Lost connection to client -- exiting");
+      ret = TRUE;
+      goto done;
+      break;
+
   case AUTHENTICATE:
     if (timlex(NULL, NULL, sieved_in)!=SPACE)
     {
@@ -490,7 +527,7 @@
   const char *serverout=NULL;
   unsigned int serveroutlen;
   const char *errstr=NULL;
-  const char *canon_user;
+  const void *canon_user, *sasl_ssf;
   char *username;
   int ret = TRUE;
 
@@ -628,8 +665,7 @@
   }
 
   /* get the userid from SASL */
-  sasl_result=sasl_getprop(sieved_saslconn, SASL_USERNAME,
-			   (const void **) &canon_user);
+  sasl_result=sasl_getprop(sieved_saslconn, SASL_USERNAME, &canon_user);
   if (sasl_result!=SASL_OK)
   {
     *errmsg = "Internal SASL error";
@@ -642,7 +678,7 @@
 
     return FALSE;
   }
-  username = xstrdup(canon_user);
+  username = xstrdup((const char *) canon_user);
 
   verify_only = !strcmp(username, "anonymous");
 
@@ -690,11 +726,11 @@
 
 		  /* get a new copy of the userid */
 		  free(username);
-		  username = xstrdup(canon_user);
+		  username = xstrdup((const char *) canon_user);
 
 		  /* get the authid from SASL */
 		  sasl_result=sasl_getprop(sieved_saslconn, SASL_AUTHUSER,
-					   (const void **) &canon_user);
+					   &canon_user);
 		  if (sasl_result!=SASL_OK) {
 		      *errmsg = "Internal SASL error";
 		      syslog(LOG_ERR, "SASL: sasl_getprop SASL_AUTHUSER: %s",
@@ -707,7 +743,7 @@
 		      ret = FALSE;
 		      goto cleanup;
 		  }
-		  authname = xstrdup(canon_user);
+		  authname = xstrdup((const char *) canon_user);
 
 		  if ((p = strchr(authname, '@'))) *p = '%';
 		  if ((p = strchr(username, '@'))) *p = '%';
@@ -734,7 +770,12 @@
 		  if(c) *c = '\0';
 	      }
 
-	      backend = backend_connect(NULL, server, &protocol[PROTOCOL_SIEVE],
+	      if (config_getswitch(IMAPOPT_SIEVE_SASL_EXPECT_UNSOLICITED_CAPABILITY)) {
+		  sieve_protocol.sasl_cmd.auto_capa = 1;
+	      } else {
+		  sieve_protocol.sasl_cmd.auto_capa = 0;
+	      }
+	      backend = backend_connect(NULL, server, &sieve_protocol,
 					username, NULL, &statusline);
 
 	      if (!backend) {
@@ -784,6 +825,13 @@
   prot_setsasl(sieved_in, sieved_saslconn);
   prot_setsasl(sieved_out, sieved_saslconn);
 
+  if (config_getswitch(IMAPOPT_SIEVE_SASL_SEND_UNSOLICITED_CAPABILITY)) {
+      sasl_getprop(sieved_saslconn, SASL_SSF, &sasl_ssf);
+      if (*((sasl_ssf_t *) sasl_ssf)) {
+	  capabilities(sieved_out, sieved_saslconn, starttls_done, 2);
+      }
+  }
+
   /* Create telemetry log */
   sieved_logfd = telemetry_log(username, sieved_in, sieved_out, 0);
   
@@ -829,6 +877,7 @@
 
     result=tls_start_servertls(0, /* read */
 			       1, /* write */
+			       sieved_timeout,
 			       layerp,
 			       &authid,
 			       &tls_conn);
@@ -859,7 +908,7 @@
 
     starttls_done = 1;
 
-    return result;
+    return capabilities(sieved_out, sieved_saslconn, starttls_done, authenticated);
 }
 #else
 static int cmd_starttls(struct protstream *sieved_out, struct protstream *sieved_in)

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/parser.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/parser.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/parser.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/parser.h Mon Feb  9 12:49:22 2009
@@ -1,10 +1,8 @@
 /* parser.h
  * Tim Martin
  * 9/21/99
- * $Id: parser.h,v 1.4 2003/02/13 20:15:59 rjs3 Exp $
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -20,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -42,6 +41,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: parser.h,v 1.5 2008/03/24 20:20:57 murch Exp $
  */
 
 #ifndef PARSER_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/scripttest.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/scripttest.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/scripttest.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/scripttest.c Mon Feb  9 12:49:22 2009
@@ -1,9 +1,7 @@
 /* scripttest.c -- test wheather the sieve script is valid
  * Tim Martin
- * $Id: scripttest.c,v 1.24 2006/11/30 17:11:25 murch Exp $
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -41,6 +40,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: scripttest.c,v 1.25 2008/03/24 20:20:57 murch Exp $
  */
 
 #ifdef HAVE_CONFIG_H

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/scripttest.h
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/scripttest.h?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/scripttest.h (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/scripttest.h Mon Feb  9 12:49:22 2009
@@ -1,9 +1,7 @@
 /* scripttest.h -- test whether the sieve script is valid
  * Tim Martin
- * $Id: scripttest.h,v 1.10 2006/11/30 17:11:25 murch Exp $
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -19,14 +17,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -41,8 +40,8 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: scripttest.h,v 1.11 2008/03/24 20:20:57 murch Exp $
  */
-
 
 #ifndef INCLUDE_SCRIPTTEST_H_
 #define INCLUDE_SCRIPTTEST_H_

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/timsieved.c
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/timsieved.c?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/timsieved.c (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/timsieved/timsieved.c Mon Feb  9 12:49:22 2009
@@ -1,10 +1,8 @@
 /* timsieved.c -- main file for timsieved (sieve script accepting program)
  * Tim Martin
  * 9/21/99
- * $Id: timsieved.c,v 1.58 2006/11/30 17:11:25 murch Exp $
- */
-/*
- * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
+ *
+ * Copyright (c) 1994-2008 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
@@ -20,14 +18,15 @@
  *
  * 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
+ *    prior written permission. For permission or any 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 at andrew.cmu.edu
+ *      Center for Technology Transfer and Enterprise Creation
+ *      4615 Forbes Avenue
+ *      Suite 302
+ *      Pittsburgh, PA  15213
+ *      (412) 268-7393, fax: (412) 268-7395
+ *      innovation at andrew.cmu.edu
  *
  * 4. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
@@ -42,6 +41,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
+ * $Id: timsieved.c,v 1.62 2008/03/24 20:20:57 murch Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -88,6 +88,8 @@
 #include "mboxlist.h"
 #include "proxy.h"
 #include "util.h"
+#include "xstrlcat.h"
+#include "xstrlcpy.h"
 
 #include "scripttest.h"
 
@@ -111,6 +113,7 @@
 struct sockaddr_storage sieved_localaddr;
 struct sockaddr_storage sieved_remoteaddr;
 
+int sieved_timeout;
 struct protstream *sieved_out;
 struct protstream *sieved_in;
 
@@ -257,8 +260,6 @@
 		 char **envp __attribute__((unused)))
 {
     socklen_t salen;
-    int timeout;
-    int secflags = 0;
     char remoteip[60], localip[60];
     sasl_security_properties_t *secprops = NULL;
     char hbuf[NI_MAXHOST];
@@ -270,9 +271,10 @@
     sieved_in = prot_new(0, 0);
     sieved_out = prot_new(1, 1);
 
-    timeout = config_getint(IMAPOPT_TIMEOUT);
-    if (timeout < 10) timeout = 10;
-    prot_settimeout(sieved_in, timeout * 60);
+    sieved_timeout = config_getint(IMAPOPT_TIMEOUT);
+    if (sieved_timeout < 10) sieved_timeout = 10;
+    sieved_timeout *= 60;
+    prot_settimeout(sieved_in, sieved_timeout);
     prot_setflushonread(sieved_in, sieved_out);
 
     signal(SIGPIPE, SIG_IGN);
@@ -325,11 +327,7 @@
     }
 
     /* will always return something valid */
-    /* should be configurable! */
-    if (!config_getswitch(IMAPOPT_ALLOWPLAINTEXT)) {
-	secflags |= SASL_SEC_NOPLAINTEXT;
-    }
-    secprops = mysasl_secprops(secflags);
+    secprops = mysasl_secprops(0);
     sasl_setprop(sieved_saslconn, SASL_SEC_PROPS, secprops);
 
     if (actions_init() != TIMSIEVE_OK)
@@ -345,7 +343,6 @@
 int reset_saslconn(sasl_conn_t **conn, sasl_ssf_t ssf, char *authid)
 {
     int ret = 0;
-    int secflags = 0;
     sasl_security_properties_t *secprops = NULL;
 
     sasl_dispose(conn);
@@ -365,10 +362,7 @@
 			   saslprops.iplocalport);
     if(ret != SASL_OK) return ret;
     
-    if (!config_getswitch(IMAPOPT_ALLOWPLAINTEXT)) {
-	secflags |= SASL_SEC_NOPLAINTEXT;
-    }
-    secprops = mysasl_secprops(secflags);
+    secprops = mysasl_secprops(0);
     ret = sasl_setprop(*conn, SASL_SEC_PROPS, secprops);
     if(ret != SASL_OK) return ret;
 

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/config2header
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/config2header?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/config2header (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/config2header Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 #!/bin/sh
-# $Id: config2header,v 1.13 2006/11/30 17:11:25 murch Exp $
-#
-# Copyright (c) 2001 Carnegie Mellon University.  All rights reserved.
+#
+# Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -39,6 +39,8 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: config2header,v 1.15 2008/03/24 20:25:22 murch Exp $
+
 exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 #!perl -w
 
@@ -84,7 +86,7 @@
 open HFILE, ">$hfile";
 
 my $blank = "";
-my $version = "\$Revision: 1.13 $blank";
+my $version = "\$Revision: 1.15 $blank";
 $version =~ s/.Revision: (.*) /$1/;
 print HFILE "/* auto-generated by config2header $version */\n";
 print CFILE "/* auto-generated by config2header $version */\n";
@@ -258,7 +260,7 @@
 ;
 
 # add the enum_values
-while (my $e = pop (@enum_values)) {
+while (my $e = shift (@enum_values)) {
     if ($#enum_values == -1) {
       print HFILE "  $e\n";
     } else {

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/config2man
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/config2man?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/config2man (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/config2man Mon Feb  9 12:49:22 2009
@@ -1,7 +1,6 @@
 #!/bin/sh
-# $Id: config2man,v 1.4 2006/11/30 17:11:25 murch Exp $
 #
-# Copyright (c) 2001 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -17,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -39,6 +39,8 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: config2man,v 1.5 2008/03/24 20:25:22 murch Exp $
+
 exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 #!perl -w
 
@@ -79,7 +81,7 @@
 my $enums = "";
 
 my $blank = "";
-my $version = "\$Revision: 1.4 $blank";
+my $version = "\$Revision: 1.5 $blank";
 $version =~ s/.Revision: (.*) /$1/;
 print ".\\\" -*- nroff -*-\n";
 print ".\\\" auto-generated by config2man $version\n";

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/dohash
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/dohash?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/dohash (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/dohash Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -38,11 +39,12 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: dohash,v 1.13 2008/03/24 20:25:22 murch Exp $
+
 exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 #!perl -w
 # script to upgrade from versions of imapd previous to 1.6.2
 # make sure you run it as the cyrus user
-# $Id: dohash,v 1.12 2006/11/30 17:11:25 murch Exp $
 
 if ($] !~ /^5\..*/) {
   # uh-oh. this isn't perl 5.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/masssievec
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/masssievec?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/masssievec (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/masssievec Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -38,12 +39,12 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: masssievec,v 1.7 2008/03/24 20:25:22 murch Exp $
+
 exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 #!perl -w
 #
 # Script for mass compilation of sieve scripts.
-#
-# $Id: masssievec,v 1.6 2006/11/30 17:11:25 murch Exp $
 
 if ($] !~ /^5\..*/) {
   # uh-oh. this isn't perl 5.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/migrate-metadata
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/migrate-metadata?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/migrate-metadata (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/migrate-metadata Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -38,11 +39,12 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: migrate-metadata,v 1.4 2008/03/24 20:25:22 murch Exp $
+
 exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 #!perl -w
 # script to upgrade from versions of imapd previous to 1.6.2
 # make sure you run it as the cyrus user
-# $Id: migrate-metadata,v 1.2 2006/11/30 17:11:25 murch Exp $
 
 if ($] !~ /^5\..*/) {
   # uh-oh. this isn't perl 5.
@@ -150,6 +152,15 @@
     opendir DIR, $part . $path;
     while ($subdir = readdir DIR) {
 	my $subpath = $path . "/" . $subdir;
+
+	# skip message files, '.' and '..'
+	next if ( $subdir =~ /^[0-9]+\.$/ || 
+	          $subdir =~ /^\.\.$/ || 
+		  $subdir =~ /^\.$/ );
+	# skip special subdirs
+	next if ( $subpath =~ /^\/socket$/ ||
+	          $subpath =~ /^\/stage\.$/ ||
+		  $subpath =~ /^\/sync\.$/ );
 
 	if ($subdir =~ /^cyrus\.(.+)/s) {
 	    # cyrus.* file, see if we should migrate it
@@ -160,8 +171,8 @@
 		    ouch "couldn't delete $part$subpath";
 	    }
 	}
-	elsif ($subdir =~ /^[^\.]+$/s) {
-	    # no dot in name, so this is a subdir, process it
+	else {
+	    # this is a mailbox subdir, process it
 	    mkdir($mpart . $subpath, 0700) ||
 		ouch "couldn't create $mpart$subpath";
 	    migrate($part, $mpart, $subpath);

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/mkimap
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/mkimap?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/mkimap (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/mkimap Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -38,9 +39,10 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: mkimap,v 1.19 2008/03/24 20:25:22 murch Exp $
+
 exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 #!perl -w
-# $Id: mkimap,v 1.18 2006/11/30 17:11:25 murch Exp $
 
 if ($] !~ /^5\..*/) {
   # uh-oh. this isn't perl 5.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/mknewsgroups
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/mknewsgroups?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/mknewsgroups (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/mknewsgroups Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 # 
-# Copyright (c) 2003 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -38,13 +39,13 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: mknewsgroups,v 1.3 2008/03/24 20:25:22 murch Exp $
+
 exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 #!perl -w
 #
 # Create newsgroups on imap server
 # Based on the make_fromactive.pl script by Tim Martin
-#
-# $Id: mknewsgroups,v 1.2 2003/10/22 18:03:47 rjs3 Exp $
 
 if ($] !~ /^5\..*/) {
   # uh-oh. this isn't perl 5.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/not-mkdep
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/not-mkdep?rev=768&root=cyrus22&r1=767&r2=768&view=
3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/not-mkdep (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/not-mkdep Mon Feb  9 12:49:22 2009
@@ -1,10 +1,8 @@
 #!/bin/sh
 #
 # not-mkdep for those systems without it
-# $Id: not-mkdep,v 1.3 2000/05/23 20:56:53 robeson Exp $
 #
-# 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -20,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -42,6 +41,8 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: not-mkdep,v 1.4 2008/03/24 20:25:22 murch Exp $
+
 cat <<EOF
 
 		    WARNING: MAKEDEPEND COULD NOT BE FOUND

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/rehash
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/rehash?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/rehash (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/rehash Mon Feb  9 12:49:22 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -16,14 +16,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -38,14 +39,14 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: rehash,v 1.10 2008/03/24 20:25:22 murch Exp $
+
 exec perl -x -S $0 ${1+"$@"} # -*-perl-*-
 #!perl -w
 # script to upgrade from simple hashing scheme to full hashing scheme
 # make sure you run it as the cyrus user
 #
 # Written by Gary Mills <mills at cc.UManitoba.CA>
-#
-# $Id: rehash,v 1.9 2006/11/30 17:11:25 murch Exp $
 
 if ($] !~ /^5\..*/) {
   # uh-oh. this isn't perl 5.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/translatesieve
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/translatesieve?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/translatesieve (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/translatesieve Mon Feb  9 12:49:22 2009
@@ -4,9 +4,8 @@
 # script to translate sieve scripts to use unixhierarchysep and/or altnamespace
 # make sure you run it as the cyrus user
 #!/usr/bin/perl
-# $Id: translatesieve,v 1.8 2006/11/30 17:11:25 murch Exp $
 # 
-# Copyright (c) 2001 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -22,14 +21,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -44,6 +44,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: translatesieve,v 1.9 2008/03/24 20:25:23 murch Exp $
 
 if ($] !~ /^5\..*/) {
   # uh-oh. this isn't perl 5.

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/undohash
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/undohash?rev=768&root=cyrus22&r1=767&r2=768&view=3Ddiff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/undohash (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/undohash Mon Feb  9 12:49:22 2009
@@ -1,9 +1,8 @@
 #!/usr/bin/perl
 # script to downgrade from cyrus imapd 1.6.2+ to earlier.
 # do NOT run this script while imapd's are running
-# $Id: undohash,v 1.9 2006/11/30 17:11:25 murch Exp $
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -19,14 +18,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -41,6 +41,8 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: undohash,v 1.10 2008/03/24 20:25:23 murch Exp $
+
 require 5;
 
 $| = 1;

Modified: branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/upgradesieve
URL: https://mail.incase.de/viewcvs/branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/upgradesieve?rev=768&root=cyrus22&r1=767&r2=768&view=diff
==============================================================================
--- branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/upgradesieve (original)
+++ branches/cyrus23/cyrus-imapd-2.3-2.3.13/tools/upgradesieve Mon Feb  9 12:49:22 2009
@@ -4,9 +4,8 @@
 # script to upgrade sievedir from imapd 1.6.13
 # make sure you run it as the cyrus user
 #!/usr/bin/perl
-# $Id: upgradesieve,v 1.8 2006/11/30 17:11:25 murch Exp $
 # 
-# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
+# Copyright (c) 1994-2008 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
@@ -22,14 +21,15 @@
 #
 # 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
+#    prior written permission. For permission or any 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 at andrew.cmu.edu
+#      Center for Technology Transfer and Enterprise Creation
+#      4615 Forbes Avenue
+#      Suite 302
+#      Pittsburgh, PA  15213
+#      (412) 268-7393, fax: (412) 268-7395
+#      innovation at andrew.cmu.edu
 #
 # 4. Redistributions of any form whatsoever must retain the following
 #    acknowledgment:
@@ -44,6 +44,7 @@
 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
+# $Id: upgradesieve,v 1.9 2008/03/24 20:25:23 murch Exp $
 
 if ($] !~ /^5\..*/) {
   # uh-oh. this isn't perl 5.




More information about the Pkg-Cyrus-imapd-Debian-devel mailing list