]> code.citadel.org Git - citadel.git/blob - citadel/serv_netfilter.c
* fixz to allow incoming vCards in the address book to actually get processed
[citadel.git] / citadel / serv_netfilter.c
1 /*
2  * $Id$
3  * 
4  * A server-side module for Citadel designed to filter idiots off the network.
5  * 
6  * Copyright (c) 2002 / released under the GNU General Public License
7  */
8
9 #include "sysdep.h"
10 #include <stdlib.h>
11 #include <unistd.h>
12 #include <stdio.h>
13 #include <fcntl.h>
14 #include <signal.h>
15 #include <pwd.h>
16 #include <errno.h>
17 #include <sys/types.h>
18
19 #if TIME_WITH_SYS_TIME
20 # include <sys/time.h>
21 # include <time.h>
22 #else
23 # if HAVE_SYS_TIME_H
24 #  include <sys/time.h>
25 # else
26 #  include <time.h>
27 # endif
28 #endif
29
30 #include <sys/wait.h>
31 #include <string.h>
32 #include <limits.h>
33 #include "citadel.h"
34 #include "server.h"
35 #include "sysdep_decls.h"
36 #include "citserver.h"
37 #include "support.h"
38 #include "config.h"
39 #include "control.h"
40 #include "dynloader.h"
41 #include "room_ops.h"
42 #include "user_ops.h"
43 #include "policy.h"
44 #include "database.h"
45 #include "msgbase.h"
46 #include "tools.h"
47
48 /*
49  * This handler detects whether the user is attempting to save a new
50  * vCard as part of his/her personal configuration, and handles the replace
51  * function accordingly (delete the user's existing vCard in the config room
52  * and in the global address book).
53  */
54 int filter_the_idiots(struct CtdlMessage *msg, char *target_room) {
55
56         if (msg == NULL) {
57                 return(0);
58         }
59
60         /* FIXME ... write it!  In the meantime, here's a temporary fix */
61
62         if (msg->cm_fields['A'] != NULL) {
63                 if (!strcasecmp(msg->cm_fields['A'],
64                                 "Curly Surmudgeon")) {
65                         return(1);
66                 }
67         }
68
69         return(0);
70 }
71
72
73 char *Dynamic_Module_Init(void)
74 {
75         CtdlRegisterNetprocHook(filter_the_idiots);
76         return "$Id$";
77 }