1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

ctdb-protocol: Allow rfc5952 "[2001:db8::1]:80" ipv6 notation

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14934
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit 224e99804e)
This commit is contained in:
Volker Lendecke 2021-12-23 11:52:38 +01:00 committed by Jule Anger
parent 70d81ab148
commit 870991a12c

View File

@ -240,6 +240,19 @@ static int ip_from_string(const char *str, ctdb_sock_addr *addr)
uint8_t ipv4_mapped_prefix[12] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff
};
size_t len = strlen(str);
char s[64];
len = strlcpy(s, str, sizeof(s));
if (len >= sizeof(s)) {
return EINVAL;
}
if ((len >= 2) && (s[0] == '[') && (s[len-1] == ']')) {
s[len-1] = '\0';
str = s+1;
p = strrchr(str, ':');
}
ret = ipv6_from_string(str, &addr->ip6);
if (ret != 0) {