]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/patches/cyrus-imapd-2.2.12-notify_sms.patch
Wir kehren zurueck zu Kudzu, da hwinfo noch mehr Aerger macht.
[people/teissler/ipfire-2.x.git] / src / patches / cyrus-imapd-2.2.12-notify_sms.patch
CommitLineData
b40388bb
MT
1diff -Naur cyrus-imapd-2.2.12.orig/doc/man/imapd.conf.5.html cyrus-imapd-2.2.12/doc/man/imapd.conf.5.html
2--- cyrus-imapd-2.2.12.orig/doc/man/imapd.conf.5.html 2005-02-14 19:02:18.000000000 +0100
3+++ cyrus-imapd-2.2.12/doc/man/imapd.conf.5.html 2005-08-16 13:32:36.000000000 +0200
4@@ -2751,6 +2751,24 @@
5 <tr valign="top" align="left">
6 <td width="10%"></td>
7 <td width="89%">
8+<p><b>sendsms:</b> /usr/bin/sendsms</p></td>
9+</table></p>
10+<!-- INDENTATION -->
11+<table width="100%" border=0 rules="none" frame="void"
12+ cols="2" cellspacing="0" cellpadding="0">
13+<tr valign="top" align="left">
14+<td width="19%"></td>
15+<td width="80%">
16+<p>The pathname of the sendsms executable. Sieve invokes
17+sendsms for sending SMS notifications.</p>
18+</td>
19+</table>
20+<!-- INDENTATION -->
21+<p><table width="100%" border=0 rules="none" frame="void"
22+ cols="2" cellspacing="0" cellpadding="0">
23+<tr valign="top" align="left">
24+<td width="10%"></td>
25+<td width="89%">
26 <p><b>servername:</b> &lt;none&gt;</p></td>
27 </table></p>
28 <!-- INDENTATION -->
29diff -Naur cyrus-imapd-2.2.12.orig/doc/man/notifyd.8.html cyrus-imapd-2.2.12/doc/man/notifyd.8.html
30--- cyrus-imapd-2.2.12.orig/doc/man/notifyd.8.html 2005-02-14 19:02:19.000000000 +0100
31+++ cyrus-imapd-2.2.12/doc/man/notifyd.8.html 2005-08-16 13:17:33.000000000 +0200
32@@ -181,6 +181,18 @@
33 <td width="11%"></td>
34 <td width="10%">
35
36+<p><b>sms</b></p>
37+</td>
38+<td width="77%">
39+
40+<p>Send the notification as SMS. This method can ONLY be used in
41+a Sieve &rsquo;notify&rsquo; action as it requires a
42+<i>sms:</i> URL to be specified as an <i>:option</i>.</p>
43+</td>
44+<tr valign="top" align="left">
45+<td width="11%"></td>
46+<td width="10%">
47+
48 <p><b>zephyr</b></p>
49 </td>
50 <td width="77%">
51diff -Naur cyrus-imapd-2.2.12.orig/lib/imapoptions cyrus-imapd-2.2.12/lib/imapoptions
52--- cyrus-imapd-2.2.12.orig/lib/imapoptions 2004-07-21 21:07:45.000000000 +0200
53+++ cyrus-imapd-2.2.12/lib/imapoptions 2005-08-16 13:27:08.000000000 +0200
54@@ -721,6 +721,10 @@
55 /* The pathname of the sendmail executable. Sieve invokes sendmail
56 for sending rejections, redirects and vacation responses. */
57
58+{ "sendsms", "/usr/bin/sendsms", STRING }
59+/* The pathname of the sendsms executable. Sieve invokes sendsms
60+ for sending SMS notifications. */
61+
62 { "servername", NULL, STRING }
63 /* This is the hostname visible in the greeting messages of the POP,
64 IMAP and LMTP daemons. If it is unset, then the result returned
65diff -Naur cyrus-imapd-2.2.12.orig/man/imapd.conf.5 cyrus-imapd-2.2.12/man/imapd.conf.5
66--- cyrus-imapd-2.2.12.orig/man/imapd.conf.5 2005-02-14 19:02:16.000000000 +0100
67+++ cyrus-imapd-2.2.12/man/imapd.conf.5 2005-08-16 13:35:40.000000000 +0200
68@@ -590,6 +590,9 @@
69 .IP "\fBsendmail:\fR /usr/lib/sendmail" 5
70 The pathname of the sendmail executable. Sieve invokes sendmail
71 for sending rejections, redirects and vacation responses.
72+.IP "\fBsendsms:\fR /usr/bin/sendsms" 5
73+The pathname of the sendsms executable. Sieve invokes sendsms
74+for sending SMS notifications.
75 .IP "\fBservername:\fR <none>" 5
76 This is the hostname visible in the greeting messages of the POP,
77 IMAP and LMTP daemons. If it is unset, then the result returned
78diff -Naur cyrus-imapd-2.2.12.orig/man/notifyd.8 cyrus-imapd-2.2.12/man/notifyd.8
79--- cyrus-imapd-2.2.12.orig/man/notifyd.8 2003-08-10 01:43:14.000000000 +0200
80+++ cyrus-imapd-2.2.12/man/notifyd.8 2005-08-16 13:18:03.000000000 +0200
81@@ -110,6 +110,11 @@
82 Sieve 'notify' action as it requires a \fImailto:\fR URL to be
83 specified as an \fI:option\fR.
84 .TP
85+.B sms
86+Send the notification as SMS. This method can ONLY be used in a
87+Sieve 'notify' action as it requires a \fIsms:\fR URL to be
88+specified as an \fI:option\fR.
89+.TP
90 .B zephyr
91 Send the notification as a zephyrgram. If used in a Sieve 'notify'
92 action, additional recipients can be specified as \fI:options\fR.
93diff -Naur cyrus-imapd-2.2.12.orig/notifyd/Makefile.in cyrus-imapd-2.2.12/notifyd/Makefile.in
94--- cyrus-imapd-2.2.12.orig/notifyd/Makefile.in 2004-05-28 20:03:06.000000000 +0200
95+++ cyrus-imapd-2.2.12/notifyd/Makefile.in 2005-08-16 15:18:45.000000000 +0200
96@@ -82,7 +82,7 @@
97 install:
98 $(INSTALL) -m 755 notifyd $(DESTDIR)$(service_path)
99
100-OBJS= notifyd.o notify_null.o notify_log.o notify_mailto.o notify_zephyr.o
101+OBJS= notifyd.o notify_null.o notify_log.o notify_mailto.o notify_sms.o notify_zephyr.o
102
103 notifytest: notifytest.o
104 $(CC) $(LDFLAGS) -o notifytest \
105diff -Naur cyrus-imapd-2.2.12.orig/notifyd/notifyd.h cyrus-imapd-2.2.12/notifyd/notifyd.h
106--- cyrus-imapd-2.2.12.orig/notifyd/notifyd.h 2003-02-13 21:15:48.000000000 +0100
107+++ cyrus-imapd-2.2.12/notifyd/notifyd.h 2005-08-16 12:58:17.000000000 +0200
108@@ -48,6 +48,7 @@
109 #include "notify_null.h"
110 #include "notify_log.h"
111 #include "notify_mailto.h"
112+#include "notify_sms.h"
113 #include "notify_zephyr.h"
114
115 /* Notify method dispatch table definition */
116@@ -64,6 +65,7 @@
117 { "null", notify_null }, /* do nothing */
118 { "log", notify_log }, /* use syslog (for testing) */
119 { "mailto", notify_mailto }, /* send an email */
120+ { "sms", notify_sms }, /* send an sms */
121 #ifdef HAVE_ZEPHYR
122 { "zephyr", notify_zephyr }, /* send a zephyrgram */
123 #endif
124diff -Naur cyrus-imapd-2.2.12.orig/notifyd/notify_sms.c cyrus-imapd-2.2.12/notifyd/notify_sms.c
125--- cyrus-imapd-2.2.12.orig/notifyd/notify_sms.c 1970-01-01 01:00:00.000000000 +0100
126+++ cyrus-imapd-2.2.12/notifyd/notify_sms.c 2005-08-16 18:43:56.000000000 +0200
127@@ -0,0 +1,111 @@
128+/* notify_sms.c -- SMS notification method
129+ * Simon Matter
130+ */
131+/*
132+ * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
133+ *
134+ * Redistribution and use in source and binary forms, with or without
135+ * modification, are permitted provided that the following conditions
136+ * are met:
137+ *
138+ * 1. Redistributions of source code must retain the above copyright
139+ * notice, this list of conditions and the following disclaimer.
140+ *
141+ * 2. Redistributions in binary form must reproduce the above copyright
142+ * notice, this list of conditions and the following disclaimer in
143+ * the documentation and/or other materials provided with the
144+ * distribution.
145+ *
146+ * 3. The name "Carnegie Mellon University" must not be used to
147+ * endorse or promote products derived from this software without
148+ * prior written permission. For permission or any other legal
149+ * details, please contact
150+ * Office of Technology Transfer
151+ * Carnegie Mellon University
152+ * 5000 Forbes Avenue
153+ * Pittsburgh, PA 15213-3890
154+ * (412) 268-4387, fax: (412) 268-7395
155+ * tech-transfer@andrew.cmu.edu
156+ *
157+ * 4. Redistributions of any form whatsoever must retain the following
158+ * acknowledgment:
159+ * "This product includes software developed by Computing Services
160+ * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
161+ *
162+ * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
163+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
164+ * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
165+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
166+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
167+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
168+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
169+ *
170+ * notify_sms is based on code from notify_mailto by Ken Murchison.
171+ * Copyright (c) 2005 Simon Matter, Invoca Systems.
172+ * Release 2005081600/2.2.12
173+*/
174+
175+#include <config.h>
176+
177+#include "notify_sms.h"
178+
179+#include <stdio.h>
180+#include <string.h>
181+#include <unistd.h>
182+#include <sys/types.h>
183+#include <sys/wait.h>
184+
185+#include "global.h"
186+#include "libconfig.h"
187+#include "sieve_interface.h"
188+
189+static int global_outgoing_count = 0;
190+
191+char* notify_sms(const char *class __attribute__((unused)),
192+ const char *priority __attribute__((unused)),
193+ const char *user __attribute__((unused)),
194+ const char *mailbox __attribute__((unused)),
195+ int nopt, char **options,
196+ const char *message)
197+{
198+ FILE *sm;
199+ const char *smbuf[10];
200+ int sm_stat;
201+ pid_t sm_pid;
202+ int fds[2];
203+
204+ /* XXX check/parse options (sms URI) */
205+ if (nopt < 1)
206+ return strdup("NO sms URI not specified");
207+
208+ smbuf[0] = "sendsms";
209+ smbuf[1] = options[0];
210+ smbuf[2] = NULL;
211+
212+ pipe(fds);
213+ if ((sm_pid = fork()) == 0) {
214+ /* i'm the child! run sendsms! */
215+ close(fds[1]);
216+ /* make the pipe be stdin */
217+ dup2(fds[0], 0);
218+ execv(config_getstring(IMAPOPT_SENDSMS), (char **) smbuf);
219+
220+ /* if we're here we suck */
221+ return strdup("NO sms couldn't exec");
222+ }
223+ /* i'm the parent */
224+ close(fds[0]);
225+ sm = fdopen(fds[1], "w");
226+
227+ if (!sm)
228+ return strdup("NO sms could not spawn sendsms process");
229+
230+ fprintf(sm, message);
231+
232+ fclose(sm);
233+ while (waitpid(sm_pid, &sm_stat, 0) < 0);
234+
235+ /* XXX check for sendsms exit code */
236+
237+ return strdup("OK sms notification successful");
238+}
239diff -Naur cyrus-imapd-2.2.12.orig/notifyd/notify_sms.h cyrus-imapd-2.2.12/notifyd/notify_sms.h
240--- cyrus-imapd-2.2.12.orig/notifyd/notify_sms.h 1970-01-01 01:00:00.000000000 +0100
241+++ cyrus-imapd-2.2.12/notifyd/notify_sms.h 2005-08-16 14:57:16.000000000 +0200
242@@ -0,0 +1,62 @@
243+/* notify_sms.h -- SMS notification method
244+ * Simon Matter
245+ */
246+/*
247+ * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
248+ *
249+ * Redistribution and use in source and binary forms, with or without
250+ * modification, are permitted provided that the following conditions
251+ * are met:
252+ *
253+ * 1. Redistributions of source code must retain the above copyright
254+ * notice, this list of conditions and the following disclaimer.
255+ *
256+ * 2. Redistributions in binary form must reproduce the above copyright
257+ * notice, this list of conditions and the following disclaimer in
258+ * the documentation and/or other materials provided with the
259+ * distribution.
260+ *
261+ * 3. The name "Carnegie Mellon University" must not be used to
262+ * endorse or promote products derived from this software without
263+ * prior written permission. For permission or any other legal
264+ * details, please contact
265+ * Office of Technology Transfer
266+ * Carnegie Mellon University
267+ * 5000 Forbes Avenue
268+ * Pittsburgh, PA 15213-3890
269+ * (412) 268-4387, fax: (412) 268-7395
270+ * tech-transfer@andrew.cmu.edu
271+ *
272+ * 4. Redistributions of any form whatsoever must retain the following
273+ * acknowledgment:
274+ * "This product includes software developed by Computing Services
275+ * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
276+ *
277+ * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
278+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
279+ * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
280+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
281+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
282+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
283+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
284+ *
285+ * notify_sms is based on code from notify_mailto by Ken Murchison.
286+ * Copyright (c) 2005 Simon Matter, Invoca Systems.
287+ * Release 2005081600/2.2.12
288+ *
289+ */
290+
291+#ifndef _NOTIFY_SMS_H_
292+#define _NOTIFY_SMS_H_
293+
294+#include <config.h>
295+
296+/* the only option should be a sms URI */
297+char* notify_sms(const char *class __attribute__((unused)),
298+ const char *priority __attribute__((unused)),
299+ const char *user __attribute__((unused)),
300+ const char *mailbox __attribute__((unused)),
301+ int nopt, char **options,
302+ const char *message);
303+
304+#endif /* _NOTIFY_SMS_H_ */