mgw, mgcp-li: Handle X-Osmux param name as case insensitive

RFC3435 states most text (except SDP) must be handled as case
insensitive.

Related: OS#4001
Change-Id: Iac073f1db46569b46eddeaecc9934a2986bd50f1
This commit is contained in:
Pau Espin Pedrol
2019-05-14 16:23:24 +02:00
parent 1442c5a99e
commit c1bf4694e7
3 changed files with 10 additions and 7 deletions

View File

@@ -403,12 +403,12 @@ static int mgcp_parse_osmux_cid(const char *line)
int osmux_cid;
if (strstr(line + 2, "Osmux: *")) {
if (strcasecmp(line + 2, "Osmux: *") == 0) {
LOGP(DLMGCP, LOGL_DEBUG, "Parsed wilcard Osmux CID\n");
return -1;
}
if (sscanf(line + 2, "Osmux: %u", &osmux_cid) != 1) {
if (sscanf(line + 2 + 7, "%u", &osmux_cid) != 1) {
LOGP(DLMGCP, LOGL_ERROR, "Failed parsing Osmux in MGCP msg line: %s\n",
line);
return -2;
@@ -602,7 +602,8 @@ static int parse_head_params(struct mgcp_response *r)
goto exit;
break;
case 'X':
if (strncmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
case 'x':
if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
rc = mgcp_parse_osmux_cid(line);
if (rc < 0) {
/* -1: we don't want wildcards in response. -2: error */

View File

@@ -360,12 +360,12 @@ int mgcp_parse_osmux_cid(const char *line)
int osmux_cid;
if (strstr(line + 2, "Osmux: *")) {
if (strcasecmp(line + 2, "Osmux: *") == 0) {
LOGP(DLMGCP, LOGL_DEBUG, "Parsed wilcard Osmux CID\n");
return -1;
}
if (sscanf(line + 2, "Osmux: %u", &osmux_cid) != 1) {
if (sscanf(line + 2 + 7, "%u", &osmux_cid) != 1) {
LOGP(DLMGCP, LOGL_ERROR, "Failed parsing Osmux in MGCP msg line: %s\n",
line);
return -2;

View File

@@ -816,7 +816,8 @@ static struct msgb *handle_create_con(struct mgcp_parse_data *p)
mode = (const char *)line + 3;
break;
case 'X':
if (strncmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
case 'x':
if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
/* If osmux is disabled, just skip setting it up */
if (!p->endp->cfg->osmux)
break;
@@ -1099,7 +1100,8 @@ static struct msgb *handle_modify_con(struct mgcp_parse_data *p)
silent = strcmp("noanswer", line + 3) == 0;
break;
case 'X':
if (strncmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
case 'x':
if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
/* If osmux is disabled, just skip setting it up */
if (!p->endp->cfg->osmux)
break;