diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index 7b73d9a..36ae036 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2009-03-03 P. A. Bagyenda + * Added -n flag to prevent stripping of host/domain part from sender address on email2mms interface 2009-03-01 P. A. Bagyenda * pgsql-queue module fix: Connection pool should return only valid (active) connections 2009-02-25 P. A. Bagyenda diff --git a/mbuni/doc/userguide.shtml b/mbuni/doc/userguide.shtml index fbfb99b..1e7dec2 100644 --- a/mbuni/doc/userguide.shtml +++ b/mbuni/doc/userguide.shtml @@ -4103,10 +4103,13 @@ This interface should be invoked from your MTA as follows:

mmsfromemail -f from_address -t recipient_address --s sender_mmsc_hostname conf_file +-s sender_mmsc_hostname [-n]conf_file

+The -n flag may be used to prevent stripping of the host/domain +part from the sender address. +
Note that no IP-based security is provided at this interface. It is expected that security measures (e.g. firewalls, etc) will have been setup to ensure that messages can only reach the MTA diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index 5db7ed5..585d2a8 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -88,7 +88,7 @@ int mms_load_core_settings(mCfg *cfg, mCfgGrp *cgrp) if (http_proxy_port > 0) http_use_proxy(http_proxy_host, http_proxy_port, 0, - exceptions, username, password, except_regex); + exceptions, username, password, except_regex); octstr_destroy(http_proxy_host); octstr_destroy(username); octstr_destroy(password); diff --git a/mbuni/mmsc/mmsfromemail.c b/mbuni/mmsc/mmsfromemail.c index 9d9efc9..2fcce7d 100644 --- a/mbuni/mmsc/mmsfromemail.c +++ b/mbuni/mmsc/mmsfromemail.c @@ -51,7 +51,7 @@ static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid, static void strip_quotes(Octstr *s); static List *proxyrelays; - +static int no_strip = 0; int main(int argc, char *argv[]) { @@ -214,8 +214,16 @@ int main(int argc, char *argv[]) x = mms_message_type_to_cstr(mm1_type); break; } - if (x) + + if (x) { http_header_add(headers, "X-Mms-Message-Type", (char *)x); + if (orig_sys == NULL) /* Make it up! */ + orig_sys = octstr_format("system-user@%S", + xproxy ? xproxy : octstr_imm("unknown")); + } else { + octstr_destroy(mm4_type); + mm4_type = NULL; /* So that we assume normal message below. */ + } if ((y = http_header_value(headers, octstr_imm("X-Mms-MM-Status-Code"))) != NULL) { /* This field is different on MM1. */ @@ -223,9 +231,9 @@ int main(int argc, char *argv[]) http_header_add(headers, "X-Mms-Status", octstr_get_cstr(y)); octstr_destroy(y); } - if (orig_sys == NULL) /* Make it up! */ - orig_sys = octstr_format("system-user@%S", xproxy ? xproxy : octstr_imm("unknown")); - } else { /* else assume a normal send message. */ + } + + if (mm4_type == NULL) { /* else assume a normal send message. */ http_header_add(headers, "X-Mms-Message-Type", "m-send-req"); mm1_type = MMS_MSGTYPE_SEND_REQ; mtype = MM4_FORWARD_REQ; @@ -522,7 +530,10 @@ static int find_own(int i, int argc, char *argv[]) return 1; } else return -1; - else + else if (argv[i][1] == 'n') { + no_strip = 1; + return 0; + } else return -1; } @@ -568,7 +579,7 @@ static void fixup_recipient(Octstr **host) static void fixup_sender(void) { - int i; + int i, isphone = 1; /* Find the TYPE=xxx element. If it is there, it is a number. Strip the @ */ @@ -590,11 +601,15 @@ static void fixup_sender(void) octstr_format_append(xfrom, "@unknown"); else if (xproxy == NULL) xproxy = octstr_copy(xfrom, i+1, octstr_len(xfrom)); + isphone = 0; } /* clean the number. */ _mms_fixup_address(&xfrom, octstr_get_cstr(settings->unified_prefix), settings->strip_prefixes, 1); + + if (no_strip && isphone && xproxy) + octstr_format_append(xfrom, "@%S", xproxy); } static void fixup_address_type(List *headers, char *hdr)