]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tcp: Remove a use of ctdb_addr_to_str()
authorMartin Schwenke <mschwenke@ddn.com>
Sun, 18 Aug 2024 22:48:43 +0000 (08:48 +1000)
committerVolker Lendecke <vl@samba.org>
Tue, 20 Aug 2024 14:24:14 +0000 (14:24 +0000)
This one is in a rarely used error path, so call a function that
talloc()s the string instead.

Again, this will also print the port, which might be useful if we ever
add the ability to also specify ports in the nodes list.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Aug 20 14:24:14 UTC 2024 on atb-devel-224

ctdb/tcp/tcp_connect.c
ctdb/wscript

index 29825e12332a73f715f5cc84381e9b5c273e007a..1ad3fa74d55d3a4f7da892b45e4e2d2f33762076 100644 (file)
@@ -36,6 +36,8 @@
 #include "common/logging.h"
 #include "common/path.h"
 
+#include "protocol/protocol_util.h"
+
 #include "ctdb_tcp.h"
 
 /*
@@ -319,8 +321,14 @@ static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
 
        node = ctdb_ip_to_node(ctdb, &addr);
        if (node == NULL) {
-               D_ERR("Refused connection from unknown node %s\n",
-                     ctdb_addr_to_str(&addr));
+               char *t = ctdb_sock_addr_to_string(ctcp, &addr, true);
+               if (t == NULL) {
+                       DBG_ERR("Refused connection from unparsable node\n");
+                       goto failed;
+               }
+
+               D_ERR("Refused connection from unknown node %s\n", t);
+               talloc_free(t);
                goto failed;
        }
 
index a211afbc77d4f82b5f13e4b23afc464be5c1d17b..855989a2493df29ee3a8a90b78d8447362d6c0ff 100644 (file)
@@ -400,7 +400,7 @@ def build(bld):
                         source=bld.SUBDIR('tcp',
                                           'tcp_connect.c tcp_init.c tcp_io.c'),
                         includes='include',
-                        deps='replace tdb talloc tevent')
+                        deps='replace tdb talloc tevent ctdb-protocol-util')
 
     ib_deps = ''
     if bld.env.HAVE_INFINIBAND: