[asterisk-commits] oej: trunk r68029 - in /trunk: ./ res/res_jabber.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 7 02:57:53 MST 2007


Author: oej
Date: Thu Jun  7 04:57:52 2007
New Revision: 68029

URL: http://svn.digium.com/view/asterisk?view=rev&rev=68029
Log:
Merged revisions 68027 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r68027 | oej | 2007-06-07 11:42:26 +0200 (Thu, 07 Jun 2007) | 8 lines

If you have a jabber client that uses TLS, refuse unload. Bad fix, but will prevent
crashes while we are trying to find a workaround.

Iksemel development seems to have stalled and we might have to stop using the 
TCP/TLS connections in that library and use our own, which would scale better
from a poll/select perspective I guess. It would also make it easier to migrate
to OpenSSL and stop Asterisk from depending on both OpenSSL and GnuTLS.

........

Modified:
    trunk/   (props changed)
    trunk/res/res_jabber.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_jabber.c?view=diff&rev=68029&r1=68028&r2=68029
==============================================================================
--- trunk/res/res_jabber.c (original)
+++ trunk/res/res_jabber.c Thu Jun  7 04:57:52 2007
@@ -56,6 +56,14 @@
 #include "asterisk/manager.h"
 
 #define JABBER_CONFIG "jabber.conf"
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
 
 /*-- Forward declarations */
 static int aji_highest_bit(int number);
@@ -2065,6 +2073,7 @@
 	ast_copy_string(client->name, label, sizeof(client->name));
 	ast_copy_string(client->mid, "aaaaa", sizeof(client->mid));
 
+	/* Set default values for the client object */
 	client->debug = debug;
 	ast_copy_flags(client, &globalflags, AST_FLAGS_ALL);
 	client->port = 5222;
@@ -2387,10 +2396,29 @@
 
 static int unload_module(void)
 {
+	int module_uses_tls = FALSE;
+
+	/* Check if any client use TLS. If that's the case, we can't unload this
+	   module due to a bug in the iksemel library that will cause a crash or
+	   a deadlock. We're trying to find a way to handle this, but in the meantime
+	   we will simply refuse to die... 
+	 */
+	ASTOBJ_CONTAINER_TRAVERSE(&clients, 1, {
+		ASTOBJ_RDLOCK(iterator);
+		if (iterator->usetls)
+			module_uses_tls = TRUE;
+		ASTOBJ_UNLOCK(iterator);
+	});
+	if (module_uses_tls) {
+		ast_log(LOG_ERROR, "Module can't be unloaded due to a bug in the Iksemel library when using TLS.\n");
+		return 1;	/* You need a forced unload to get rid of this module */
+	}
+
 	ast_cli_unregister_multiple(aji_cli, sizeof(aji_cli) / sizeof(struct ast_cli_entry));
 	ast_unregister_application(app_ajisend);
 	ast_unregister_application(app_ajistatus);
 	ast_manager_unregister("JabberSend");
+	
 	ASTOBJ_CONTAINER_TRAVERSE(&clients, 1, {
 		ASTOBJ_RDLOCK(iterator);
 		if (option_debug > 2)



More information about the asterisk-commits mailing list