diff options
author | Michael Adam <obnox@samba.org> | 2010-09-20 06:19:57 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2010-09-21 06:53:31 +0200 |
commit | 53dcbc2dd2705c5273163c757e2587e3596c6971 (patch) | |
tree | 2e9de964d60c737816545537e9fbc4eeeed15854 | |
parent | 9fee03365621cca011da4521d98f1e1aa2882278 (diff) | |
download | samba-53dcbc2dd2705c5273163c757e2587e3596c6971.tar.gz samba-53dcbc2dd2705c5273163c757e2587e3596c6971.tar.bz2 samba-53dcbc2dd2705c5273163c757e2587e3596c6971.zip |
s3:services_db: change svcctl_lookup_description() to use reg_api functions
-rw-r--r-- | source3/services/services_db.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/source3/services/services_db.c b/source3/services/services_db.c index b223e9acf2..e05db94492 100644 --- a/source3/services/services_db.c +++ b/source3/services/services_db.c @@ -671,46 +671,44 @@ done: const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, struct security_token *token ) { const char *description = 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) { - return NULL; + goto done; } - wresult = regkey_open_internal(mem_ctx, &key, path, token, - REG_KEY_READ ); + wresult = reg_open_path(mem_ctx, path, REG_KEY_READ, token, &key); if (!W_ERROR_IS_OK(wresult)) { DEBUG(0, ("svcctl_lookup_description: key lookup failed! " "[%s] (%s)\n", path, win_errstr(wresult))); goto done; } - wresult = regval_ctr_init(key, &values); + wresult = reg_queryvalue(mem_ctx, key, "Description", &value); if (!W_ERROR_IS_OK(wresult)) { - DEBUG(0, ("svcctl_lookup_description: talloc() failed!\n")); - goto done; + DEBUG(0, ("svcctl_lookup_dispname: error getting value " + "'Description': %s\n", win_errstr(wresult))); + goto fail; } - fetch_reg_values( key, values ); - - if ( !(val = regval_ctr_getvalue( values, "Description" )) ) { - description = talloc_strdup(ctx, "Unix Service"); - goto done; + if (value->type != REG_SZ) { + goto fail; } - blob = data_blob_const(regval_data_p(val), regval_size(val)); - pull_reg_sz(ctx, &blob, &description); + pull_reg_sz(ctx, &value->data, &description); + + goto done; + +fail: + description = talloc_strdup(ctx, "Unix Service"); done: talloc_free(mem_ctx); - return description; } |