Module: kamailio
Branch: master
Commit: 2aa614d49f4917faec62534a51fcf8ddfc5fb870
URL:
https://github.com/kamailio/kamailio/commit/2aa614d49f4917faec62534a51fcf8d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-10-25T12:55:06+02: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
---
Modified: src/lib/srdb1/db_id.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2aa614d49f4917faec62534a51fcf8d…
Patch:
https://github.com/kamailio/kamailio/commit/2aa614d49f4917faec62534a51fcf8d…
---
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;
}