From: Martin Schwenke Date: Sun, 18 Aug 2024 22:48:43 +0000 (+1000) Subject: ctdb-tcp: Remove a use of ctdb_addr_to_str() X-Git-Tag: tdb-1.4.13~1341 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8edb1fd13c1d1c02a25f5991d985c1c81b066760;p=thirdparty%2Fsamba.git ctdb-tcp: Remove a use of ctdb_addr_to_str() 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 Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Tue Aug 20 14:24:14 UTC 2024 on atb-devel-224 --- diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c index 29825e12332..1ad3fa74d55 100644 --- a/ctdb/tcp/tcp_connect.c +++ b/ctdb/tcp/tcp_connect.c @@ -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; } diff --git a/ctdb/wscript b/ctdb/wscript index a211afbc77d..855989a2493 100644 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -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: