diff options
author | Jeremy Allison <jra@samba.org> | 2007-11-26 17:24:56 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-11-26 17:24:56 -0800 |
commit | 80c2446321c519797a57b8006942a983f8481d79 (patch) | |
tree | 1b3cc43b7cbcb2b1688027364f99291993467046 /source3/registry/reg_dynamic.c | |
parent | d5b2325fcd597813b081d17161d26d85110c100b (diff) | |
download | samba-80c2446321c519797a57b8006942a983f8481d79.tar.gz samba-80c2446321c519797a57b8006942a983f8481d79.tar.bz2 samba-80c2446321c519797a57b8006942a983f8481d79.zip |
Remove pstrings from nsswitch/ and registry/
Jeremy.
(This used to be commit 331c0d6216e1a1607a49ed7eb4078e10138ec16a)
Diffstat (limited to 'source3/registry/reg_dynamic.c')
-rw-r--r-- | source3/registry/reg_dynamic.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/source3/registry/reg_dynamic.c b/source3/registry/reg_dynamic.c index e589dff2c8..e70bd178f9 100644 --- a/source3/registry/reg_dynamic.c +++ b/source3/registry/reg_dynamic.c @@ -216,16 +216,23 @@ static struct reg_dyn_values dynamic_values[] = { int fetch_dynamic_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ) { int i; - pstring path; - - pstrcpy( path, key->name ); - normalize_reg_path( path ); - + char *path = NULL; + TALLOC_CTX *ctx = talloc_tos(); + + path = talloc_strdup(ctx, key->name); + if (!path) { + return -1; + } + path = normalize_reg_path(ctx, path); + if (!path) { + return -1; + } + for ( i=0; dynamic_values[i].path; i++ ) { if ( strcmp( path, dynamic_values[i].path ) == 0 ) return dynamic_values[i].fetch_values( val ); } - + return -1; } @@ -235,17 +242,23 @@ int fetch_dynamic_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ) bool check_dynamic_reg_values( REGISTRY_KEY *key ) { int i; - pstring path; - - pstrcpy( path, key->name ); - normalize_reg_path( path ); - + char *path = NULL; + TALLOC_CTX *ctx = talloc_tos(); + + path = talloc_strdup(ctx, key->name); + if (!path) { + return false; + } + path = normalize_reg_path(ctx, path); + if (!path) { + return false; + } + for ( i=0; dynamic_values[i].path; i++ ) { /* can't write to dynamic keys */ if ( strcmp( path, dynamic_values[i].path ) == 0 ) - return True; + return true; } - - return False; -} + return false; +} |