diff --git a/mms-lib/include/mms_lib_log.h b/mms-lib/include/mms_lib_log.h index c17950c..fa7cbee 100644 --- a/mms-lib/include/mms_lib_log.h +++ b/mms-lib/include/mms_lib_log.h @@ -22,6 +22,7 @@ log(mms_handler_log)\ log(mms_message_log)\ log(mms_attachment_log)\ + log(mms_codec_log)\ log(mms_task_log)\ log(mms_task_http_log)\ log(mms_task_decode_log)\ diff --git a/mms-lib/src/mms_codec.c b/mms-lib/src/mms_codec.c index 571663d..2076a95 100644 --- a/mms-lib/src/mms_codec.c +++ b/mms-lib/src/mms_codec.c @@ -43,6 +43,11 @@ #include "wsputil.h" #include "mms_codec.h" +/* Logging */ +#define MMS_LOG_MODULE_NAME mms_codec_log +#include "mms_lib_log.h" +MMS_LOG_MODULE_DEFINE("mms-codec"); + #define MAX_ENC_VALUE_BYTES 6 #ifdef TEMP_FAILURE_RETRY @@ -1295,8 +1300,13 @@ static gboolean mms_parse_attachments(struct wsp_header_iter *iter, return FALSE; if (attachment_parse_headers(&hi, part) == FALSE) { - free_attachment(part, NULL); - return FALSE; + + /* + * Better to ignore this. It doesn't stop us from + * parsing the rest of the PDU. And yes, it does + * happen in real life. + */ + MMS_WARN("Failed to parse part headers"); } if (wsp_header_iter_at_end(&hi) == FALSE) { diff --git a/mms-lib/test/mms_codec/data/m-retrieve_9.conf b/mms-lib/test/mms_codec/data/m-retrieve_9.conf new file mode 100644 index 0000000..2d7a5b8 Binary files /dev/null and b/mms-lib/test/mms_codec/data/m-retrieve_9.conf differ diff --git a/mms-lib/test/mms_codec/test_mms_codec.c b/mms-lib/test/mms_codec/test_mms_codec.c index 85fc988..cc45986 100644 --- a/mms-lib/test/mms_codec/test_mms_codec.c +++ b/mms-lib/test/mms_codec/test_mms_codec.c @@ -12,7 +12,8 @@ * */ -#include "mms_log.h" +#include "mms_lib_util.h" +#include "mms_lib_log.h" #include "mms_codec.h" #define DATA_DIR "data/" @@ -50,7 +51,6 @@ test_file( int main(int argc, char* argv[]) { - int i, ret = RET_OK; static const char* default_files[] = { "m-acknowledge.ind", "m-notification_1.ind", @@ -66,6 +66,7 @@ int main(int argc, char* argv[]) "m-retrieve_6.conf", "m-retrieve_7.conf", "m-retrieve_8.conf", + "m-retrieve_9.conf", "m-notifyresp.ind", "m-read-rec.ind", "m-send_1.req", @@ -73,23 +74,49 @@ int main(int argc, char* argv[]) "m-send_3.req", "m-send.conf" }; - mms_log_set_type(MMS_LOG_TYPE_STDOUT, "test_mms_codec"); - mms_log_stdout_timestamp = FALSE; - mms_log_default.level = MMS_LOGLEVEL_INFO; - if (argc > 1) { - for (i=1; i 1) { + for (i=1; i