The Samba-Bugzilla – Attachment 17069 Details for
Bug 14934
kill_tcp_connections does not work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix ipv6-encoded ipv4 addresses
bug-14934.patch (text/plain), 3.39 KB, created by
Volker Lendecke
on 2022-01-04 09:58:08 UTC
(
hide
)
Description:
Fix ipv6-encoded ipv4 addresses
Filename:
MIME Type:
Creator:
Volker Lendecke
Created:
2022-01-04 09:58:08 UTC
Size:
3.39 KB
patch
obsolete
>From adb8fcae285e59356375946386a0eed0ddecccf5 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Wed, 29 Dec 2021 15:10:28 +0100 >Subject: [PATCH 1/3] ctdb: rindex->strrchr > >According to "man rindex" on debian bullseye rindex() was deprecated >in Posix.1-2001 and removed from Posix.1-2008. > >Signed-off-by: Volker Lendecke <vl@samba.org> >--- > ctdb/protocol/protocol_util.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > >diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c >index 2d0a6f33038..1f1d874167a 100644 >--- a/ctdb/protocol/protocol_util.c >+++ b/ctdb/protocol/protocol_util.c >@@ -230,10 +230,10 @@ static int ip_from_string(const char *str, ctdb_sock_addr *addr) > > /* IPv4 or IPv6 address? > * >- * Use rindex() because we need the right-most ':' below for >+ * Use strrchr() because we need the right-most ':' below for > * IPv4-mapped IPv6 addresses anyway... > */ >- p = rindex(str, ':'); >+ p = strrchr(str, ':'); > if (p == NULL) { > ret = ipv4_from_string(str, &addr->ip); > } else { >@@ -286,7 +286,7 @@ int ctdb_sock_addr_from_string(const char *str, > return EINVAL; > } > >- p = rindex(s, ':'); >+ p = strrchr(s, ':'); > if (p == NULL) { > return EINVAL; > } >@@ -324,7 +324,7 @@ int ctdb_sock_addr_mask_from_string(const char *str, > return EINVAL; > } > >- p = rindex(s, '/'); >+ p = strrchr(s, '/'); > if (p == NULL) { > return EINVAL; > } >-- >2.30.2 > > >From 79dccc1b04ff1ab5ef10ecc901f03c8f79594b47 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Wed, 29 Dec 2021 14:46:14 +0100 >Subject: [PATCH 2/3] ctdb: Save 50 bytes .text segment > >Having this as a small static .text is simpler than having to create >this on the stack. > >Signed-off-by: Volker Lendecke <vl@samba.org> >--- > ctdb/protocol/protocol_util.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c >index 1f1d874167a..0a0998f1847 100644 >--- a/ctdb/protocol/protocol_util.c >+++ b/ctdb/protocol/protocol_util.c >@@ -237,7 +237,7 @@ static int ip_from_string(const char *str, ctdb_sock_addr *addr) > if (p == NULL) { > ret = ipv4_from_string(str, &addr->ip); > } else { >- uint8_t ipv4_mapped_prefix[12] = { >+ static const uint8_t ipv4_mapped_prefix[12] = { > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff > }; > >-- >2.30.2 > > >From 3f9b838c4fa86943338ba4bcd0323767cf18c8c5 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Thu, 23 Dec 2021 11:52:38 +0100 >Subject: [PATCH 3/3] ctdb: 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> >--- > ctdb/protocol/protocol_util.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > >diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c >index 0a0998f1847..c5d0eb6480e 100644 >--- a/ctdb/protocol/protocol_util.c >+++ b/ctdb/protocol/protocol_util.c >@@ -240,6 +240,19 @@ static int ip_from_string(const char *str, ctdb_sock_addr *addr) > static const 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) { >-- >2.30.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 14934
:
17064
| 17069 |
17085