1 /**
2 * collectd - src/email.c
3 * Copyright (C) 2006 Sebastian Harl
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Author:
20 * Sebastian Harl <sh at tokkee.org>
21 **/
23 /*
24 * This plugin communicates with a spam filter, a virus scanner or similar
25 * software using a UNIX socket and a very simple protocol:
26 *
27 * e-mail type (e.g. ham, spam, virus, ...) and size
28 * e:<type>:<bytes>
29 *
30 * spam score
31 * s:<value>
32 *
33 * successful spam checks
34 * c:<type1>[,<type2>,...]
35 */
37 #include "collectd.h"
38 #include "common.h"
39 #include "plugin.h"
41 #include "configfile.h"
43 #if HAVE_LIBPTHREAD
44 # include <pthread.h>
45 # define EMAIL_HAVE_READ 1
46 #else
47 # define EMAIL_HAVE_READ 0
48 #endif
50 #if HAVE_SYS_SELECT_H
51 # include <sys/select.h>
52 #endif /* HAVE_SYS_SELECT_H */
54 #if HAVE_SYS_SOCKET_H
55 # include <sys/socket.h>
56 #endif /* HAVE_SYS_SOCKET_H */
58 /* *sigh* glibc does not define UNIX_PATH_MAX in sys/un.h ... */
59 #if HAVE_LINUX_UN_H
60 # include <linux/un.h>
61 #elif HAVE_SYS_UN_H
62 # include <sys/un.h>
63 #endif /* HAVE_LINUX_UN_H | HAVE_SYS_UN_H */
65 /* some systems (e.g. Darwin) seem to not define UNIX_PATH_MAX at all */
66 #ifndef UNIX_PATH_MAX
67 # define UNIX_PATH_MAX sizeof (((struct sockaddr_un *)0)->sun_path)
68 #endif /* UNIX_PATH_MAX */
70 #if HAVE_GRP_H
71 # include <grp.h>
72 #endif /* HAVE_GRP_H */
74 #define MODULE_NAME "email"
76 /* 256 bytes ought to be enough for anybody ;-) */
77 #define BUFSIZE 256
79 #ifndef COLLECTD_SOCKET_PREFIX
80 # define COLLECTD_SOCKET_PREFIX "/tmp/.collectd-"
81 #endif /* COLLECTD_SOCKET_PREFIX */
83 #define SOCK_PATH COLLECTD_SOCKET_PREFIX"email"
84 #define MAX_CONNS 5
85 #define MAX_CONNS_LIMIT 16384
87 #define log_err(...) syslog (LOG_ERR, MODULE_NAME": "__VA_ARGS__)
88 #define log_warn(...) syslog (LOG_WARNING, MODULE_NAME": "__VA_ARGS__)
90 /*
91 * Private data structures
92 */
93 #if EMAIL_HAVE_READ
94 /* linked list of email and check types */
95 typedef struct type {
96 char *name;
97 int value;
98 struct type *next;
99 } type_t;
101 typedef struct {
102 type_t *head;
103 type_t *tail;
104 } type_list_t;
106 /* collector thread control information */
107 typedef struct collector {
108 pthread_t thread;
110 /* socket descriptor of the current/last connection */
111 int socket;
112 } collector_t;
114 /* linked list of pending connections */
115 typedef struct conn {
116 /* socket to read data from */
117 int socket;
119 /* buffer to read data to */
120 char *buffer;
121 int idx; /* current write position in buffer */
122 int length; /* length of the current line, i.e. index of '\0' */
124 struct conn *next;
125 } conn_t;
127 typedef struct {
128 conn_t *head;
129 conn_t *tail;
130 } conn_list_t;
131 #endif /* EMAIL_HAVE_READ */
133 /*
134 * Private variables
135 */
136 #if EMAIL_HAVE_READ
137 /* valid configuration file keys */
138 static char *config_keys[] =
139 {
140 "SocketGroup",
141 "SocketPerms",
142 "MaxConns",
143 NULL
144 };
145 static int config_keys_num = 3;
147 /* socket configuration */
148 static char *sock_group = COLLECTD_GRP_NAME;
149 static int sock_perms = S_IRWXU | S_IRWXG;
150 static int max_conns = MAX_CONNS;
152 /* state of the plugin */
153 static int disabled = 0;
155 /* thread managing "client" connections */
156 static pthread_t connector;
157 static int connector_socket;
159 /* tell the collector threads that a new connection is available */
160 static pthread_cond_t conn_available = PTHREAD_COND_INITIALIZER;
162 /* connections that are waiting to be processed */
163 static pthread_mutex_t conns_mutex = PTHREAD_MUTEX_INITIALIZER;
164 static conn_list_t conns;
166 /* tell the connector thread that a collector is available */
167 static pthread_cond_t collector_available = PTHREAD_COND_INITIALIZER;
169 /* collector threads */
170 static collector_t **collectors;
172 static pthread_mutex_t available_mutex = PTHREAD_MUTEX_INITIALIZER;
173 static int available_collectors;
175 static pthread_mutex_t count_mutex = PTHREAD_MUTEX_INITIALIZER;
176 static type_list_t count;
178 static pthread_mutex_t size_mutex = PTHREAD_MUTEX_INITIALIZER;
179 static type_list_t size;
181 static pthread_mutex_t score_mutex = PTHREAD_MUTEX_INITIALIZER;
182 static double score;
183 static int score_count;
185 static pthread_mutex_t check_mutex = PTHREAD_MUTEX_INITIALIZER;
186 static type_list_t check;
187 #endif /* EMAIL_HAVE_READ */
189 #define COUNT_FILE "email/email-%s.rrd"
190 static char *count_ds_def[] =
191 {
192 "DS:count:GAUGE:"COLLECTD_HEARTBEAT":0:U",
193 NULL
194 };
195 static int count_ds_num = 1;
197 #define SIZE_FILE "email/email_size-%s.rrd"
198 static char *size_ds_def[] =
199 {
200 "DS:size:GAUGE:"COLLECTD_HEARTBEAT":0:U",
201 NULL
202 };
203 static int size_ds_num = 1;
205 #define SCORE_FILE "email/spam_score.rrd"
206 static char *score_ds_def[] =
207 {
208 "DS:score:GAUGE:"COLLECTD_HEARTBEAT":U:U",
209 NULL
210 };
211 static int score_ds_num = 1;
213 #define CHECK_FILE "email/spam_check-%s.rrd"
214 static char *check_ds_def[] =
215 {
216 "DS:hits:GAUGE:"COLLECTD_HEARTBEAT":0:U",
217 NULL
218 };
219 static int check_ds_num = 1;
221 #if EMAIL_HAVE_READ
222 static int email_config (char *key, char *value)
223 {
224 if (0 == strcasecmp (key, "SocketGroup")) {
225 sock_group = sstrdup (value);
226 }
227 else if (0 == strcasecmp (key, "SocketPerms")) {
228 /* the user is responsible for providing reasonable values */
229 sock_perms = (int)strtol (value, NULL, 8);
230 }
231 else if (0 == strcasecmp (key, "MaxConns")) {
232 long int tmp = strtol (value, NULL, 0);
234 if (tmp < 1) {
235 fprintf (stderr, "email plugin: `MaxConns' was set to invalid "
236 "value %li, will use default %i.\n",
237 tmp, MAX_CONNS);
238 max_conns = MAX_CONNS;
239 }
240 else if (tmp > MAX_CONNS_LIMIT) {
241 fprintf (stderr, "email plugin: `MaxConns' was set to invalid "
242 "value %li, will use hardcoded limit %i.\n",
243 tmp, MAX_CONNS_LIMIT);
244 max_conns = MAX_CONNS_LIMIT;
245 }
246 else {
247 max_conns = (int)tmp;
248 }
249 }
250 else {
251 return -1;
252 }
253 return 0;
254 } /* static int email_config (char *, char *) */
256 /* Increment the value of the given name in the given list by incr. */
257 static void type_list_incr (type_list_t *list, char *name, int incr)
258 {
259 if (NULL == list->head) {
260 list->head = (type_t *)smalloc (sizeof (type_t));
262 list->head->name = sstrdup (name);
263 list->head->value = incr;
264 list->head->next = NULL;
266 list->tail = list->head;
267 }
268 else {
269 type_t *ptr;
271 for (ptr = list->head; NULL != ptr; ptr = ptr->next) {
272 if (0 == strcmp (name, ptr->name))
273 break;
274 }
276 if (NULL == ptr) {
277 list->tail->next = (type_t *)smalloc (sizeof (type_t));
278 list->tail = list->tail->next;
280 list->tail->name = sstrdup (name);
281 list->tail->value = incr;
282 list->tail->next = NULL;
283 }
284 else {
285 ptr->value += incr;
286 }
287 }
288 return;
289 } /* static void type_list_incr (type_list_t *, char *) */
291 /* Read a single character from the socket. If an error occurs or end-of-file
292 * is reached return '\0'. */
293 static char read_char (conn_t *src)
294 {
295 char ret = '\0';
297 fd_set fdset;
299 FD_ZERO (&fdset);
300 FD_SET (src->socket, &fdset);
302 if (-1 == select (src->socket + 1, &fdset, NULL, NULL, NULL)) {
303 log_err ("select() failed: %s", strerror (errno));
304 return '\0';
305 }
307 assert (FD_ISSET (src->socket, &fdset));
309 do {
310 ssize_t len = 0;
312 errno = 0;
313 if (0 > (len = read (src->socket, (void *)&ret, 1))) {
314 if (EINTR != errno) {
315 log_err ("read() failed: %s", strerror (errno));
316 return '\0';
317 }
318 }
320 if (0 == len)
321 return '\0';
322 } while (EINTR == errno);
323 return ret;
324 } /* static char read_char (conn_t *) */
326 /* Read a single line (terminated by '\n') from the the socket.
327 *
328 * The return value is zero terminated and does not contain any newline
329 * characters.
330 *
331 * If an error occurs or end-of-file is reached return NULL.
332 *
333 * IMPORTANT NOTE: If there is no newline character found in BUFSIZE
334 * characters of the input stream, the line will will be ignored! By
335 * definition we should not get any longer input lines, thus this is
336 * acceptable in this case ;-) */
337 static char *read_line (conn_t *src)
338 {
339 int i = 0;
341 assert ((BUFSIZE >= src->idx) && (src->idx >= 0));
342 assert ((src->idx > src->length) || (src->length == 0));
344 if (src->length > 0) { /* remove old line */
345 src->idx -= (src->length + 1);
346 memmove (src->buffer, src->buffer + src->length + 1, src->idx);
347 src->length = 0;
348 }
350 for (i = 0; i < src->idx; ++i) {
351 if ('\n' == src->buffer[i])
352 break;
353 }
355 if (i == src->idx) {
356 fd_set fdset;
358 ssize_t len = 0;
360 FD_ZERO (&fdset);
361 FD_SET (src->socket, &fdset);
363 if (-1 == select (src->socket + 1, &fdset, NULL, NULL, NULL)) {
364 log_err ("select() failed: %s", strerror (errno));
365 return NULL;
366 }
368 assert (FD_ISSET (src->socket, &fdset));
370 do {
371 errno = 0;
372 if (0 > (len = read (src->socket,
373 (void *)(src->buffer + src->idx),
374 BUFSIZE - src->idx))) {
375 if (EINTR != errno) {
376 log_err ("read() failed: %s", strerror (errno));
377 return NULL;
378 }
379 }
381 if (0 == len)
382 return NULL;
383 } while (EINTR == errno);
385 src->idx += len;
387 for (i = src->idx - len; i < src->idx; ++i) {
388 if ('\n' == src->buffer[i])
389 break;
390 }
392 if (i == src->idx) {
393 src->length = 0;
395 if (BUFSIZE == src->idx) { /* no space left in buffer */
396 while ('\n' != read_char (src))
397 /* ignore complete line */;
399 src->idx = 0;
400 }
401 return read_line (src);
402 }
403 }
405 src->buffer[i] = '\0';
406 src->length = i;
408 return src->buffer;
409 } /* static char *read_line (conn_t *) */
411 static void *collect (void *arg)
412 {
413 collector_t *this = (collector_t *)arg;
415 char *buffer = (char *)smalloc (BUFSIZE);
417 while (1) {
418 int loop = 1;
420 conn_t *connection;
422 pthread_mutex_lock (&conns_mutex);
424 while (NULL == conns.head) {
425 pthread_cond_wait (&conn_available, &conns_mutex);
426 }
428 connection = conns.head;
429 conns.head = conns.head->next;
431 if (NULL == conns.head) {
432 conns.tail = NULL;
433 }
435 this->socket = connection->socket;
437 pthread_mutex_unlock (&conns_mutex);
439 connection->buffer = buffer;
440 connection->idx = 0;
441 connection->length = 0;
443 { /* put the socket in non-blocking mode */
444 int flags = 0;
446 errno = 0;
447 if (-1 == fcntl (connection->socket, F_GETFL, &flags)) {
448 log_err ("fcntl() failed: %s", strerror (errno));
449 loop = 0;
450 }
452 errno = 0;
453 if (-1 == fcntl (connection->socket, F_SETFL, flags | O_NONBLOCK)) {
454 log_err ("fcntl() failed: %s", strerror (errno));
455 loop = 0;
456 }
457 }
459 while (loop) {
460 char *line = read_line (connection);
462 if (NULL == line) {
463 loop = 0;
464 break;
465 }
467 if (':' != line[1]) {
468 log_err ("syntax error in line '%s'", line);
469 continue;
470 }
472 if ('e' == line[0]) { /* e:<type>:<bytes> */
473 char *ptr = NULL;
474 char *type = strtok_r (line + 2, ":", &ptr);
475 char *tmp = strtok_r (NULL, ":", &ptr);
476 int bytes = 0;
478 if (NULL == tmp) {
479 log_err ("syntax error in line '%s'", line);
480 continue;
481 }
483 bytes = atoi (tmp);
485 pthread_mutex_lock (&count_mutex);
486 type_list_incr (&count, type, 1);
487 pthread_mutex_unlock (&count_mutex);
489 pthread_mutex_lock (&size_mutex);
490 type_list_incr (&size, type, bytes);
491 pthread_mutex_unlock (&size_mutex);
492 }
493 else if ('s' == line[0]) { /* s:<value> */
494 pthread_mutex_lock (&score_mutex);
495 score = (score * (double)score_count + atof (line + 2))
496 / (double)(score_count + 1);
497 ++score_count;
498 pthread_mutex_unlock (&score_mutex);
499 }
500 else if ('c' == line[0]) { /* c:<type1>[,<type2>,...] */
501 char *ptr = NULL;
502 char *type = strtok_r (line + 2, ",", &ptr);
504 do {
505 pthread_mutex_lock (&check_mutex);
506 type_list_incr (&check, type, 1);
507 pthread_mutex_unlock (&check_mutex);
508 } while (NULL != (type = strtok_r (NULL, ",", &ptr)));
509 }
510 else {
511 log_err ("unknown type '%c'", line[0]);
512 }
513 } /* while (loop) */
515 close (connection->socket);
517 free (connection);
519 pthread_mutex_lock (&available_mutex);
520 ++available_collectors;
521 pthread_mutex_unlock (&available_mutex);
523 pthread_cond_signal (&collector_available);
524 } /* while (1) */
526 free (buffer);
527 pthread_exit ((void *)0);
528 } /* static void *collect (void *) */
530 static void *open_connection (void *arg)
531 {
532 struct sockaddr_un addr;
534 /* create UNIX socket */
535 errno = 0;
536 if (-1 == (connector_socket = socket (PF_UNIX, SOCK_STREAM, 0))) {
537 disabled = 1;
538 log_err ("socket() failed: %s", strerror (errno));
539 pthread_exit ((void *)1);
540 }
542 addr.sun_family = AF_UNIX;
544 strncpy (addr.sun_path, SOCK_PATH, (size_t)(UNIX_PATH_MAX - 1));
545 addr.sun_path[UNIX_PATH_MAX - 1] = '\0';
546 unlink (addr.sun_path);
548 errno = 0;
549 if (-1 == bind (connector_socket, (struct sockaddr *)&addr,
550 offsetof (struct sockaddr_un, sun_path)
551 + strlen(addr.sun_path))) {
552 disabled = 1;
553 log_err ("bind() failed: %s", strerror (errno));
554 pthread_exit ((void *)1);
555 }
557 errno = 0;
558 if (-1 == listen (connector_socket, 5)) {
559 disabled = 1;
560 log_err ("listen() failed: %s", strerror (errno));
561 pthread_exit ((void *)1);
562 }
564 if ((uid_t)0 == geteuid ()) {
565 struct group *grp;
567 errno = 0;
568 if (NULL != (grp = getgrnam (sock_group))) {
569 errno = 0;
570 if (0 != chown (SOCK_PATH, (uid_t)-1, grp->gr_gid)) {
571 log_warn ("chown() failed: %s", strerror (errno));
572 }
573 }
574 else {
575 log_warn ("getgrnam() failed: %s", strerror (errno));
576 }
577 }
578 else {
579 log_warn ("not running as root");
580 }
582 errno = 0;
583 if (0 != chmod (SOCK_PATH, sock_perms)) {
584 log_warn ("chmod() failed: %s", strerror (errno));
585 }
587 { /* initialize collector threads */
588 int i = 0;
589 int err = 0;
591 pthread_attr_t ptattr;
593 conns.head = NULL;
594 conns.tail = NULL;
596 pthread_attr_init (&ptattr);
597 pthread_attr_setdetachstate (&ptattr, PTHREAD_CREATE_DETACHED);
599 available_collectors = max_conns;
601 collectors =
602 (collector_t **)smalloc (max_conns * sizeof (collector_t *));
604 for (i = 0; i < max_conns; ++i) {
605 collectors[i] = (collector_t *)smalloc (sizeof (collector_t));
606 collectors[i]->socket = 0;
608 if (0 != (err = pthread_create (&collectors[i]->thread, &ptattr,
609 collect, collectors[i]))) {
610 log_err ("pthread_create() failed: %s", strerror (err));
611 }
612 }
614 pthread_attr_destroy (&ptattr);
615 }
617 while (1) {
618 int remote = 0;
620 conn_t *connection;
622 pthread_mutex_lock (&available_mutex);
624 while (0 == available_collectors) {
625 pthread_cond_wait (&collector_available, &available_mutex);
626 }
628 --available_collectors;
630 pthread_mutex_unlock (&available_mutex);
632 do {
633 errno = 0;
634 if (-1 == (remote = accept (connector_socket, NULL, NULL))) {
635 if (EINTR != errno) {
636 disabled = 1;
637 log_err ("accept() failed: %s", strerror (errno));
638 pthread_exit ((void *)1);
639 }
640 }
641 } while (EINTR == errno);
643 connection = (conn_t *)smalloc (sizeof (conn_t));
645 connection->socket = remote;
646 connection->next = NULL;
648 pthread_mutex_lock (&conns_mutex);
650 if (NULL == conns.head) {
651 conns.head = connection;
652 conns.tail = connection;
653 }
654 else {
655 conns.tail->next = connection;
656 conns.tail = conns.tail->next;
657 }
659 pthread_mutex_unlock (&conns_mutex);
661 pthread_cond_signal (&conn_available);
662 }
663 pthread_exit ((void *)0);
664 } /* static void *open_connection (void *) */
665 #endif /* EMAIL_HAVE_READ */
667 static void email_init (void)
668 {
669 #if EMAIL_HAVE_READ
670 int err = 0;
672 if (0 != (err = pthread_create (&connector, NULL,
673 open_connection, NULL))) {
674 disabled = 1;
675 log_err ("pthread_create() failed: %s", strerror (err));
676 return;
677 }
678 #endif /* EMAIL_HAVE_READ */
679 return;
680 } /* static void email_init (void) */
682 #if EMAIL_HAVE_READ
683 static void email_shutdown (void)
684 {
685 int i = 0;
687 if (disabled)
688 return;
690 pthread_kill (connector, SIGTERM);
691 close (connector_socket);
693 /* don't allow any more connections to be processed */
694 pthread_mutex_lock (&conns_mutex);
696 for (i = 0; i < max_conns; ++i) {
697 pthread_kill (collectors[i]->thread, SIGTERM);
698 close (collectors[i]->socket);
699 }
701 pthread_mutex_unlock (&conns_mutex);
703 unlink (SOCK_PATH);
704 return;
705 } /* static void email_shutdown (void) */
706 #endif /* EMAIL_HAVE_READ */
708 static void count_write (char *host, char *inst, char *val)
709 {
710 char file[BUFSIZE] = "";
711 int len = 0;
713 len = snprintf (file, BUFSIZE, COUNT_FILE, inst);
714 if ((len < 0) || (len >= BUFSIZE))
715 return;
717 rrd_update_file (host, file, val, count_ds_def, count_ds_num);
718 return;
719 } /* static void email_write (char *host, char *inst, char *val) */
721 static void size_write (char *host, char *inst, char *val)
722 {
723 char file[BUFSIZE] = "";
724 int len = 0;
726 len = snprintf (file, BUFSIZE, SIZE_FILE, inst);
727 if ((len < 0) || (len >= BUFSIZE))
728 return;
730 rrd_update_file (host, file, val, size_ds_def, size_ds_num);
731 return;
732 } /* static void size_write (char *host, char *inst, char *val) */
734 static void score_write (char *host, char *inst, char *val)
735 {
736 rrd_update_file (host, SCORE_FILE, val, score_ds_def, score_ds_num);
737 return;
738 } /* static void score_write (char *host, char *inst, char *val) */
740 static void check_write (char *host, char *inst, char *val)
741 {
742 char file[BUFSIZE] = "";
743 int len = 0;
745 len = snprintf (file, BUFSIZE, CHECK_FILE, inst);
746 if ((len < 0) || (len >= BUFSIZE))
747 return;
749 rrd_update_file (host, file, val, check_ds_def, check_ds_num);
750 return;
751 } /* static void check_write (char *host, char *inst, char *val) */
753 #if EMAIL_HAVE_READ
754 static void type_submit (char *plugin, char *inst, int value)
755 {
756 char buf[BUFSIZE] = "";
757 int len = 0;
759 len = snprintf (buf, BUFSIZE, "%u:%i", (unsigned int)curtime, value);
760 if ((len < 0) || (len >= BUFSIZE))
761 return;
763 plugin_submit (plugin, inst, buf);
764 return;
765 } /* static void type_submit (char *, char *, int) */
767 static void score_submit (double value)
768 {
769 char buf[BUFSIZE] = "";
770 int len = 0;
772 len = snprintf (buf, BUFSIZE, "%u:%.2f", (unsigned int)curtime, value);
773 if ((len < 0) || (len >= BUFSIZE))
774 return;
776 plugin_submit ("email_spam_score", NULL, buf);
777 return;
778 } /* static void score_submit (double) */
780 static void email_read (void)
781 {
782 type_t *ptr;
784 if (disabled)
785 return;
787 pthread_mutex_lock (&count_mutex);
789 for (ptr = count.head; NULL != ptr; ptr = ptr->next) {
790 type_submit ("email_count", ptr->name, ptr->value);
791 ptr->value = 0;
792 }
794 pthread_mutex_unlock (&count_mutex);
796 pthread_mutex_lock (&size_mutex);
798 for (ptr = size.head; NULL != ptr; ptr = ptr->next) {
799 type_submit ("email_size", ptr->name, ptr->value);
800 ptr->value = 0;
801 }
803 pthread_mutex_unlock (&size_mutex);
805 pthread_mutex_lock (&score_mutex);
807 score_submit (score);
808 score = 0.0;
809 score_count = 0;
811 pthread_mutex_unlock (&score_mutex);
813 pthread_mutex_lock (&check_mutex);
815 for (ptr = check.head; NULL != ptr; ptr = ptr->next) {
816 type_submit ("email_spam_check", ptr->name, ptr->value);
817 ptr->value = 0;
818 }
820 pthread_mutex_unlock (&check_mutex);
821 return;
822 } /* static void read (void) */
823 #else /* if !EMAIL_HAVE_READ */
824 # define email_read NULL
825 #endif
827 void module_register (void)
828 {
829 plugin_register (MODULE_NAME, email_init, email_read, NULL);
830 plugin_register ("email_count", NULL, NULL, count_write);
831 plugin_register ("email_size", NULL, NULL, size_write);
832 plugin_register ("email_spam_score", NULL, NULL, score_write);
833 plugin_register ("email_spam_check", NULL, NULL, check_write);
834 #if EMAIL_HAVE_READ
835 plugin_register_shutdown (MODULE_NAME, email_shutdown);
836 cf_register (MODULE_NAME, email_config, config_keys, config_keys_num);
837 #endif /* EMAIL_HAVE_READ */
838 return;
839 } /* void module_register (void) */
841 /* vim: set sw=4 ts=4 tw=78 noexpandtab : */