Change in osmo-mgw[master]: mgw, mgcp-li: Handle X-Osmux param name as case insensitive

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun May 19 07:30:47 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/14043 )

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

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
---
M src/libosmo-mgcp-client/mgcp_client.c
M src/libosmo-mgcp/mgcp_msg.c
M src/libosmo-mgcp/mgcp_protocol.c
3 files changed, 10 insertions(+), 7 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index d65a799..7074328 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -403,12 +403,12 @@
 	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 @@
 				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 */
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index a31bff4..59e0e91 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -360,12 +360,12 @@
 	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;
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 0831abb..74926ad 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -816,7 +816,8 @@
 			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 @@
 			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;

-- 
To view, visit https://gerrit.osmocom.org/14043
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iac073f1db46569b46eddeaecc9934a2986bd50f1
Gerrit-Change-Number: 14043
Gerrit-PatchSet: 3
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190519/5c9ca1a0/attachment.html>


More information about the gerrit-log mailing list