From b36fe802626cbd4a868a9cddbc79e1fc2e925766 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Wed, 19 Dec 2007 06:18:33 +0000 Subject: [PATCH] minor fix to mmsbox --- mbuni/mmlib/mms_util.c | 2 +- mbuni/mmlib/mms_util.h | 2 +- mbuni/mmsbox/bearerbox.c | 2 +- mbuni/mmsbox/mmsbox.c | 6 +++--- mbuni/mmsbox/mmsbox_cfg.c | 20 +++++++++++++------- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index 72461fb..d05e8db 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -3,7 +3,7 @@ * * Misc. functions * - * Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com + * Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com * * Paul Bagyenda * diff --git a/mbuni/mmlib/mms_util.h b/mbuni/mmlib/mms_util.h index 9f5953c..ce7c86c 100644 --- a/mbuni/mmlib/mms_util.h +++ b/mbuni/mmlib/mms_util.h @@ -3,7 +3,7 @@ * * Misc. functions * - * Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com + * Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com * * Paul Bagyenda * diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c index 18f4346..78c8e01 100644 --- a/mbuni/mmsbox/bearerbox.c +++ b/mbuni/mmsbox/bearerbox.c @@ -3,7 +3,7 @@ * * MMSC handler functions: Receive and send MMS messages to MMSCs * - * Copyright (C) 2003 - 2007, Digital Solutions Ltd. - http://www.dsmagic.com + * Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com * * Paul Bagyenda * diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 75e3f60..3f3f579 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -3,7 +3,7 @@ * * MMSBOX: MMS Content engine * - * Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com + * Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com * * Paul Bagyenda * @@ -937,7 +937,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, xservice_code = octstr_duplicate(hsvc_code); if (from) - _mms_fixup_address(&from, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL, 1); + _mms_fixup_address(&from, NULL, 1); /* Don't normalise. */ /* Now get the data. */ if (octstr_case_compare(ctype, octstr_imm("application/vnd.wap.mms-message")) == 0) @@ -1286,7 +1286,7 @@ static void sendmms_func(void *unused) if ((from = http_cgi_variable(cgivars, "from")) != NULL) { from = octstr_duplicate(from); - _mms_fixup_address(&from, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL, 1); + _mms_fixup_address(&from, NULL, 1); if (from) HTTP_REPLACE_HEADER(rh, "X-Mbuni-From", octstr_get_cstr(from)); octstr_destroy(from); diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index 581bfd6..5f98219 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -3,7 +3,7 @@ * * MMSBox CFG: MMBox configuration and misc. functions * - * Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com + * Copyright (C) 2003 - 2008, Digital Solutions Ltd. - http://www.dsmagic.com * * Paul Bagyenda * @@ -457,12 +457,7 @@ MmscGrp *get_handler_mmc(Octstr *id, Octstr *to, Octstr *from) MmscGrp *mmc = NULL, *res = NULL; int i, n; Octstr *phonenum = NULL, *xfrom = NULL; - - if (id) - for (i = 0, n = gwlist_len(mmscs); i < n; i++) - if ((mmc = gwlist_get(mmscs, i)) != NULL && - mmc->id && octstr_compare(mmc->id, id) == 0) - return mmc; + int has_criteria = 0; if (octstr_search_char(to, '@', 0) > 0 || octstr_case_search(to, octstr_imm("/TYPE=IPv"), 0) > 0) /* For emails, or ip take first mmsc. */ @@ -491,12 +486,23 @@ MmscGrp *get_handler_mmc(Octstr *id, Octstr *to, Octstr *from) does_prefix_match(mmc->denied_sender_prefix, xfrom) != 0) continue; /* matches. */ + has_criteria = has_criteria || mmc->denied_prefix || + mmc->allowed_prefix || mmc->denied_sender_prefix || mmc->allowed_sender_prefix; res = mmc; /* otherwise it matches, so go away. */ break; } octstr_destroy(phonenum); octstr_destroy(xfrom); + + if (res && has_criteria) /* choice driven by allowed/denied settings */ + return res; + else if (res == NULL && id) /* try sending it back the way it came. */ + for (i = 0, n = gwlist_len(mmscs); i < n; i++) + if ((mmc = gwlist_get(mmscs, i)) != NULL && + mmc->id && octstr_compare(mmc->id, id) == 0) + return mmc; + return res; }