[SCM] Samba Shared Repository - branch v4-15-stable updated
Jule Anger
janger at samba.org
Mon Sep 13 13:46:35 UTC 2021
The branch, v4-15-stable has been updated
via 9f5b76a42d7 VERSION: Disable GIT_SNAPSHOT for the 4.15.0rc7 release.
via 54d6868e169 WHATSNEW: Add release notes for Samba 4.15.0rc7.
via 8d4c482410c ctdb-daemon: Don't mark a node as unhealthy when connecting to it
via 7c353e6e383 ctdb-daemon: Ignore flag changes for disconnected nodes
via 665b380d249 ctdb-daemon: Simplify ctdb_control_modflags()
via f340dcbc675 ctdb-recoverd: Mark CTDB_SRVID_SET_NODE_FLAGS obsolete
via c8a9f9147c2 ctdb-daemon: Don't bother sending CTDB_SRVID_SET_NODE_FLAGS
via 17e0a052da0 ctdb-daemon: Modernise remaining debug macro in this function
via 05d2f5e41c7 ctdb-daemon: Update logging for flag changes
via e634ddde5e6 ctdb-daemon: Correct the condition for logging unchanged flags
via 9f06ec8b108 ctdb-tools: Use disable and enable controls in tool
via 772126bd68b ctdb-client: Add client code for disable/enable controls
via 8ed5910b847 ctdb_daemon: Implement controls DISABLE_NODE/ENABLE_NODE
via b5f8913f359 ctdb-daemon: Start as disabled means PERMANENTLY_DISABLED
via c61b5e7b489 ctdb-daemon: Factor out a function to get node structure from PNN
via 65d64194b6d ctdb-daemon: Add a helper variable
via 675d68caabc ctdb-protocol: Add marshalling for controls DISABLE_NODE/ENABLE_NODE
via 84a285851d7 ctdb-protocol: Add new controls to disable and enable nodes
via c01d48d7a54 ctdb-recoverd: Push flags for a node if any remote node disagrees
via 2cc4b917f78 ctdb-recoverd: Update the local node map before pushing out flags
via f8fa33ac320 ctdb-recoverd: Add a helper variable
via bddd7db7b2f WHATSNEW: The New VFS
via bd730209109 Don't use sysconf(_SC_NGROUPS_MAX) on macOS for getgroups()
via 92251109fa2 smbd: fix "ea support = no"
via 13ba74a67a3 WHATSNEW: unknown options now trigger an error in all tools
via cc39fca1f5a WHATSNEW: clarify the -e and -s handling for ldb tools
via b52fdad21fb s4/torture/masktest: don't ignore unknown options
via 1eaab01e178 s4/torture/locktest: don't ignore unknown options
via 047274d1278 s4/torture/gentest: don't ignore unknown options
via 79f231a5484 s4/regtree: don't ignore unknown options
via b87f953efb9 s4/regshell: don't ignore unknown options
via f377070e75b s4/regpatch: don't ignore unknown options
via 9e0b596ab76 s4/regdiff: don't ignore unknown options
via c4dc60a7992 s4/cifsdd: don't ignore unknown options
via c94c2bb7503 testparm: don't ignore unknown options
via 7c0725daaf3 split_tokens: don't ignore unknown options
via ece1e503d84 smbtree: don't ignore unknown options
via 3e5d5713a10 smbget: don't ignore unknown options
via 647e2865eb3 smbcquotas: don't ignore unknown options
via 2270e098c02 smbcacls: don't ignore unknown options
via eeebabe4067 sharesec: don't ignore unknown options
via 9af6e536edd regedit: don't ignore unknown options
via 02144f364e6 profiles: don't ignore unknown options
via 362c9f28a36 pdbedit: don't ignore unknown options
via 609509f8ed1 ntlm_auth: don't ignore unknown options
via 84579c965b1 nmblookup: don't ignore unknown options
via 99eca1a3329 mvxattr: don't ignore unknown options
via df0e4a6b67d log2pcaphex: don't ignore unknown options
via 2f8aabd1761 s3/async-tracker: don't ignore unknown options
via e5f6c2e25c5 vfstest: don't ignore unknown options
via 7bee957378e pdbtest: don't ignore unknown options
via 66dd6cc6286 rpcclient: don't ignore unknown options
via 424135b1796 s3/param: don't ignore unknown options
via 4af952f4ccd source3/lib/smbconf: don't ignore unknown options
via a0e860c2360 nmblookup: don't ignore unknown options
via 6e320e7f767 s4/smbclient: don't ignore unknown options
via 43f57091f7f smbstatus: don't ignore unknown options
via 26ccc96a41d texpect: don't ignore unknown options
via be8c65fb748 smbclient: don't ignore unknown options
via 223ac583cfa selftest: remove unsupported smbcacls option --get
via 619baa2390f lib/cmdline: restore s3 option name --max-protocol for MAXPROTOCOL from 4.14
via ec937b7035d manpages: remove duplicate options from smbclient
via 4ccc9a4c391 selftest: fix ---configfile option
via b2934e2a726 lib/cmdline: fix --configfile handling of POPT_COMMON_CONFIG_ONLY used by ntlm_auth
via 35d474c3030 vfs_btrfs: fix btrfs_fget_compression()
via a7b9904c90b docs: Avoid duplicate information on USER and PASSWD, reference the common section
via 4ad10cf8e82 docs: Document all the other ways to send a password to smbclient et al
via 8416bcce6a7 docs: Ensure to rebuild manpages if samba.entities or samba.version changes
via 33f06d10a03 docs-xml: use upper case for "{client,server} smb3 {signing,encryption} algorithms" values
via 2baaa891bb3 VERSION: Bump version up to Samba 4.15.0rc7...
from 30c5a0e60e8 VERSION: Disable GIT_SNAPSHOT for the 4.15.0rc6 release.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-15-stable
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
VERSION | 2 +-
WHATSNEW.txt | 47 +++++++-
buildtools/wafsamba/wafsamba.py | 6 +-
buildtools/wafsamba/wscript | 5 +-
ctdb/client/client_control_sync.c | 68 ++++++++++++
ctdb/client/client_sync.h | 12 +++
ctdb/include/ctdb_private.h | 2 +
ctdb/protocol/protocol.h | 4 +-
ctdb/protocol/protocol_api.h | 6 ++
ctdb/protocol/protocol_client.c | 36 +++++++
ctdb/protocol/protocol_control.c | 12 +++
ctdb/protocol/protocol_debug.c | 2 +
ctdb/server/ctdb_control.c | 42 ++++++++
ctdb/server/ctdb_daemon.c | 35 ++++--
ctdb/server/ctdb_monitor.c | 67 ++++++------
ctdb/server/ctdb_recoverd.c | 120 +++++++++++----------
ctdb/server/ctdb_server.c | 1 -
ctdb/tests/UNIT/cunit/protocol_test_101.sh | 2 +-
ctdb/tests/src/fake_ctdbd.c | 54 ++++++++++
ctdb/tests/src/protocol_common_ctdb.c | 24 +++++
ctdb/tests/src/protocol_ctdb_test.c | 2 +-
ctdb/tools/ctdb.c | 57 +++-------
docs-xml/build/DTD/samba.entities | 58 +++++++---
docs-xml/manpages/mdsearch.1.xml | 2 +-
docs-xml/manpages/net.8.xml | 2 +-
docs-xml/manpages/nmblookup.1.xml | 2 +-
docs-xml/manpages/rpcclient.1.xml | 2 +-
docs-xml/manpages/samba-regedit.8.xml | 2 +-
docs-xml/manpages/smbcacls.1.xml | 2 +-
docs-xml/manpages/smbclient.1.xml | 63 +----------
docs-xml/manpages/smbcquotas.1.xml | 2 +-
docs-xml/manpages/winexe.1.xml | 2 +-
.../security/clientsmbencryptionalgos.xml | 8 +-
.../smbdotconf/security/clientsmbsigningalgos.xml | 10 +-
.../security/serversmbencryptionalgos.xml | 8 +-
.../smbdotconf/security/serversmbsigningalgos.xml | 10 +-
lib/cmdline/cmdline.c | 5 +-
lib/param/loadparm.h | 4 +-
lib/texpect/texpect.c | 8 +-
libcli/nbt/tools/nmblookup.c | 5 +
libcli/smb/util.c | 14 +--
python/samba/tests/blackbox/smbcacls.py | 2 +-
.../blackbox/smbcacls_propagate_inhertance.py | 2 +-
source3/client/client.c | 6 +-
source3/include/proto.h | 3 +-
source3/lib/smbconf/testsuite.c | 11 +-
source3/lib/system.c | 24 ++++-
source3/lib/system_smbd.c | 2 +-
source3/modules/vfs_btrfs.c | 7 +-
source3/param/test_lp_load.c | 11 +-
source3/rpcclient/rpcclient.c | 6 ++
source3/smbd/sec_ctx.c | 2 +-
source3/smbd/trans2.c | 3 +-
source3/torture/pdbtest.c | 11 +-
source3/torture/vfstest.c | 12 ++-
source3/utils/async-tracker.c | 5 +
source3/utils/log2pcaphex.c | 5 +
source3/utils/mvxattr.c | 5 +
source3/utils/net_help_common.c | 2 +-
source3/utils/nmblookup.c | 5 +
source3/utils/ntlm_auth.c | 6 ++
source3/utils/pdbedit.c | 5 +
source3/utils/profiles.c | 5 +
source3/utils/regedit.c | 8 +-
source3/utils/sharesec.c | 5 +
source3/utils/smbcacls.c | 5 +
source3/utils/smbcquotas.c | 5 +
source3/utils/smbget.c | 5 +
source3/utils/smbtree.c | 12 ++-
source3/utils/split_tokens.c | 11 +-
source3/utils/status.c | 5 +
source3/utils/testparm.c | 11 +-
source4/client/cifsdd.c | 8 +-
source4/client/client.c | 5 +
source4/lib/registry/tools/regdiff.c | 5 +
source4/lib/registry/tools/regpatch.c | 7 ++
source4/lib/registry/tools/regshell.c | 7 ++
source4/lib/registry/tools/regtree.c | 7 ++
source4/torture/gentest.c | 5 +
source4/torture/locktest.c | 5 +
source4/torture/masktest.c | 5 +
testprogs/blackbox/test_client_kerberos.sh | 2 +-
testsuite/smbd/sec_ctx_utils.c | 2 +-
83 files changed, 789 insertions(+), 291 deletions(-)
Changeset truncated at 500 lines:
diff --git a/VERSION b/VERSION
index 31a0c312220..f57bed5d2a2 100644
--- a/VERSION
+++ b/VERSION
@@ -87,7 +87,7 @@ SAMBA_VERSION_PRE_RELEASE=
# e.g. SAMBA_VERSION_RC_RELEASE=1 #
# -> "3.0.0rc1" #
########################################################
-SAMBA_VERSION_RC_RELEASE=6
+SAMBA_VERSION_RC_RELEASE=7
########################################################
# To mark SVN snapshots this should be set to 'yes' #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 739a0b319ca..bf63cf2b908 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,7 +1,7 @@
Release Announcements
=====================
-This is the sixth release candidate of Samba 4.15. This is *not*
+This is the seventh release candidate of Samba 4.15. This is *not*
intended for production environments and is designed for testing
purposes only. Please report any defects via the Samba bug reporting
system at https://bugzilla.samba.org/.
@@ -64,6 +64,16 @@ bugs CVE-2021-37750 and CVE-2021-36222
NEW FEATURES/CHANGES
====================
+VFS
+---
+
+The effort to modernize Samba's VFS interface is complete and Samba 4.15.0 ships
+with a modernized VFS designed for the post SMB1 world.
+
+For details please refer to the documentation at source3/modules/The_New_VFS.txt
+or visit the <https://wiki.samba.org/index.php/The_New_VFS>.
+
+
Bind DLZ: add the ability to set allow/deny lists for zone transfer clients
---------------------------------------------------------------------------
@@ -104,6 +114,9 @@ These should be stories of the past now. A new command line parser has been
implemented with sanity checking. Also the command line interface has been
simplified and provides better control for encryption, signing and kerberos.
+Previously many tools silently ignored unknown options. To prevent unexpected
+behaviour all tools will now consistently reject unknown options.
+
Also several command line options have a smb.conf variable to control the
default now.
@@ -131,9 +144,11 @@ Options removed:
### Duplicates in command line utils
-ldbadd/ldbsearch/ldbdel/ldbmodify/ldbrename:
--e is not available for --editor anymore
--s is not used for --configfile anymore
+ldbadd/ldbdel/ldbedit/ldbmodify/ldbrename/ldbsearch:
+-e is still available as an alias for --editor,
+ as it used to be.
+-s is no longer reported as an alias for --configfile,
+ it never worked that way as it was shadowed by '-s' for '--scope'.
ndrdump:
-l is not available for --load-dso anymore
@@ -341,6 +356,30 @@ smb.conf changes
winbind scan trusted domains Changed No
+CHANGES SINCE 4.15.0rc6
+=======================
+
+o Andrew Bartlett <abartlet at samba.org>
+ * BUG 14791: All the ways to specify a password are not documented.
+
+o Ralph Boehme <slow at samba.org>
+ * BUG 14790: vfs_btrfs compression support broken.
+ * BUG 14828: Problems with commandline parsing.
+ * BUG 14829: smbd crashes when "ea support" is set to no.
+
+o Stefan Metzmacher <metze at samba.org>
+ * BUG 14825: "{client,server} smb3 {signing,encryption} algorithms" should
+ use the same strings as smbstatus output.
+ * BUG 14828: Problems with commandline parsing.
+
+o Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
+ * BUG 8773: smbd fails to run as root because it belongs to more than 16
+ groups on MacOS X.
+
+o Martin Schwenke <martin at meltin.net>
+ * BUG 14784: Fix CTDB flag/status update race conditions.
+
+
CHANGES SINCE 4.15.0rc5
=======================
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 4fe9daf160e..0427c90ca80 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -946,9 +946,13 @@ def SAMBAMANPAGES(bld, manpages, extra_source=None):
bld.env.SAMBA_CATALOGS = 'file:///etc/xml/catalog file:///usr/local/share/xml/catalog file://' + bld.env.SAMBA_CATALOG
for m in manpages.split():
- source = m + '.xml'
+ source = [m + '.xml']
if extra_source is not None:
source = [source, extra_source]
+ # ${SRC[1]} and ${SRC[2]} are not referenced in the
+ # SAMBA_GENERATOR but trigger the dependency calculation so
+ # ensures that manpages are rebuilt when these change.
+ source += ['build/DTD/samba.entities', 'build/DTD/samba.build.version']
bld.SAMBA_GENERATOR(m,
source=source,
target=m,
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 1aadb9570e1..def13f71c93 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -542,7 +542,10 @@ struct foo bar = { .y = 'X', .x = 1 };
conf.CHECK_HEADERS('strings.h inttypes.h stdint.h unistd.h minix/config.h', add_headers=True)
conf.CHECK_HEADERS('ctype.h', add_headers=True)
- if sys.platform != 'darwin':
+ if sys.platform == 'darwin':
+ conf.DEFINE('_DARWIN_C_SOURCE', 1, add_to_cflags=True)
+ conf.DEFINE('_DARWIN_UNLIMITED_GETGROUPS', 1, add_to_cflags=True)
+ else:
conf.CHECK_HEADERS('standards.h', add_headers=True)
conf.CHECK_HEADERS('stdbool.h stdint.h stdarg.h vararg.h', add_headers=True)
diff --git a/ctdb/client/client_control_sync.c b/ctdb/client/client_control_sync.c
index b9a25ce2b2c..e9f97dd0f30 100644
--- a/ctdb/client/client_control_sync.c
+++ b/ctdb/client/client_control_sync.c
@@ -2660,3 +2660,71 @@ int ctdb_ctrl_tunnel_deregister(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
return 0;
}
+
+int ctdb_ctrl_disable_node(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct ctdb_client_context *client,
+ int destnode,
+ struct timeval timeout)
+{
+ struct ctdb_req_control request;
+ struct ctdb_reply_control *reply;
+ int ret;
+
+ ctdb_req_control_disable_node(&request);
+ ret = ctdb_client_control(mem_ctx,
+ ev,
+ client,
+ destnode,
+ timeout,
+ &request,
+ &reply);
+ if (ret != 0) {
+ D_ERR("Control DISABLE_NODE failed to node %u, ret=%d\n",
+ destnode,
+ ret);
+ return ret;
+ }
+
+ ret = ctdb_reply_control_disable_node(reply);
+ if (ret != 0) {
+ D_ERR("Control DISABLE_NODE failed, ret=%d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
+int ctdb_ctrl_enable_node(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct ctdb_client_context *client,
+ int destnode,
+ struct timeval timeout)
+{
+ struct ctdb_req_control request;
+ struct ctdb_reply_control *reply;
+ int ret;
+
+ ctdb_req_control_enable_node(&request);
+ ret = ctdb_client_control(mem_ctx,
+ ev,
+ client,
+ destnode,
+ timeout,
+ &request,
+ &reply);
+ if (ret != 0) {
+ D_ERR("Control ENABLE_NODE failed to node %u, ret=%d\n",
+ destnode,
+ ret);
+ return ret;
+ }
+
+ ret = ctdb_reply_control_enable_node(reply);
+ if (ret != 0) {
+ D_ERR("Control ENABLE_NODE failed, ret=%d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
diff --git a/ctdb/client/client_sync.h b/ctdb/client/client_sync.h
index dc8b67395e3..b8f5d905857 100644
--- a/ctdb/client/client_sync.h
+++ b/ctdb/client/client_sync.h
@@ -482,6 +482,18 @@ int ctdb_ctrl_tunnel_deregister(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
int destnode, struct timeval timeout,
uint64_t tunnel_id);
+int ctdb_ctrl_disable_node(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct ctdb_client_context *client,
+ int destnode,
+ struct timeval timeout);
+
+int ctdb_ctrl_enable_node(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct ctdb_client_context *client,
+ int destnode,
+ struct timeval timeout);
+
/* from client/client_message_sync.c */
int ctdb_message_recd_update_ip(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 8eb6686f953..f5e647f08a5 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -565,6 +565,8 @@ int daemon_deregister_message_handler(struct ctdb_context *ctdb,
void daemon_tunnel_handler(uint64_t tunnel_id, TDB_DATA data,
void *private_data);
+struct ctdb_node *ctdb_find_node(struct ctdb_context *ctdb, uint32_t pnn);
+
int ctdb_start_daemon(struct ctdb_context *ctdb,
bool interactive,
bool test_mode_enabled);
diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h
index e4b76c6b986..5f788f6f2a8 100644
--- a/ctdb/protocol/protocol.h
+++ b/ctdb/protocol/protocol.h
@@ -137,7 +137,7 @@ struct ctdb_call {
/* SRVID to inform clients that an IP address has been taken over */
#define CTDB_SRVID_TAKE_IP 0xF301000000000000LL
-/* SRVID to inform recovery daemon of the node flags */
+/* SRVID to inform recovery daemon of the node flags - OBSOLETE */
#define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
/* SRVID to inform recovery daemon to update public ip assignment */
@@ -376,6 +376,8 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
CTDB_CONTROL_VACUUM_FETCH = 154,
CTDB_CONTROL_DB_VACUUM = 155,
CTDB_CONTROL_ECHO_DATA = 156,
+ CTDB_CONTROL_DISABLE_NODE = 157,
+ CTDB_CONTROL_ENABLE_NODE = 158,
};
#define MAX_COUNT_BUCKETS 16
diff --git a/ctdb/protocol/protocol_api.h b/ctdb/protocol/protocol_api.h
index 7bbe33b22fe..499d9329c54 100644
--- a/ctdb/protocol/protocol_api.h
+++ b/ctdb/protocol/protocol_api.h
@@ -605,6 +605,12 @@ void ctdb_req_control_echo_data(struct ctdb_req_control *request,
struct ctdb_echo_data *echo_data);
int ctdb_reply_control_echo_data(struct ctdb_reply_control *reply);
+void ctdb_req_control_disable_node(struct ctdb_req_control *request);
+int ctdb_reply_control_disable_node(struct ctdb_reply_control *reply);
+
+void ctdb_req_control_enable_node(struct ctdb_req_control *request);
+int ctdb_reply_control_enable_node(struct ctdb_reply_control *reply);
+
/* From protocol/protocol_debug.c */
void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
diff --git a/ctdb/protocol/protocol_client.c b/ctdb/protocol/protocol_client.c
index 6d850be86df..dcce83f02a1 100644
--- a/ctdb/protocol/protocol_client.c
+++ b/ctdb/protocol/protocol_client.c
@@ -2360,3 +2360,39 @@ int ctdb_reply_control_echo_data(struct ctdb_reply_control *reply)
return reply->status;
}
+
+/* CTDB_CONTROL_DISABLE_NODE */
+
+void ctdb_req_control_disable_node(struct ctdb_req_control *request)
+{
+ request->opcode = CTDB_CONTROL_DISABLE_NODE;
+ request->pad = 0;
+ request->srvid = 0;
+ request->client_id = 0;
+ request->flags = 0;
+
+ request->rdata.opcode = CTDB_CONTROL_DISABLE_NODE;
+}
+
+int ctdb_reply_control_disable_node(struct ctdb_reply_control *reply)
+{
+ return ctdb_reply_control_generic(reply, CTDB_CONTROL_DISABLE_NODE);
+}
+
+/* CTDB_CONTROL_ENABLE_NODE */
+
+void ctdb_req_control_enable_node(struct ctdb_req_control *request)
+{
+ request->opcode = CTDB_CONTROL_ENABLE_NODE;
+ request->pad = 0;
+ request->srvid = 0;
+ request->client_id = 0;
+ request->flags = 0;
+
+ request->rdata.opcode = CTDB_CONTROL_ENABLE_NODE;
+}
+
+int ctdb_reply_control_enable_node(struct ctdb_reply_control *reply)
+{
+ return ctdb_reply_control_generic(reply, CTDB_CONTROL_ENABLE_NODE);
+}
diff --git a/ctdb/protocol/protocol_control.c b/ctdb/protocol/protocol_control.c
index fb6b0219ef7..f64a1a90e10 100644
--- a/ctdb/protocol/protocol_control.c
+++ b/ctdb/protocol/protocol_control.c
@@ -411,6 +411,12 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
case CTDB_CONTROL_ECHO_DATA:
len = ctdb_echo_data_len(cd->data.echo_data);
break;
+
+ case CTDB_CONTROL_DISABLE_NODE:
+ break;
+
+ case CTDB_CONTROL_ENABLE_NODE:
+ break;
}
return len;
@@ -1385,6 +1391,12 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd)
case CTDB_CONTROL_ECHO_DATA:
len = ctdb_echo_data_len(cd->data.echo_data);
break;
+
+ case CTDB_CONTROL_DISABLE_NODE:
+ break;
+
+ case CTDB_CONTROL_ENABLE_NODE:
+ break;
}
return len;
diff --git a/ctdb/protocol/protocol_debug.c b/ctdb/protocol/protocol_debug.c
index 694285515e1..d94cb548d68 100644
--- a/ctdb/protocol/protocol_debug.c
+++ b/ctdb/protocol/protocol_debug.c
@@ -243,6 +243,8 @@ static void ctdb_opcode_print(uint32_t opcode, FILE *fp)
{ CTDB_CONTROL_VACUUM_FETCH, "VACUUM_FETCH" },
{ CTDB_CONTROL_DB_VACUUM, "DB_VACUUM" },
{ CTDB_CONTROL_ECHO_DATA, "ECHO_DATA" },
+ { CTDB_CONTROL_DISABLE_NODE, "DISABLE_NODE" },
+ { CTDB_CONTROL_ENABLE_NODE, "ENABLE_NODE" },
{ MAP_END, "" },
};
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index 206ea149693..131ebd43afc 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -173,6 +173,40 @@ done:
TALLOC_FREE(state);
}
+static int ctdb_control_disable_node(struct ctdb_context *ctdb)
+{
+ struct ctdb_node *node;
+
+ node = ctdb_find_node(ctdb, CTDB_CURRENT_NODE);
+ if (node == NULL) {
+ /* Can't happen */
+ DBG_ERR("Unable to find current node\n");
+ return -1;
+ }
+
+ D_ERR("Disable node\n");
+ node->flags |= NODE_FLAGS_PERMANENTLY_DISABLED;
+
+ return 0;
+}
+
+static int ctdb_control_enable_node(struct ctdb_context *ctdb)
+{
+ struct ctdb_node *node;
+
+ node = ctdb_find_node(ctdb, CTDB_CURRENT_NODE);
+ if (node == NULL) {
+ /* Can't happen */
+ DBG_ERR("Unable to find current node\n");
+ return -1;
+ }
+
+ D_ERR("Enable node\n");
+ node->flags &= ~NODE_FLAGS_PERMANENTLY_DISABLED;
+
+ return 0;
+}
+
/*
process a control request
*/
@@ -827,6 +861,14 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
return ctdb_control_echo_data(ctdb, c, indata, async_reply);
}
+ case CTDB_CONTROL_DISABLE_NODE:
+ CHECK_CONTROL_DATA_SIZE(0);
+ return ctdb_control_disable_node(ctdb);
+
+ case CTDB_CONTROL_ENABLE_NODE:
+ CHECK_CONTROL_DATA_SIZE(0);
+ return ctdb_control_enable_node(ctdb);
+
default:
DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode));
return -1;
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index 57f80235e7c..0896ba08f90 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -1235,28 +1235,51 @@ failed:
return -1;
}
-static void initialise_node_flags (struct ctdb_context *ctdb)
+struct ctdb_node *ctdb_find_node(struct ctdb_context *ctdb, uint32_t pnn)
{
+ struct ctdb_node *node = NULL;
unsigned int i;
+ if (pnn == CTDB_CURRENT_NODE) {
+ pnn = ctdb->pnn;
+ }
+
/* Always found: PNN correctly set just before this is called */
for (i = 0; i < ctdb->num_nodes; i++) {
- if (ctdb->pnn == ctdb->nodes[i]->pnn) {
- break;
+ node = ctdb->nodes[i];
+ if (pnn == node->pnn) {
+ return node;
}
}
- ctdb->nodes[i]->flags &= ~NODE_FLAGS_DISCONNECTED;
+ return NULL;
+}
+
+static void initialise_node_flags (struct ctdb_context *ctdb)
+{
+ struct ctdb_node *node = NULL;
+
+ node = ctdb_find_node(ctdb, CTDB_CURRENT_NODE);
+ /*
+ * PNN correctly set just before this is called so always
+ * found but keep static analysers happy...
+ */
+ if (node == NULL) {
+ DBG_ERR("Unable to find current node\n");
+ return;
+ }
+
+ node->flags &= ~NODE_FLAGS_DISCONNECTED;
/* do we start out in DISABLED mode? */
if (ctdb->start_as_disabled != 0) {
D_ERR("This node is configured to start in DISABLED state\n");
- ctdb->nodes[i]->flags |= NODE_FLAGS_DISABLED;
+ node->flags |= NODE_FLAGS_PERMANENTLY_DISABLED;
}
/* do we start out in STOPPED mode? */
if (ctdb->start_as_stopped != 0) {
D_ERR("This node is configured to start in STOPPED state\n");
- ctdb->nodes[i]->flags |= NODE_FLAGS_STOPPED;
+ node->flags |= NODE_FLAGS_STOPPED;
}
}
diff --git a/ctdb/server/ctdb_monitor.c b/ctdb/server/ctdb_monitor.c
index 5c694bde969..ab58ec485fe 100644
--- a/ctdb/server/ctdb_monitor.c
+++ b/ctdb/server/ctdb_monitor.c
@@ -455,52 +455,55 @@ int32_t ctdb_control_modflags(struct ctdb_context *ctdb, TDB_DATA indata)
struct ctdb_node *node;
--
Samba Shared Repository
More information about the samba-cvs
mailing list