[PATCH] Drop stanzas when failing to convert them to LmMessages.
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Sat, 10 Oct 2009 18:52:22 +0200
changeset 602 3bcd644fe1ba
parent 601 7972c1499f6d
child 603 2c3812feeb76
[PATCH] Drop stanzas when failing to convert them to LmMessages. When a stanza comes in that for some reason can't be parsed into an LmMessage, just drop them on the floor instead of blocking the parser. I've seen this issue happen in practise because some (buggy?) client sending an iq with a prefix e.g. <client:iq xmlns:client="jabber:client" ... /> committer: Frank Zschockelt <lm@freakysoft.de>
loudmouth/lm-parser.c
--- a/loudmouth/lm-parser.c	Sat Oct 10 18:25:37 2009 +0200
+++ b/loudmouth/lm-parser.c	Sat Oct 10 18:52:22 2009 +0200
@@ -154,19 +154,16 @@
             g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
                    "Couldn't create message: %s\n",
                    parser->cur_root->name);
-            return;
-        }
-
-        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
+        } else {
+            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
                "Have a new message\n");
-        if (parser->function) {
-            (* parser->function) (parser, m, parser->user_data);
-        }
+            if (parser->function) {
+                (* parser->function) (parser, m, parser->user_data);
+            }
+	    lm_message_unref (m);
+	}
 
-        lm_message_unref (m);
         lm_message_node_unref (parser->cur_root);
-        
-            
         parser->cur_node = parser->cur_root = NULL;
     } else {
         LmMessageNode *tmp_node;