Module: kamailio Branch: 5.3 Commit: e591ff9ded3e3ab8478c7a574c64e27ff35c3e91 URL: https://github.com/kamailio/kamailio/commit/e591ff9ded3e3ab8478c7a574c64e27f...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Henning Westerholt hw@skalatan.de Date: 2019-10-29T14:52:33+01:00
lib/srdb1: detect if ipv6 address is between square brakets
- if not, let it be host part with surrounding brakets, because it can by a mysql conf group name
(cherry picked from commit 2aa614d49f4917faec62534a51fcf8ddfc5fb870)
---
Modified: src/lib/srdb1/db_id.c
---
Diff: https://github.com/kamailio/kamailio/commit/e591ff9ded3e3ab8478c7a574c64e27f... Patch: https://github.com/kamailio/kamailio/commit/e591ff9ded3e3ab8478c7a574c64e27f...
---
diff --git a/src/lib/srdb1/db_id.c b/src/lib/srdb1/db_id.c index 74788ff9bd..094baaa0dd 100644 --- a/src/lib/srdb1/db_id.c +++ b/src/lib/srdb1/db_id.c @@ -29,6 +29,7 @@ #include "db_id.h" #include "../../core/dprint.h" #include "../../core/mem/mem.h" +#include "../../core/resolve.h" #include "../../core/pt.h" #include "../../core/ut.h" #include <stdlib.h> @@ -111,6 +112,7 @@ static int parse_db_url(struct db_id* id, const str* url) unsigned int len, i, j, a, foundanother, ipv6_flag=0; const char* begin; char* prev_token; + str sval = STR_NULL;
foundanother = 0; prev_token = 0; @@ -253,7 +255,14 @@ static int parse_db_url(struct db_id* id, const str* url) case ST_HOST6: switch(url->s[i]) { case ']': - ipv6_flag = 1; + sval.s = (char*)begin; + sval.len = url->s + i - begin; + if(str2ip6(&sval)==NULL) { + ipv6_flag = 0; + begin -= 1; + } else { + ipv6_flag = 1; + } st = ST_HOST; break; }