summaryrefslogtreecommitdiff
path: root/source3/services
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-09-20 08:11:07 +0200
committerMichael Adam <obnox@samba.org>2010-09-21 06:53:31 +0200
commit464515cd610b5ee3862d8bc8558cd698d4f7258e (patch)
treee056d2dcda96aa394cf488ad12829c8304fd316f /source3/services
parente464ca9f311e3becd5f88f41fa7a95520fe6fbc3 (diff)
downloadsamba-464515cd610b5ee3862d8bc8558cd698d4f7258e.tar.gz
s3:services_db: change svcctl_lookup_dispname() to use reg_api functions
Diffstat (limited to 'source3/services')
-rw-r--r--source3/services/services_db.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/source3/services/services_db.c b/source3/services/services_db.c
index ee565001584..f0b7dd0cac9 100644
--- a/source3/services/services_db.c
+++ b/source3/services/services_db.c
@@ -623,39 +623,36 @@ done:
const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, struct security_token *token )
{
const char *display_name = NULL;
- struct registry_key_handle *key = NULL;
- struct regval_ctr *values = NULL;
- struct regval_blob *val = NULL;
+ struct registry_key *key = NULL;
+ struct registry_value *value = NULL;
char *path = NULL;
WERROR wresult;
- DATA_BLOB blob;
TALLOC_CTX *mem_ctx = talloc_stackframe();
path = talloc_asprintf(mem_ctx, "%s\\%s", KEY_SERVICES, name);
if (path == NULL) {
goto done;
}
- wresult = regkey_open_internal(mem_ctx, &key, path, token,
- REG_KEY_READ );
- if ( !W_ERROR_IS_OK(wresult) ) {
- DEBUG(0,("svcctl_lookup_dispname: key lookup failed! [%s] (%s)\n",
- path, win_errstr(wresult)));
+
+ wresult = reg_open_path(mem_ctx, path, REG_KEY_READ, token, &key);
+ if (!W_ERROR_IS_OK(wresult)) {
+ DEBUG(0, ("svcctl_lookup_dispname: key lookup failed! [%s] (%s)\n",
+ path, win_errstr(wresult)));
goto fail;
}
- wresult = regval_ctr_init(key, &values);
+ wresult = reg_queryvalue(mem_ctx, key, "DisplayName", &value);
if (!W_ERROR_IS_OK(wresult)) {
- DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n"));
+ DEBUG(0, ("svcctl_lookup_dispname: error getting value "
+ "'DisplayName': %s\n", win_errstr(wresult)));
goto fail;
}
- fetch_reg_values( key, values );
-
- if ( !(val = regval_ctr_getvalue( values, "DisplayName" )) )
+ if (value->type != REG_SZ) {
goto fail;
+ }
- blob = data_blob_const(regval_data_p(val), regval_size(val));
- pull_reg_sz(ctx, &blob, &display_name);
+ pull_reg_sz(ctx, &value->data, &display_name);
goto done;