From 21160fd990a74ba498f9d5e007787aca294a061e Mon Sep 17 00:00:00 2001 From: Artur Frysiak Date: Thu, 9 Mar 2000 00:20:36 +0000 Subject: [PATCH] - more cyrus stuff Changed files: cyrus-deliver-wrapper.c -> 1.1 cyrus-user-procmailrc.template -> 1.1 --- cyrus-deliver-wrapper.c | 34 ++++++++++++++++++++ cyrus-user-procmailrc.template | 58 ++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 cyrus-deliver-wrapper.c create mode 100644 cyrus-user-procmailrc.template diff --git a/cyrus-deliver-wrapper.c b/cyrus-deliver-wrapper.c new file mode 100644 index 0000000..1328433 --- /dev/null +++ b/cyrus-deliver-wrapper.c @@ -0,0 +1,34 @@ +/* + * Wrapper for cyrus 'deliver' to allow anyone to run it - + * I hope this is secure! Should be setgid mail. + */ + +#include +#include +#include +#include +#include + +#ifndef LIBEXECDIR +#define LIBEXECDIR "/usr/libexec/cyrus" +#endif + +int main(int argc, char *argv[]) +{ + char *const envp[] = { NULL }; + struct passwd *ent = getpwuid(getuid()); + const char *uname = (ent && ent->pw_name && ent->pw_name[0]) + ? ent->pw_name : "anonymous"; + + if (argc != 2) { + fprintf(stderr, "Usage: %s mailbox\n", argv[0]); + return EX_USAGE; + } + + execle(LIBEXECDIR"/deliver", "deliver", "-e", + "-a", uname, "-m", argv[1], + NULL, envp); + + perror("exec "LIBEXECDIR"/deliver"); + return EX_OSERR; +} diff --git a/cyrus-user-procmailrc.template b/cyrus-user-procmailrc.template new file mode 100644 index 0000000..8a018a1 --- /dev/null +++ b/cyrus-user-procmailrc.template @@ -0,0 +1,58 @@ +############################## +# Begin procmailrc.joe file +# +# This is Joe's specific set of procmail +# recipes. It assumes that Joe has a +# number of specific folders created +# to which these recipes refer. Otherwise +# the mail cannot be sorted properly. +# +# First, let's define some high-level +# folder macros to save typing later on. +# The ALERTSBOX points to the +# folder where we'll sort out various +# incoming news alerts. +# The LISTSBOX will point to a +# folder where we'll sort out various +# list services to which we're subscribed. +# +# Both ALERTSBOX and LISTSBOX +# are subfolders of a generic folder called, +# duh, Folders, which is right off the +# user's INBOX. +# +# So if a Linux-kernel message comes in +# it gets deposited in the folder +# Folders/Lists/Linux_Kernel which is +# represented in Cyrus IMAP terms as +# user.Joe.Folders.Lists.Linux_kernel +# + +############################ +# Put anchordesk alerts in news alerts folder + +:0:$LOGNAME.lock +* ^From:.*anchordesk +| $DELIVERTO $ALERTSBOX.News-Alerts + +# Put NC World alerts in their own folder + +:0:$LOGNAME.lock +* ^From:.*NCWorld@FDDS.com +| $DELIVERTO $ALERTSBOX.NCWorld-Alerts + +############################# +# List processing & Misc Alerts + +:0:$LOGNAME.lock +* (^Cc:|^CC:|^To:|^Sender:).*linux-kernel@vger.rutgers.edu +| $DELIVERTO $LISTSBOX.Linux_Kernel + +:0:$LOGNAME.lock +* (^Cc:|^CC:|^To:|^Sender:).*linux-net@vger.rutgers.edu +| $DELIVERTO $LISTSBOX.Linux_Net + +# +# End of procmailrc.joe file +############################## + -- 2.44.0