diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index ef94304..5d4ea03 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2007-03-09 P. A. Bagyenda + * Patch to fix panic in the event of missing/corrupt data file in queue (Thanks to Deon van der Merwe ) 2007-01-31 Vincent Chavanis * Patch to allow controlling content adaptation on mmsbox side from sendmms interface 2007-01-30 Paul A. Bagyenda diff --git a/mbuni/mmlib/mms_queue.c b/mbuni/mmlib/mms_queue.c index 95f0b3a..d2cad6b 100644 --- a/mbuni/mmlib/mms_queue.c +++ b/mbuni/mmlib/mms_queue.c @@ -916,7 +916,7 @@ MmsMsg *mms_queue_getdata(MmsEnvelope *e) } m = mms_frombinary(ms, octstr_imm("")); if (!m) { - error(0, "mms_queue_getdata: Failed to load decode data file for queue entry %s in %s", + error(0, "mms_queue_getdata: Failed to decode data file for queue entry %s in %s", e->qf.name, e->qf.dir); octstr_destroy(fname); return NULL; diff --git a/mbuni/mmsc/mmsglobalsender.c b/mbuni/mmsc/mmsglobalsender.c index 81b5572..bbc6dd6 100644 --- a/mbuni/mmsc/mmsglobalsender.c +++ b/mbuni/mmsc/mmsglobalsender.c @@ -420,7 +420,7 @@ int mms_sendtomobile(Octstr *from, Octstr *to, Octstr *msgid, time_t expires, MmsMsg *m, int dlr, Octstr **error) { - Octstr *ret, *x; + Octstr *ret = NULL, *x; List *l = gwlist_create(); char tokenstr[128]; @@ -434,19 +434,22 @@ int mms_sendtomobile(Octstr *from, Octstr *to, random() % 100); x = octstr_create(tokenstr); + if (m) + ret = mms_queue_add(from, l, subject, fromproxy, NULL, 0, expires, m, + x, NULL, NULL, + NULL, NULL, + NULL, + dlr, mobile_qdir, + settings->host_alias); + else + *error = octstr_format("GlobalSend: Failed to send to %S, Message format is corrupt!", to); - ret = mms_queue_add(from, l, subject, fromproxy, NULL, 0, expires, m, - x, NULL, NULL, - NULL, NULL, - NULL, - dlr, mobile_qdir, - settings->host_alias); octstr_destroy(x); gwlist_destroy(l, NULL); octstr_destroy(ret); if (ret == NULL) - return MMS_SEND_ERROR_TRANSIENT; + return (m) ? MMS_SEND_ERROR_TRANSIENT : MMS_SEND_ERROR_FATAL; else return MMS_SEND_OK; } @@ -462,7 +465,7 @@ static int mms_sendtoproxy(Octstr *from, Octstr *to, { Octstr *pto; - int x; + int x = MMS_SEND_ERROR_FATAL; if (!to || octstr_search_char(to, '@', 0) >= 0) { @@ -470,7 +473,8 @@ static int mms_sendtoproxy(Octstr *from, Octstr *to, return MMS_SEND_ERROR_FATAL; } - if (mms_messagetype(msg) == MMS_MSGTYPE_SEND_REQ) { /* Only queue these ones for future response. */ + if (msg && + mms_messagetype(msg) == MMS_MSGTYPE_SEND_REQ) { /* Only queue these ones for future response. */ List *l = gwlist_create(); Octstr *ret; gwlist_append(l, to); @@ -488,18 +492,20 @@ static int mms_sendtoproxy(Octstr *from, Octstr *to, } octstr_destroy(ret); } - - pto = octstr_format("%S@%S", to, proxy); - x = mms_sendtoemail(from, pto, - subject ? subject : settings->mms_email_subject, - msgid, msg, 0, - error, sendmail_cmd, - settings->hostname, 0, 0,NULL,NULL,0); - - mms_log2("Sent", from, pto, - -1, msgid, NULL, proxy, "MM4", NULL,NULL); - - octstr_destroy(pto); + if (msg) { + pto = octstr_format("%S@%S", to, proxy); + x = mms_sendtoemail(from, pto, + subject ? subject : settings->mms_email_subject, + msgid, msg, 0, + error, sendmail_cmd, + settings->hostname, 0, 0,NULL,NULL,0); + + mms_log2("Sent", from, pto, + -1, msgid, NULL, proxy, "MM4", NULL,NULL); + + octstr_destroy(pto); + } else + *error = octstr_format("GlobalSend: Failed to send to %S, Message format is corrupt!", to); return x; } @@ -686,7 +692,10 @@ static int mm7eaif_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgid, static int mms_sendtovasp(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgid, MmsMsg *m, Octstr **err) { - if (vasp->type == SOAP_VASP) + if (m == NULL) { + *err = octstr_format("GlobalSend: Failed to send to %S, Message format is corrupt!", to); + return MMS_SEND_ERROR_FATAL; + } else if (vasp->type == SOAP_VASP) return mm7soap_send(vasp, from, to, msgid, m, err); else if (vasp->type == EAIF_VASP) return mm7eaif_send(vasp, from, to, msgid, m, err);