summaryrefslogtreecommitdiffstats
path: root/ctdb/tcp
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@samba.org>2008-02-19 14:35:15 +1100
committerRonnie Sahlberg <sahlberg@samba.org>2008-02-19 14:35:15 +1100
commit87b38e01b2f27314a8283b7fd079e5348d2e97fd (patch)
tree1dd49efd28718bc7adb103e71f4468cf75011e2a /ctdb/tcp
parentbef60e82001c8398be57ea9a5c69cffb5cb921cb (diff)
downloadsamba-87b38e01b2f27314a8283b7fd079e5348d2e97fd.tar.gz
samba-87b38e01b2f27314a8283b7fd079e5348d2e97fd.tar.xz
samba-87b38e01b2f27314a8283b7fd079e5348d2e97fd.zip
the ctdb structure must make its own copy of the ->address field and not just
copy the content of the nodes structure. this ctdb_address structure contains a pointer which is talloced hanging off the structure itself. If we copy the content of this structure as we did in assigning to ctdb->address from nodes[i] then if we talloc_free() the node structure we end up with a wild pointer in ctdb->address (This used to be ctdb commit 644a7248548260d37df432979b129797750907f4)
Diffstat (limited to 'ctdb/tcp')
-rw-r--r--ctdb/tcp/tcp_connect.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index 1bad440d01..f85e3dfdeb 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -302,7 +302,8 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
DEBUG(DEBUG_CRIT,("Unable to bind to any of the node addresses - giving up\n"));
goto failed;
}
- ctdb->address = ctdb->nodes[i]->address;
+ ctdb->address.address = talloc_strdup(ctdb, ctdb->nodes[i]->address.address);
+ ctdb->address.port = ctdb->nodes[i]->address.port;
ctdb->name = talloc_asprintf(ctdb, "%s:%u",
ctdb->address.address,
ctdb->address.port);
@@ -363,7 +364,7 @@ int ctdb_tcp_listen(struct ctdb_context *ctdb)
#endif
sock.sin_port = htons(ctdb->address.port);
sock.sin_family = PF_INET;
-
+
if (ctdb_tcp_get_address(ctdb, ctdb->address.address,
&sock.sin_addr) != 0) {
goto failed;