1
0
Fork 0

fix panic for missing queue file entry

This commit is contained in:
bagyenda 2007-03-09 04:53:59 +00:00
parent 222cf4487a
commit 2255fe303b
3 changed files with 35 additions and 24 deletions

View File

@ -1,3 +1,5 @@
2007-03-09 P. A. Bagyenda <bagyenda@dsmagic.com>
* Patch to fix panic in the event of missing/corrupt data file in queue (Thanks to Deon van der Merwe <deonvandermerwe@gmail.com>)
2007-01-31 Vincent Chavanis <vincent@telemaque.fr>
* Patch to allow controlling content adaptation on mmsbox side from sendmms interface
2007-01-30 Paul A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -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;

View File

@ -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);