1
0
Fork 0

MM4 incoming message type fix

This commit is contained in:
bagyenda 2007-01-30 17:06:29 +00:00
parent bc7049dbd6
commit 869a6d3eed
4 changed files with 26 additions and 7 deletions

View File

@ -1,3 +1,6 @@
2007-01-30 Paul A. Bagyenda <bagyenda@dsmagic.com>
* Fix for MM4 incoming, thanks to Vincent Chavanis <vincent@telemaque.fr> (and
Deon van der Merwe <deonvandermerwe@gmail.com> for testing)
2007-01-24 Paul A. Bagyenda <bagyenda@dsmagic.com>
* Fix crash for missing error code definition (thanks to Vincent Chavanis <vincent@telemaque.fr>)
2006-12-28 Paul A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -1361,10 +1361,14 @@ MmsMsg *mms_frommime(MIMEEntity *mime)
m->msgId = http_header_value(m->headers, octstr_imm("Message-ID"));
/* Default type is send */
if ((s = http_header_value(m->headers, octstr_imm("X-Mms-Message-Type"))) == NULL) {
if ((s = http_header_value(m->headers, octstr_imm("X-Mms-Message-Type"))) == NULL ||
octstr_compare(s, octstr_imm("MM4_forward.REQ")) == 0) {
http_header_remove_all(m->headers, "X-Mms-Message-Type");
http_header_add(m->headers, "X-Mms-Message-Type",
(char *)mms_message_type_to_cstr(MMS_MSGTYPE_SEND_REQ));
m->message_type = MMS_MSGTYPE_SEND_REQ;
if (s)
octstr_destroy(s);
} else {
m->message_type = mms_string_to_message_type(s);
if (m->message_type < 0) {

View File

@ -125,7 +125,7 @@ static unsigned char *number_to_cstr(long number, struct table *table)
return (unsigned char *)octstr_get_cstr(table->strings[i]);
}
}
return "";
return NULL;
}
/* Case-insensitive string lookup */

View File

@ -439,13 +439,14 @@ void mmsc_receive_func(MmscGrp *m)
{
MmsHTTPClientInfo h = {NULL};
Octstr *err = NULL;
h.m = m;
while(rstop == 0 &&
(h.client = http_accept_request(m->incoming.port,
&h.ip, &h.url, &h.headers,
&h.body, &h.cgivars)) != NULL)
if (is_allowed_ip(m->incoming.deny_ip, m->incoming.allow_ip, h.ip)) {
if (is_allowed_ip(m->incoming.allow_ip, m->incoming.deny_ip, h.ip)) {
h.ua = http_header_value(h.headers, octstr_imm("User-Agent"));
debug("mmsbox", 0,
@ -466,7 +467,7 @@ void mmsc_receive_func(MmscGrp *m)
http_header_add(hh, "WWW-Authenticate",
"Basic realm=\"" MM_NAME "\"");
http_send_reply(h.client, HTTP_UNAUTHORIZED, hh,
octstr_imm(""));
octstr_imm("Authentication failed"));
http_destroy_headers(hh);
info(0, "MMSBox: Auth failed, incoming connection, MMC group=%s",
m->id ? octstr_get_cstr(m->id) : "(none)");
@ -475,9 +476,20 @@ void mmsc_receive_func(MmscGrp *m)
else
mm7eaif_receive(&h);
free_clientInfo(&h, 0);
} else {
} else {
h.ua = http_header_value(h.headers, octstr_imm("User-Agent"));
err = octstr_format("HTTP: Incoming IP denied MMSC[%s] ip=[%s], ua=[%s], disconnected",
m->id ? octstr_get_cstr(m->id) : "(none)",
h.ip ? octstr_get_cstr(h.ip) : "(none)",
h.ua ? octstr_get_cstr(h.ua) : "(none)");
if (err) {
error(0, "%s", octstr_get_cstr(err));
octstr_destroy(err);
}
http_send_reply(h.client, HTTP_FORBIDDEN, NULL,
octstr_imm("Access denied."));
free_clientInfo(&h, 0);
http_close_client(h.client);
}
debug("proxy", 0, "MMSBox: MM7 Shutting down...");