2 This file is part of GNUnet
3 (C) 2003, 2004, 2005, 2006, 2007 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet 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.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file transport/plugin_transport_smtp.c
23 * @brief Implementation of the SMTP transport service
24 * @author Christian Grothoff
25 * @author Renaldo Ferreira
29 #include "gnunet_util.h"
30 #include "gnunet_directories.h"
31 #include "gnunet_protocols.h"
32 #include "gnunet_transport.h"
33 #include "gnunet_stats_service.h"
39 * The default maximum size of each outbound SMTP message.
41 #define SMTP_MESSAGE_SIZE 65528
43 #define DEBUG_SMTP GNUNET_NO
45 #define FILTER_STRING_SIZE 64
47 /* how long can a line in base64 encoded
48 mime text be? (in characters, excluding "\n") */
49 #define MAX_CHAR_PER_LINE 76
54 * Host-Address in a SMTP network.
60 * Filter line that every sender must include in the E-mails such
61 * that the receiver can effectively filter out the GNUnet traffic
64 char filter[FILTER_STRING_SIZE];
67 * Claimed E-mail address of the sender.
68 * Format is "foo@bar.com" with null termination, padded to be
69 * of a multiple of 8 bytes long.
71 char senderAddress[0];
76 * Encapsulation of a GNUnet message in the SMTP mail body (before
81 GNUNET_MessageHeader header;
84 * What is the identity of the sender (GNUNET_hash of public key)
86 GNUNET_PeerIdentity sender;
90 /* *********** globals ************* */
93 * apis (our advertised API and the core api )
95 static GNUNET_CoreAPIForTransport *coreAPI;
97 static struct GNUNET_GE_Context *ectx;
100 * Thread that listens for inbound messages
102 static struct GNUNET_ThreadHandle *dispatchThread;
105 * Flag to indicate that server has been shut down.
107 static int smtp_shutdown = GNUNET_YES;
110 * Set to the SMTP server hostname (and port) for outgoing messages.
112 static char *smtp_server_name;
114 static char *pipename;
117 * Lock for uses of libesmtp (not thread-safe).
119 static struct GNUNET_Mutex *lock;
122 * Old handler for SIGPIPE (kept to be able to restore).
124 static struct sigaction old_handler;
128 static GNUNET_TransportAPI smtpAPI;
130 static GNUNET_Stats_ServiceAPI *stats;
132 static int stat_bytesReceived;
134 static int stat_bytesSent;
136 static int stat_bytesDropped;
139 * How many e-mails are we allowed to send per hour?
141 static unsigned long long rate_limit;
143 static GNUNET_CronTime last_transmission;
145 /** ******************** Base64 encoding ***********/
149 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/";
152 * Encode into Base64.
154 * @param data the data to encode
155 * @param len the length of the input
156 * @param output where to write the output (*output should be NULL,
158 * @return the size of the output
161 base64_encode (const char *data, unsigned int len, char **output)
168 /* (*output)[ret++] = '\r'; \*/
170 if ( (ret % MAX_CHAR_PER_LINE) == 0) { \
171 (*output)[ret++] = '\n'; \
176 (((len * 4 / 3) + 8) * (MAX_CHAR_PER_LINE +
177 2)) / MAX_CHAR_PER_LINE);
178 /* message must start with \r\n for libesmtp */
183 for (i = 0; i < len; ++i)
185 c = (data[i] >> 2) & 0x3f;
186 opt[ret++] = cvt[(int) c];
188 c = (data[i] << 4) & 0x3f;
190 c |= (data[i] >> 4) & 0x0f;
191 opt[ret++] = cvt[(int) c];
195 c = (data[i] << 2) & 0x3f;
197 c |= (data[i] >> 6) & 0x03;
198 opt[ret++] = cvt[(int) c];
204 opt[ret++] = FILLCHAR;
210 opt[ret++] = cvt[(int) c];
215 opt[ret++] = FILLCHAR;
219 opt[ret++] = FILLCHAR;
223 #define cvtfind(a)( (((a) >= 'A')&&((a) <= 'Z'))? (a)-'A'\
224 :(((a)>='a')&&((a)<='z')) ? (a)-'a'+26\
225 :(((a)>='0')&&((a)<='9')) ? (a)-'0'+52\
227 :((a) == '/') ? 63 : -1)
229 * Decode from Base64.
231 * @param data the data to encode
232 * @param len the length of the input
233 * @param output where to write the output (*output should be NULL,
235 * @return the size of the output
238 base64_decode (const char *data, unsigned int len, char **output)
243 unsigned int ret = 0;
245 #define CHECK_CRLF while (data[i] == '\r' || data[i] == '\n') {\
246 GNUNET_GE_LOG(ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, "ignoring CR/LF\n"); \
248 if (i >= len) goto END; \
251 *output = GNUNET_malloc ((len * 3 / 4) + 8);
253 GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
254 "base64_decode decoding len=%d\n", len);
256 for (i = 0; i < len; ++i)
259 if (data[i] == FILLCHAR)
261 c = (char) cvtfind (data[i]);
264 c1 = (char) cvtfind (data[i]);
265 c = (c << 2) | ((c1 >> 4) & 0x3);
266 (*output)[ret++] = c;
273 c = (char) cvtfind (c);
274 c1 = ((c1 << 4) & 0xf0) | ((c >> 2) & 0xf);
275 (*output)[ret++] = c1;
284 c1 = (char) cvtfind (c1);
285 c = ((c << 6) & 0xc0) | c1;
286 (*output)[ret++] = c;
293 /* ********************* the real stuff ******************* */
295 #define strAUTOncmp(a,b) strncmp(a,b,strlen(b))
298 * Listen to the pipe, decode messages and send to core.
301 listenAndDistribute (void *unused)
304 unsigned int linesize;
310 GNUNET_TransportPacket *coreMP;
314 linesize = ((GNUNET_MAX_BUFFER_SIZE * 4 / 3) + 8) * (MAX_CHAR_PER_LINE + 2) / MAX_CHAR_PER_LINE; /* maximum size of a line supported */
315 line = GNUNET_malloc (linesize + 2); /* 2 bytes for off-by-one errors, just to be safe... */
317 #define READLINE(l,limit) \
318 do { retl = fgets(l, (limit), fdes); \
319 if ( (retl == NULL) || (smtp_shutdown == GNUNET_YES)) {\
322 if (coreAPI->load_monitor != NULL) \
323 GNUNET_network_monitor_notify_transmission(coreAPI->load_monitor, GNUNET_ND_DOWNLOAD, strlen(retl)); \
327 while (smtp_shutdown == GNUNET_NO)
329 fd = OPEN (pipename, O_RDONLY | O_ASYNC);
332 if (smtp_shutdown == GNUNET_NO)
333 GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS);
336 fdes = fdopen (fd, "r");
337 while (smtp_shutdown == GNUNET_NO)
339 /* skip until end of header */
342 READLINE (line, linesize);
344 while ((line[0] != '\r') && (line[0] != '\n')); /* expect newline */
345 READLINE (line, linesize); /* read base64 encoded message; decode, process */
349 pos = strlen (line) - 1; /* ignore new line */
350 READLINE (&line[pos], linesize - pos); /* read base64 encoded message; decode, process */
351 if ((line[pos] == '\r') || (line[pos] == '\n'))
352 break; /* empty line => end of message! */
354 size = base64_decode (line, pos, &out);
355 if (size < sizeof (SMTPMessage))
357 GNUNET_GE_BREAK (ectx, 0);
362 mp = (SMTPMessage *) &out[size - sizeof (SMTPMessage)];
363 if (ntohs (mp->header.size) != size)
366 GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
367 _("Received malformed message via %s. Ignored.\n"),
371 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
372 "Size returned by base64=%d, in the msg=%d.\n", size,
379 stats->change (stat_bytesReceived, size);
380 coreMP = GNUNET_malloc (sizeof (GNUNET_TransportPacket));
382 coreMP->size = size - sizeof (SMTPMessage);
383 coreMP->tsession = NULL;
384 coreMP->sender = mp->sender;
386 GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
387 "SMTP message passed to the core.\n");
390 coreAPI->receive (coreMP);
394 GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
395 "SMTP message processed.\n");
404 /* *************** API implementation *************** */
407 * Verify that a hello-Message is correct (a node is reachable at that
408 * address). Since the reply will be asynchronous, a method must be
411 * @param hello the hello message to verify
412 * (the signature/crc have been verified before)
413 * @return GNUNET_OK on success, GNUNET_SYSERR on error
416 api_verify_hello (const GNUNET_MessageHello * hello)
418 const EmailAddress *maddr;
420 maddr = (const EmailAddress *) &hello[1];
421 if ((ntohs (hello->header.size) !=
422 sizeof (GNUNET_MessageHello) + ntohs (hello->senderAddressSize)) ||
424 senderAddress[ntohs (hello->senderAddressSize) - 1 -
425 FILTER_STRING_SIZE] != '\0'))
427 GNUNET_GE_BREAK (ectx, 0);
428 return GNUNET_SYSERR; /* obviously invalid */
430 if (NULL == strstr (maddr->filter, ": "))
431 return GNUNET_SYSERR;
436 * Create a hello-Message for the current node. The hello is created
437 * without signature and without a timestamp. The GNUnet core will
438 * GNUNET_RSA_sign the message and add an expiration time.
440 * @return hello on success, NULL on error
442 static GNUNET_MessageHello *
445 GNUNET_MessageHello *msg;
450 GNUNET_GC_get_configuration_value_string (coreAPI->cfg, "SMTP", "FILTER",
451 "X-mailer: GNUnet", &filter);
452 if (NULL == strstr (filter, ": "))
454 GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
455 _("SMTP filter string to invalid, lacks ': '\n"));
456 GNUNET_free (filter);
460 if (strlen (filter) > FILTER_STRING_SIZE)
462 filter[FILTER_STRING_SIZE] = '\0';
463 GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
464 _("SMTP filter string to long, capped to `%s'\n"), filter);
466 i = (strlen (email) + 8) & (~7); /* make multiple of 8 */
468 GNUNET_malloc (sizeof (GNUNET_MessageHello) + sizeof (EmailAddress) + i);
469 memset (msg, 0, sizeof (GNUNET_MessageHello) + sizeof (EmailAddress) + i);
470 haddr = (EmailAddress *) &msg[1];
471 memset (&haddr->filter[0], 0, FILTER_STRING_SIZE);
472 strcpy (&haddr->filter[0], filter);
473 memcpy (&haddr->senderAddress[0], email, strlen (email) + 1);
474 msg->senderAddressSize = htons (strlen (email) + 1 + sizeof (EmailAddress));
475 msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP);
476 msg->MTU = htonl (smtpAPI.mtu);
477 msg->header.size = htons (GNUNET_sizeof_hello (msg));
478 if (api_verify_hello (msg) == GNUNET_SYSERR)
479 GNUNET_GE_ASSERT (ectx, 0);
480 GNUNET_free (filter);
484 struct GetMessageClosure
492 get_message (void **buf, int *len, void *cls)
494 struct GetMessageClosure *gmc = cls;
502 if (gmc->pos == gmc->esize)
503 return NULL; /* done */
505 gmc->pos = gmc->esize;
510 * Send a message to the specified remote node.
512 * @param tsession the GNUNET_MessageHello identifying the remote node
513 * @param msg what to send
514 * @param size the size of the message
515 * @param important is this message important enough to override typical limits?
516 * @return GNUNET_SYSERR on error, GNUNET_OK on success
519 api_send (GNUNET_TSession * tsession, const void *msg, const unsigned int size,
522 const GNUNET_MessageHello *hello;
523 const EmailAddress *haddr;
528 struct GetMessageClosure gm_cls;
529 smtp_session_t session;
530 smtp_message_t message;
531 smtp_recipient_t recipient;
537 if (smtp_shutdown == GNUNET_YES)
538 return GNUNET_SYSERR;
539 if ((size == 0) || (size > smtpAPI.mtu))
541 GNUNET_GE_BREAK (ectx, 0);
542 return GNUNET_SYSERR;
544 now = GNUNET_get_time ();
545 if ((important != GNUNET_YES) &&
546 ((now - last_transmission) * rate_limit) < GNUNET_CRON_HOURS)
547 return GNUNET_NO; /* rate too high */
548 last_transmission = now;
550 hello = (const GNUNET_MessageHello *) tsession->internal;
552 return GNUNET_SYSERR;
553 GNUNET_mutex_lock (lock);
554 session = smtp_create_session ();
558 GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
559 GNUNET_GE_IMMEDIATE, _("SMTP: `%s' failed: %s.\n"),
560 "smtp_create_session", smtp_strerror (smtp_errno (), ebuf,
562 GNUNET_mutex_unlock (lock);
563 return GNUNET_SYSERR;
565 if (0 == smtp_set_server (session, smtp_server_name))
568 GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER |
569 GNUNET_GE_IMMEDIATE, _("SMTP: `%s' failed: %s.\n"),
570 "smtp_set_server", smtp_strerror (smtp_errno (), ebuf,
572 smtp_destroy_session (session);
573 GNUNET_mutex_unlock (lock);
574 return GNUNET_SYSERR;
576 haddr = (const EmailAddress *) &hello[1];
577 message = smtp_add_message (session);
581 GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
582 GNUNET_GE_BULK, _("SMTP: `%s' failed: %s.\n"),
583 "smtp_add_message", smtp_strerror (smtp_errno (), ebuf,
585 smtp_destroy_session (session);
586 GNUNET_mutex_unlock (lock);
587 return GNUNET_SYSERR;
589 smtp_set_header (message, "To", NULL, haddr->senderAddress);
590 smtp_set_header (message, "From", NULL, email);
592 filter = GNUNET_strdup (haddr->filter);
593 fvalue = strstr (filter, ": ");
594 GNUNET_GE_ASSERT (NULL, NULL != fvalue);
597 if (0 == smtp_set_header (message, filter, fvalue))
600 GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
601 GNUNET_GE_BULK, _("SMTP: `%s' failed: %s.\n"),
602 "smtp_set_header", smtp_strerror (smtp_errno (), ebuf,
604 smtp_destroy_session (session);
605 GNUNET_mutex_unlock (lock);
606 GNUNET_free (filter);
607 return GNUNET_SYSERR;
609 GNUNET_free (filter);
610 m = GNUNET_malloc (size + sizeof (SMTPMessage));
611 memcpy (m, msg, size);
612 mp = (SMTPMessage *) &m[size];
613 mp->header.size = htons (size + sizeof (SMTPMessage));
614 mp->header.type = htons (0);
615 mp->sender = *coreAPI->my_identity;
618 gm_cls.esize = base64_encode (m, size + sizeof (SMTPMessage), &gm_cls.ebody);
620 if (0 == smtp_size_set_estimate (message, gm_cls.esize))
623 GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
624 GNUNET_GE_BULK, _("SMTP: `%s' failed: %s.\n"),
625 "smtp_size_set_estimate", smtp_strerror (smtp_errno (), ebuf,
628 if (0 == smtp_set_messagecb (message, &get_message, &gm_cls))
631 GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
632 GNUNET_GE_BULK, _("SMTP: `%s' failed: %s.\n"),
633 "smtp_set_messagecb", smtp_strerror (smtp_errno (), ebuf,
635 smtp_destroy_session (session);
636 GNUNET_mutex_unlock (lock);
637 GNUNET_free (gm_cls.ebody);
638 return GNUNET_SYSERR;
640 recipient = smtp_add_recipient (message, haddr->senderAddress);
641 if (recipient == NULL)
644 GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
645 GNUNET_GE_BULK, _("SMTP: `%s' failed: %s.\n"),
646 "smtp_add_recipient", smtp_strerror (smtp_errno (), ebuf,
648 smtp_destroy_session (session);
649 GNUNET_mutex_unlock (lock);
650 return GNUNET_SYSERR;
652 if (0 == smtp_start_session (session))
655 GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
656 GNUNET_GE_BULK, _("SMTP: `%s' failed: %s.\n"),
657 "smtp_start_session", smtp_strerror (smtp_errno (), ebuf,
659 smtp_destroy_session (session);
660 GNUNET_mutex_unlock (lock);
661 GNUNET_free (gm_cls.ebody);
662 return GNUNET_SYSERR;
665 stats->change (stat_bytesSent, size);
666 if (coreAPI->load_monitor != NULL)
667 GNUNET_network_monitor_notify_transmission (coreAPI->load_monitor,
668 GNUNET_ND_UPLOAD, gm_cls.esize);
669 smtp_message_reset_status (message); /* this is needed to plug a 28-byte/message memory leak in libesmtp */
670 smtp_destroy_session (session);
671 GNUNET_mutex_unlock (lock);
672 GNUNET_free (gm_cls.ebody);
677 * Establish a connection to a remote node.
678 * @param hello the hello-Message for the target node
679 * @param tsessionPtr the session handle that is to be set
680 * @param may_reuse can we re-use an existing connection?
681 * @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
684 api_connect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
687 GNUNET_TSession *tsession;
689 tsession = GNUNET_malloc (sizeof (GNUNET_TSession));
690 tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello));
691 tsession->peer = hello->senderIdentity;
692 memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello));
693 tsession->ttype = smtpAPI.protocol_number;
694 (*tsessionPtr) = tsession;
699 * Disconnect from a remote node.
701 * @param tsession the session that is closed
702 * @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
705 api_disconnect (GNUNET_TSession * tsession)
707 if (tsession != NULL)
709 if (tsession->internal != NULL)
710 GNUNET_free (tsession->internal);
711 GNUNET_free (tsession);
717 * Start the server process to receive inbound traffic.
718 * @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
721 api_start_transport_server ()
723 smtp_shutdown = GNUNET_NO;
724 /* initialize SMTP network */
725 dispatchThread = GNUNET_thread_create (&listenAndDistribute, NULL, 1024 * 4);
726 if (dispatchThread == NULL)
728 GNUNET_GE_DIE_STRERROR (ectx,
729 GNUNET_GE_ADMIN | GNUNET_GE_BULK | GNUNET_GE_FATAL,
731 return GNUNET_SYSERR;
737 * Shutdown the server process (stop receiving inbound traffic). Maybe
741 api_stop_transport_server ()
745 smtp_shutdown = GNUNET_YES;
746 GNUNET_thread_stop_sleep (dispatchThread);
747 GNUNET_thread_join (dispatchThread, &unused);
752 * Convert SMTP hello to an IP address (always fails).
755 api_hello_to_address (const GNUNET_MessageHello * hello, void **sa,
756 unsigned int *sa_len)
758 return GNUNET_SYSERR;
765 api_associate (GNUNET_TSession * tsession)
767 return GNUNET_SYSERR; /* SMTP connections can never be associated */
771 * Always succeeds (for now; we should look at adding
772 * frequency limits to SMTP in the future!).
775 api_test_would_try (GNUNET_TSession * tsession, const unsigned int size,
778 return GNUNET_OK; /* we always try... */
782 * The exported method. Makes the core api available via a global and
783 * returns the smtp transport API.
785 GNUNET_TransportAPI *
786 inittransport_smtp (GNUNET_CoreAPIForTransport * core)
790 unsigned long long mtu;
795 if (!GNUNET_GC_have_configuration_value (coreAPI->cfg, "SMTP", "EMAIL"))
797 GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
799 ("No email-address specified, can not start SMTP transport.\n"));
802 GNUNET_GC_get_configuration_value_number (coreAPI->cfg, "SMTP", "MTU", 1200,
804 SMTP_MESSAGE_SIZE, &mtu);
805 GNUNET_GC_get_configuration_value_number (coreAPI->cfg, "SMTP", "RATELIMIT",
806 0, 0, 1024 * 1024, &rate_limit);
807 stats = coreAPI->service_request ("stats");
811 stats->create (gettext_noop ("# bytes received via SMTP"));
812 stat_bytesSent = stats->create (gettext_noop ("# bytes sent via SMTP"));
814 stats->create (gettext_noop ("# bytes dropped by SMTP (outgoing)"));
816 GNUNET_GC_get_configuration_value_filename (coreAPI->cfg, "SMTP", "PIPE",
817 GNUNET_DEFAULT_DAEMON_VAR_DIRECTORY
818 "/smtp-pipe", &pipename);
820 if (0 != mkfifo (pipename, S_IWUSR | S_IRUSR | S_IWGRP | S_IWOTH))
822 GNUNET_GE_LOG_STRERROR (ectx,
823 GNUNET_GE_ADMIN | GNUNET_GE_BULK | GNUNET_GE_FATAL,
825 GNUNET_free (pipename);
826 coreAPI->service_release (stats);
830 /* we need to allow the mailer program to send us messages;
831 * easiest done by giving it write permissions (see Mantis #1142) */
832 if (0 != chmod (pipename, S_IWUSR | S_IRUSR | S_IWGRP | S_IWOTH))
833 GNUNET_GE_LOG_STRERROR (ectx,
834 GNUNET_GE_ADMIN | GNUNET_GE_BULK |
835 GNUNET_GE_WARNING, "chmod");
836 GNUNET_GC_get_configuration_value_string (coreAPI->cfg, "SMTP", "EMAIL", NULL,
838 lock = GNUNET_mutex_create (GNUNET_NO);
839 GNUNET_GC_get_configuration_value_string (coreAPI->cfg, "SMTP", "SERVER",
840 "localhost:25", &smtp_server_name);
841 sa.sa_handler = SIG_IGN;
842 sigemptyset (&sa.sa_mask);
844 sigaction (SIGPIPE, &sa, &old_handler);
846 smtpAPI.protocol_number = GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP;
847 smtpAPI.mtu = mtu - sizeof (SMTPMessage);
849 smtpAPI.hello_verify = &api_verify_hello;
850 smtpAPI.hello_create = &api_create_hello;
851 smtpAPI.connect = &api_connect;
852 smtpAPI.send = &api_send;
853 smtpAPI.associate = &api_associate;
854 smtpAPI.disconnect = &api_disconnect;
855 smtpAPI.server_start = &api_start_transport_server;
856 smtpAPI.server_stop = &api_stop_transport_server;
857 smtpAPI.hello_to_address = &api_hello_to_address;
858 smtpAPI.send_now_test = &api_test_would_try;
863 donetransport_smtp ()
865 sigaction (SIGPIPE, &old_handler, NULL);
866 GNUNET_free (smtp_server_name);
869 coreAPI->service_release (stats);
872 GNUNET_mutex_destroy (lock);
875 GNUNET_free (pipename);