From d98f7906b6a96e21195c7f8969da36be299c3f9b Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Wed, 28 Jan 2009 19:38:36 +0000 Subject: [PATCH] *** empty log message *** --- mbuni/ChangeLog | 2 ++ mbuni/extras/pgsql-queue/mms_pgsql_queue.c | 10 ++++++---- mbuni/mmsbox/mmsbox.c | 2 ++ mbuni/mmsbox/mmsbox_cfg.c | 12 ++++++++---- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index 306036d..49732e4 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2009-01-28 P. A. Bagyenda + * Minor fix: mmsbox sendmms default content type 2009-01-22 P. A. Bagyenda * Fix: PGSQL Queue module was not honouring send_time fully 2009-01-21 P. A. Bagyenda diff --git a/mbuni/extras/pgsql-queue/mms_pgsql_queue.c b/mbuni/extras/pgsql-queue/mms_pgsql_queue.c index c42dc77..a14746d 100644 --- a/mbuni/extras/pgsql-queue/mms_pgsql_queue.c +++ b/mbuni/extras/pgsql-queue/mms_pgsql_queue.c @@ -370,7 +370,7 @@ static MmsEnvelope *pgq_queue_readenvelope_ex(char *qf, char *mms_queuedir, int /* read and block, to ensure no one else touches it. */ sprintf(cmd, "SELECT id,cdate,lastt,sendt,edate,num_attempts,sender,data FROM " - " mms_messages_view WHERE qdir='%s' AND qfname = '%s' %s FOR UPDATE %s", + " mms_messages_view WHERE qdir='%.128s' AND qfname = '%.256s' %s FOR UPDATE %s", mms_queuedir, _qf, check_send_time ? " AND send_time <= current_timestamp " : "", shouldblock ? "" : "NOWAIT"); /* nice little PostgreSQL 8.x addition. */ @@ -1032,8 +1032,9 @@ static MmsMsg *pgq_queue_getdata(MmsEnvelope *e) struct Qthread_data_t { int64_t qid; char qf[QFNAMEMAX]; + char _pad1; char dir[QFNAMEMAX]; /* item to load. */ - + char _pad2; int (*deliver)(MmsEnvelope *e); }; @@ -1104,11 +1105,12 @@ static void pgq_queue_run(char *dir, if ((qfname = PQgetvalue(r, i, 1)) != NULL && (qid = PQgetvalue(r, i, 0)) != NULL) { struct Qthread_data_t *d = gw_malloc(sizeof *d); - - memset(d, 0, sizeof *d); + d->qid = strtoull(qid, NULL, 10); strncpy(d->qf, qfname, sizeof d->qf); strncpy(d->dir, dir, sizeof d->dir); + d->_pad1 = d->_pad2 = 0; /* Just in case! */ + d->deliver = deliver; gwlist_produce(items_list, d); diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 4730041..d2afb90 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -1476,6 +1476,8 @@ static void dispatch_sendmms_recv(List *rl) _xctype = http_cgi_variable(cgivar_ctypes, "content"); if (_xctype) ctype = octstr_duplicate(_xctype); + else + ctype = octstr_create("application/octet-stream"); } else if (h->body && tparse != 0) { /* if all above fails, use send-mms msg body if any. */ data = octstr_duplicate(h->body); diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index 5bdacce..8c1efd4 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -58,7 +58,7 @@ static Octstr *admin_deny_ip = NULL; static gwthread_func_t *mmsc_receiver_func; -struct SendMmsPortInfo sendmms_port; +struct SendMmsPortInfo sendmms_port = {-1}; struct MmsBoxMTfilter *mt_filter = NULL; @@ -211,10 +211,14 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) #ifdef HAVE_LIBSSL mms_cfg_get_bool(cfg, grp, octstr_imm("sendmms-port-ssl"), &send_port_ssl); #endif - if (http_open_port(sendmms_port.port, send_port_ssl) < 0) + + if (sendmms_port.port > 0 && + http_open_port(sendmms_port.port, send_port_ssl) < 0) mms_error(0, "mmsbox", NULL, "Failed to start sendmms HTTP server on %ld: %s!", - sendmms_port.port, - strerror(errno)); + sendmms_port.port, + strerror(errno)); + else + sendmms_port.port = -1; sendmms_port.allow_ip = mms_cfg_get(cfg, grp, octstr_imm("allow-ip")); sendmms_port.deny_ip = mms_cfg_get(cfg, grp, octstr_imm("deny-ip"));