1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-12 20:58:37 +03:00

s3:smbd: disconnect the all client connections if a ctdb public ip dropped

For now we keep it simple and any disconnect on a connection that
used a ctdb public address, will disconnect all other remaining
connections.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11898

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
This commit is contained in:
Stefan Metzmacher 2020-06-25 15:59:42 +02:00
parent af51b75c61
commit 79eaa196dc
3 changed files with 36 additions and 0 deletions

View File

@ -361,6 +361,7 @@ struct smbXsrv_connection {
const struct tsocket_address *local_address;
const struct tsocket_address *remote_address;
const char *remote_hostname;
bool has_ctdb_public_ip;
enum protocol_types protocol;

View File

@ -2802,6 +2802,25 @@ static NTSTATUS smbd_register_ips(struct smbXsrv_connection *xconn,
return NT_STATUS_NO_MEMORY;
}
if (xconn->client->server_multi_channel_enabled) {
struct ctdb_public_ip_list_old *ips = NULL;
ret = ctdbd_control_get_public_ips(cconn,
0, /* flags */
state,
&ips);
if (ret != 0) {
return NT_STATUS_INTERNAL_ERROR;
}
xconn->has_ctdb_public_ip = ctdbd_find_in_public_ips(ips, srv);
TALLOC_FREE(ips);
if (xconn->has_ctdb_public_ip) {
DBG_DEBUG("CTDB public ip on %s\n",
smbXsrv_connection_dbg(xconn));
}
}
ret = ctdbd_register_ips(cconn, srv, clnt, release_ip, state);
if (ret != 0) {
return map_nt_error_from_unix(ret);

View File

@ -1635,6 +1635,22 @@ void smbd_server_connection_terminate_ex(struct smbXsrv_connection *xconn,
smbXsrv_connection_dbg(xconn), num_ok,
reason, location);
if (xconn->has_ctdb_public_ip) {
/*
* If the connection has a ctdb public address
* we disconnect all client connections,
* as the public address might be moved to
* a different node.
*
* In future we may recheck which node currently
* holds this address, but for now we keep it simple.
*/
smbd_server_disconnect_client_ex(xconn->client,
reason,
location);
return;
}
if (num_ok != 0) {
struct tevent_req *subreq = NULL;