[SCM] Samba Shared Repository - branch v3-6-test updated
Volker Lendecke
vlendec at samba.org
Tue Nov 2 11:03:43 MDT 2010
The branch, v3-6-test has been updated
via 29ecdd5 s3: Add "net registry getvaluesraw"
via c6c45e6 s3: Do not connect to ctdb if it is blocked for some reason
via 33d13f0 cluster_fatal() exit code should not indicate success.
from 7182f08 s3:winbindd: fix query_user for users with NULL full name.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit 29ecdd52699bf74c4419fb0a03358dc8c16233c8
Author: Volker Lendecke <vl at samba.org>
Date: Tue Dec 15 20:17:01 2009 +0100
s3: Add "net registry getvaluesraw"
Autobuild-User: Volker Lendecke <vlendec at samba.org>
Autobuild-Date: Tue Nov 2 15:42:22 UTC 2010 on sn-devel-104
commit c6c45e6314a258592681da37befc41062bc0d2a9
Author: Volker Lendecke <vl at samba.org>
Date: Mon Nov 16 12:03:24 2009 +0100
s3: Do not connect to ctdb if it is blocked for some reason
commit 33d13f0bb99fd4155994cdf280a7239bc121ea1e
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Oct 22 13:03:20 2009 +0200
cluster_fatal() exit code should not indicate success.
cluster_fatal() logs a fatal event and then exits with 0. This seems
wrong. Sometimes command like "net" use this code and return
incorrect empty output but then exit with 0.
This simply changes the exit code to 1.
Signed-off-by: Martin Schwenke <martin at meltin.net>
-----------------------------------------------------------------------
Summary of changes:
source3/lib/ctdbd_conn.c | 60 +++++++++++++++++++++++++++++++++++++++++-
source3/utils/net_registry.c | 51 +++++++++++++++++++++++++++++++++++
2 files changed, 110 insertions(+), 1 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 7644d7e..f83ece4 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -57,7 +57,7 @@ static void cluster_fatal(const char *why)
a core file. We need to release this process id immediately
so that someone else can take over without getting sharing
violations */
- _exit(0);
+ _exit(1);
}
/*
@@ -104,6 +104,59 @@ static NTSTATUS get_cluster_vnn(struct ctdbd_connection *conn, uint32 *vnn)
return status;
}
+/*
+ * Are we active (i.e. not banned or stopped?)
+ */
+static bool ctdbd_working(struct ctdbd_connection *conn, uint32_t vnn)
+{
+ int32_t cstatus=-1;
+ NTSTATUS status;
+ TDB_DATA outdata;
+ struct ctdb_node_map *m;
+ uint32_t failure_flags;
+ bool ret = false;
+ int i;
+
+ status = ctdbd_control(conn, CTDB_CURRENT_NODE,
+ CTDB_CONTROL_GET_NODEMAP, 0, 0,
+ tdb_null, talloc_tos(), &outdata, &cstatus);
+ if (!NT_STATUS_IS_OK(status)) {
+ cluster_fatal("ctdbd_control failed\n");
+ }
+ if ((cstatus != 0) || (outdata.dptr == NULL)) {
+ DEBUG(2, ("Received invalid ctdb data\n"));
+ return false;
+ }
+
+ m = (struct ctdb_node_map *)outdata.dptr;
+
+ for (i=0; i<m->num; i++) {
+ if (vnn == m->nodes[i].pnn) {
+ break;
+ }
+ }
+
+ if (i == m->num) {
+ DEBUG(2, ("Did not find ourselves (node %d) in nodemap\n",
+ (int)vnn));
+ goto fail;
+ }
+
+ failure_flags = NODE_FLAGS_BANNED | NODE_FLAGS_DISCONNECTED
+ | NODE_FLAGS_PERMANENTLY_DISABLED | NODE_FLAGS_STOPPED;
+
+ if ((m->nodes[i].flags & failure_flags) != 0) {
+ DEBUG(2, ("Node has status %x, not active\n",
+ (int)m->nodes[i].flags));
+ goto fail;
+ }
+
+ ret = true;
+fail:
+ TALLOC_FREE(outdata.dptr);
+ return ret;;
+}
+
uint32 ctdbd_vnn(const struct ctdbd_connection *conn)
{
return conn->our_vnn;
@@ -458,6 +511,11 @@ static NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
goto fail;
}
+ if (!ctdbd_working(conn, conn->our_vnn)) {
+ DEBUG(2, ("Node is not working, can not connect\n"));
+ goto fail;
+ }
+
generate_random_buffer((unsigned char *)&conn->rand_srvid,
sizeof(conn->rand_srvid));
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index 3395826..13a8ed4 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -331,6 +331,49 @@ static int net_registry_getvalueraw(struct net_context *c, int argc,
return net_registry_getvalue_internal(c, argc, argv, true);
}
+static int net_registry_getvaluesraw(struct net_context *c, int argc,
+ const char **argv)
+{
+ WERROR werr;
+ int ret = -1;
+ struct registry_key *key = NULL;
+ TALLOC_CTX *ctx = talloc_stackframe();
+ uint32_t idx;
+
+ if (argc != 1 || c->display_usage) {
+ d_fprintf(stderr, "usage: net rpc registry getvaluesraw "
+ "<key>\n");
+ goto done;
+ }
+
+ werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
+ if (!W_ERROR_IS_OK(werr)) {
+ d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
+ goto done;
+ }
+
+ idx = 0;
+ while (true) {
+ struct registry_value *val;
+
+ werr = reg_enumvalue(talloc_tos(), key, idx, NULL, &val);
+
+ if (W_ERROR_EQUAL(werr, WERR_NO_MORE_ITEMS)) {
+ ret = 0;
+ break;
+ }
+ if (!W_ERROR_IS_OK(werr)) {
+ break;
+ }
+ print_registry_value(val, true);
+ TALLOC_FREE(val);
+ idx += 1;
+ }
+done:
+ TALLOC_FREE(ctx);
+ return ret;
+}
+
static int net_registry_setvalue(struct net_context *c, int argc,
const char **argv)
{
@@ -787,6 +830,14 @@ int net_registry(struct net_context *c, int argc, const char **argv)
" Print a registry value (raw format)")
},
{
+ "getvaluesraw",
+ net_registry_getvaluesraw,
+ NET_TRANSPORT_LOCAL,
+ "Print all values of a key in raw format",
+ "net registry getvaluesraw <key>\n"
+ " Print a registry value (raw format)"
+ },
+ {
"setvalue",
net_registry_setvalue,
NET_TRANSPORT_LOCAL,
--
Samba Shared Repository
More information about the samba-cvs
mailing list