From e4fc2ab6cca31a901fe4df9605332b9d940ad8c2 Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Wed, 3 Aug 2016 16:03:18 -0500 Subject: fix:decode: add support for decoding GSM PDU encoding 01 Discovered in portal case #5072165 https://support.multitech.com/support/case.html?action=view&id=72165 --- configure.in | 2 +- src/pdu.h | 1 + src/pdu_decode.c | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index dcc974a..accba59 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT([src/sms_main.c]) -AM_INIT_AUTOMAKE([sms-utils], [1.0.0]) +AM_INIT_AUTOMAKE([sms-utils], [1.0.2]) AM_CONFIG_HEADER([config.h]) AC_PROG_CC diff --git a/src/pdu.h b/src/pdu.h index 60243ec..9e399c9 100644 --- a/src/pdu.h +++ b/src/pdu.h @@ -52,6 +52,7 @@ enum { //PDU data formats (how the data was represented before encoding) enum { PDU_ALPHABET_DEFAULT = 0, //GSM 7-bit, (supposedly CDMA 8-bit but haven't seen it) + PDU_ALPHABET_DEFAULT2 = 1, //GSM 7-bit (used with some shortcodes) PDU_ALPHABET_CDMA_DEFAULT = 2, //no GSM, CDMA 7-bit PDU_ALPHABET_EIGHT = 4, //GSM 8-bit, CDMA 16-bit unicode PDU_ALPHABET_CDMA_EIGHT = 8, //GSM 16-bit, CDMA 8-bit (what CDMA radios are actually using) diff --git a/src/pdu_decode.c b/src/pdu_decode.c index 5acb07b..ebe939e 100644 --- a/src/pdu_decode.c +++ b/src/pdu_decode.c @@ -194,7 +194,9 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe } - if (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) { + if (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT || + pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT2) + { log_debug("data coding alphabet is default (7-bit)"); } else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT_MULTI) { log_debug("data coding alphabet is default (7-bit) multi-part"); @@ -214,6 +216,7 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe // VERIFY DATA LENGTH AND GET NUMBER OF OCTETS (ACTUAL DATA BYTES IN PDU STRING) // ----------------------------------------------------------------------------- if ((pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) || + (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT2) || (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT_MULTI)) { if (pdu->user_data_len > PDU_UD_7BIT_MAX) { log_warning("pdu contains invalid user-data-len: 0x%02X", @@ -277,6 +280,7 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe // --------------------------------------------------------- // GSM 7-BIT & LVW2 7-BIT MULTI-PART if ((pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) || + (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT2) || (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT_MULTI)) { // Keep UDH for concatenated SMS. // Otherwise it is impossible to process correctly concatenated SMS. @@ -345,6 +349,7 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe // (includes LVW2 multi-part) // --------------------------------------------------------------------- if ((pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) || + (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT2) || (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT_MULTI)) { int read = user_data_start_index; int store = user_data_start_index; -- cgit v1.2.3