diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-08-29 02:30:39 +0200 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-09-07 04:14:51 +0200 |
commit | a77eade744933b8ad37e48b0f96a9cd0f5b89e83 (patch) | |
tree | 3b47e1e2e5379a2ca36379890c167147903e5ed9 /tests | |
parent | 6531726a02c1da607789ab9327ab29dce3a0d2f5 (diff) |
mgcp_conn_get(): match conn Id ('I:') despite leading zeros
The Connection Identifier is defined as a hex string, so clients may send the
ID back with or without leading zeros. Ignore all leading zeros when comparing.
A specific SCCPlite MSC is observed to DLCX with Connection Identifier with
leading zeros removed, which would mismatch pefore this patch.
Extend test_conn_id_matching() in mgcp_test.c to include leading zero tests.
Now, mgcp_conn_get() would match a valid id with *any* amount of leading zeros,
even if that far surpasses the permitted conn id length. Valid lengths of
incoming conn ids should be and is checked elsewhere.
Related: OS#3509
Change-Id: If55a64a2da47b6eff035711c08e4114d70dbec91
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mgcp/mgcp_test.c | 6 | ||||
-rw-r--r-- | tests/mgcp/mgcp_test.ok | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c index 99ddd7186..b9f7253bd 100644 --- a/tests/mgcp/mgcp_test.c +++ b/tests/mgcp/mgcp_test.c @@ -1759,8 +1759,14 @@ void test_conn_id_matching() int i; const char *conn_id_generated = "000023AB"; const char *conn_id_request[] = { + "23AB", + "0023AB", "000023AB", + "00000023AB", + "23ab", + "0023ab", "000023ab", + "00000023ab", }; printf("\nTesting %s\n", __func__); diff --git a/tests/mgcp/mgcp_test.ok b/tests/mgcp/mgcp_test.ok index f50f487e8..28e9aadeb 100644 --- a/tests/mgcp/mgcp_test.ok +++ b/tests/mgcp/mgcp_test.ok @@ -1171,6 +1171,12 @@ p10, aPCMU -> (null) '10,a :PCMU' -> '(null)' Testing test_conn_id_matching +needle='23AB' found '000023AB' +needle='0023AB' found '000023AB' needle='000023AB' found '000023AB' +needle='00000023AB' found '000023AB' +needle='23ab' found '000023AB' +needle='0023ab' found '000023AB' needle='000023ab' found '000023AB' +needle='00000023ab' found '000023AB' Done |