[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Fri Jul 10 21:42:02 UTC 2015


The branch, master has been updated
       via  37e1502 ctdb-daemon: Remove control CTDB_CONTROL_SET_CALL
       via  9aa9048 ctdb-daemon: Fix valgrind invalid read error in db_statistics control
      from  46ea8b5 dfs_server: Use multi-byte string handling

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 37e1502f684a74301fe96e4c4c0aaa15d0c8965a
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 9 22:33:23 2015 +1000

    ctdb-daemon: Remove control CTDB_CONTROL_SET_CALL
    
    This has not been used for a long time.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Fri Jul 10 23:41:18 CEST 2015 on sn-devel-104

commit 9aa90482f8ffbddf898eb8a900112f45d82f0930
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Jul 9 14:55:59 2015 +1000

    ctdb-daemon: Fix valgrind invalid read error in db_statistics control
    
      ==20761== Invalid read of size 8
      ==20761==    at 0x11BE30: ctdb_ctrl_dbstatistics (ctdb_client.c:1286)
      ==20761==    by 0x12BA89: control_dbstatistics (ctdb.c:713)
      ==20761==    by 0x1312E0: main (ctdb.c:6543)
      ==20761==  Address 0x713b0d0 is 0 bytes after a block of size 560 alloc'd
      ==20761==    at 0x4C27A2E: malloc (vg_replace_malloc.c:270)
      ==20761==    by 0x5CB0954: _talloc_memdup (talloc.c:615)
      ==20761==    by 0x11395C: ctdb_control_recv (ctdb_client.c:1146)
      ==20761==    by 0x11BDD7: ctdb_ctrl_dbstatistics (ctdb_client.c:1265)
      ==20761==    by 0x12BA89: control_dbstatistics (ctdb.c:713)
      ==20761==    by 0x1312E0: main (ctdb.c:6543)
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/client/ctdb_client.c      | 28 +++-------------------------
 ctdb/include/ctdb_private.h    |  9 ---------
 ctdb/include/ctdb_protocol.h   |  2 +-
 ctdb/server/ctdb_control.c     |  8 ++------
 ctdb/server/ctdb_ltdb_server.c |  3 ++-
 5 files changed, 8 insertions(+), 42 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c
index 5bf3a68..7bffefe 100644
--- a/ctdb/client/ctdb_client.c
+++ b/ctdb/client/ctdb_client.c
@@ -1283,7 +1283,7 @@ int ctdb_ctrl_dbstatistics(struct ctdb_context *ctdb, uint32_t destnode, uint32_
 	}
 
 	wire = (struct ctdb_db_statistics *)outdata.dptr;
-	*s = *wire;
+	memcpy(s, wire, offsetof(struct ctdb_db_statistics, hot_keys_wire));
 	ptr = &wire->hot_keys_wire[0];
 	for (i=0; i<wire->num_hot_keys; i++) {
 		s->hot_keys[i].key.dptr = talloc_size(mem_ctx, s->hot_keys[i].key.dsize);
@@ -2161,34 +2161,12 @@ int ctdb_set_call(struct ctdb_db_context *ctdb_db, ctdb_fn_t fn, uint32_t id)
 {
 	struct ctdb_registered_call *call;
 
-#if 0
-	TDB_DATA data;
-	int32_t status;
-	struct ctdb_control_set_call c;
-	int ret;
-
-	/* this is no longer valid with the separate daemon architecture */
-	c.db_id = ctdb_db->db_id;
-	c.fn    = fn;
-	c.id    = id;
-
-	data.dptr = (uint8_t *)&c;
-	data.dsize = sizeof(c);
-
-	ret = ctdb_control(ctdb_db->ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_SET_CALL, 0,
-			   data, NULL, NULL, &status, NULL, NULL);
-	if (ret != 0 || status != 0) {
-		DEBUG(DEBUG_ERR,("ctdb_set_call failed for call %u\n", id));
-		return -1;
-	}
-#endif
-
-	/* also register locally */
+	/* register locally */
 	call = talloc(ctdb_db, struct ctdb_registered_call);
 	call->fn = fn;
 	call->id = id;
 
-	DLIST_ADD(ctdb_db->calls, call);	
+	DLIST_ADD(ctdb_db->calls, call);
 	return 0;
 }
 
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 4413a32..4cb0fe6 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -608,15 +608,6 @@ struct ctdb_db_context {
 	  }} while (0)
 
 /*
-  structure passed in set_call control
- */
-struct ctdb_control_set_call {
-	uint32_t db_id;
-	ctdb_fn_t fn;
-	uint32_t id;
-};
-
-/*
   struct for kill_tcp control
  */
 struct ctdb_control_killtcp {
diff --git a/ctdb/include/ctdb_protocol.h b/ctdb/include/ctdb_protocol.h
index 4dea56b..d9cad7c 100644
--- a/ctdb/include/ctdb_protocol.h
+++ b/ctdb/include/ctdb_protocol.h
@@ -298,7 +298,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
 		    CTDB_CONTROL_SET_RECMODE             = 16,
 		    CTDB_CONTROL_STATISTICS_RESET        = 17,
 		    CTDB_CONTROL_DB_ATTACH               = 18,
-		    CTDB_CONTROL_SET_CALL                = 19,
+		    CTDB_CONTROL_SET_CALL                = 19, /* obsolete */
 		    CTDB_CONTROL_TRAVERSE_START          = 20,
 		    CTDB_CONTROL_TRAVERSE_ALL            = 21,
 		    CTDB_CONTROL_TRAVERSE_DATA           = 22,
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index 9069087..fda4c29 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -270,12 +270,8 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 	case CTDB_CONTROL_DB_ATTACH_PERSISTENT:
 	  return ctdb_control_db_attach(ctdb, indata, outdata, srvid, true, client_id, c, async_reply);
 
-	case CTDB_CONTROL_SET_CALL: {
-		struct ctdb_control_set_call *sc = 
-			(struct ctdb_control_set_call *)indata.dptr;
-		CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_control_set_call));
-		return ctdb_daemon_set_call(ctdb, sc->db_id, sc->fn, sc->id);
-	}
+	case CTDB_CONTROL_SET_CALL:
+		return control_not_implemented("SET_CALL", NULL);
 
 	case CTDB_CONTROL_TRAVERSE_START:
 		CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_traverse_start));
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c
index c94e1d5..5357c6c 100644
--- a/ctdb/server/ctdb_ltdb_server.c
+++ b/ctdb/server/ctdb_ltdb_server.c
@@ -1627,7 +1627,8 @@ int32_t ctdb_control_get_db_statistics(struct ctdb_context *ctdb,
 		return -1;
 	}
 
-	*stats = ctdb_db->statistics;
+	memcpy(stats, &ctdb_db->statistics,
+	       offsetof(struct ctdb_db_statistics, hot_keys_wire));
 
 	stats->num_hot_keys = MAX_HOT_KEYS;
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list