diff options
Diffstat (limited to 'source3/registry/reg_perfcount.c')
-rw-r--r-- | source3/registry/reg_perfcount.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c index 4ed3305c15..64e3cbee0f 100644 --- a/source3/registry/reg_perfcount.c +++ b/source3/registry/reg_perfcount.c @@ -25,6 +25,7 @@ #include "registry.h" #include "reg_perfcount.h" #include "../libcli/registry/util_reg.h" +#include "util_tdb.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY @@ -94,7 +95,7 @@ uint32 reg_perfcount_get_base_index(void) and so on. So last_counter becomes num_counters*2, and last_help will be last_counter+1 */ kbuf = string_tdb_data(key); - dbuf = tdb_fetch(names, kbuf); + dbuf = tdb_fetch_compat(names, kbuf); if(dbuf.dptr == NULL) { DEBUG(1, ("reg_perfcount_get_base_index: failed to find key \'1\' in [%s].\n", fname)); @@ -161,7 +162,7 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb, memset(temp, 0, sizeof(temp)); snprintf(temp, sizeof(temp), "%d", keyval); kbuf = string_tdb_data(temp); - dbuf = tdb_fetch(tdb, kbuf); + dbuf = tdb_fetch_compat(tdb, kbuf); if(dbuf.dptr == NULL) { /* If a key isn't there, just bypass it -- this really shouldn't @@ -346,7 +347,7 @@ static uint32 _reg_perfcount_get_numinst(int objInd, TDB_CONTEXT *names) char buf[PERFCOUNT_MAX_LEN]; _reg_perfcount_make_key(&key, buf, PERFCOUNT_MAX_LEN, objInd, "inst"); - data = tdb_fetch(names, key); + data = tdb_fetch_compat(names, key); if(data.dptr == NULL) return (uint32)PERF_NO_INSTANCES; @@ -375,7 +376,7 @@ static bool _reg_perfcount_add_object(struct PERF_DATA_BLOCK *block, bool success = True; struct PERF_OBJECT_TYPE *obj; - block->objects = (struct PERF_OBJECT_TYPE *)TALLOC_REALLOC_ARRAY(mem_ctx, + block->objects = (struct PERF_OBJECT_TYPE *)talloc_realloc(mem_ctx, block->objects, struct PERF_OBJECT_TYPE, block->NumObjectTypes+1); @@ -420,7 +421,7 @@ static bool _reg_perfcount_get_counter_data(TDB_DATA key, TDB_DATA *data) return False; } - *data = tdb_fetch(counters, key); + *data = tdb_fetch_compat(counters, key); tdb_close(counters); @@ -487,7 +488,7 @@ static bool _reg_perfcount_get_counter_info(struct PERF_DATA_BLOCK *block, padding = 0; _reg_perfcount_make_key(&key, buf, PERFCOUNT_MAX_LEN, CounterIndex, "type"); - data = tdb_fetch(names, key); + data = tdb_fetch_compat(names, key); if(data.dptr == NULL) { DEBUG(3, ("_reg_perfcount_get_counter_info: No type data for counter [%d].\n", CounterIndex)); @@ -546,7 +547,7 @@ static bool _reg_perfcount_get_counter_info(struct PERF_DATA_BLOCK *block, SAFE_FREE(data.dptr); obj->counter_data.ByteLength += dsize + padding; - obj->counter_data.data = TALLOC_REALLOC_ARRAY(mem_ctx, + obj->counter_data.data = talloc_realloc(mem_ctx, obj->counter_data.data, uint8, obj->counter_data.ByteLength - sizeof(uint32)); @@ -634,7 +635,7 @@ static bool _reg_perfcount_add_counter(struct PERF_DATA_BLOCK *block, parent, num)); return False; } - obj->counters = (struct PERF_COUNTER_DEFINITION *)TALLOC_REALLOC_ARRAY(mem_ctx, + obj->counters = (struct PERF_COUNTER_DEFINITION *)talloc_realloc(mem_ctx, obj->counters, struct PERF_COUNTER_DEFINITION, obj->NumCounters+1); @@ -686,7 +687,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in return False; } inst->counter_data.ByteLength = data.dsize + sizeof(inst->counter_data.ByteLength); - inst->counter_data.data = TALLOC_REALLOC_ARRAY(mem_ctx, + inst->counter_data.data = talloc_realloc(mem_ctx, inst->counter_data.data, uint8, data.dsize); @@ -700,7 +701,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in memset(temp, 0, PERFCOUNT_MAX_LEN); snprintf(temp, PERFCOUNT_MAX_LEN, "i%dname", instId); _reg_perfcount_make_key(&key, buf, PERFCOUNT_MAX_LEN, obj->ObjectNameTitleIndex, temp); - data = tdb_fetch(names, key); + data = tdb_fetch_compat(names, key); if(data.dptr == NULL) { /* Not actually an error, but possibly unintended? -- just logging FYI */ @@ -718,7 +719,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in SAFE_FREE(data.dptr); return False; } - inst->data = TALLOC_REALLOC_ARRAY(mem_ctx, + inst->data = talloc_realloc(mem_ctx, inst->data, uint8, inst->NameLength); @@ -740,7 +741,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in if((pad = (inst->ByteLength % 8))) { pad = 8 - pad; - inst->data = TALLOC_REALLOC_ARRAY(mem_ctx, + inst->data = talloc_realloc(mem_ctx, inst->data, uint8, inst->NameLength + pad); @@ -762,7 +763,7 @@ static bool _reg_perfcount_add_instance(struct PERF_OBJECT_TYPE *obj, struct PERF_INSTANCE_DEFINITION *inst; if(obj->instances == NULL) { - obj->instances = TALLOC_REALLOC_ARRAY(mem_ctx, + obj->instances = talloc_realloc(mem_ctx, obj->instances, struct PERF_INSTANCE_DEFINITION, obj->NumInstances); @@ -792,7 +793,7 @@ static int _reg_perfcount_assemble_global(struct PERF_DATA_BLOCK *block, { j = i*2; _reg_perfcount_make_key(&key, keybuf, PERFCOUNT_MAX_LEN, j, "rel"); - data = tdb_fetch(names, key); + data = tdb_fetch_compat(names, key); if(data.dptr != NULL) { if(_reg_perfcount_isparent(data)) @@ -830,7 +831,7 @@ static bool _reg_perfcount_get_64(uint64_t *retval, _reg_perfcount_make_key(&key, buf, PERFCOUNT_MAX_LEN, key_part1, key_part2); - data = tdb_fetch(tdb, key); + data = tdb_fetch_compat(tdb, key); if(data.dptr == NULL) { DEBUG(3,("_reg_perfcount_get_64: No data found for key [%s].\n", key.dptr)); @@ -942,9 +943,9 @@ static bool _reg_perfcount_init_data_block(struct PERF_DATA_BLOCK *block, make_systemtime(&(block->SystemTime), gmtime(&tm)); _reg_perfcount_init_data_block_perf(block, names); memset(temp, 0, sizeof(temp)); - rpcstr_push((void *)temp, global_myname(), sizeof(temp), STR_TERMINATE); + rpcstr_push((void *)temp, lp_netbios_name(), sizeof(temp), STR_TERMINATE); block->SystemNameLength = (strlen_w(temp) * 2) + 2; - block->data = TALLOC_ZERO_ARRAY(mem_ctx, uint8, block->SystemNameLength + (8 - (block->SystemNameLength % 8))); + block->data = talloc_zero_array(mem_ctx, uint8, block->SystemNameLength + (8 - (block->SystemNameLength % 8))); if (block->data == NULL) { return False; } @@ -992,7 +993,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(struct PERF_DATA_BLOCK *block counter_data = &(instance->counter_data); counter = &(object[obj].counters[object[obj].NumCounters - 1]); counter_data->ByteLength = counter->CounterOffset + counter->CounterSize + sizeof(counter_data->ByteLength); - temp = TALLOC_REALLOC_ARRAY(mem_ctx, + temp = talloc_realloc(mem_ctx, temp, char, counter_data->ByteLength- sizeof(counter_data->ByteLength)); @@ -1013,7 +1014,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(struct PERF_DATA_BLOCK *block { pad = 8 - pad; } - counter_data->data = TALLOC_REALLOC_ARRAY(mem_ctx, + counter_data->data = talloc_realloc(mem_ctx, counter_data->data, uint8, counter_data->ByteLength - sizeof(counter_data->ByteLength) + pad); @@ -1033,7 +1034,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(struct PERF_DATA_BLOCK *block if((pad = (object[obj].counter_data.ByteLength % 8))) { pad = 8 - pad; - object[obj].counter_data.data = TALLOC_REALLOC_ARRAY(mem_ctx, + object[obj].counter_data.data = talloc_realloc(mem_ctx, object[obj].counter_data.data, uint8, object[obj].counter_data.ByteLength + pad); |