309 lines
11 KiB
Diff
309 lines
11 KiB
Diff
diff -Naur cyrus-imapd-2.3.7.orig/doc/man/imapd.conf.5.html cyrus-imapd-2.3.7/doc/man/imapd.conf.5.html
|
|
--- cyrus-imapd-2.3.7.orig/doc/man/imapd.conf.5.html 2006-07-10 16:31:53.000000000 +0200
|
|
+++ cyrus-imapd-2.3.7/doc/man/imapd.conf.5.html 2006-07-14 10:27:29.000000000 +0200
|
|
@@ -3130,6 +3130,24 @@
|
|
<tr valign="top" align="left">
|
|
<td width="10%"></td>
|
|
<td width="89%">
|
|
+<p><b>sendsms:</b> /usr/bin/sendsms</p></td>
|
|
+</table></p>
|
|
+<!-- INDENTATION -->
|
|
+<table width="100%" border=0 rules="none" frame="void"
|
|
+ cols="2" cellspacing="0" cellpadding="0">
|
|
+<tr valign="top" align="left">
|
|
+<td width="19%"></td>
|
|
+<td width="80%">
|
|
+<p>The pathname of the sendsms executable. Sieve invokes
|
|
+sendsms for sending SMS notifications.</p>
|
|
+</td>
|
|
+</table>
|
|
+<!-- INDENTATION -->
|
|
+<p><table width="100%" border=0 rules="none" frame="void"
|
|
+ cols="2" cellspacing="0" cellpadding="0">
|
|
+<tr valign="top" align="left">
|
|
+<td width="10%"></td>
|
|
+<td width="89%">
|
|
<p><b>servername:</b> <none></p></td>
|
|
</table>
|
|
<!-- INDENTATION -->
|
|
diff -Naur cyrus-imapd-2.3.7.orig/doc/man/notifyd.8.html cyrus-imapd-2.3.7/doc/man/notifyd.8.html
|
|
--- cyrus-imapd-2.3.7.orig/doc/man/notifyd.8.html 2006-07-10 16:31:54.000000000 +0200
|
|
+++ cyrus-imapd-2.3.7/doc/man/notifyd.8.html 2006-07-14 10:27:29.000000000 +0200
|
|
@@ -181,6 +181,18 @@
|
|
<td width="11%"></td>
|
|
<td width="10%">
|
|
|
|
+<p><b>sms</b></p>
|
|
+</td>
|
|
+<td width="77%">
|
|
+
|
|
+<p>Send the notification as SMS. This method can ONLY be used in
|
|
+a Sieve ’notify’ action as it requires a
|
|
+<i>sms:</i> URL to be specified as an <i>:option</i>.</p>
|
|
+</td>
|
|
+<tr valign="top" align="left">
|
|
+<td width="11%"></td>
|
|
+<td width="10%">
|
|
+
|
|
<p><b>zephyr</b></p>
|
|
</td>
|
|
<td width="77%">
|
|
diff -Naur cyrus-imapd-2.3.7.orig/lib/imapoptions cyrus-imapd-2.3.7/lib/imapoptions
|
|
--- cyrus-imapd-2.3.7.orig/lib/imapoptions 2006-06-27 17:58:42.000000000 +0200
|
|
+++ cyrus-imapd-2.3.7/lib/imapoptions 2006-07-14 10:27:29.000000000 +0200
|
|
@@ -829,6 +829,10 @@
|
|
/* The pathname of the sendmail executable. Sieve invokes sendmail
|
|
for sending rejections, redirects and vacation responses. */
|
|
|
|
+{ "sendsms", "/usr/bin/sendsms", STRING }
|
|
+/* The pathname of the sendsms executable. Sieve invokes sendsms
|
|
+ for sending SMS notifications. */
|
|
+
|
|
{ "servername", NULL, STRING }
|
|
/* This is the hostname visible in the greeting messages of the POP,
|
|
IMAP and LMTP daemons. If it is unset, then the result returned
|
|
diff -Naur cyrus-imapd-2.3.7.orig/man/imapd.conf.5 cyrus-imapd-2.3.7/man/imapd.conf.5
|
|
--- cyrus-imapd-2.3.7.orig/man/imapd.conf.5 2006-07-10 16:31:52.000000000 +0200
|
|
+++ cyrus-imapd-2.3.7/man/imapd.conf.5 2006-07-14 10:27:29.000000000 +0200
|
|
@@ -691,6 +691,9 @@
|
|
.IP "\fBsendmail:\fR /usr/lib/sendmail" 5
|
|
The pathname of the sendmail executable. Sieve invokes sendmail
|
|
for sending rejections, redirects and vacation responses.
|
|
+.IP "\fBsendsms:\fR /usr/bin/sendsms" 5
|
|
+The pathname of the sendsms executable. Sieve invokes sendsms
|
|
+for sending SMS notifications.
|
|
.IP "\fBservername:\fR <none>" 5
|
|
This is the hostname visible in the greeting messages of the POP,
|
|
IMAP and LMTP daemons. If it is unset, then the result returned
|
|
diff -Naur cyrus-imapd-2.3.7.orig/man/notifyd.8 cyrus-imapd-2.3.7/man/notifyd.8
|
|
--- cyrus-imapd-2.3.7.orig/man/notifyd.8 2003-08-10 01:43:14.000000000 +0200
|
|
+++ cyrus-imapd-2.3.7/man/notifyd.8 2006-07-14 10:27:29.000000000 +0200
|
|
@@ -110,6 +110,11 @@
|
|
Sieve 'notify' action as it requires a \fImailto:\fR URL to be
|
|
specified as an \fI:option\fR.
|
|
.TP
|
|
+.B sms
|
|
+Send the notification as SMS. This method can ONLY be used in a
|
|
+Sieve 'notify' action as it requires a \fIsms:\fR URL to be
|
|
+specified as an \fI:option\fR.
|
|
+.TP
|
|
.B zephyr
|
|
Send the notification as a zephyrgram. If used in a Sieve 'notify'
|
|
action, additional recipients can be specified as \fI:options\fR.
|
|
diff -Naur cyrus-imapd-2.3.7.orig/notifyd/Makefile.in cyrus-imapd-2.3.7/notifyd/Makefile.in
|
|
--- cyrus-imapd-2.3.7.orig/notifyd/Makefile.in 2004-05-31 20:22:59.000000000 +0200
|
|
+++ cyrus-imapd-2.3.7/notifyd/Makefile.in 2006-07-14 10:27:29.000000000 +0200
|
|
@@ -82,7 +82,7 @@
|
|
install:
|
|
$(INSTALL) -m 755 notifyd $(DESTDIR)$(service_path)
|
|
|
|
-OBJS= notifyd.o notify_null.o notify_log.o notify_mailto.o notify_zephyr.o
|
|
+OBJS= notifyd.o notify_null.o notify_log.o notify_mailto.o notify_sms.o notify_zephyr.o
|
|
|
|
notifytest: notifytest.o
|
|
$(CC) $(LDFLAGS) -o notifytest \
|
|
diff -Naur cyrus-imapd-2.3.7.orig/notifyd/notifyd.h cyrus-imapd-2.3.7/notifyd/notifyd.h
|
|
--- cyrus-imapd-2.3.7.orig/notifyd/notifyd.h 2003-02-13 21:15:48.000000000 +0100
|
|
+++ cyrus-imapd-2.3.7/notifyd/notifyd.h 2006-07-14 10:27:29.000000000 +0200
|
|
@@ -48,6 +48,7 @@
|
|
#include "notify_null.h"
|
|
#include "notify_log.h"
|
|
#include "notify_mailto.h"
|
|
+#include "notify_sms.h"
|
|
#include "notify_zephyr.h"
|
|
|
|
/* Notify method dispatch table definition */
|
|
@@ -64,6 +65,7 @@
|
|
{ "null", notify_null }, /* do nothing */
|
|
{ "log", notify_log }, /* use syslog (for testing) */
|
|
{ "mailto", notify_mailto }, /* send an email */
|
|
+ { "sms", notify_sms }, /* send an sms */
|
|
#ifdef HAVE_ZEPHYR
|
|
{ "zephyr", notify_zephyr }, /* send a zephyrgram */
|
|
#endif
|
|
diff -Naur cyrus-imapd-2.3.7.orig/notifyd/notify_sms.c cyrus-imapd-2.3.7/notifyd/notify_sms.c
|
|
--- cyrus-imapd-2.3.7.orig/notifyd/notify_sms.c 1970-01-01 01:00:00.000000000 +0100
|
|
+++ cyrus-imapd-2.3.7/notifyd/notify_sms.c 2006-07-14 10:29:10.000000000 +0200
|
|
@@ -0,0 +1,116 @@
|
|
+/* notify_sms.c -- SMS notification method
|
|
+ * Simon Matter
|
|
+ */
|
|
+/*
|
|
+ * Copyright (c) 1998-2003 Carnegie 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@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.
|
|
+ *
|
|
+ * notify_sms is based on code from notify_mailto by Ken Murchison.
|
|
+ * Copyright (c) 2005-2006 Simon Matter, Invoca Systems.
|
|
+ * Release 2006071300/2.3.7
|
|
+*/
|
|
+
|
|
+#include <config.h>
|
|
+
|
|
+#include "notify_sms.h"
|
|
+
|
|
+#include <stdio.h>
|
|
+#include <string.h>
|
|
+#include <unistd.h>
|
|
+#include <sys/types.h>
|
|
+#include <sys/wait.h>
|
|
+
|
|
+#include "global.h"
|
|
+#include "libconfig.h"
|
|
+#include "sieve_interface.h"
|
|
+
|
|
+static int global_outgoing_count = 0;
|
|
+
|
|
+char* notify_sms(const char *class __attribute__((unused)),
|
|
+ const char *priority,
|
|
+ const char *user,
|
|
+ const char *mailbox __attribute__((unused)),
|
|
+ int nopt, char **options,
|
|
+ const char *message)
|
|
+{
|
|
+ FILE *sm;
|
|
+ const char *smbuf[10];
|
|
+ int sm_stat;
|
|
+ pid_t sm_pid;
|
|
+ int fds[2];
|
|
+
|
|
+ /* XXX check/parse options (sms URI) */
|
|
+ if (nopt < 1)
|
|
+ return strdup("NO sms URI not specified");
|
|
+
|
|
+ smbuf[0] = "sendsms";
|
|
+ smbuf[1] = "-u";
|
|
+ smbuf[2] = user;
|
|
+ smbuf[3] = "-p";
|
|
+ smbuf[4] = priority;
|
|
+ smbuf[5] = "-o";
|
|
+ smbuf[6] = options[0];
|
|
+ smbuf[7] = NULL;
|
|
+
|
|
+ pipe(fds);
|
|
+ if ((sm_pid = fork()) == 0) {
|
|
+ /* i'm the child! run sendsms! */
|
|
+ close(fds[1]);
|
|
+ /* make the pipe be stdin */
|
|
+ dup2(fds[0], 0);
|
|
+ execv(config_getstring(IMAPOPT_SENDSMS), (char **) smbuf);
|
|
+
|
|
+ /* if we're here we suck */
|
|
+ return strdup("NO sms couldn't exec");
|
|
+ }
|
|
+ /* i'm the parent */
|
|
+ close(fds[0]);
|
|
+ sm = fdopen(fds[1], "w");
|
|
+
|
|
+ if (!sm)
|
|
+ return strdup("NO sms could not spawn sendsms process");
|
|
+
|
|
+ fprintf(sm, message);
|
|
+
|
|
+ fclose(sm);
|
|
+ while (waitpid(sm_pid, &sm_stat, 0) < 0);
|
|
+
|
|
+ /* XXX check for sendsms exit code */
|
|
+
|
|
+ return strdup("OK sms notification successful");
|
|
+}
|
|
diff -Naur cyrus-imapd-2.3.7.orig/notifyd/notify_sms.h cyrus-imapd-2.3.7/notifyd/notify_sms.h
|
|
--- cyrus-imapd-2.3.7.orig/notifyd/notify_sms.h 1970-01-01 01:00:00.000000000 +0100
|
|
+++ cyrus-imapd-2.3.7/notifyd/notify_sms.h 2006-07-14 10:29:10.000000000 +0200
|
|
@@ -0,0 +1,61 @@
|
|
+/* notify_sms.h -- SMS notification method
|
|
+ * Simon Matter
|
|
+ */
|
|
+/*
|
|
+ * Copyright (c) 1998-2003 Carnegie 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@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.
|
|
+ *
|
|
+ * notify_sms is based on code from notify_mailto by Ken Murchison.
|
|
+ * Copyright (c) 2005-2006 Simon Matter, Invoca Systems.
|
|
+ * Release 2006071300/2.3.7
|
|
+ *
|
|
+ */
|
|
+
|
|
+#ifndef _NOTIFY_SMS_H_
|
|
+#define _NOTIFY_SMS_H_
|
|
+
|
|
+#include <config.h>
|
|
+
|
|
+char* notify_sms(const char *class __attribute__((unused)),
|
|
+ const char *priority,
|
|
+ const char *user,
|
|
+ const char *mailbox __attribute__((unused)),
|
|
+ int nopt, char **options,
|
|
+ const char *message);
|
|
+
|
|
+#endif /* _NOTIFY_SMS_H_ */
|