]> code.citadel.org Git - citadel.git/blob - citadel/serv_listsub.c
* Bugfix for above
[citadel.git] / citadel / serv_listsub.c
1 /*
2  * $Id$
3  *
4  * This module handles self-service subscription/unsubscription to mail lists.
5  *
6  * Copyright (C) 2002 by Art Cancro and others.
7  * This code is released under the terms of the GNU General Public License.
8  *
9  */
10
11 #include "sysdep.h"
12 #include <stdlib.h>
13 #include <unistd.h>
14 #include <stdio.h>
15 #include <fcntl.h>
16 #include <ctype.h>
17 #include <signal.h>
18 #include <pwd.h>
19 #include <errno.h>
20 #include <sys/types.h>
21 #include <dirent.h>
22 #if TIME_WITH_SYS_TIME
23 # include <sys/time.h>
24 # include <time.h>
25 #else
26 # if HAVE_SYS_TIME_H
27 #  include <sys/time.h>
28 # else
29 #  include <time.h>
30 # endif
31 #endif
32
33 #include <sys/wait.h>
34 #include <string.h>
35 #include <limits.h>
36 #include "citadel.h"
37 #include "server.h"
38 #include "sysdep_decls.h"
39 #include "citserver.h"
40 #include "support.h"
41 #include "config.h"
42 #include "dynloader.h"
43 #include "room_ops.h"
44 #include "user_ops.h"
45 #include "policy.h"
46 #include "database.h"
47 #include "msgbase.h"
48 #include "tools.h"
49 #include "internet_addressing.h"
50 #include "serv_network.h"
51 #include "clientsocket.h"
52 #include "file_ops.h"
53
54 #ifndef HAVE_SNPRINTF
55 #include "snprintf.h"
56 #endif
57
58
59 /*
60  * Generate a randomizationalisticized token to use for authentication of
61  * a subscribe or unsubscribe request.
62  */
63 void listsub_generate_token(char *buf) {
64         char sourcebuf[SIZ];
65
66         /* Theo, please sit down and shut up.  This key doesn't have to be
67          * tinfoil-hat secure, it just needs to be reasonably unguessable.
68          */
69         sprintf(sourcebuf, "%d%d%ld",
70                 rand,
71                 getpid(),
72                 time(NULL)
73         );
74
75         /* Convert it to base64 so it looks cool */     
76         encode_base64(buf, sourcebuf);
77 }
78
79
80
81 void cmd_subs(char *cmdbuf) {
82         cprintf("%d not yet implemented, dumbass...\n", ERROR);
83 }
84
85
86 /*
87  * Module entry point
88  */
89 char *Dynamic_Module_Init(void)
90 {
91         CtdlRegisterProtoHook(cmd_subs, "SUBS", "List subscribe/unsubscribe");
92         return "$Id$";
93 }