15a55e79960758b4237ccdbf1b209c9dc6fab30b
[citadel.git] / citadel / modules / smtp / serv_smtpeventclient.c
1 /*
2  * This module is an SMTP and ESMTP implementation for the Citadel system.
3  * It is compliant with all of the following:
4  *
5  * RFC  821 - Simple Mail Transfer Protocol
6  * RFC  876 - Survey of SMTP Implementations
7  * RFC 1047 - Duplicate messages and SMTP
8  * RFC 1652 - 8 bit MIME
9  * RFC 1869 - Extended Simple Mail Transfer Protocol
10  * RFC 1870 - SMTP Service Extension for Message Size Declaration
11  * RFC 2033 - Local Mail Transfer Protocol
12  * RFC 2197 - SMTP Service Extension for Command Pipelining
13  * RFC 2476 - Message Submission
14  * RFC 2487 - SMTP Service Extension for Secure SMTP over TLS
15  * RFC 2554 - SMTP Service Extension for Authentication
16  * RFC 2821 - Simple Mail Transfer Protocol
17  * RFC 2822 - Internet Message Format
18  * RFC 2920 - SMTP Service Extension for Command Pipelining
19  *  
20  * The VRFY and EXPN commands have been removed from this implementation
21  * because nobody uses these commands anymore, except for spammers.
22  *
23  * Copyright (c) 1998-2009 by the citadel.org team
24  *
25  *  This program is free software; you can redistribute it and/or modify
26  *  it under the terms of the GNU General Public License as published by
27  *  the Free Software Foundation; either version 3 of the License, or
28  *  (at your option) any later version.
29  *
30  *  This program is distributed in the hope that it will be useful,
31  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
32  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33  *  GNU General Public License for more details.
34  *
35  *  You should have received a copy of the GNU General Public License
36  *  along with this program; if not, write to the Free Software
37  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
38  */
39
40 #include "sysdep.h"
41 #include <stdlib.h>
42 #include <unistd.h>
43 #include <stdio.h>
44 #include <termios.h>
45 #include <fcntl.h>
46 #include <signal.h>
47 #include <pwd.h>
48 #include <errno.h>
49 #include <sys/types.h>
50 #include <syslog.h>
51
52 #if TIME_WITH_SYS_TIME
53 # include <sys/time.h>
54 # include <time.h>
55 #else
56 # if HAVE_SYS_TIME_H
57 #  include <sys/time.h>
58 # else
59 #  include <time.h>
60 # endif
61 #endif
62 #include <sys/wait.h>
63 #include <ctype.h>
64 #include <string.h>
65 #include <limits.h>
66 #include <sys/socket.h>
67 #include <netinet/in.h>
68 #include <arpa/inet.h>
69 #include <libcitadel.h>
70 #include "citadel.h"
71 #include "server.h"
72 #include "citserver.h"
73 #include "support.h"
74 #include "config.h"
75 #include "control.h"
76 #include "user_ops.h"
77 #include "database.h"
78 #include "msgbase.h"
79 #include "internet_addressing.h"
80 #include "genstamp.h"
81 #include "domain.h"
82 #include "clientsocket.h"
83 #include "locate_host.h"
84 #include "citadel_dirs.h"
85
86 #include "ctdl_module.h"
87
88 #include "smtp_util.h"
89 #include "event_client.h"
90 #include "smtpqueue.h"
91 #include "smtp_clienthandlers.h"
92
93 #ifdef EXPERIMENTAL_SMTP_EVENT_CLIENT
94 const unsigned short DefaultMXPort = 25;
95 void DeleteSmtpOutMsg(void *v)
96 {
97         SmtpOutMsg *Msg = v;
98
99         ares_free_data(Msg->AllMX);
100         if (Msg->HostLookup.VParsedDNSReply != NULL)
101                 Msg->HostLookup.DNSReplyFree(Msg->HostLookup.VParsedDNSReply);
102         FreeStrBuf(&Msg->msgtext);
103         FreeAsyncIOContents(&Msg->IO);
104         free(Msg);
105 }
106
107 eNextState SMTP_C_Shutdown(AsyncIO *IO);
108 eNextState SMTP_C_Timeout(AsyncIO *IO);
109 eNextState SMTP_C_ConnFail(AsyncIO *IO);
110 eNextState SMTP_C_DispatchReadDone(AsyncIO *IO);
111 eNextState SMTP_C_DispatchWriteDone(AsyncIO *IO);
112 eNextState SMTP_C_Terminate(AsyncIO *IO);
113 eReadState SMTP_C_ReadServerStatus(AsyncIO *IO);
114
115 eNextState mx_connect_ip(AsyncIO *IO);
116 eNextState get_one_mx_host_ip(AsyncIO *IO);
117
118 /******************************************************************************
119  * So, we're finished with sending (regardless of success or failure)         *
120  * This Message might be referenced by several Queue-Items, if we're the last,*
121  * we need to free the memory and send bounce messages (on terminal failure)  *
122  * else we just free our SMTP-Message struct.                                 *
123  ******************************************************************************/
124 void FinalizeMessageSend(SmtpOutMsg *Msg)
125 {
126         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
127         
128         if (DecreaseQReference(Msg->MyQItem)) 
129         {
130                 int nRemain;
131                 StrBuf *MsgData;
132
133                 nRemain = CountActiveQueueEntries(Msg->MyQItem);
134
135                 MsgData = SerializeQueueItem(Msg->MyQItem);
136                 /*
137                  * Uncompleted delivery instructions remain, so delete the old
138                  * instructions and replace with the updated ones.
139                  */
140                 CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, &Msg->MyQItem->QueMsgID, 1, "");
141                 smtpq_do_bounce(Msg->MyQItem,
142                                 Msg->msgtext); 
143                 if (nRemain > 0) {
144                         struct CtdlMessage *msg;
145                         msg = malloc(sizeof(struct CtdlMessage));
146                         memset(msg, 0, sizeof(struct CtdlMessage));
147                         msg->cm_magic = CTDLMESSAGE_MAGIC;
148                         msg->cm_anon_type = MES_NORMAL;
149                         msg->cm_format_type = FMT_RFC822;
150                         msg->cm_fields['M'] = SmashStrBuf(&MsgData);
151                         CtdlSubmitMsg(msg, NULL, SMTP_SPOOLOUT_ROOM, QP_EADDR);
152                         CtdlFreeMessage(msg);
153                 }
154                 else {
155                         CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, &Msg->MyQItem->MessageID, 1, "");
156                         FreeStrBuf(&MsgData);
157                 }
158
159                 RemoveQItem(Msg->MyQItem);
160         }
161         DeleteSmtpOutMsg(Msg);
162 }
163
164 eNextState FailOneAttempt(AsyncIO *IO)
165 {
166         SmtpOutMsg *SendMsg = IO->Data;
167         /* 
168          * possible ways here: 
169          * - connection timeout 
170          * - 
171          */     
172         SendMsg->pCurrRelay = SendMsg->pCurrRelay->Next;
173
174         if (SendMsg->pCurrRelay == NULL)
175                 return eAbort;
176         if (SendMsg->pCurrRelay->IsIP)
177                 return mx_connect_ip(IO);
178         else
179                 return get_one_mx_host_ip(IO);
180 }
181
182
183 void SetConnectStatus(AsyncIO *IO)
184 {
185         
186         SmtpOutMsg *SendMsg = IO->Data;
187         char buf[256];
188         void *src;
189
190         buf[0] = '\0';
191
192         if (IO->ConnectMe->IPv6) {
193                 src = &IO->ConnectMe->Addr.sin6_addr;
194         }
195         else {
196                 struct sockaddr_in *addr = (struct sockaddr_in *)&IO->ConnectMe->Addr;
197
198                 src = &addr->sin_addr.s_addr;
199         }
200
201         inet_ntop((IO->ConnectMe->IPv6)?AF_INET6:AF_INET,
202                   src,
203                   buf, 
204                   sizeof(buf));
205
206         if (SendMsg->mx_host == NULL)
207                 SendMsg->mx_host = "<no name>";
208
209         CtdlLogPrintf(CTDL_DEBUG, 
210                       "SMTP client[%ld]: connecting to %s [%s]:%d ...\n", 
211                       SendMsg->n, 
212                       SendMsg->mx_host, 
213                       buf,
214                       SendMsg->IO.ConnectMe->Port);
215
216         SendMsg->MyQEntry->Status = 5; 
217         StrBufPrintf(SendMsg->MyQEntry->StatusMessage, 
218                      "Timeout while connecting %s [%s]:%d ", 
219                      SendMsg->mx_host,
220                      buf,
221                      SendMsg->IO.ConnectMe->Port);
222 }
223
224 /*****************************************************************************
225  * So we connect our Relay IP here.                                          *
226  *****************************************************************************/
227 eNextState mx_connect_ip(AsyncIO *IO)
228 {
229         SmtpOutMsg *SendMsg = IO->Data;
230
231         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
232         
233         IO->ConnectMe = SendMsg->pCurrRelay;
234         /*  Bypass the ns lookup result like this: IO->Addr.sin_addr.s_addr = inet_addr("127.0.0.1"); */
235
236         SetConnectStatus(IO);
237
238         return InitEventIO(IO, SendMsg, 
239                            SMTP_C_ConnTimeout, 
240                            SMTP_C_ReadTimeouts[0],
241                            1);
242 }
243
244 eNextState get_one_mx_host_ip_done(AsyncIO *IO)
245 {
246         SmtpOutMsg *SendMsg = IO->Data;
247         struct hostent *hostent;
248
249         QueryCbDone(IO);
250
251         hostent = SendMsg->HostLookup.VParsedDNSReply;
252         if ((SendMsg->HostLookup.DNSStatus == ARES_SUCCESS) && 
253             (hostent != NULL) ) {
254                 memset(&SendMsg->pCurrRelay->Addr, 0, sizeof(struct in6_addr));
255                 if (SendMsg->pCurrRelay->IPv6) {
256                         memcpy(&SendMsg->pCurrRelay->Addr.sin6_addr.s6_addr, 
257                                &hostent->h_addr_list[0],
258                                sizeof(struct in6_addr));
259                         
260                         SendMsg->pCurrRelay->Addr.sin6_family = hostent->h_addrtype;
261                         SendMsg->pCurrRelay->Addr.sin6_port   = htons(DefaultMXPort);
262                 }
263                 else {
264                         struct sockaddr_in *addr = (struct sockaddr_in*) &SendMsg->pCurrRelay->Addr;
265                         /* Bypass the ns lookup result like this: IO->Addr.sin_addr.s_addr = inet_addr("127.0.0.1"); */
266 //                      addr->sin_addr.s_addr = htonl((uint32_t)&hostent->h_addr_list[0]);
267                         memcpy(&addr->sin_addr.s_addr, 
268                                hostent->h_addr_list[0], 
269                                sizeof(uint32_t));
270                         
271                         addr->sin_family = hostent->h_addrtype;
272                         addr->sin_port   = htons(DefaultMXPort);
273                         
274                 }
275                 return mx_connect_ip(IO);
276         }
277         else // TODO: here we need to find out whether there are more mx'es, backup relay, and so on
278                 return FailOneAttempt(IO);
279 }
280
281 eNextState get_one_mx_host_ip(AsyncIO *IO)
282 {
283         SmtpOutMsg * SendMsg = IO->Data;
284         /* 
285          * here we start with the lookup of one host. it might be...
286          * - the relay host *sigh*
287          * - the direct hostname if there was no mx record
288          * - one of the mx'es
289          */ 
290
291         InitC_ares_dns(IO);
292
293         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
294
295         CtdlLogPrintf(CTDL_DEBUG, 
296                       "SMTP client[%ld]: looking up %s : %d ...\n", 
297                       SendMsg->n, 
298                       SendMsg->pCurrRelay->Host, 
299                       SendMsg->pCurrRelay->Port);
300
301         if (!QueueQuery((SendMsg->pCurrRelay->IPv6)? ns_t_aaaa : ns_t_a, 
302                         SendMsg->pCurrRelay->Host, 
303                         &SendMsg->IO, 
304                         &SendMsg->HostLookup, 
305                         get_one_mx_host_ip_done))
306         {
307                 SendMsg->MyQEntry->Status = 5;
308                 StrBufPrintf(SendMsg->MyQEntry->StatusMessage, 
309                              "No MX hosts found for <%s>", SendMsg->node);
310                 return IO->NextState;
311         }
312         return IO->NextState;
313 }
314
315
316 /*****************************************************************************
317  * here we try to find out about the MX records for our recipients.          *
318  *****************************************************************************/
319 eNextState smtp_resolve_mx_record_done(AsyncIO *IO)
320 {
321         SmtpOutMsg * SendMsg = IO->Data;
322         ParsedURL **pp;
323
324         QueryCbDone(IO);
325
326         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
327         pp = &SendMsg->Relay;
328         while ((pp != NULL) && (*pp != NULL) && ((*pp)->Next != NULL))
329                 pp = &(*pp)->Next;
330
331         if ((IO->DNSQuery->DNSStatus == ARES_SUCCESS) && 
332             (IO->DNSQuery->VParsedDNSReply != NULL))
333         { /* ok, we found mx records. */
334                 SendMsg->IO.ErrMsg = SendMsg->MyQEntry->StatusMessage;
335                 
336                 SendMsg->CurrMX    = SendMsg->AllMX 
337                                    = IO->DNSQuery->VParsedDNSReply;
338                 while (SendMsg->CurrMX) {
339                         int i;
340                         for (i = 0; i < 2; i++) {
341                                 ParsedURL *p;
342
343                                 p = (ParsedURL*) malloc(sizeof(ParsedURL));
344                                 memset(p, 0, sizeof(ParsedURL));
345                                 p->IsIP = 0;
346                                 p->Port = DefaultMXPort;
347                                 p->IPv6 = i == 1;
348                                 p->Host = SendMsg->CurrMX->host;
349                                 
350                                 *pp = p;
351                                 pp = &p->Next;
352                         }
353                         SendMsg->CurrMX    = SendMsg->CurrMX->next;
354                 }
355                 SendMsg->CXFlags   = SendMsg->CXFlags & F_HAVE_MX;
356         }
357         else { /* else fall back to the plain hostname */
358                 int i;
359                 for (i = 0; i < 2; i++) {
360                         ParsedURL *p;
361
362                         p = (ParsedURL*) malloc(sizeof(ParsedURL));
363                         memset(p, 0, sizeof(ParsedURL));
364                         p->IsIP = 0;
365                         p->Port = DefaultMXPort;
366                         p->IPv6 = i == 1;
367                         p->Host = SendMsg->node;
368                                 
369                         *pp = p;
370                         pp = &p;
371                 }
372                 SendMsg->CXFlags   = SendMsg->CXFlags & F_DIRECT;
373         }
374         *pp = SendMsg->MyQItem->FallBackHost;
375         SendMsg->pCurrRelay = SendMsg->Relay;
376         return get_one_mx_host_ip(IO);
377 }
378
379 eNextState resolve_mx_records(AsyncIO *IO)
380 {
381         SmtpOutMsg * SendMsg = IO->Data;
382
383         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
384         /* start resolving MX records here. */
385         if (!QueueQuery(ns_t_mx, 
386                         SendMsg->node, 
387                         &SendMsg->IO, 
388                         &SendMsg->MxLookup, 
389                         smtp_resolve_mx_record_done))
390         {
391                 SendMsg->MyQEntry->Status = 5;
392                 StrBufPrintf(SendMsg->MyQEntry->StatusMessage, 
393                              "No MX hosts found for <%s>", SendMsg->node);
394                 return IO->NextState;
395         }
396         return eAbort;
397 }
398
399
400
401 /******************************************************************************
402  *  so, we're going to start a SMTP delivery.  lets get it on.                *
403  ******************************************************************************/
404
405 SmtpOutMsg *new_smtp_outmsg(OneQueItem *MyQItem, 
406                             MailQEntry *MyQEntry, 
407                             int MsgCount)
408 {
409         SmtpOutMsg * SendMsg;
410
411         SendMsg = (SmtpOutMsg *) malloc(sizeof(SmtpOutMsg));
412         memset(SendMsg, 0, sizeof(SmtpOutMsg));
413
414         SendMsg->n                = MsgCount;
415         SendMsg->MyQEntry         = MyQEntry;
416         SendMsg->MyQItem          = MyQItem;
417         SendMsg->pCurrRelay       = MyQItem->URL;
418
419         SendMsg->IO.Data          = SendMsg;
420
421         SendMsg->IO.SendDone      = SMTP_C_DispatchWriteDone;
422         SendMsg->IO.ReadDone      = SMTP_C_DispatchReadDone;
423         SendMsg->IO.Terminate     = SMTP_C_Terminate;
424         SendMsg->IO.LineReader    = SMTP_C_ReadServerStatus;
425         SendMsg->IO.ConnFail      = SMTP_C_ConnFail;
426         SendMsg->IO.Timeout       = SMTP_C_Timeout;
427         SendMsg->IO.ShutdownAbort = SMTP_C_Shutdown;
428
429         SendMsg->IO.SendBuf.Buf   = NewStrBufPlain(NULL, 1024);
430         SendMsg->IO.RecvBuf.Buf   = NewStrBufPlain(NULL, 1024);
431         SendMsg->IO.IOBuf         = NewStrBuf();
432
433         SendMsg->IO.NextState     = eReadMessage;
434         
435         return SendMsg;
436 }
437
438 void smtp_try_one_queue_entry(OneQueItem *MyQItem, 
439                               MailQEntry *MyQEntry, 
440                               StrBuf *MsgText, 
441                               int KeepMsgText,  /* KeepMsgText allows us to use MsgText as ours. */
442                               int MsgCount)
443 {
444         SmtpOutMsg *SendMsg;
445
446         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
447
448         SendMsg = new_smtp_outmsg(MyQItem, MyQEntry, MsgCount);
449         if (KeepMsgText) SendMsg->msgtext = MsgText;
450         else             SendMsg->msgtext = NewStrBufDup(MsgText);
451         
452         if (smtp_resolve_recipients(SendMsg)) {
453
454                 
455
456
457                 if (SendMsg->pCurrRelay == NULL)
458                         QueueEventContext(&SendMsg->IO,
459                                           resolve_mx_records);
460                 else { /* oh... via relay host */
461                         if (SendMsg->pCurrRelay->IsIP) {
462                                 QueueEventContext(&SendMsg->IO,
463                                                   mx_connect_ip);
464                         }
465                         else { /* uneducated admin has chosen to add DNS to the equation... */
466                                 QueueEventContext(&SendMsg->IO,
467                                                   get_one_mx_host_ip);
468                         }
469                 }
470         }
471         else {
472                 /* No recipients? well fail then. */
473                 if ((SendMsg==NULL) || 
474                     (SendMsg->MyQEntry == NULL)) {
475                         SendMsg->MyQEntry->Status = 5;
476                         StrBufPlain(SendMsg->MyQEntry->StatusMessage, 
477                                     HKEY("Invalid Recipient!"));
478                 }
479                 FinalizeMessageSend(SendMsg);
480         }
481 }
482
483
484
485
486
487
488 /*****************************************************************************/
489 /*                     SMTP CLIENT DISPATCHER                                */
490 /*****************************************************************************/
491
492 void SMTPSetTimeout(eNextState NextTCPState, SmtpOutMsg *pMsg)
493 {
494         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
495         double Timeout;
496         switch (NextTCPState) {
497         case eSendReply:
498         case eSendMore:
499                 Timeout = SMTP_C_SendTimeouts[pMsg->State];
500                 if (pMsg->State == eDATABody) {
501                         /* if we're sending a huge message, we need more time. */
502                         Timeout += StrLength(pMsg->msgtext) / 1024;
503                 }
504                 break;
505         case eReadMessage:
506                 Timeout = SMTP_C_ReadTimeouts[pMsg->State];
507                 if (pMsg->State == eDATATerminateBody) {
508                         /* 
509                          * some mailservers take a nap before accepting the message
510                          * content inspection and such.
511                          */
512                         Timeout += StrLength(pMsg->msgtext) / 1024;
513                 }
514                 break;
515         case eTerminateConnection:
516         case eAbort:
517                 return;
518         }
519         SetNextTimeout(&pMsg->IO, Timeout);
520 }
521 eNextState SMTP_C_DispatchReadDone(AsyncIO *IO)
522 {
523         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
524         SmtpOutMsg *pMsg = IO->Data;
525         eNextState rc;
526
527         rc = ReadHandlers[pMsg->State](pMsg);
528         pMsg->State++;
529         SMTPSetTimeout(rc, pMsg);
530         return rc;
531 }
532 eNextState SMTP_C_DispatchWriteDone(AsyncIO *IO)
533 {
534         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
535         SmtpOutMsg *pMsg = IO->Data;
536         eNextState rc;
537
538         rc = SendHandlers[pMsg->State](pMsg);
539         SMTPSetTimeout(rc, pMsg);
540         return rc;
541 }
542
543
544 /*****************************************************************************/
545 /*                     SMTP CLIENT ERROR CATCHERS                            */
546 /*****************************************************************************/
547 eNextState SMTP_C_Terminate(AsyncIO *IO)
548 {
549         SmtpOutMsg *pMsg = IO->Data;
550
551         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
552         FinalizeMessageSend(pMsg);
553         return eAbort;
554 }
555 eNextState SMTP_C_Timeout(AsyncIO *IO)
556 {
557         SmtpOutMsg *pMsg = IO->Data;
558
559         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
560         StrBufPlain(IO->ErrMsg, CKEY(ReadErrors[pMsg->State]));
561         return FailOneAttempt(IO);
562 }
563 eNextState SMTP_C_ConnFail(AsyncIO *IO)
564 {
565         SmtpOutMsg *pMsg = IO->Data;
566
567         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
568         StrBufPlain(IO->ErrMsg, CKEY(ReadErrors[pMsg->State]));
569         return FailOneAttempt(IO);
570 }
571 eNextState SMTP_C_Shutdown(AsyncIO *IO)
572 {
573         CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
574         SmtpOutMsg *pMsg = IO->Data;
575
576         pMsg->MyQEntry->Status = 3;
577         StrBufPlain(pMsg->MyQEntry->StatusMessage, HKEY("server shutdown during message submit."));
578         FinalizeMessageSend(pMsg);
579         return eAbort;
580 }
581
582
583 /**
584  * @brief lineread Handler; understands when to read more SMTP lines, and when this is a one-lined reply.
585  */
586 eReadState SMTP_C_ReadServerStatus(AsyncIO *IO)
587 {
588         eReadState Finished = eBufferNotEmpty; 
589
590         while (Finished == eBufferNotEmpty) {
591                 Finished = StrBufChunkSipLine(IO->IOBuf, &IO->RecvBuf);
592                 
593                 switch (Finished) {
594                 case eMustReadMore: /// read new from socket... 
595                         return Finished;
596                         break;
597                 case eBufferNotEmpty: /* shouldn't happen... */
598                 case eReadSuccess: /// done for now...
599                         if (StrLength(IO->IOBuf) < 4)
600                                 continue;
601                         if (ChrPtr(IO->IOBuf)[3] == '-')
602                                 Finished = eBufferNotEmpty;
603                         else 
604                                 return Finished;
605                         break;
606                 case eReadFail: /// WHUT?
607                         ///todo: shut down! 
608                         break;
609                 }
610         }
611         return Finished;
612 }
613
614 #endif
615 CTDL_MODULE_INIT(smtp_eventclient)
616 {
617         return "smtpeventclient";
618 }