s3:rpc_server:ntsvcs: use svcctl_lookup_dispname instead of legacy svcctl in _PNP_Get...
authorMichael Adam <obnox@samba.org>
Mon, 20 Sep 2010 09:17:38 +0000 (11:17 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 21 Sep 2010 04:53:32 +0000 (06:53 +0200)
source3/rpc_server/srv_ntsvcs_nt.c

index aed9a5319cd3ffc454bf3c91fde14d10cf252f70..0cc4d31c94d4c8a1ab99229c96a05523bf65f60a 100644 (file)
@@ -125,8 +125,9 @@ WERROR _PNP_GetDeviceRegProp(struct pipes_struct *p,
                             struct PNP_GetDeviceRegProp *r)
 {
        char *ptr;
-       struct regval_ctr *values;
-       struct regval_blob *val;
+       const char *result;
+       DATA_BLOB blob;
+       TALLOC_CTX *mem_ctx = NULL;
 
        switch( r->in.property ) {
        case DEV_REGPROP_DESC:
@@ -141,31 +142,34 @@ WERROR _PNP_GetDeviceRegProp(struct pipes_struct *p,
                        return WERR_GENERAL_FAILURE;
                ptr++;
 
-               if ( !(values = svcctl_fetch_regvalues(
-                              ptr, p->server_info->ptok)))
+               mem_ctx = talloc_stackframe();
+
+               result = svcctl_lookup_dispname(mem_ctx, ptr, p->server_info->ptok);
+               if (result == NULL) {
                        return WERR_GENERAL_FAILURE;
+               }
 
-               if ( !(val = regval_ctr_getvalue( values, "DisplayName" )) ) {
-                       TALLOC_FREE( values );
+               if (!push_reg_sz(mem_ctx, &blob, result)) {
+                       talloc_free(mem_ctx);
                        return WERR_GENERAL_FAILURE;
                }
 
-               if (*r->in.buffer_size < regval_size(val)) {
-                       *r->out.needed = regval_size(val);
+               if (*r->in.buffer_size < blob.length) {
+                       *r->out.needed = blob.length;
                        *r->out.buffer_size = 0;
-                       TALLOC_FREE( values );
+                       talloc_free(mem_ctx);
                        return WERR_CM_BUFFER_SMALL;
                }
 
-               r->out.buffer = (uint8_t *)talloc_memdup(p->mem_ctx, regval_data_p(val), regval_size(val));
-               TALLOC_FREE(values);
+               r->out.buffer = (uint8_t *)talloc_memdup(p->mem_ctx, blob.data, blob.length);
+               talloc_free(mem_ctx);
                if (!r->out.buffer) {
                        return WERR_NOMEM;
                }
 
                *r->out.reg_data_type = REG_SZ; /* always 1...tested using a remove device manager connection */
-               *r->out.buffer_size = regval_size(val);
-               *r->out.needed = regval_size(val);
+               *r->out.buffer_size = blob.length;
+               *r->out.needed = blob.length;
 
                break;