2 * XMPP (Jabber) service for the Citadel system
3 * Copyright (c) 2007-2011 by Art Cancro
5 * This program is open source software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include <sys/types.h>
31 #if TIME_WITH_SYS_TIME
32 # include <sys/time.h>
36 # include <sys/time.h>
46 #define SHOW_ME_VAPPEND_PRINTF
47 #include <libcitadel.h>
51 #include "citserver.h"
57 #include "internet_addressing.h"
59 #include "ctdl_module.h"
60 #include "serv_xmpp.h"
62 /* XML_StopParser is present in expat 2.x */
63 #if XML_MAJOR_VERSION > 1
64 #define HAVE_XML_STOPPARSER
67 HashList *XMPP_StartHandlers = NULL;
68 HashList *XMPP_EndHandlers = NULL;
69 HashList *XMPP_SupportedNamespaces = NULL;
70 HashList *XMPP_NameSpaces = NULL;
71 HashList *FlatToken = NULL;
73 int XMPPSrvDebugEnable = 0;
79 cputbuf(Xmpp->OutBuf);
80 FlushStrBuf(Xmpp->OutBuf);
83 void XPutBody(const char *Str, long Len)
85 StrBufXMLEscAppend(XMPP->OutBuf, NULL, Str, Len, 0);
88 void XPutProp(const char *Str, long Len)
90 StrEscAppend(XMPP->OutBuf, NULL, Str, 0, 1);
93 void XPut(const char *Str, long Len)
95 StrBufAppendBufPlain(XMPP->OutBuf, Str, Len, 0);
98 void XPrintf(const char *Format, ...)
101 va_start(arg_ptr, Format);
102 StrBufVAppendPrintf(XMPP->OutBuf, Format, arg_ptr);
107 void XPrint(const char *Token, long tlen,
124 va_start(arg_ptr, Flags);
127 ArgType = va_arg(arg_ptr, int);
131 PName = va_arg(arg_ptr, char*);
132 PLen = va_arg(arg_ptr, long);
133 Val = va_arg(arg_ptr, char*);
134 VLen = va_arg(arg_ptr, long);
142 PName = va_arg(arg_ptr, char*);
143 PLen = va_arg(arg_ptr, long);
144 Val = va_arg(arg_ptr, char*);
145 VLen = va_arg(arg_ptr, long);
156 PName = va_arg(arg_ptr, char*);
157 PLen = va_arg(arg_ptr, long);
158 VLen = va_arg(arg_ptr, long);
162 XPrintf("%ld", VLen);
168 Val = va_arg(arg_ptr, char*);
169 VLen = va_arg(arg_ptr, long);
177 if (Flags == XCLOSED)
197 #ifdef HAVE_XML_STOPPARSER
198 /* Stop the parser if an entity declaration is hit. */
199 static void xmpp_entity_declaration(void *userData, const XML_Char *entityName,
200 int is_parameter_entity, const XML_Char *value,
201 int value_length, const XML_Char *base,
202 const XML_Char *systemId, const XML_Char *publicId,
203 const XML_Char *notationName
205 XMPPM_syslog(LOG_WARNING, "Illegal entity declaration encountered; stopping parser.");
206 XML_StopParser(XMPP->xp, XML_FALSE);
211 * We have just received a <stream> tag from the client, so send them ours
213 void xmpp_stream_start(void *data, const char *supplied_el, const char **attr)
215 citxmpp *Xmpp = XMPP;
218 if (!strcasecmp(attr[0], "to")) {
219 safestrncpy(Xmpp->server_name, attr[1], sizeof Xmpp->server_name);
224 XPUT("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
226 XPUT("<stream:stream ");
228 XPutProp(Xmpp->server_name, strlen(Xmpp->server_name));
230 XPrintf("%08x\" ", CC->cs_pid);
231 XPUT("version=\"1.0\" "
232 "xmlns:stream=\"http://etherx.jabber.org/streams\" "
233 "xmlns=\"jabber:client\">"
234 /* The features of this stream are... */
235 "<stream:features>");
238 * TLS encryption (but only if it isn't already active)
242 if (!CC->redirect_ssl) {
243 XPUT("<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'></starttls>");
247 if (!CC->logged_in) {
248 /* If we're not logged in yet, offer SASL as our feature set */
249 xmpp_output_auth_mechs();
251 /* Also offer non-SASL authentication */
252 XPUT("<auth xmlns=\"http://jabber.org/features/iq-auth\"/>");
255 /* Offer binding and sessions as part of our feature set */
256 XPUT("<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"/>"
257 "<session xmlns=\"urn:ietf:params:xml:ns:xmpp-session\"/>"
258 "</stream:features>");
260 CC->is_async = 1; /* XMPP sessions are inherently async-capable */
263 void xmpp_start_query(void *data, const char *supplied_el, const char **attr)
265 XMPP->iq_query_xmlns[0] = 0;
266 safestrncpy(XMPP->iq_query_xmlns, supplied_el, sizeof XMPP->iq_query_xmlns);
269 void xmpp_start_bind(void *data, const char *supplied_el, const char **attr)
271 XMPP->bind_requested = 1;
274 void xmpp_start_auth(void *data, const char *supplied_el, const char **attr)
278 XMPP->sasl_auth_mech[0] = 0;
279 for (i=0; attr[i] != NULL; i+=2) {
280 if (!strcasecmp(attr[i], "mechanism")) {
281 safestrncpy(XMPP->sasl_auth_mech, attr[i+1], sizeof XMPP->sasl_auth_mech);
286 void xmpp_start_message(void *data, const char *supplied_el, const char **attr)
290 for (i=0; attr[i] != NULL; i+=2) {
291 if (!strcasecmp(attr[i], "to")) {
292 safestrncpy(XMPP->message_to, attr[i+1], sizeof XMPP->message_to);
297 void xmpp_start_html(void *data, const char *supplied_el, const char **attr)
299 ++XMPP->html_tag_level;
302 void xmpp_xml_start(void *data, const char *supplied_el, const char **attr)
304 HashList *ThisNamespace = NULL;
307 const char *NS = NULL;
312 /* Axe the namespace, we don't care about it */
313 pToken = supplied_el;
314 pch = strchr(pToken, ':');
318 pch = strchr(pToken + 1, ':');
324 NSLen = pToken - supplied_el;
325 if (GetHash(XMPP_NameSpaces, NS, NSLen, &pv))
334 len = strlen(pToken);
337 if (ThisNamespace != NULL)
339 if (GetHash(ThisNamespace, pToken, len, &pv))
345 th = (TokenHandler*) pv;
346 value = th->GetToken();
348 while (attr[i] != NULL)
351 if (GetHash(th->Properties, attr[i], strlen(attr[i]), &pv))
353 PropertyHandler* ph = pv;
358 len = strlen(attr[i+1]);
361 pVal = (StrBuf**) val;
363 StrBufPlain(*pVal, attr[i+1], len);
365 *pVal = NewStrBufPlain(attr[i+1], len);
374 XMPP_syslog(LOG_DEBUG, "XMPP ELEMENT START: <%s>\n", el);
375 for (i=0; attr[i] != NULL; i+=2) {
376 XMPP_syslog(LOG_DEBUG, " Attribute '%s' = '%s'\n", attr[i], attr[i+1]);
378 uncomment for more verbosity */
380 if (GetHash(XMPP_StartHandlers, pToken, len, &pv))
383 h = (xmpp_handler*) pv;
384 h->Handler(data, supplied_el, attr);
388 void xmpp_end_resource(void *data, const char *supplied_el, const char **attr)
390 if (XMPP->chardata_len > 0) {
391 safestrncpy(XMPP->iq_client_resource, XMPP->chardata,
392 sizeof XMPP->iq_client_resource);
393 striplt(XMPP->iq_client_resource);
397 void xmpp_end_username(void *data, const char *supplied_el, const char **attr)
400 if (XMPP->chardata_len > 0) {
401 safestrncpy(XMPP->iq_client_username, XMPP->chardata,
402 sizeof XMPP->iq_client_username);
403 striplt(XMPP->iq_client_username);
407 void xmpp_end_password(void *data, const char *supplied_el, const char **attr)
408 { /* NON SASL ONLY */
409 if (XMPP->chardata_len > 0) {
410 safestrncpy(XMPP->iq_client_password, XMPP->chardata,
411 sizeof XMPP->iq_client_password);
412 striplt(XMPP->iq_client_password);
416 void xmpp_end_iq(void *data, const char *supplied_el, const char **attr)
418 citxmpp *Xmpp = XMPP;
421 * iq type="get" (handle queries)
423 if (!strcasecmp(ChrPtr(Xmpp->IQ.type), "get"))
426 * Query on a namespace
428 if (!IsEmptyStr(Xmpp->iq_query_xmlns)) {
429 xmpp_query_namespace(&Xmpp->IQ, Xmpp->iq_query_xmlns);
433 * ping ( http://xmpp.org/extensions/xep-0199.html )
435 else if (Xmpp->ping_requested) {
436 XPUT("<iq type=\"result\" ");
437 if (StrLength(Xmpp->IQ.from) > 0) {
439 XPutSProp(Xmpp->IQ.from);
442 if (StrLength(Xmpp->IQ.to)>0) {
444 XPutSProp(Xmpp->IQ.to);
448 XPutSProp(Xmpp->IQ.id);
453 * Unknown query ... return the XML equivalent of a blank stare
457 Xmpp_syslog(LOG_DEBUG,
458 "Unknown query <%s> - returning <service-unavailable/>\n",
462 XPUT("<iq type=\"error\" id=\"");
463 XPutSProp(Xmpp->IQ.id);
465 "<error code=\"503\" type=\"cancel\">"
466 "<service-unavailable xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>"
473 * Non SASL authentication
476 (!strcasecmp(ChrPtr(Xmpp->IQ.type), "set"))
477 && (!strcasecmp(Xmpp->iq_query_xmlns, "jabber:iq:auth:query"))
480 xmpp_non_sasl_authenticate(
482 Xmpp->iq_client_username,
483 Xmpp->iq_client_password,
484 Xmpp->iq_client_resource
489 * If this <iq> stanza was a "bind" attempt, process it ...
492 (Xmpp->bind_requested)
493 && (StrLength(Xmpp->IQ.id)>0)
494 && (!IsEmptyStr(Xmpp->iq_client_resource))
498 /* Generate the "full JID" of the client resource */
500 snprintf(Xmpp->client_jid, sizeof Xmpp->client_jid,
503 Xmpp->iq_client_resource
506 /* Tell the client what its JID is */
508 XPUT("<iq type=\"result\" id=\"");
509 XPutSProp(Xmpp->IQ.id);
511 "<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\">");
513 XPutBody(Xmpp->client_jid, strlen(Xmpp->client_jid));
519 else if (Xmpp->iq_session) {
520 XPUT("<iq type=\"result\" id=\"");
521 XPutSProp(Xmpp->IQ.id);
527 XPUT("<iq type=\"error\" id=\"");
528 XPutSProp(Xmpp->IQ.id);
530 XPUT("<error>Don't know howto do '");
531 XPutBody(SKEY(Xmpp->IQ.type));
536 /* Now clear these fields out so they don't get used by a future stanza */
537 FlushStrBuf(Xmpp->IQ.id);
538 FlushStrBuf(Xmpp->IQ.from);
539 FlushStrBuf(Xmpp->IQ.to);
540 FlushStrBuf(Xmpp->IQ.type);
541 Xmpp->iq_client_resource[0] = 0;
542 Xmpp->iq_session = 0;
543 Xmpp->iq_query_xmlns[0] = 0;
544 Xmpp->bind_requested = 0;
545 Xmpp->ping_requested = 0;
549 void xmpp_end_auth(void *data, const char *supplied_el, const char **attr)
551 /* Try to authenticate (this function is responsible for the output stanza) */
552 xmpp_sasl_auth(XMPP->sasl_auth_mech, (XMPP->chardata != NULL ? XMPP->chardata : "") );
554 /* Now clear these fields out so they don't get used by a future stanza */
555 XMPP->sasl_auth_mech[0] = 0;
558 void xmpp_end_session(void *data, const char *supplied_el, const char **attr)
560 XMPP->iq_session = 1;
563 void xmpp_end_body(void *data, const char *supplied_el, const char **attr)
565 if (XMPP->html_tag_level == 0)
567 if (XMPP->message_body != NULL)
569 free(XMPP->message_body);
570 XMPP->message_body = NULL;
572 if (XMPP->chardata_len > 0) {
573 XMPP->message_body = strdup(XMPP->chardata);
578 void xmpp_end_html(void *data, const char *supplied_el, const char **attr)
580 --XMPP->html_tag_level;
583 void xmpp_end_starttls(void *data, const char *supplied_el, const char **attr)
586 XPUT("<proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
588 CtdlModuleStartCryptoMsgs(NULL, NULL, NULL);
589 if (!CC->redirect_ssl) CC->kill_me = KILLME_NO_CRYPTO;
591 XPUT("<failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
592 CC->kill_me = KILLME_NO_CRYPTO;
596 void xmpp_end_ping(void *data, const char *supplied_el, const char **attr)
598 XMPP->ping_requested = 1;
601 void xmpp_end_stream(void *data, const char *supplied_el, const char **attr)
603 XMPPM_syslog(LOG_DEBUG, "XMPP client shut down their stream\n");
604 xmpp_massacre_roster();
606 CC->kill_me = KILLME_CLIENT_LOGGED_OUT;
609 void xmpp_xml_end(void *data, const char *supplied_el)
616 /* Axe the namespace, we don't care about it */
617 pToken = supplied_el;
618 pch = strchr(pToken, ':');
622 pch = strchr(pToken + 1, ':');
628 len = strlen(pToken);
631 XMPP_syslog(LOG_DEBUG, "XMPP ELEMENT END : <%s>\n", el);
632 if (XMPP->chardata_len > 0) {
633 XMPP_syslog(LOG_DEBUG, " chardata: %s\n", XMPP->chardata);
635 uncomment for more verbosity */
637 if (GetHash(XMPP_EndHandlers, pToken, len, &pv))
640 h = (xmpp_handler*) pv;
641 h->Handler(data, supplied_el, NULL);
645 XMPP_syslog(LOG_DEBUG, "Ignoring unknown tag <%s>\n", pToken);
648 XMPP->chardata_len = 0;
649 if (XMPP->chardata_alloc > 0) {
650 XMPP->chardata[0] = 0;
655 void xmpp_xml_chardata(void *data, const XML_Char *s, int len)
659 if (X->chardata_alloc == 0) {
660 X->chardata_alloc = SIZ;
661 X->chardata = malloc(X->chardata_alloc);
663 if ((X->chardata_len + len + 1) > X->chardata_alloc) {
664 X->chardata_alloc = X->chardata_len + len + 1024;
665 X->chardata = realloc(X->chardata, X->chardata_alloc);
667 memcpy(&X->chardata[X->chardata_len], s, len);
668 X->chardata_len += len;
669 X->chardata[X->chardata_len] = 0;
674 * This cleanup function blows away the temporary memory and files used by the XMPP service.
676 void xmpp_cleanup_function(void) {
678 /* Don't do this stuff if this is not a XMPP session! */
679 if (CC->h_command_function != xmpp_command_loop) return;
681 if (XMPP->chardata != NULL) {
682 free(XMPP->chardata);
683 XMPP->chardata = NULL;
684 XMPP->chardata_len = 0;
685 XMPP->chardata_alloc = 0;
686 if (XMPP->message_body != NULL) {
687 free(XMPP->message_body);
690 free_buf_iq(&XMPP->IQ);
692 XML_ParserFree(XMPP->xp);
693 FreeStrBuf(&XMPP->OutBuf);
700 * Here's where our XMPP session begins its happy day.
702 void xmpp_greeting(void) {
703 client_set_inbound_buf(4);
704 strcpy(CC->cs_clientname, "XMPP session");
705 CC->session_specific_data = malloc(sizeof(citxmpp));
706 memset(XMPP, 0, sizeof(citxmpp));
707 XMPP->last_event_processed = queue_event_seq;
708 XMPP->OutBuf = NewStrBufPlain(NULL, SIZ);
709 /* XMPP does not use a greeting, but we still have to initialize some things. */
711 XMPP->xp = XML_ParserCreateNS("UTF-8", ':');
712 if (XMPP->xp == NULL) {
713 XMPPM_syslog(LOG_ALERT, "Cannot create XML parser!\n");
714 CC->kill_me = KILLME_XML_PARSER;
718 XML_SetElementHandler(XMPP->xp, xmpp_xml_start, xmpp_xml_end);
719 XML_SetCharacterDataHandler(XMPP->xp, xmpp_xml_chardata);
720 // XML_SetUserData(XMPP->xp, something...);
722 /* Prevent the "billion laughs" attack against expat by disabling
723 * internal entity expansion. With 2.x, forcibly stop the parser
724 * if an entity is declared - this is safer and a more obvious
725 * failure mode. With older versions, simply prevent expansion
726 * of such entities. */
727 #ifdef HAVE_XML_STOPPARSER
728 XML_SetEntityDeclHandler(XMPP->xp, xmpp_entity_declaration);
730 XML_SetDefaultHandler(XMPP->xp, NULL);
733 CC->can_receive_im = 1; /* This protocol is capable of receiving instant messages */
739 * Main command loop for XMPP sessions.
741 void xmpp_command_loop(void) {
743 StrBuf *stream_input = NewStrBuf();
746 rc = client_read_random_blob(stream_input, 30);
748 XML_Parse(XMPP->xp, ChrPtr(stream_input), rc, 0);
751 XMPPM_syslog(LOG_ERR, "client disconnected: ending session.\n");
752 CC->kill_me = KILLME_CLIENT_DISCONNECTED;
754 FreeStrBuf(&stream_input);
760 * Async loop for XMPP sessions (handles the transmission of unsolicited stanzas)
762 void xmpp_async_loop(void) {
763 xmpp_process_events();
764 xmpp_output_incoming_messages();
769 * Login hook for XMPP sessions
771 void xmpp_login_hook(void) {
772 xmpp_queue_event(XMPP_EVT_LOGIN, CC->cs_inet_email);
777 * Logout hook for XMPP sessions
779 void xmpp_logout_hook(void) {
780 xmpp_queue_event(XMPP_EVT_LOGOUT, CC->cs_inet_email);
784 void LogXMPPSrvDebugEnable(const int n)
786 XMPPSrvDebugEnable = n;
788 const char *CitadelServiceXMPP="XMPP";
792 /******************************************************************************
793 * XMPP handler registering logic *
794 ******************************************************************************/
796 void AddXMPPStartHandler(const char *key,
798 xmpp_handler_func Handler,
802 h = (xmpp_handler*) malloc(sizeof (xmpp_handler));
804 h->Handler = Handler;
805 Put(XMPP_StartHandlers, key, len, h, NULL);
808 void AddXMPPEndHandler(const char *key,
810 xmpp_handler_func Handler,
814 h = (xmpp_handler*) malloc(sizeof (xmpp_handler));
816 h->Handler = Handler;
817 Put(XMPP_EndHandlers, key, len, h, NULL);
820 void HFreePropertyHandler(void *FreeMe)
825 void HDeleteTokenHandler(void *FreeMe)
827 TokenHandler *th = (TokenHandler *) FreeMe;
828 DeleteHash(&th->Properties);
832 void XMPP_RegisterTokenProperty(const char *NS, long NSLen,
833 const char *Token, long TLen,
834 const char *Property, long PLen,
835 GetTokenDataFunc GetToken,
839 HashList *ThisNamespace = NULL;
843 h = (PropertyHandler*) malloc(sizeof(PropertyHandler));
845 h->NameSpaceLen = NSLen;
848 h->Property = Property;
849 h->PropertyLen = PLen;
852 if (!GetHash(XMPP_SupportedNamespaces, NS, NSLen, &pv))
854 Put(XMPP_SupportedNamespaces, NS, NSLen, NewStrBufPlain(NS, NSLen), HFreeStrBuf);
858 if (GetHash(XMPP_NameSpaces, NS, NSLen, &pv))
864 ThisNamespace = NewHash(1, NULL);
865 Put(XMPP_NameSpaces, NS, NSLen, ThisNamespace, HDeleteHash);
868 if (GetHash(ThisNamespace, Token, TLen, &pv))
874 th = (TokenHandler*) malloc (sizeof(TokenHandler));
875 th->GetToken = GetToken;
876 th->Properties = NewHash(1, NULL);
877 Put(ThisNamespace, Token, TLen, th, HDeleteTokenHandler);
882 Put(th->Properties, Property, PLen, h, HFreePropertyHandler);
884 if (!GetHash(FlatToken, Token, TLen, &pv))
886 // todo mark pv as non uniq
887 Put(FlatToken, Token, TLen, ThisToken, reference_free_handler);
892 void xmpp_cleanup(void)
894 DeleteHash(&XMPP_StartHandlers);
895 DeleteHash(&XMPP_EndHandlers);
896 DeleteHash(&XMPP_SupportedNamespaces);
897 DeleteHash(&XMPP_NameSpaces);
898 DeleteHash(&FlatToken);
901 CTDL_MODULE_INIT(xmpp)
904 CtdlRegisterServiceHook(config.c_xmpp_c2s_port,
912 XMPP_StartHandlers = NewHash(1, NULL);
913 XMPP_EndHandlers = NewHash(1, NULL);
914 XMPP_NameSpaces = NewHash(1, NULL);
915 XMPP_SupportedNamespaces = NewHash(1, NULL);
916 FlatToken = NewHash(1, NULL);
918 AddXMPPEndHandler(HKEY("resource"), xmpp_end_resource, 0);
919 AddXMPPEndHandler(HKEY("username"), xmpp_end_username, 0);
920 AddXMPPEndHandler(HKEY("password"), xmpp_end_password, 0);
921 AddXMPPEndHandler(HKEY("iq"), xmpp_end_iq, 0);
922 AddXMPPEndHandler(HKEY("auth"), xmpp_end_auth, 0);
923 AddXMPPEndHandler(HKEY("session"), xmpp_end_session, 0);
924 AddXMPPEndHandler(HKEY("body"), xmpp_end_body, 0);
925 AddXMPPEndHandler(HKEY("html"), xmpp_end_html, 0);
926 AddXMPPEndHandler(HKEY("starttls"), xmpp_end_starttls, 0);
927 AddXMPPEndHandler(HKEY("ping"), xmpp_end_ping, 0);
928 AddXMPPEndHandler(HKEY("stream"), xmpp_end_stream, 0);
930 AddXMPPStartHandler(HKEY("stream"), xmpp_stream_start, 0);
931 AddXMPPStartHandler(HKEY("query"), xmpp_start_query, 0);
932 AddXMPPStartHandler(HKEY("bind"), xmpp_start_bind, 0);
933 AddXMPPStartHandler(HKEY("auth"), xmpp_start_auth, 0);
934 /// AddXMPPStartHandler(HKEY("message"), xmpp_start_message, 0);
935 AddXMPPStartHandler(HKEY("html"), xmpp_start_html, 0);
938 CtdlRegisterDebugFlagHook(HKEY("serv_xmpp"), LogXMPPSrvDebugEnable, &XMPPSrvDebugEnable);
939 CtdlRegisterSessionHook(xmpp_cleanup_function, EVT_STOP, PRIO_STOP + 70);
940 CtdlRegisterSessionHook(xmpp_login_hook, EVT_LOGIN, PRIO_LOGIN + 90);
941 CtdlRegisterSessionHook(xmpp_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 90);
942 CtdlRegisterSessionHook(xmpp_login_hook, EVT_UNSTEALTH, PRIO_UNSTEALTH + 1);
943 CtdlRegisterSessionHook(xmpp_logout_hook, EVT_STEALTH, PRIO_STEALTH + 1);
944 CtdlRegisterCleanupHook(xmpp_cleanup);
947 /* return our module name for the log */