diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index 49732e4..4173e43 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,6 @@ +2009-02-03 P. A. Bagyenda + * Fix: url replacement in SMIL + * Fix: sendmms port setup bug in mmsbox 2009-01-28 P. A. Bagyenda * Minor fix: mmsbox sendmms default content type 2009-01-22 P. A. Bagyenda diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index d2afb90..169a595 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -852,19 +852,32 @@ static Octstr *get_toplevel_url(Octstr *url) } /* little dirty method to see if file begins with url scheme. */ -static int has_url_scheme(char *url) +static int has_url_scheme(char *url, int *supported_scheme) { char *p = strstr(url, "://"); - char *q = strstr(url, "data:"); /* data url scheme. */ - if (q && q == url) + *supported_scheme = 1; + + if (strstr(url, "data:") == url || /* data: url scheme */ + strstr(url, "http://") == url || +#ifdef HAVE_LIBSSL + strstr(url, "https://") == url || +#endif + strstr(url, "file://") == url) return 1; - if (!p) + + if (p) { + + for (p--; p >= url; p--) + if (!isalpha(*p)) + break; + if (p < url) { + *supported_scheme = 0; /* we don't support this one. */ + return 1; + } else + return 0; + } else return 0; - for (p -= 1; p >= url; p--) - if (!isalpha(*p)) - return 0; - return 1; } static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, @@ -877,7 +890,8 @@ static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, char *src = NULL; int isurl, slash_prefix; Octstr *cid = NULL; - + int supported_url_scheme = 0; + /* For each node in the smil doc, if it has an src attribute, then: * - if our type of base_url is FILE *and the src attribute does not look * like a url, then file the file referenced, load it into the message and go @@ -894,15 +908,12 @@ static int add_msg_part(MIMEEntity *res, xmlNodePtr node, Octstr *base_url, goto done; } - isurl = has_url_scheme(src); + isurl = has_url_scheme(src, &supported_url_scheme); slash_prefix = (src[0] == '/'); -#if 0 /* we now support file:// */ - if (isurl && strstr(src, "http") != src) /* Only http and https allowed! */ + if (isurl && !supported_url_scheme) goto done; -#endif - - if (isurl) + else if (isurl) curl = octstr_create(src); else if (slash_prefix) { if (type == URL_TYPE) diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index 8c1efd4..637e242 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -213,12 +213,12 @@ int mms_load_mmsbox_settings(Octstr *fname, gwthread_func_t *mmsc_handler_func) #endif if (sendmms_port.port > 0 && - http_open_port(sendmms_port.port, send_port_ssl) < 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)); - 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"));