From 98979e042ba6cf2dbb9e1656fc44769ebf628c48 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 28 Mar 2009 10:18:35 +0000 Subject: [PATCH] * add ssl xmpp port; this should work with pidgin as samjam documented. --- citadel/control.c | 4 ++++ citadel/include/dtds/config-defs.h | 1 + citadel/modules/jabber/serv_xmpp.c | 28 ++++++++++++++++++++++++++++ citadel/setup.c | 2 +- citadel/tuiconfig.c | 1 + 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/citadel/control.c b/citadel/control.c index 03ffa7c75..07edd88ba 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -389,6 +389,7 @@ void cmd_conf(char *argbuf) cprintf("%ld\n", config.c_pop3_fetch); cprintf("%ld\n", config.c_pop3_fastest); cprintf("%d\n", config.c_spam_flag_only); + cprintf("%d\n", config.c_xmpps_c2s_port); cprintf("000\n"); } @@ -645,6 +646,9 @@ void cmd_conf(char *argbuf) case 66: config.c_spam_flag_only = atoi(buf); break; + case 67: + config.c_xmpps_c2s_port = atoi(buf); + break; } ++a; } diff --git a/citadel/include/dtds/config-defs.h b/citadel/include/dtds/config-defs.h index d14b3b4f4..71f609608 100644 --- a/citadel/include/dtds/config-defs.h +++ b/citadel/include/dtds/config-defs.h @@ -89,3 +89,4 @@ CFG_VALUE(INTEGER(c_xmpp_s2s_port), " XMPP server-to-server port (usually 5269) CFG_VALUE(TIME(c_pop3_fetch), " How often to fetch POP3 messages"); CFG_VALUE(TIME(c_pop3_fastest), " Users can specify POP3 fetching this often"); CFG_VALUE(INTEGER(c_spam_flag_only), " 1 = flag instead of reject spam"); +CFG_VALUE(INTEGER(c_xmpps_c2s_port), " XMPP client-to-server SSL port (usually 5223)"); diff --git a/citadel/modules/jabber/serv_xmpp.c b/citadel/modules/jabber/serv_xmpp.c index 314ecbaa1..c6fc94731 100644 --- a/citadel/modules/jabber/serv_xmpp.c +++ b/citadel/modules/jabber/serv_xmpp.c @@ -424,6 +424,18 @@ void xmpp_greeting(void) { } +/* + * Here's where our XMPPs session begins its happy day. + */ +void xmpps_greeting(void) { + CtdlModuleStartCryptoMsgs(NULL, NULL, NULL); +#ifdef HAVE_OPENSSL + if (!CC->redirect_ssl) CC->kill_me = 1; /* kill session if no crypto */ +#endif + xmpp_greeting(); +} + + /* * Main command loop for XMPP sessions. */ @@ -472,6 +484,7 @@ void xmpp_logout_hook(void) { const char *CitadelServiceXMPP="XMPP"; +const char *CitadelServiceXMPPs="XMPPs"; CTDL_MODULE_INIT(jabber) { @@ -487,6 +500,21 @@ CTDL_MODULE_INIT(jabber) CtdlRegisterSessionHook(xmpp_logout_hook, EVT_LOGOUT); CtdlRegisterSessionHook(xmpp_login_hook, EVT_UNSTEALTH); CtdlRegisterSessionHook(xmpp_logout_hook, EVT_STEALTH); + +#ifdef HAVE_OPENSSL + CtdlRegisterServiceHook(config.c_xmpps_c2s_port, + NULL, + xmpps_greeting, + xmpp_command_loop, + xmpp_async_loop, + CitadelServiceXMPPs); +#endif + + CtdlRegisterSessionHook(xmpp_cleanup_function, EVT_STOP); + CtdlRegisterSessionHook(xmpp_login_hook, EVT_LOGIN); + CtdlRegisterSessionHook(xmpp_logout_hook, EVT_LOGOUT); + CtdlRegisterSessionHook(xmpp_login_hook, EVT_UNSTEALTH); + CtdlRegisterSessionHook(xmpp_logout_hook, EVT_STEALTH); } /* return our Subversion id for the Log */ diff --git a/citadel/setup.c b/citadel/setup.c index 05e6eacb1..b5ff9e9d5 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -1212,7 +1212,7 @@ int main(int argc, char *argv[]) if (config.c_managesieve_port == 0) config.c_managesieve_port = 2020; if (config.c_xmpp_c2s_port == 0) config.c_xmpp_c2s_port = 5222; if (config.c_xmpp_s2s_port == 0) config.c_xmpp_s2s_port = 5269; - + if (config.c_xmpps_c2s_port == 0) config.c_xmpps_c2s_port = 5223; /* Go through a series of dialogs prompting for config info */ for (curr = 1; curr <= MAXSETUP; ++curr) { edit_value(curr); diff --git a/citadel/tuiconfig.c b/citadel/tuiconfig.c index 5197abeae..9401b345e 100644 --- a/citadel/tuiconfig.c +++ b/citadel/tuiconfig.c @@ -173,6 +173,7 @@ void do_system_configuration(CtdlIPC *ipc) strprompt("ManageSieve server port (-1 to disable)", &sc[51][0], 5); strprompt("XMPP (Jabber) client to server port (-1 to disable)", &sc[62][0], 5); + strprompt("XMPP (Jabber) client to server SSL port (-1 to disable)", &sc[67][0], 5); /* No prompt because we don't implement this service yet, it's just a placeholder */ /* strprompt("XMPP (Jabber) server to server port (-1 to disable)", &sc[63][0], 5); */ -- 2.30.2