diff options
author | Michael Adam <obnox@samba.org> | 2012-03-30 14:39:50 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2012-04-25 14:31:01 +0200 |
commit | 64a9ab4f82e54420caa26f92ef99b13084923282 (patch) | |
tree | e3af45c6600cb000138de869c3e829e1258ecf2c /source3 | |
parent | 2fc610caf5c4a54556464623976d5f92871c49c9 (diff) | |
download | samba-64a9ab4f82e54420caa26f92ef99b13084923282.tar.gz samba-64a9ab4f82e54420caa26f92ef99b13084923282.tar.bz2 samba-64a9ab4f82e54420caa26f92ef99b13084923282.zip |
s3:registry: add a new function regval_ctr_value_byname()
This is like regval_ctr_key_exists() but does not return bool,
but the regval_blob instead, if found, and NULL if not found.
Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/registry/reg_objects.c | 18 | ||||
-rw-r--r-- | source3/registry/reg_objects.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c index 6336d00657..baa3000eb6 100644 --- a/source3/registry/reg_objects.c +++ b/source3/registry/reg_objects.c @@ -407,6 +407,24 @@ bool regval_ctr_value_exists(struct regval_ctr *ctr, const char *value) return False; } +/** + * Get a value by its name + */ +struct regval_blob *regval_ctr_value_byname(struct regval_ctr *ctr, + const char *value) +{ + int i; + + for (i = 0; i < ctr->num_values; i++) { + if (strequal(ctr->values[i]->valuename, value)) { + return ctr->values[i]; + } + } + + return NULL; +} + + /*********************************************************************** * compose a struct regval_blob from input data **********************************************************************/ diff --git a/source3/registry/reg_objects.h b/source3/registry/reg_objects.h index 52d078e678..9e1c1d1795 100644 --- a/source3/registry/reg_objects.h +++ b/source3/registry/reg_objects.h @@ -53,6 +53,8 @@ char* regval_name(struct regval_blob *val); uint32_t regval_type(struct regval_blob *val); struct regval_blob* regval_ctr_specific_value(struct regval_ctr *ctr, uint32_t idx); +struct regval_blob *regval_ctr_value_byname(struct regval_ctr *ctr, + const char *value); bool regval_ctr_value_exists(struct regval_ctr *ctr, const char *value); struct regval_blob *regval_compose(TALLOC_CTX *ctx, const char *name, uint32_t type, |