Change in osmo-mgw[master]: mgcp-client: Sanitize implementation of mgcp_client_rtpbridge_wildcard
Pau Espin Pedrol
gerrit-no-reply at lists.osmocom.org
Wed Apr 17 09:45:56 UTC 2019
Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/13665 )
Change subject: mgcp-client: Sanitize implementation of mgcp_client_rtpbridge_wildcard
......................................................................
mgcp-client: Sanitize implementation of mgcp_client_rtpbridge_wildcard
* Get rid of string define containing printf statements
* Split name from rest of checks to easily add new names later
Change-Id: I46e05a7a3432733976760bbf1c5deb4f7610db11
---
M src/libosmo-mgcp-client/mgcp_client.c
1 file changed, 9 insertions(+), 5 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 17f40b9..2dcab62 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -828,16 +828,15 @@
return mgcp->actual.endpoint_domain_name[0] ? mgcp->actual.endpoint_domain_name : "mgw";
}
-const char *mgcp_client_rtpbridge_wildcard(const struct mgcp_client *mgcp)
+static const char *_mgcp_client_name_append_domain(const struct mgcp_client *mgcp, char *name)
{
static char endpoint[MGCP_ENDPOINT_MAXLEN];
int rc;
-#define RTPBRIDGE_WILDCARD_FMT "rtpbridge/*@%s"
- rc = snprintf(endpoint, sizeof(endpoint), RTPBRIDGE_WILDCARD_FMT, mgcp_client_endpoint_domain(mgcp));
+ rc = snprintf(endpoint, sizeof(endpoint), "%s@%s", name, mgcp_client_endpoint_domain(mgcp));
if (rc > sizeof(endpoint) - 1) {
- LOGP(DLMGCP, LOGL_ERROR, "MGCP endpoint exceeds maximum length of %zu: '" RTPBRIDGE_WILDCARD_FMT "'\n",
- sizeof(endpoint) - 1, mgcp_client_endpoint_domain(mgcp));
+ LOGP(DLMGCP, LOGL_ERROR, "MGCP endpoint exceeds maximum length of %zu: '%s@%s'\n",
+ sizeof(endpoint) - 1, name, mgcp_client_endpoint_domain(mgcp));
return NULL;
}
if (rc < 1) {
@@ -847,6 +846,11 @@
return endpoint;
}
+const char *mgcp_client_rtpbridge_wildcard(const struct mgcp_client *mgcp)
+{
+ return _mgcp_client_name_append_domain(mgcp, "rtpbridge/*");
+}
+
struct mgcp_response_pending * mgcp_client_pending_add(
struct mgcp_client *mgcp,
mgcp_trans_id_t trans_id,
--
To view, visit https://gerrit.osmocom.org/13665
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: I46e05a7a3432733976760bbf1c5deb4f7610db11
Gerrit-Change-Number: 13665
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190417/01780581/attachment.html>
More information about the gerrit-log
mailing list