[Freeswitch-svn] [commit] r3861 - freeswitch/trunk/libs/libdingaling/src

Freeswitch SVN anthm at freeswitch.org
Thu Dec 28 15:05:38 EST 2006


Author: anthm
Date: Thu Dec 28 15:05:38 2006
New Revision: 3861

Modified:
   freeswitch/trunk/libs/libdingaling/src/libdingaling.c

Log:
fix issues

Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.c	(original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.c	Thu Dec 28 15:05:38 2006
@@ -1016,11 +1016,15 @@
 
 static int on_stream_component(ldl_handle_t *handle, int type, iks *node)
 {
-	ikspak *pak = iks_packet(node);
+	ikspak *pak = NULL;
+
+    if (node) {
+        pak = iks_packet(node);
+    }
 
 	switch (type) {
 	case IKS_NODE_START:
-		if (handle->state == CS_NEW) {
+		if (pak && handle->state == CS_NEW) {
 			char secret[256] = "";
 			char hash[256] = "";
 			char handshake[512] = "";
@@ -1061,9 +1065,7 @@
 		return IKS_HOOK;
 	}
 	
-	
-	pak = iks_packet(node);
-	iks_filter_packet(handle->filter, pak);
+    iks_filter_packet(handle->filter, pak);
 
 	if (handle->job_done == 1) {
 		return IKS_HOOK;
@@ -1080,7 +1082,8 @@
 {
 	handle->counter = opt_timeout;
 
-	switch (type) {
+
+    switch (type) {
 	case IKS_NODE_START:
 		if (ldl_test_flag(handle, LDL_FLAG_TLS) && !iks_is_secure(handle->parser)) {
 			if (iks_has_tls()) {
@@ -1091,9 +1094,7 @@
 		}
 		break;
 	case IKS_NODE_NORMAL:
-		
-
-		if (strcmp("stream:features", iks_name(node)) == 0) {
+        if (node && strcmp("stream:features", iks_name(node)) == 0) {
 			handle->features = iks_stream_features(node);
 			if (ldl_test_flag(handle, LDL_FLAG_TLS) && !iks_is_secure(handle->parser))
 				break;
@@ -1137,12 +1138,12 @@
 					
 				}
 			}
-		} else if (strcmp("failure", iks_name(node)) == 0) {
+		} else if (node && strcmp("failure", iks_name(node)) == 0) {
 			globals.logger(DL_LOG_DEBUG, "sasl authentication failed\n");
 			if (handle->session_callback) {
 				handle->session_callback(handle, NULL, LDL_SIGNAL_LOGIN_FAILURE, "user", "core", "Login Failure", handle->login);
 			}
-		} else if (strcmp("success", iks_name(node)) == 0) {
+		} else if (node && strcmp("success", iks_name(node)) == 0) {
 			globals.logger(DL_LOG_DEBUG, "XMPP server connected\n");
 			iks_send_header(handle->parser, handle->acc->server);
 			ldl_set_flag_locked(handle, LDL_FLAG_CONNECTED);
@@ -1158,9 +1159,10 @@
 				globals.logger(DL_LOG_DEBUG, "XMPP authenticated\n");
 				ldl_set_flag_locked(handle, LDL_FLAG_AUTHORIZED);
 			}
-
-			pak = iks_packet(node);
-			iks_filter_packet(handle->filter, pak);
+            if (node) {
+                pak = iks_packet(node);
+                iks_filter_packet(handle->filter, pak);
+            }
 			if (handle->job_done == 1) {
 				return IKS_HOOK;
 			}
@@ -1178,8 +1180,9 @@
 
 	}
 
-	if (node)
+	if (node) {
 		iks_delete(node);
+    }
 	return IKS_OK;
 }
 



More information about the Freeswitch-svn mailing list