Index: packet-gsm_sms_ud.c
===================================================================
RCS file: /cvsroot/ethereal/packet-gsm_sms_ud.c,v
retrieving revision 1.4
diff -u -r1.4 packet-gsm_sms_ud.c
--- packet-gsm_sms_ud.c	27 Jan 2004 17:17:31 -0000	1.4
+++ packet-gsm_sms_ud.c	28 Jan 2004 10:21:58 -0000
@@ -136,6 +136,8 @@
 /* Always try dissecting the 1st fragment of a SM,
  * even if it is not reassembled */
 static gboolean try_dissect_1st_frag = FALSE;
+/* Prevent subdissectors changing column data */
+static gboolean prevent_subdissectors_changing_columns = FALSE;
 
 static dissector_handle_t wsp_handle;
 
@@ -212,9 +214,6 @@
 	gboolean ports_available = FALSE;
 
 	udh_len = tvb_get_guint8(tvb, i++);
-#ifdef DEBUG
-printf("udhlen %d\n", udh_len);
-#endif
 	tree = proto_tree_add_uint(sm_tree, hf_gsm_sms_udh_length, tvb, 0, 1, udh_len);
 	tree = proto_item_add_subtree(tree, ett_udh);
 	while (i < udh_len) {
@@ -225,10 +224,11 @@
 		switch (udh) {
 			case 0x00: /* Multiple messages - 8-bit message ID */
 				if (len == 3) {
-					is_fragmented = TRUE;
 					sm_id = tvb_get_guint8(tvb, i++);
 					frags = tvb_get_guint8(tvb, i++);
 					frag  = tvb_get_guint8(tvb, i++);
+					if(frags>1)
+						is_fragmented = TRUE;
 					proto_item_append_text(subtree,
 							": message %u, part %u of %u", sm_id, frag, frags);
 					subtree = proto_item_add_subtree(subtree,
@@ -250,10 +250,11 @@
 
 			case 0x08: /* Multiple messages - 16-bit message ID */
 				if (len == 4) {
-					is_fragmented = TRUE;
 					sm_id = tvb_get_ntohs(tvb, i); i += 2;
 					frags = tvb_get_guint8(tvb, i++);
 					frag  = tvb_get_guint8(tvb, i++);
+					if(frags>1)
+						is_fragmented = TRUE;
 					proto_item_append_text(subtree,
 							": message %u, part %u of %u", sm_id, frag, frags);
 					subtree = proto_item_add_subtree(subtree,
@@ -384,6 +385,12 @@
 			 *  - the preference "Always Try Dissection for 1st SM fragment"
 			 *    is switched on, and this is the SM's 1st fragment. */
 			if ( ports_available ) {
+				gboolean allow_write = FALSE;
+				if ( prevent_subdissectors_changing_columns && col_get_writable(pinfo->cinfo) ) {
+					allow_write = TRUE;
+					col_set_writable(pinfo->cinfo, FALSE);
+				}				
+
 				if ( port_number_udh_means_wsp ) {
 					call_dissector (wsp_handle, sm_tvb, pinfo, top_tree);
 				} else {
@@ -398,6 +405,9 @@
 						}
 					}
 				}
+				
+				if( allow_write )
+					col_set_writable(pinfo->cinfo, TRUE);
 			} else { /* No ports IE */
 				proto_tree_add_text (sm_tree, sm_tvb, 0, -1,
 						"Short Message body");
@@ -601,6 +611,11 @@
 	    "may be dissected twice (once as a short frame, once in its "
 	    "entirety).",
 	    &try_dissect_1st_frag);
+    prefs_register_bool_preference (gsm_sms_ud_module, "prevent_dissectors_chg_cols",
+    	    "Prevent sub-dissectors from changing column data",
+	    "Prevent sub-dissectors from replacing column data with their "
+	    "own. Eg. Prevent WSP dissector overwriting SMPP information.",
+	    &prevent_subdissectors_changing_columns);
 
     register_dissector("gsm-sms-ud", dissect_gsm_sms_ud, proto_gsm_sms_ud);
 
@@ -614,6 +629,7 @@
 	dissector_handle_t gsm_sms_ud_handle;
 	gsm_sms_ud_handle = create_dissector_handle(dissect_gsm_sms_ud,
 			proto_gsm_sms_ud);
+			
 	wsp_handle = find_dissector("wsp-cl");
 	g_assert(wsp_handle);
 }
