* Renamed "struct user" to "struct ctdluser"
[citadel.git] / citadel / serv_expire.c
1 /*
2  * $Id$
3  *
4  * This module handles the expiry of old messages and the purging of old users.
5  *
6  */
7
8
9 /*
10  * A brief technical discussion:
11  *
12  * Several of the purge operations found in this module operate in two
13  * stages: the first stage generates a linked list of objects to be deleted,
14  * then the second stage deletes all listed objects from the database.
15  *
16  * At first glance this may seem cumbersome and unnecessary.  The reason it is
17  * implemented in this way is because GDBM (and perhaps some other backends we
18  * may hook into in the future) explicitly do _not_ support the deletion of
19  * records from a file while the file is being traversed.  The delete operation
20  * will succeed, but the traversal is not guaranteed to visit every object if
21  * this is done.  Therefore we utilize the two-stage purge.
22  *
23  * When using Berkeley DB, there's another reason for the two-phase purge: we
24  * don't want the entire thing being done as one huge transaction.
25  */
26
27
28 #include "sysdep.h"
29 #include <stdlib.h>
30 #include <unistd.h>
31 #include <stdio.h>
32 #include <fcntl.h>
33 #include <signal.h>
34 #include <pwd.h>
35 #include <errno.h>
36 #include <sys/types.h>
37
38 #if TIME_WITH_SYS_TIME
39 # include <sys/time.h>
40 # include <time.h>
41 #else
42 # if HAVE_SYS_TIME_H
43 #  include <sys/time.h>
44 # else
45 #  include <time.h>
46 # endif
47 #endif
48
49 #include <sys/wait.h>
50 #include <string.h>
51 #include <limits.h>
52 #include "citadel.h"
53 #include "server.h"
54 #include <syslog.h>
55 #include "sysdep_decls.h"
56 #include "citserver.h"
57 #include "support.h"
58 #include "config.h"
59 #include "serv_extensions.h"
60 #include "room_ops.h"
61 #include "policy.h"
62 #include "database.h"
63 #include "msgbase.h"
64 #include "user_ops.h"
65 #include "control.h"
66 #include "serv_network.h"
67 #include "tools.h"
68
69
70 struct PurgeList {
71         struct PurgeList *next;
72         char name[ROOMNAMELEN]; /* use the larger of username or roomname */
73 };
74
75 struct VPurgeList {
76         struct VPurgeList *next;
77         long vp_roomnum;
78         long vp_roomgen;
79         long vp_usernum;
80 };
81
82 struct ValidRoom {
83         struct ValidRoom *next;
84         long vr_roomnum;
85         long vr_roomgen;
86 };
87
88 struct ValidUser {
89         struct ValidUser *next;
90         long vu_usernum;
91 };
92
93
94 struct ctdlroomref {
95         struct ctdlroomref *next;
96         long msgnum;
97 };
98
99 struct UPurgeList {
100         struct UPurgeList *next;
101         char up_key[SIZ];
102 };
103
104
105 struct PurgeList *UserPurgeList = NULL;
106 struct PurgeList *RoomPurgeList = NULL;
107 struct ValidRoom *ValidRoomList = NULL;
108 struct ValidUser *ValidUserList = NULL;
109 int messages_purged;
110
111 struct ctdlroomref *rr = NULL;
112
113 extern struct CitContext *ContextList;
114
115
116 /*
117  * First phase of message purge -- gather the locations of messages which
118  * qualify for purging and write them to a temp file.
119  */
120 void GatherPurgeMessages(struct ctdlroom *qrbuf, void *data) {
121         struct ExpirePolicy epbuf;
122         long delnum;
123         time_t xtime, now;
124         struct CtdlMessage *msg;
125         int a;
126         struct cdbdata *cdbfr;
127         long *msglist = NULL;
128         int num_msgs = 0;
129         FILE *purgelist;
130
131         purgelist = (FILE *)data;
132         fprintf(purgelist, "r=%s\n", qrbuf->QRname);
133
134         time(&now);
135         GetExpirePolicy(&epbuf, qrbuf);
136
137         /* If the room is set to never expire messages ... do nothing */
138         if (epbuf.expire_mode == EXPIRE_NEXTLEVEL) return;
139         if (epbuf.expire_mode == EXPIRE_MANUAL) return;
140
141         cdbfr = cdb_fetch(CDB_MSGLISTS, &qrbuf->QRnumber, sizeof(long));
142
143         if (cdbfr != NULL) {
144                 msglist = mallok(cdbfr->len);
145                 memcpy(msglist, cdbfr->ptr, cdbfr->len);
146                 num_msgs = cdbfr->len / sizeof(long);
147                 cdb_free(cdbfr);
148         }
149
150         /* Nothing to do if there aren't any messages */
151         if (num_msgs == 0) {
152                 if (msglist != NULL) phree(msglist);
153                 return;
154         }
155
156         /* If the room is set to expire by count, do that */
157         if (epbuf.expire_mode == EXPIRE_NUMMSGS) {
158                 if (num_msgs > epbuf.expire_value) {
159                         for (a=0; a<(num_msgs - epbuf.expire_value); ++a) {
160                                 fprintf(purgelist, "m=%ld\n", msglist[a]);
161                                 ++messages_purged;
162                         }
163                 }
164         }
165
166         /* If the room is set to expire by age... */
167         if (epbuf.expire_mode == EXPIRE_AGE) {
168                 for (a=0; a<num_msgs; ++a) {
169                         delnum = msglist[a];
170
171                         msg = CtdlFetchMessage(delnum);
172                         if (msg != NULL) {
173                                 xtime = atol(msg->cm_fields['T']);
174                                 CtdlFreeMessage(msg);
175                         } else {
176                                 xtime = 0L;
177                         }
178
179                         if ((xtime > 0L)
180                            && (now - xtime > (time_t)(epbuf.expire_value * 86400L))) {
181                                 fprintf(purgelist, "m=%ld\n", delnum);
182                                 ++messages_purged;
183                         }
184                 }
185         }
186
187         if (msglist != NULL) phree(msglist);
188 }
189
190
191 /*
192  * Second phase of message purge -- read list of msgs from temp file and
193  * delete them.
194  */
195 void DoPurgeMessages(FILE *purgelist) {
196         char roomname[ROOMNAMELEN];
197         long msgnum;
198         char buf[SIZ];
199
200         rewind(purgelist);
201         strcpy(roomname, "nonexistent room ___ ___");
202         while (fgets(buf, sizeof buf, purgelist) != NULL) {
203                 buf[strlen(buf)-1]=0;
204                 if (!strncasecmp(buf, "r=", 2)) {
205                         strcpy(roomname, &buf[2]);
206                 }
207                 if (!strncasecmp(buf, "m=", 2)) {
208                         msgnum = atol(&buf[2]);
209                         if (msgnum > 0L) {
210                                 CtdlDeleteMessages(roomname, msgnum, "");
211                         }
212                 }
213         }
214 }
215
216
217 void PurgeMessages(void) {
218         FILE *purgelist;
219
220         lprintf(5, "PurgeMessages() called\n");
221         messages_purged = 0;
222
223         purgelist = tmpfile();
224         if (purgelist == NULL) {
225                 lprintf(3, "Can't create purgelist temp file: %s\n",
226                         strerror(errno));
227                 return;
228         }
229
230         ForEachRoom(GatherPurgeMessages, (void *)purgelist );
231         DoPurgeMessages(purgelist);
232         fclose(purgelist);
233 }
234
235
236 void AddValidUser(struct ctdluser *usbuf, void *data) {
237         struct ValidUser *vuptr;
238
239         vuptr = (struct ValidUser *)mallok(sizeof(struct ValidUser));
240         vuptr->next = ValidUserList;
241         vuptr->vu_usernum = usbuf->usernum;
242         ValidUserList = vuptr;
243 }
244
245 void AddValidRoom(struct ctdlroom *qrbuf, void *data) {
246         struct ValidRoom *vrptr;
247
248         vrptr = (struct ValidRoom *)mallok(sizeof(struct ValidRoom));
249         vrptr->next = ValidRoomList;
250         vrptr->vr_roomnum = qrbuf->QRnumber;
251         vrptr->vr_roomgen = qrbuf->QRgen;
252         ValidRoomList = vrptr;
253 }
254
255 void DoPurgeRooms(struct ctdlroom *qrbuf, void *data) {
256         time_t age, purge_secs;
257         struct PurgeList *pptr;
258         struct ValidUser *vuptr;
259         int do_purge = 0;
260
261         /* For mailbox rooms, there's only one purging rule: if the user who
262          * owns the room still exists, we keep the room; otherwise, we purge
263          * it.  Bypass any other rules.
264          */
265         if (qrbuf->QRflags & QR_MAILBOX) {
266                 /* if user not found, do_purge will be 1 */
267                 do_purge = 1;
268                 for (vuptr=ValidUserList; vuptr!=NULL; vuptr=vuptr->next) {
269                         if (vuptr->vu_usernum == atol(qrbuf->QRname)) {
270                                 do_purge = 0;
271                         }
272                 }
273         }
274         else {
275                 /* Any of these attributes render a room non-purgable */
276                 if (qrbuf->QRflags & QR_PERMANENT) return;
277                 if (qrbuf->QRflags & QR_DIRECTORY) return;
278                 if (qrbuf->QRflags & QR_NETWORK) return;
279                 if (!strcasecmp(qrbuf->QRname, SYSCONFIGROOM)) return;
280                 if (is_noneditable(qrbuf)) return;
281
282                 /* If we don't know the modification date, be safe and don't purge */
283                 if (qrbuf->QRmtime <= (time_t)0) return;
284
285                 /* If no room purge time is set, be safe and don't purge */
286                 if (config.c_roompurge < 0) return;
287
288                 /* Otherwise, check the date of last modification */
289                 age = time(NULL) - (qrbuf->QRmtime);
290                 purge_secs = (time_t)config.c_roompurge * (time_t)86400;
291                 if (purge_secs <= (time_t)0) return;
292                 lprintf(9, "<%s> is <%ld> seconds old\n", qrbuf->QRname, (long)age);
293                 if (age > purge_secs) do_purge = 1;
294         } /* !QR_MAILBOX */
295
296         if (do_purge) {
297                 pptr = (struct PurgeList *) mallok(sizeof(struct PurgeList));
298                 pptr->next = RoomPurgeList;
299                 strcpy(pptr->name, qrbuf->QRname);
300                 RoomPurgeList = pptr;
301         }
302
303 }
304
305
306
307 int PurgeRooms(void) {
308         struct PurgeList *pptr;
309         int num_rooms_purged = 0;
310         struct ctdlroom qrbuf;
311         struct ValidUser *vuptr;
312         char *transcript = NULL;
313
314         lprintf(5, "PurgeRooms() called\n");
315
316
317         /* Load up a table full of valid user numbers so we can delete
318          * user-owned rooms for users who no longer exist */
319         ForEachUser(AddValidUser, NULL);
320
321         /* Then cycle through the room file */
322         ForEachRoom(DoPurgeRooms, NULL);
323
324         /* Free the valid user list */
325         while (ValidUserList != NULL) {
326                 vuptr = ValidUserList->next;
327                 phree(ValidUserList);
328                 ValidUserList = vuptr;
329         }
330
331
332         transcript = mallok(SIZ);
333         strcpy(transcript, "The following rooms have been auto-purged:\n");
334
335         while (RoomPurgeList != NULL) {
336                 if (getroom(&qrbuf, RoomPurgeList->name) == 0) {
337                         transcript=reallok(transcript, strlen(transcript)+SIZ);
338                         snprintf(&transcript[strlen(transcript)], SIZ, " %s\n",
339                                 qrbuf.QRname);
340                         delete_room(&qrbuf);
341                 }
342                 pptr = RoomPurgeList->next;
343                 phree(RoomPurgeList);
344                 RoomPurgeList = pptr;
345                 ++num_rooms_purged;
346         }
347
348         if (num_rooms_purged > 0) aide_message(transcript);
349         phree(transcript);
350
351         lprintf(5, "Purged %d rooms.\n", num_rooms_purged);
352         return(num_rooms_purged);
353 }
354
355
356 void do_user_purge(struct ctdluser *us, void *data) {
357         int purge;
358         time_t now;
359         time_t purge_time;
360         struct PurgeList *pptr;
361
362         /* stupid recovery routine to re-create missing mailboxen.
363          * don't enable this.
364         struct ctdlroom qrbuf;
365         char mailboxname[ROOMNAMELEN];
366         MailboxName(mailboxname, us, MAILROOM);
367         create_room(mailboxname, 4, "", 0, 1, 1);
368         if (getroom(&qrbuf, mailboxname) != 0) return;
369         lprintf(9, "Got %s\n", qrbuf.QRname);
370          */
371
372
373         /* Set purge time; if the user overrides the system default, use it */
374         if (us->USuserpurge > 0) {
375                 purge_time = ((time_t)us->USuserpurge) * 86400L;
376         }
377         else {
378                 purge_time = ((time_t)config.c_userpurge) * 86400L;
379         }
380
381         /* The default rule is to not purge. */
382         purge = 0;
383
384         /* If the user hasn't called in two months, his/her account
385          * has expired, so purge the record.
386          */
387         now = time(NULL);
388         if ((now - us->lastcall) > purge_time) purge = 1;
389
390         /* If the user set his/her password to 'deleteme', he/she
391          * wishes to be deleted, so purge the record.
392          */
393         if (!strcasecmp(us->password, "deleteme")) purge = 1;
394
395         /* If the record is marked as permanent, don't purge it.
396          */
397         if (us->flags & US_PERM) purge = 0;
398
399         /* If the access level is 0, the record should already have been
400          * deleted, but maybe the user was logged in at the time or something.
401          * Delete the record now.
402          */
403         if (us->axlevel == 0) purge = 1;
404
405         /* 0 calls is impossible.  If there are 0 calls, it must
406          * be a corrupted record, so purge it.
407          */
408         if (us->timescalled == 0) purge = 1;
409
410         if (purge == 1) {
411                 pptr = (struct PurgeList *) mallok(sizeof(struct PurgeList));
412                 pptr->next = UserPurgeList;
413                 strcpy(pptr->name, us->fullname);
414                 UserPurgeList = pptr;
415         }
416
417 }
418
419
420
421 int PurgeUsers(void) {
422         struct PurgeList *pptr;
423         int num_users_purged = 0;
424         char *transcript = NULL;
425
426         lprintf(5, "PurgeUsers() called\n");
427         if (config.c_userpurge > 0) {
428                 ForEachUser(do_user_purge, NULL);
429         }
430
431         transcript = mallok(SIZ);
432         strcpy(transcript, "The following users have been auto-purged:\n");
433
434         while (UserPurgeList != NULL) {
435                 transcript=reallok(transcript, strlen(transcript)+SIZ);
436                 snprintf(&transcript[strlen(transcript)], SIZ, " %s\n",
437                         UserPurgeList->name);
438                 purge_user(UserPurgeList->name);
439                 pptr = UserPurgeList->next;
440                 phree(UserPurgeList);
441                 UserPurgeList = pptr;
442                 ++num_users_purged;
443         }
444
445         if (num_users_purged > 0) aide_message(transcript);
446         phree(transcript);
447
448         lprintf(5, "Purged %d users.\n", num_users_purged);
449         return(num_users_purged);
450 }
451
452
453 /*
454  * Purge visits
455  *
456  * This is a really cumbersome "garbage collection" function.  We have to
457  * delete visits which refer to rooms and/or users which no longer exist.  In
458  * order to prevent endless traversals of the room and user files, we first
459  * build linked lists of rooms and users which _do_ exist on the system, then
460  * traverse the visit file, checking each record against those two lists and
461  * purging the ones that do not have a match on _both_ lists.  (Remember, if
462  * either the room or user being referred to is no longer on the system, the
463  * record is completely useless.)
464  */
465 int PurgeVisits(void) {
466         struct cdbdata *cdbvisit;
467         struct visit vbuf;
468         struct VPurgeList *VisitPurgeList = NULL;
469         struct VPurgeList *vptr;
470         int purged = 0;
471         char IndexBuf[32];
472         int IndexLen;
473         struct ValidRoom *vrptr;
474         struct ValidUser *vuptr;
475         int RoomIsValid, UserIsValid;
476
477         /* First, load up a table full of valid room/gen combinations */
478         ForEachRoom(AddValidRoom, NULL);
479
480         /* Then load up a table full of valid user numbers */
481         ForEachUser(AddValidUser, NULL);
482
483         /* Now traverse through the visits, purging irrelevant records... */
484         cdb_rewind(CDB_VISIT);
485         while(cdbvisit = cdb_next_item(CDB_VISIT), cdbvisit != NULL) {
486                 memset(&vbuf, 0, sizeof(struct visit));
487                 memcpy(&vbuf, cdbvisit->ptr,
488                         ( (cdbvisit->len > sizeof(struct visit)) ?
489                         sizeof(struct visit) : cdbvisit->len) );
490                 cdb_free(cdbvisit);
491
492                 RoomIsValid = 0;
493                 UserIsValid = 0;
494
495                 /* Check to see if the room exists */
496                 for (vrptr=ValidRoomList; vrptr!=NULL; vrptr=vrptr->next) {
497                         if ( (vrptr->vr_roomnum==vbuf.v_roomnum)
498                              && (vrptr->vr_roomgen==vbuf.v_roomgen))
499                                 RoomIsValid = 1;
500                 }
501
502                 /* Check to see if the user exists */
503                 for (vuptr=ValidUserList; vuptr!=NULL; vuptr=vuptr->next) {
504                         if (vuptr->vu_usernum == vbuf.v_usernum)
505                                 UserIsValid = 1;
506                 }
507
508                 /* Put the record on the purge list if it's dead */
509                 if ((RoomIsValid==0) || (UserIsValid==0)) {
510                         vptr = (struct VPurgeList *)
511                                 mallok(sizeof(struct VPurgeList));
512                         vptr->next = VisitPurgeList;
513                         vptr->vp_roomnum = vbuf.v_roomnum;
514                         vptr->vp_roomgen = vbuf.v_roomgen;
515                         vptr->vp_usernum = vbuf.v_usernum;
516                         VisitPurgeList = vptr;
517                 }
518
519         }
520
521         /* Free the valid room/gen combination list */
522         while (ValidRoomList != NULL) {
523                 vrptr = ValidRoomList->next;
524                 phree(ValidRoomList);
525                 ValidRoomList = vrptr;
526         }
527
528         /* Free the valid user list */
529         while (ValidUserList != NULL) {
530                 vuptr = ValidUserList->next;
531                 phree(ValidUserList);
532                 ValidUserList = vuptr;
533         }
534
535         /* Now delete every visit on the purged list */
536         while (VisitPurgeList != NULL) {
537                 IndexLen = GenerateRelationshipIndex(IndexBuf,
538                                 VisitPurgeList->vp_roomnum,
539                                 VisitPurgeList->vp_roomgen,
540                                 VisitPurgeList->vp_usernum);
541                 cdb_delete(CDB_VISIT, IndexBuf, IndexLen);
542                 vptr = VisitPurgeList->next;
543                 phree(VisitPurgeList);
544                 VisitPurgeList = vptr;
545                 ++purged;
546         }
547
548         return(purged);
549 }
550
551 /*
552  * Purge the use table of old entries.
553  *
554  */
555 int PurgeUseTable(void) {
556         int purged = 0;
557         struct cdbdata *cdbut;
558         struct UseTable ut;
559         struct UPurgeList *ul = NULL;
560         struct UPurgeList *uptr; 
561
562         /* Phase 1: traverse through the table, discovering old records... */
563         lprintf(9, "Purge use table: phase 1\n");
564         cdb_rewind(CDB_USETABLE);
565         while(cdbut = cdb_next_item(CDB_USETABLE), cdbut != NULL) {
566
567                 memcpy(&ut, cdbut->ptr,
568                        ((cdbut->len > sizeof(struct UseTable)) ?
569                         sizeof(struct UseTable) : cdbut->len));
570                 cdb_free(cdbut);
571
572                 if ( (time(NULL) - ut.ut_timestamp) > USETABLE_RETAIN ) {
573                         uptr = (struct UPurgeList *) mallok(sizeof(struct UPurgeList));
574                         if (uptr != NULL) {
575                                 uptr->next = ul;
576                                 safestrncpy(uptr->up_key, ut.ut_msgid, SIZ);
577                                 ul = uptr;
578                         }
579                         ++purged;
580                 }
581
582         }
583
584         /* Phase 2: delete the records */
585         lprintf(9, "Purge use table: phase 2\n");
586         while (ul != NULL) {
587                 cdb_delete(CDB_USETABLE, ul->up_key, strlen(ul->up_key));
588                 uptr = ul->next;
589                 phree(ul);
590                 ul = uptr;
591         }
592
593         lprintf(9, "Purge use table: finished (purged %d records)\n", purged);
594         return(purged);
595 }
596
597
598 void cmd_expi(char *argbuf) {
599         char cmd[SIZ];
600         int retval;
601
602         if (CtdlAccessCheck(ac_aide)) return;
603
604         extract(cmd, argbuf, 0);
605         if (!strcasecmp(cmd, "users")) {
606                 retval = PurgeUsers();
607                 cprintf("%d Purged %d users.\n", CIT_OK, retval);
608                 return;
609         }
610         else if (!strcasecmp(cmd, "messages")) {
611                 PurgeMessages();
612                 cprintf("%d Expired %d messages.\n", CIT_OK, messages_purged);
613                 return;
614         }
615         else if (!strcasecmp(cmd, "rooms")) {
616                 retval = PurgeRooms();
617                 cprintf("%d Expired %d rooms.\n", CIT_OK, retval);
618                 return;
619         }
620         else if (!strcasecmp(cmd, "visits")) {
621                 retval = PurgeVisits();
622                 cprintf("%d Purged %d visits.\n", CIT_OK, retval);
623         }
624         else if (!strcasecmp(cmd, "usetable")) {
625                 retval = PurgeUseTable();
626                 cprintf("%d Purged %d entries from the use table.\n",
627                         CIT_OK, retval);
628         }
629         else if (!strcasecmp(cmd, "defrag")) {
630                 defrag_databases();
631                 cprintf("%d Defragmented the databases.\n", CIT_OK);
632         }
633         else {
634                 cprintf("%d Invalid command.\n", ERROR+ILLEGAL_VALUE);
635                 return;
636         }
637 }
638
639 /*****************************************************************************/
640
641
642 void do_fsck_msg(long msgnum, void *userdata) {
643         struct ctdlroomref *ptr;
644
645         ptr = (struct ctdlroomref *)mallok(sizeof(struct ctdlroomref));
646         ptr->next = rr;
647         ptr->msgnum = msgnum;
648         rr = ptr;
649 }
650
651 void do_fsck_room(struct ctdlroom *qrbuf, void *data)
652 {
653         getroom(&CC->room, qrbuf->QRname);
654         CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, do_fsck_msg, NULL);
655 }
656
657 /*
658  * Check message reference counts
659  */
660 void cmd_fsck(char *argbuf) {
661         long msgnum;
662         struct cdbdata *cdbmsg;
663         struct MetaData smi;
664         struct ctdlroomref *ptr;
665         int realcount;
666
667         if (CtdlAccessCheck(ac_aide)) return;
668
669         /* Lame way of checking whether anyone else is doing this now */
670         if (rr != NULL) {
671                 cprintf("%d Another FSCK is already running.\n", ERROR);
672                 return;
673         }
674
675         cprintf("%d Checking message reference counts\n", LISTING_FOLLOWS);
676
677         cprintf("\nThis could take a while.  Please be patient!\n\n");
678         cprintf("Gathering pointers...\n");
679         ForEachRoom(do_fsck_room, NULL);
680
681         get_control();
682         cprintf("Checking message base...\n");
683         for (msgnum = 0L; msgnum <= CitControl.MMhighest; ++msgnum) {
684
685                 cdbmsg = cdb_fetch(CDB_MSGMAIN, &msgnum, sizeof(long));
686                 if (cdbmsg != NULL) {
687                         cdb_free(cdbmsg);
688                         cprintf("Message %7ld    ", msgnum);
689
690                         GetMetaData(&smi, msgnum);
691                         cprintf("refcount=%-2d   ", smi.meta_refcount);
692
693                         realcount = 0;
694                         for (ptr = rr; ptr != NULL; ptr = ptr->next) {
695                                 if (ptr->msgnum == msgnum) ++realcount;
696                         }
697                         cprintf("realcount=%-2d\n", realcount);
698
699                         if ( (smi.meta_refcount != realcount)
700                            || (realcount == 0) ) {
701                                 smi.meta_refcount = realcount;
702                                 PutMetaData(&smi);
703                                 AdjRefCount(msgnum, 0); /* deletes if needed */
704                         }
705
706                 }
707
708         }
709
710         cprintf("Freeing memory...\n");
711         while (rr != NULL) {
712                 ptr = rr->next;
713                 phree(rr);
714                 rr = ptr;
715         }
716
717         cprintf("Done!\n");
718         cprintf("000\n");
719
720 }
721
722
723
724
725 /*****************************************************************************/
726
727 char *serv_expire_init(void)
728 {
729         CtdlRegisterProtoHook(cmd_expi, "EXPI", "Expire old system objects");
730         CtdlRegisterProtoHook(cmd_fsck, "FSCK", "Check message ref counts");
731         return "$Id$";
732 }