More work on getting cassandane running.

This commit is contained in:
Jason Tibbitts 2017-05-23 12:18:54 -05:00
parent ab96e24f94
commit 5a7ae23159
4 changed files with 101 additions and 249 deletions

47
cassandane.ini Normal file
View File

@ -0,0 +1,47 @@
# A basic cassandane.ini file for running cassandane as part of the Fedora
# package build process.
# The idea here is to run tests on the just-compiled version of cyrus-imapd.
# However, many of the build locations are just random temporary directories, and
# so this requires some finesse.
[cassandane]
rootdir = BUILDDIR/cassandane/work
pwcheck = alwaystrue
cleanup = no
maxworkers = 1
#[valgrind]
#enabled = no
# The installed copy
[cyrus default]
prefix = /usr
destdir = BUILDROOT
# Replication testing disabled
# [cyrus replica]
# [cyrus murder]
# Don't enable any of the gdb options but leave them here in case someone ever
# needs to do so
#[gdb]
# imapd = yes
# sync_server = yes
# lntpd = yes
# timsieved = yes
# backupd = yes
#[config]
#[caldavtalk]
#basedir = BUILDDIR/cassandane/testdata
#[imaptest]
# XXX Cassandane wants this to not be installed. Don't know why. If
# necessary, make a link farm to it.
#basedir = /usr
#[caldavtester]
# XXX Would need to include the source in the cyrus package just as cassandane is, and get it built before running tests
# basedir = ...

View File

@ -20,7 +20,6 @@ Summary: A high-performance email, contacts and calendar server
License: BSD
URL: http://www.cyrusimap.org/
Source0: http://www.cyrusimap.org/releases/%name-%version.tar.gz
Source1: https://github.com/cyrusimap/cassandane/archive/%cmt1.tar.gz#/cassandane-%{scmt %cmt1}.tar.gz
Source10: cyrus-imapd.logrotate
Source11: cyrus-imapd.pam-config
@ -34,6 +33,24 @@ Source17: cyrus-imapd.service
Source18: cyrus-imapd-init.service
Source19: cyr_systemd_helper
# Source files for running the Cassandane test suite at build time.
Source90: https://github.com/cyrusimap/cassandane/archive/%cmt1.tar.gz#/cassandane-%{scmt %cmt1}.tar.gz
# The CPAN version, and hence the Fedora-packaged version, of Net::CalDAVTalk
# doesn't include the testdata directory. Cassandane can use it for testing
# calendaring, so it's included here.
# This archive was generated by running:
# svn export https://github.com/brong/Net-CalDAVTalk/trunk/testdata
# tar cfz cassandane-testdata-20170523.tar.gz testdata
Source91: cassandane-testdata-20170523.tar.gz
# This is a source file and not a patch because you can't use autosetup to
# apply patches to secondary unpacked source files.
Source92: patch-cassandane-no-sudo
# A template config file for cassandane; we will substitute in varions values.
Source93: cassandane.ini
# Dependency notes:
# * clamav-devel and mariadb-devel removed because they both depend on
# compat-openssl.
@ -57,6 +74,8 @@ BuildRequires: xapian-core-devel
# SASL modules needed for 'make check' to function:
BuildRequires: cyrus-sasl-plain cyrus-sasl-md5
#BuildRequires: imaptest
# Perl modules required for cassandane to function
BuildRequires: perl(AnyEvent) perl(BSD::Resource) perl(Clone)
BuildRequires: perl(File::chdir) perl(IO::Socket::INET6) perl(Mail::IMAPTalk)
@ -150,20 +169,30 @@ files compatible with the iCalendar specification (RFC2445).
This package contains a forked version of vzic for internal use by the Cyrus
IMAP server.
# Build dir is either $PWD, $(pwd) or %
%prep
%autosetup -p1
tar xf %SOURCE1
ln -s cassandane-%cmt1 cassandane
# Install the Fedora-specific documentation file
install -m 644 %SOURCE16 doc/
# Fix permissions on perl programs
#find . -type f -name "*.pl" -exec chmod 755 {} \;
# Unpack and prepare cassandane
tar xf %SOURCE90
ln -s cassandane-%cmt1 cassandane
pushd cassandane
mkdir work
tar xf %SOURCE91
patch -p1 < %SOURCE92
cp %SOURCE93 cassandane.ini
sed -i \
-e "s!BUILDDIR!$(pwd)!" \
-e "s!BUILDROOT!%buildroot!" \
cassandane.ini
popd
%build
# This is the test suite, which doesn't build much but does verify its dependencies.
# If this is done after the configure call, the one thing it does build fails
# because the configure macro puts some hardening flags into the environment.
@ -175,13 +204,14 @@ popd
# --enable-objectstore
# It's experimental, and it doesn't appear that either openio or caringo are
# in Fedora.
# --with-mysql
# libmysqlclient doesn't support openssl 1.1 and you can't two versions of
# openssl linked into the same program.
# XXX --with-cyrus-prefix and --with-service-path went away.
# Use --with-libexecdir= instead
# --with-cyrus-prefix and --with-service-path went away; use --with-libexecdir=
# instead.
autoreconf -vi
# XXX --with-mysql removed because libmysqlclient needs compat-openssl and you
# can't link them both into the same program.
%configure \
--disable-silent-rules \
\
@ -330,7 +360,6 @@ touch %buildroot/%ssl_pem_file
mv %buildroot/%_sbindir/fetchnews %buildroot/%cyrexecdir/cyr_fetchnews
mv %buildroot/%_mandir/man8/fetchnews.8 %buildroot/%_mandir/man8/cyr_fetchnews.8
# fix conflicts with uw-imap
mv %buildroot/%_mandir/man8/imapd.8 %buildroot/%_mandir/man8/imapd.8cyrus
mv %buildroot/%_mandir/man8/pop3d.8 %buildroot/%_mandir/man8/pop3d.8cyrus
@ -359,6 +388,8 @@ find %buildroot -name ".packlist" -exec rm {} \;
%check
make check
pushd cassandane
./testrunner.pl --config cassandane.ini -f tap
%pre
# Create 'cyrus' user on target host

View File

@ -1,238 +0,0 @@
diff --git a/imap/http_caldav.c b/imap/http_caldav.c
index 98c0f70..4520424 100644
--- a/imap/http_caldav.c
+++ b/imap/http_caldav.c
@@ -362,7 +362,7 @@ static int store_resource(struct transaction_t *txn, icalcomponent *ical,
struct caldav_db *caldavdb, int overwrite,
unsigned flags);
-static void sched_request(const char *organizer, struct sched_param *sparam,
+static void sched_request(const char *organizer, struct caldav_sched_param *sparam,
icalcomponent *oldical, icalcomponent *newical,
const char *att_update);
static void sched_reply(const char *userid,
@@ -1154,7 +1154,7 @@ static int caldav_delete_sched(struct transaction_t *txn,
const char *userid, *organizer, **hdr;
icalcomponent *ical, *comp;
icalproperty *prop;
- struct sched_param sparam;
+ struct caldav_sched_param sparam;
/* Load message containing the resource and parse iCal data */
ical = record_to_ical(mailbox, record);
@@ -2441,7 +2441,7 @@ static int caldav_post(struct transaction_t *txn)
icalproperty_method meth = 0;
icalproperty *prop = NULL;
const char *uid = NULL, *organizer = NULL;
- struct sched_param sparam;
+ struct caldav_sched_param sparam;
if (!(namespace_calendar.allow & ALLOW_CAL_SCHED) || !txn->req_tgt.flags) {
/* POST to regular calendar collection */
@@ -2726,7 +2726,7 @@ static int caldav_put(struct transaction_t *txn,
/* Scheduling object resource */
const char *userid;
struct caldav_data *cdata;
- struct sched_param sparam;
+ struct caldav_sched_param sparam;
icalcomponent *oldical = NULL;
int r;
@@ -5359,12 +5359,12 @@ static int store_resource(struct transaction_t *txn, icalcomponent *ical,
}
-int caladdress_lookup(const char *addr, struct sched_param *param)
+int caladdress_lookup(const char *addr, struct caldav_sched_param *param)
{
const char *userid = addr;
int islocal = 1, found = 1;
- memset(param, 0, sizeof(struct sched_param));
+ memset(param, 0, sizeof(struct caldav_sched_param));
if (!addr) return HTTP_NOT_FOUND;
@@ -5571,7 +5571,7 @@ struct remote_rock {
static void busytime_query_remote(const char *server __attribute__((unused)),
void *data, void *rock)
{
- struct sched_param *remote = (struct sched_param *) data;
+ struct caldav_sched_param *remote = (struct caldav_sched_param *) data;
struct remote_rock *rrock = (struct remote_rock *) rock;
icalcomponent *comp;
struct proplist *list;
@@ -5673,18 +5673,18 @@ static void busytime_query_remote(const char *server __attribute__((unused)),
}
-static void free_sched_param(void *data)
+static void free_caldav_sched_param(void *data)
{
- struct sched_param *sched_param = (struct sched_param *) data;
+ struct caldav_sched_param *caldav_sched_param = (struct caldav_sched_param *) data;
- if (sched_param) {
+ if (caldav_sched_param) {
struct proplist *prop, *next;
- for (prop = sched_param->props; prop; prop = next) {
+ for (prop = caldav_sched_param->props; prop; prop = next) {
next = prop->next;
free(prop);
}
- free(sched_param);
+ free(caldav_sched_param);
}
}
@@ -5700,14 +5700,14 @@ int sched_busytime_query(struct transaction_t *txn,
char mailboxname[MAX_MAILBOX_BUFFER];
icalproperty *prop = NULL, *next;
const char *uid = NULL, *organizer = NULL;
- struct sched_param sparam;
+ struct caldav_sched_param sparam;
struct auth_state *org_authstate = NULL;
xmlNodePtr root = NULL;
xmlNsPtr ns[NUM_NAMESPACE];
struct propfind_ctx fctx;
struct calquery_filter calfilter;
struct hash_table remote_table;
- struct sched_param *remote = NULL;
+ struct caldav_sched_param *remote = NULL;
if (!calendarprefix) {
calendarprefix = config_getstring(IMAPOPT_CALENDARPREFIX);
@@ -5811,7 +5811,7 @@ int sched_busytime_query(struct transaction_t *txn,
remote = hash_lookup(key, &remote_table);
if (!remote) {
/* New remote - add it to the hash table */
- remote = xzmalloc(sizeof(struct sched_param));
+ remote = xzmalloc(sizeof(struct caldav_sched_param));
if (sparam.server) remote->server = xstrdup(sparam.server);
remote->port = sparam.port;
remote->flags = sparam.flags;
@@ -5907,7 +5907,7 @@ int sched_busytime_query(struct transaction_t *txn,
struct remote_rock rrock = { txn, ical, root, ns };
hash_enumerate(&remote_table, busytime_query_remote, &rrock);
}
- free_hash_table(&remote_table, free_sched_param);
+ free_hash_table(&remote_table, free_caldav_sched_param);
/* Output the XML response */
if (!ret) xml_response(HTTP_OK, txn, root->doc);
@@ -5945,7 +5945,7 @@ static void free_sched_data(void *data)
/* Deliver scheduling object to a remote recipient */
static void sched_deliver_remote(const char *recipient,
- struct sched_param *sparam,
+ struct caldav_sched_param *sparam,
struct sched_data *sched_data)
{
int r;
@@ -6250,7 +6250,7 @@ static int deliver_merge_pollstatus(icalcomponent *ical, icalcomponent *request)
static void sched_pollstatus(const char *organizer,
- struct sched_param *sparam, icalcomponent *ical,
+ struct caldav_sched_param *sparam, icalcomponent *ical,
const char *voter)
{
struct auth_state *authstate;
@@ -6376,7 +6376,7 @@ deliver_merge_pollstatus(icalcomponent *ical __attribute__((unused)),
}
static void sched_pollstatus(const char *organizer __attribute__((unused)),
- struct sched_param *sparam __attribute__((unused)),
+ struct caldav_sched_param *sparam __attribute__((unused)),
icalcomponent *ical __attribute__((unused)),
const char *voter __attribute__((unused)))
{
@@ -6708,7 +6708,7 @@ static int deliver_merge_request(const char *attendee,
/* Deliver scheduling object to local recipient */
static void sched_deliver_local(const char *recipient,
- struct sched_param *sparam,
+ struct caldav_sched_param *sparam,
struct sched_data *sched_data,
struct auth_state *authstate)
{
@@ -6986,7 +6986,7 @@ void sched_deliver(const char *recipient, void *data, void *rock)
{
struct sched_data *sched_data = (struct sched_data *) data;
struct auth_state *authstate = (struct auth_state *) rock;
- struct sched_param sparam;
+ struct caldav_sched_param sparam;
int islegal;
/* Check SCHEDULE-FORCE-SEND value */
@@ -7325,7 +7325,7 @@ static unsigned propcmp(icalcomponent *oldical, icalcomponent *newical,
/* Create and deliver an organizer scheduling request */
-static void sched_request(const char *organizer, struct sched_param *sparam,
+static void sched_request(const char *organizer, struct caldav_sched_param *sparam,
icalcomponent *oldical, icalcomponent *newical,
const char *att_update)
{
@@ -7607,7 +7607,7 @@ static icalcomponent *trim_attendees(icalcomponent *comp, const char *userid,
prop;
prop = nextprop) {
const char *att = get_recipient(prop);
- struct sched_param sparam;
+ struct caldav_sched_param sparam;
nextprop = icalcomponent_get_next_property(copy, recip_kind);
diff --git a/imap/http_caldav_sched.h b/imap/http_caldav_sched.h
index 5d8b2a9..9b66b81 100644
--- a/imap/http_caldav_sched.h
+++ b/imap/http_caldav_sched.h
@@ -109,7 +109,7 @@ struct proplist {
};
/* Each calendar user address has the following scheduling protocol params */
-struct sched_param {
+struct caldav_sched_param {
char *userid; /* Userid corresponding to calendar address */
char *server; /* Remote server user lives on */
unsigned port; /* Remote server port, default = 80 */
@@ -119,7 +119,7 @@ struct sched_param {
extern icalarray *rscale_calendars;
extern const char *get_icalcomponent_errstr(icalcomponent *ical);
-extern int isched_send(struct sched_param *sparam, const char *recipient,
+extern int isched_send(struct caldav_sched_param *sparam, const char *recipient,
icalcomponent *ical, xmlNodePtr *xml);
extern int sched_busytime_query(struct transaction_t *txn,
@@ -127,6 +127,6 @@ extern int sched_busytime_query(struct transaction_t *txn,
extern void sched_deliver(const char *recipient, void *data, void *rock);
extern xmlNodePtr xml_add_schedresponse(xmlNodePtr root, xmlNsPtr dav_ns,
xmlChar *recipient, xmlChar *status);
-extern int caladdress_lookup(const char *addr, struct sched_param *param);
+extern int caladdress_lookup(const char *addr, struct caldav_sched_param *param);
#endif /* HTTP_CALDAV_SCHED_H */
diff --git a/imap/http_ischedule.c b/imap/http_ischedule.c
index fef11a0..e08bc80 100644
--- a/imap/http_ischedule.c
+++ b/imap/http_ischedule.c
@@ -540,7 +540,7 @@ static int meth_post_isched(struct transaction_t *txn,
while ((recipient = tok_next(&tok))) {
/* Is recipient remote or local? */
- struct sched_param sparam;
+ struct caldav_sched_param sparam;
int r = caladdress_lookup(recipient, &sparam);
/* Don't allow scheduling with remote users via iSchedule */
@@ -583,7 +583,7 @@ static int meth_post_isched(struct transaction_t *txn,
}
-int isched_send(struct sched_param *sparam, const char *recipient,
+int isched_send(struct caldav_sched_param *sparam, const char *recipient,
icalcomponent *ical, xmlNodePtr *xml)
{
int r = 0;

12
patch-cassandane-no-sudo Normal file
View File

@ -0,0 +1,12 @@
diff --git a/Cassandane/Util/Setup.pm b/Cassandane/Util/Setup.pm
index 3a67f0b..5a81e51 100644
--- a/Cassandane/Util/Setup.pm
+++ b/Cassandane/Util/Setup.pm
@@ -57,6 +57,7 @@ my @saved_argv = @ARGV;
sub become_cyrus
{
+ return 0;
my $cyrus = 'cyrus';
my $pw = getpwnam($cyrus);
die "No user named '$cyrus'"