From 26b1c37a1d739e3e63431c8e6420cfd9a48fa807 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Fri, 4 Nov 2005 16:43:16 +0000 Subject: [PATCH] Improved sender/recipient address format checking --- mbuni/mmlib/mms_queue.c | 14 ++++++++++---- mbuni/mmsc/mmssend.c | 8 ++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/mbuni/mmlib/mms_queue.c b/mbuni/mmlib/mms_queue.c index 3b18009..92fb03e 100644 --- a/mbuni/mmlib/mms_queue.c +++ b/mbuni/mmlib/mms_queue.c @@ -207,14 +207,20 @@ MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int shouldbloc break; case 'F': e->from = octstr_create(res); - if (mms_validate_address(e->from) != 0) - error(0, "mms_queueread: Mal-formed address %s in file %s!", res, xqf); + if (mms_validate_address(e->from) != 0) { + warning(0, "mms_queueread: Mal-formed address [%s] in file %s! " + "Attempting fixup.", res, xqf); + _mms_fixup_address(e->from); + } break; case 'R': t = octstr_create(res); - if (mms_validate_address(t) != 0) - error(0, "mms_queueread: Mal-formed address %s in file %s!", res, xqf); + if (mms_validate_address(t) != 0) { + warning(0, "mms_queueread: Mal-formed address [%s] in file %s! " + "Attempting fixup.", res, xqf); + _mms_fixup_address(t); + } to = gw_malloc(sizeof *to); to->rcpt = t; to->process = 1; diff --git a/mbuni/mmsc/mmssend.c b/mbuni/mmsc/mmssend.c index bef3c6f..f2ff5e2 100644 --- a/mbuni/mmsc/mmssend.c +++ b/mbuni/mmsc/mmssend.c @@ -34,6 +34,7 @@ static int find_own(int i, int argc, char *argv[]) if (argv[i][1] == 'f') if (i + 1 < argc) { from = octstr_create(argv[i+1]); + _mms_fixup_address(from); return 1; } else return -1; @@ -45,8 +46,11 @@ static int find_own(int i, int argc, char *argv[]) int j, m; List *l = octstr_split(octstr_create(argv[i+1]), octstr_imm(":")); - for (j = 0, m = list_len(l); j < m; j++) - list_append(to, list_get(l, j)); + for (j = 0, m = list_len(l); j < m; j++) { + Octstr *x = list_get(l, j); + _mms_fixup_address(x); + list_append(to, x); + } list_destroy(l, NULL); return 1; } else