1
0
Fork 0

fix for dlr and rr

This commit is contained in:
bagyenda 2008-08-06 17:45:08 +00:00
parent 80682bbcb3
commit 3f4df1cdc7
9 changed files with 26 additions and 19 deletions

View File

@ -1,5 +1,6 @@
2008-08-06 P. A. Bagyenda <bagyenda@dsmagic.com>
* Additional fixes for bad message formats causing crash
* Fix for incorrect From and To headers in DLR and RR messages
2008-08-05 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor fix for crash in mmsproxy with bad message type
2008-07-18 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -969,7 +969,7 @@ MmsMsg *mm7_soap_to_mmsmsg(MSoapMsg_t *m, Octstr *from)
if (msgtype == MM7_TAG_DeliveryReportReq &&
p && r && mms_string_to_status(r) >= 0)
msg = mms_deliveryreport(s ? s : octstr_imm("0000"), p, t, r);
msg = mms_deliveryreport(s ? s : octstr_imm("0000"), from, p, t, r);
else if (msgtype == MM7_TAG_ReadReplyReq &&
f && p && r && mms_string_to_read_status(r) >= 0)
msg = mms_readreport(s ? s : octstr_imm("0000"),

View File

@ -1573,7 +1573,7 @@ MmsMsg *mms_readreport(Octstr *msgid, Octstr *from, Octstr *to, time_t date, Oct
return m;
}
MmsMsg *mms_deliveryreport(Octstr *msgid, Octstr *to, time_t date, Octstr *status)
MmsMsg *mms_deliveryreport(Octstr *msgid, Octstr *from, Octstr *to, time_t date, Octstr *status)
{
MmsMsg *m = gw_malloc(sizeof *m);
@ -1593,8 +1593,10 @@ MmsMsg *mms_deliveryreport(Octstr *msgid, Octstr *to, time_t date, Octstr *statu
http_header_add(m->headers, "X-Mms-MMS-Version", MMS_DEFAULT_VERSION);
http_header_add(m->headers, "Message-ID", msgid ? octstr_get_cstr(msgid) : "none");
http_header_add(m->headers, "To", octstr_get_cstr(to));
if (to)
http_header_add(m->headers, "To", octstr_get_cstr(to));
if (from)
http_header_add(m->headers, "From", octstr_get_cstr(from));
s = date_format_http(date);
http_header_add(m->headers, "Date", octstr_get_cstr(s));

View File

@ -59,7 +59,8 @@ extern void mms_msgdump(MmsMsg *m, int headers_only);
extern void mms_destroy(MmsMsg *msg);
/* Make a delivery report message. */
extern MmsMsg *mms_deliveryreport(Octstr *msgid, Octstr *to, time_t date, Octstr *status);
extern MmsMsg *mms_deliveryreport(Octstr *msgid, Octstr *from,
Octstr *to, time_t date, Octstr *status);
MmsMsg *mms_readreport(Octstr *msgid, Octstr *from, Octstr *to, time_t date, Octstr *status);

View File

@ -828,7 +828,7 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
if (prof->ccppaccept.all) /* Check if it accepts all content types. */
supported = 1;
else
for (i = 0, n = prof->ccppaccept.content ? gwlist_len(prof->ccppaccept.content) : 0;
for (i = 0, n = gwlist_len(prof->ccppaccept.content);
i<n; i++)
if ((unsigned long)gwlist_get(prof->ccppaccept._hash,i) == chash &&
octstr_case_compare(gwlist_get(prof->ccppaccept.content,i),content_type) == 0) {

View File

@ -786,9 +786,12 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
else if (mtype == MMS_MSGTYPE_DELIVERY_IND) {
Octstr *s = http_header_value(headers, octstr_imm("X-Mms-Status"));
x = "MM4_delivery_report.REQ";
#if 0
/* insert FROM address as recipient as per spec */
http_header_add(newhdrs, "From", octstr_get_cstr(to));
#else
http_header_add(newhdrs, "To", octstr_get_cstr(to));
#endif
/* rename status header. */
http_header_remove_all(headers, "X-Mms-Status");
http_header_add(newhdrs, "X-Mms-MM-Status-Code",
@ -798,8 +801,12 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
octstr_destroy(s);
} else if (mtype == MMS_MSGTYPE_READ_REC_IND) {
x = "MM4_read_reply_report.REQ";
#if 0
/* insert FROM address as recipient as per spec */
http_header_add(newhdrs, "From", octstr_get_cstr(to));
#else
http_header_add(newhdrs, "To", octstr_get_cstr(to));
#endif
} else {
*error = octstr_format("Invalid message type %s on MM4 outgoing interface!",
mms_message_type_to_cstr(mtype));

View File

@ -363,7 +363,7 @@ static int sendMsg(MmsEnvelope *e)
mstatus = "Expired";
else
mstatus = "Rejected";
m = mms_deliveryreport(e->msgId, to->rcpt, tnow, octstr_imm(mstatus));
m = mms_deliveryreport(e->msgId, to->rcpt, e->from, tnow, octstr_imm(mstatus));
l = gwlist_create();

View File

@ -416,7 +416,7 @@ static int sendNotify(MmsEnvelope *e)
*/
if (dlr) {
MmsMsg *m = mms_deliveryreport(msgId, to, tnow,
MmsMsg *m = mms_deliveryreport(msgId, to, e->from, tnow,
rtype ? octstr_imm(rtype) :
octstr_imm("Indeterminate"));

View File

@ -389,7 +389,8 @@ void fetchmms_proxy(MmsHTTPClientInfo *h)
char tbuf[64];
Octstr *x, *from = h->client_addr ? h->client_addr : settings->system_user;
List *l = gwlist_create(), *qh = gwlist_create();
MmsMsg *mrpt = mms_deliveryreport(e->msgId, h->client_addr, time(NULL), octstr_imm("Retrieved"));
MmsMsg *mrpt = mms_deliveryreport(e->msgId, from, e->from,
time(NULL), octstr_imm("Retrieved"));
gwlist_append(l, octstr_duplicate(e->from));
@ -845,11 +846,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
}
}
if (x)
octstr_destroy(x);
octstr_destroy(x);
if (!qf2)
mresp = mms_sendconf("Error-transient-failure",
"None", octstr_get_cstr(otransid),1,menc);
@ -884,7 +881,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
(pdelivery_report && octstr_case_compare(pdelivery_report,
octstr_imm("Yes")))) {
Octstr *from = h->client_addr ? h->client_addr : settings->system_user;
MmsMsg *mrep = mms_deliveryreport(pmsgid, h->client_addr, time(NULL),
MmsMsg *mrep = mms_deliveryreport(pmsgid, from, e ? e->from : NULL, time(NULL),
octstr_imm("Forwarded"));
Octstr *x;
List *l = gwlist_create();
@ -900,8 +897,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
octstr_get_cstr(settings->global_queuedir),
"MM1",
settings->host_alias);
if (x)
octstr_destroy(x);
octstr_destroy(x);
gwlist_destroy(l, NULL);
mms_destroy(mrep);
@ -991,7 +987,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
Octstr *from = h->client_addr ? h->client_addr : settings->system_user;
List *l = gwlist_create();
mrpt = mms_deliveryreport(e->msgId, h->client_addr, time(NULL), status);
mrpt = mms_deliveryreport(e->msgId, from, e->from, time(NULL), status);
gwlist_append(l, octstr_duplicate(e->from));
x = settings->qfs->mms_queue_add(from, l, NULL, NULL, NULL, 0,