diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/registry | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2 samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_api.c | 6 | ||||
-rw-r--r-- | source3/registry/reg_backend_current_version.c | 4 | ||||
-rw-r--r-- | source3/registry/reg_backend_db.c | 63 | ||||
-rw-r--r-- | source3/registry/reg_objects.c | 13 | ||||
-rw-r--r-- | source3/registry/reg_parse.c | 2 | ||||
-rw-r--r-- | source3/registry/reg_parse_internal.c | 9 | ||||
-rw-r--r-- | source3/registry/reg_parse_internal.h | 7 | ||||
-rw-r--r-- | source3/registry/reg_perfcount.c | 41 | ||||
-rw-r--r-- | source3/registry/reg_util_internal.c | 7 | ||||
-rw-r--r-- | source3/registry/reg_util_token.c | 2 | ||||
-rw-r--r-- | source3/registry/regfio.c | 23 |
11 files changed, 104 insertions, 73 deletions
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 935d2441af..51bd98e939 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -142,9 +142,9 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx, SMB_ASSERT(strchr(name, '\\') == NULL); - if (!(regkey = TALLOC_ZERO_P(mem_ctx, struct registry_key)) || + if (!(regkey = talloc_zero(mem_ctx, struct registry_key)) || !(regkey->token = dup_nt_token(regkey, token)) || - !(regkey->key = TALLOC_ZERO_P(regkey, struct registry_key_handle))) + !(regkey->key = talloc_zero(regkey, struct registry_key_handle))) { result = WERR_NOMEM; goto done; @@ -188,7 +188,7 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx, /* Tag this as a Performance Counter Key */ - if( StrnCaseCmp(key->name, KEY_HKPD, strlen(KEY_HKPD)) == 0 ) + if( strncasecmp_m(key->name, KEY_HKPD, strlen(KEY_HKPD)) == 0 ) key->type = REG_KEY_HKPD; /* Look up the table of registry I/O operations */ diff --git a/source3/registry/reg_backend_current_version.c b/source3/registry/reg_backend_current_version.c index ab7bd517b0..adf304e8c9 100644 --- a/source3/registry/reg_backend_current_version.c +++ b/source3/registry/reg_backend_current_version.c @@ -58,8 +58,8 @@ static int current_version_fetch_values(const char *key, struct regval_ctr *valu regval_ctr_addvalue_sz(values, "SystemRoot", sysroot_string); - fstr_sprintf(sysversion, "%d.%d", lp_major_announce_version(), - lp_minor_announce_version()); + fstr_sprintf(sysversion, "%d.%d", SAMBA_MAJOR_NBT_ANNOUNCE_VERSION, + SAMBA_MINOR_NBT_ANNOUNCE_VERSION); regval_ctr_addvalue_sz(values, "CurrentVersion", sysversion); diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index 6024a354c4..812dd0d43c 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -28,7 +28,9 @@ #include "reg_backend_db.h" #include "reg_objects.h" #include "nt_printing.h" +#include "util_tdb.h" #include "dbwrap.h" +#include "../libcli/security/secdesc.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY @@ -47,6 +49,8 @@ static int regdb_fetch_values_internal(struct db_context *db, const char* key, static bool regdb_store_values_internal(struct db_context *db, const char *key, struct regval_ctr *values); +static NTSTATUS create_sorted_subkeys(const char *key); + /* List the deepest path into the registry. All part components will be created.*/ /* If you want to have a part of the path controlled by the tdb and part by @@ -478,7 +482,7 @@ static WERROR regdb_upgrade_v1_to_v2(void) talloc_destroy(mem_ctx); - if (rc == -1) { + if (rc < 0) { return WERR_REG_IO_FAILURE; } @@ -831,22 +835,9 @@ static WERROR regdb_store_keys_internal2(struct db_context *db, W_ERROR_NOT_OK_GOTO_DONE(werr); /* - * Delete a sorted subkey cache for regdb_key_exists, will be - * recreated automatically + * recreate the sorted subkey cache for regdb_key_exists() */ - keyname = talloc_asprintf(ctx, "%s\\%s", REG_SORTED_SUBKEYS_PREFIX, - keyname); - if (keyname == NULL) { - werr = WERR_NOMEM; - goto done; - } - - werr = ntstatus_to_werror(dbwrap_delete_bystring(db, keyname)); - - /* don't treat WERR_NOT_FOUND as an error here */ - if (W_ERROR_EQUAL(werr, WERR_NOT_FOUND)) { - werr = WERR_OK; - } + werr = ntstatus_to_werror(create_sorted_subkeys(keyname)); done: TALLOC_FREE(ctx); @@ -1310,7 +1301,7 @@ done: static int cmp_keynames(char **p1, char **p2) { - return StrCaseCmp(*p1, *p2); + return strcasecmp_m(*p1, *p2); } struct create_sorted_subkeys_context { @@ -1407,7 +1398,8 @@ done: return status; } -static bool create_sorted_subkeys(const char *key, const char *sorted_keyname) +static NTSTATUS create_sorted_subkeys_internal(const char *key, + const char *sorted_keyname) { NTSTATUS status; struct create_sorted_subkeys_context sorted_ctx; @@ -1419,7 +1411,26 @@ static bool create_sorted_subkeys(const char *key, const char *sorted_keyname) create_sorted_subkeys_action, &sorted_ctx); - return NT_STATUS_IS_OK(status); + return status; +} + +static NTSTATUS create_sorted_subkeys(const char *key) +{ + char *sorted_subkeys_keyname; + NTSTATUS status; + + sorted_subkeys_keyname = talloc_asprintf(talloc_tos(), "%s\\%s", + REG_SORTED_SUBKEYS_PREFIX, + key); + if (sorted_subkeys_keyname == NULL) { + status = NT_STATUS_NO_MEMORY; + goto done; + } + + status = create_sorted_subkeys_internal(key, sorted_subkeys_keyname); + +done: + return status; } struct scan_subkey_state { @@ -1499,13 +1510,21 @@ static bool scan_parent_subkeys(struct db_context *db, const char *parent, if (state.scanned) { result = state.found; } else { + NTSTATUS status; + res = db->transaction_start(db); if (res != 0) { - DEBUG(0, ("error starting transacion\n")); + DEBUG(0, ("error starting transaction\n")); goto fail; } - if (!create_sorted_subkeys(path, key)) { + DEBUG(2, (__location__ " WARNING: recreating the sorted " + "subkeys cache for key '%s' from scan_parent_subkeys " + "this should not happen (too frequently)...\n", + path)); + + status = create_sorted_subkeys_internal(path, key); + if (!NT_STATUS_IS_OK(status)) { res = db->transaction_cancel(db); if (res != 0) { smb_panic("Failed to cancel transaction."); @@ -1801,7 +1820,7 @@ static bool regdb_store_values_internal(struct db_context *db, const char *key, goto done; } - data.dptr = TALLOC_ARRAY(ctx, uint8, len); + data.dptr = talloc_array(ctx, uint8, len); data.dsize = len; len = regdb_pack_values(values, data.dptr, data.dsize); diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c index 0fab3f7d8b..62487e1e4f 100644 --- a/source3/registry/reg_objects.c +++ b/source3/registry/reg_objects.c @@ -23,6 +23,7 @@ #include "includes.h" #include "registry.h" #include "reg_objects.h" +#include "util_tdb.h" #include "dbwrap.h" #include "../libcli/registry/util_reg.h" @@ -61,7 +62,7 @@ struct regsubkey_ctr { context for internal private data. There is no longer a regval_ctr_intit() and regval_ctr_destroy() - pair of functions. Simply TALLOC_ZERO_P() and TALLOC_FREE() the + pair of functions. Simply talloc_zero() and TALLOC_FREE() the object. **********************************************************************/ @@ -210,7 +211,7 @@ WERROR regsubkey_ctr_addkey( struct regsubkey_ctr *ctr, const char *keyname ) return WERR_OK; } - if (!(newkeys = TALLOC_REALLOC_ARRAY(ctr, ctr->subkeys, char *, + if (!(newkeys = talloc_realloc(ctr, ctr->subkeys, char *, ctr->num_subkeys+1))) { return WERR_NOMEM; } @@ -465,7 +466,7 @@ struct regval_blob *regval_compose(TALLOC_CTX *ctx, const char *name, uint32_t type, const uint8_t *data_p, size_t size) { - struct regval_blob *regval = TALLOC_P(ctx, struct regval_blob); + struct regval_blob *regval = talloc(ctx, struct regval_blob); if (regval == NULL) { return NULL; @@ -474,7 +475,7 @@ struct regval_blob *regval_compose(TALLOC_CTX *ctx, const char *name, fstrcpy(regval->valuename, name); regval->type = type; if (size) { - regval->data_p = (uint8_t *)TALLOC_MEMDUP(regval, data_p, size); + regval->data_p = (uint8_t *)talloc_memdup(regval, data_p, size); if (!regval->data_p) { TALLOC_FREE(regval); return NULL; @@ -504,9 +505,9 @@ int regval_ctr_addvalue(struct regval_ctr *ctr, const char *name, uint32_t type, /* allocate a slot in the array of pointers */ if ( ctr->num_values == 0 ) { - ctr->values = TALLOC_P( ctr, struct regval_blob *); + ctr->values = talloc( ctr, struct regval_blob *); } else { - ctr->values = TALLOC_REALLOC_ARRAY(ctr, ctr->values, + ctr->values = talloc_realloc(ctr, ctr->values, struct regval_blob *, ctr->num_values+1); } diff --git a/source3/registry/reg_parse.c b/source3/registry/reg_parse.c index 0c596a8f5e..f1258fca6d 100644 --- a/source3/registry/reg_parse.c +++ b/source3/registry/reg_parse.c @@ -622,7 +622,7 @@ static bool lookslike_utf16(const char* line, size_t len, bool* little_endian) bool le; size_t l = MIN(len/2, 64); - uint16_t* u = (uint16_t*)line; + const uint16_t* u = (const uint16_t*)line; int i; assert(len >= 2); diff --git a/source3/registry/reg_parse_internal.c b/source3/registry/reg_parse_internal.c index dedbe123d8..208844856f 100644 --- a/source3/registry/reg_parse_internal.c +++ b/source3/registry/reg_parse_internal.c @@ -1,4 +1,9 @@ -/* * Samba Unix/Linux SMB client library +/* + * Unix SMB/CIFS implementation. + * + * Registry helper routines + * + * Copyright (C) Gregor Beck 2010 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -308,7 +313,7 @@ int write_bom(FILE* file, const char* charset, charset_t ctype) DEBUG(0, ("No Byte Order Mark for charset_t: %u\n", (unsigned)ctype)); } else { for (i=0; BOM[i].name; i++) { - if (StrCaseCmp(BOM[i].name, charset) == 0) { + if (strcasecmp_m(BOM[i].name, charset) == 0) { return fwrite(BOM[i].seq, 1, BOM[i].len, file); } } diff --git a/source3/registry/reg_parse_internal.h b/source3/registry/reg_parse_internal.h index ef59161756..14fed89aa9 100644 --- a/source3/registry/reg_parse_internal.h +++ b/source3/registry/reg_parse_internal.h @@ -1,4 +1,9 @@ -/* Samba Unix/Linux SMB client library +/* + * Unix SMB/CIFS implementation. + * + * Registry helper routines + * + * Copyright (C) Gregor Beck 2010 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by 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); diff --git a/source3/registry/reg_util_internal.c b/source3/registry/reg_util_internal.c index a1aeaa405c..b15015b988 100644 --- a/source3/registry/reg_util_internal.c +++ b/source3/registry/reg_util_internal.c @@ -97,12 +97,11 @@ char *normalize_reg_path(TALLOC_CTX *ctx, const char *keyname ) char *nkeyname; /* skip leading '\' chars */ - p = (char *)keyname; - while (*p == '\\') { - p++; + while (*keyname == '\\') { + keyname++; } - nkeyname = talloc_strdup(ctx, p); + nkeyname = talloc_strdup(ctx, keyname); if (nkeyname == NULL) { return NULL; } diff --git a/source3/registry/reg_util_token.c b/source3/registry/reg_util_token.c index ca0159a649..d599b3a33d 100644 --- a/source3/registry/reg_util_token.c +++ b/source3/registry/reg_util_token.c @@ -38,7 +38,7 @@ NTSTATUS registry_create_admin_token(TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - token = TALLOC_ZERO_P(mem_ctx, struct security_token); + token = talloc_zero(mem_ctx, struct security_token); if (token == NULL) { DEBUG(1, ("talloc failed\n")); status = NT_STATUS_NO_MEMORY; diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c index bd5380787c..6d2beccfef 100644 --- a/source3/registry/regfio.c +++ b/source3/registry/regfio.c @@ -22,6 +22,7 @@ #include "regfio.h" #include "../librpc/gen_ndr/ndr_security.h" #include "../libcli/security/security_descriptor.h" +#include "../libcli/security/secdesc.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY @@ -497,7 +498,7 @@ static REGF_HBIN* read_hbin_block( REGF_FILE *file, off_t offset ) REGF_HBIN *hbin; uint32 record_size, curr_off, block_size, header; - if ( !(hbin = TALLOC_ZERO_P(file->mem_ctx, REGF_HBIN)) ) + if ( !(hbin = talloc_zero(file->mem_ctx, REGF_HBIN)) ) return NULL; hbin->file_off = offset; hbin->free_off = -1; @@ -1072,7 +1073,7 @@ static bool hbin_prs_key( REGF_FILE *file, REGF_HBIN *hbin, REGF_NK_REC *nk ) } } - if ( !(nk->sec_desc = TALLOC_ZERO_P( file->mem_ctx, REGF_SK_REC )) ) + if ( !(nk->sec_desc = talloc_zero( file->mem_ctx, REGF_SK_REC )) ) return False; nk->sec_desc->sk_off = nk->sk_off; if ( !hbin_prs_sk_rec( "sk_rec", sub_hbin, depth, nk->sec_desc )) @@ -1378,7 +1379,7 @@ REGF_NK_REC* regfio_rootkey( REGF_FILE *file ) if ( !file ) return NULL; - if ( !(nk = TALLOC_ZERO_P( file->mem_ctx, REGF_NK_REC )) ) { + if ( !(nk = talloc_zero( file->mem_ctx, REGF_NK_REC )) ) { DEBUG(0,("regfio_rootkey: talloc() failed!\n")); return NULL; } @@ -1446,7 +1447,7 @@ REGF_NK_REC* regfio_rootkey( REGF_FILE *file ) return NULL; nk->subkey_index++; - if ( !(subkey = TALLOC_ZERO_P( file->mem_ctx, REGF_NK_REC )) ) + if ( !(subkey = talloc_zero( file->mem_ctx, REGF_NK_REC )) ) return NULL; if ( !hbin_prs_key( file, hbin, subkey ) ) @@ -1464,7 +1465,7 @@ static REGF_HBIN* regf_hbin_allocate( REGF_FILE *file, uint32 block_size ) REGF_HBIN *hbin; SMB_STRUCT_STAT sbuf; - if ( !(hbin = TALLOC_ZERO_P( file->mem_ctx, REGF_HBIN )) ) + if ( !(hbin = talloc_zero( file->mem_ctx, REGF_HBIN )) ) return NULL; memcpy( hbin->header, "hbin", sizeof(HBIN_HDR_SIZE) ); @@ -1719,7 +1720,7 @@ static bool create_vk_record(REGF_FILE *file, REGF_VK_REC *vk, if ( vk->data_size > sizeof(uint32) ) { uint32 data_size = ( (vk->data_size+sizeof(uint32)) & 0xfffffff8 ) + 8; - vk->data = (uint8 *)TALLOC_MEMDUP( file->mem_ctx, + vk->data = (uint8 *)talloc_memdup( file->mem_ctx, regval_data_p(value), vk->data_size ); if (vk->data == NULL) { @@ -1750,7 +1751,7 @@ static bool create_vk_record(REGF_FILE *file, REGF_VK_REC *vk, static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) { - return StrCaseCmp( h1->fullname, h2->fullname ); + return strcasecmp_m( h1->fullname, h2->fullname ); } /******************************************************************* @@ -1764,7 +1765,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) REGF_HBIN *vlist_hbin = NULL; uint32 size; - if ( !(nk = TALLOC_ZERO_P( file->mem_ctx, REGF_NK_REC )) ) + if ( !(nk = talloc_zero( file->mem_ctx, REGF_NK_REC )) ) return NULL; memcpy( nk->header, "nk", REC_HDR_SIZE ); @@ -1830,7 +1831,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) return NULL; } - if ( !(nk->sec_desc = TALLOC_ZERO_P( file->mem_ctx, REGF_SK_REC )) ) + if ( !(nk->sec_desc = talloc_zero( file->mem_ctx, REGF_SK_REC )) ) return NULL; /* now we have to store the security descriptor in the list and @@ -1897,7 +1898,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) nk->subkeys.num_keys = nk->num_subkeys; if (nk->subkeys.num_keys) { - if ( !(nk->subkeys.hashes = TALLOC_ZERO_ARRAY( file->mem_ctx, REGF_HASH_REC, nk->subkeys.num_keys )) ) + if ( !(nk->subkeys.hashes = talloc_zero_array( file->mem_ctx, REGF_HASH_REC, nk->subkeys.num_keys )) ) return NULL; } else { nk->subkeys.hashes = NULL; @@ -1925,7 +1926,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) nk->values_off = prs_offset( &vlist_hbin->ps ) + vlist_hbin->first_hbin_off - HBIN_HDR_SIZE; if (nk->num_values) { - if ( !(nk->values = TALLOC_ARRAY( file->mem_ctx, REGF_VK_REC, nk->num_values )) ) + if ( !(nk->values = talloc_array( file->mem_ctx, REGF_VK_REC, nk->num_values )) ) return NULL; } else { nk->values = NULL; |