r166: Fix enumerating values in nt4 backend
authorJelmer Vernooij <jelmer@samba.org>
Sun, 11 Apr 2004 16:37:06 +0000 (16:37 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:51:13 +0000 (12:51 -0500)
(This used to be commit 1a7de762c60177b6e250f81cdeb3466fce148bff)

source4/lib/registry/common/reg_interface.c
source4/lib/registry/common/registry.h
source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c

index 9c78ae55fb304d3835338985b540670d053a74da..5e6b4fbac882c906fa15128170312aae33fc9db7 100644 (file)
@@ -98,6 +98,7 @@ WERROR reg_open(const char *backend, const char *location, const char *credentia
        ret = talloc(mem_ctx, sizeof(REG_HANDLE));
        ZERO_STRUCTP(ret);      
        ret->location = location?talloc_strdup(mem_ctx, location):NULL;
+       ret->credentials = credentials?talloc_strdup(mem_ctx, credentials):NULL;
        ret->functions = entry->functions;
        ret->backend_data = NULL;
        ret->mem_ctx = mem_ctx;
index 6e12de258de408b999ea7b9adceec4685f5d7465..9d7e17cf56bea7645d3f4bfa1bcd152b095ff503 100644 (file)
@@ -121,6 +121,7 @@ struct reg_handle_s {
        struct registry_ops *functions;
        REG_SUBTREE *subtrees;
        char *location;
+       char *credentials;
        void *backend_data;
        TALLOC_CTX *mem_ctx;
 };
index 9d90523a75c1670352ff7c1e8cc6357b09c7ee85..a7e5051ce4a60a6e0d1c39c9119477a1685f0cf9 100644 (file)
@@ -1697,12 +1697,16 @@ static WERROR nt_value_by_index(REG_KEY *k, int n, REG_VAL **value)
 {
        VL_TYPE *vl;
        int val_off, vk_off;
+       int val_count;
        VK_HDR *vk_hdr;
        REGF *regf = k->handle->backend_data;
        NK_HDR *nk_hdr = k->backend_data;
+       val_count = IVAL(&nk_hdr->val_cnt,0);
        val_off = IVAL(&nk_hdr->val_off,0);
        vl = (VL_TYPE *)LOCN(regf->base, val_off);
        DEBUG(2, ("Val List Offset: %0X\n", val_off));
+       if(n < 0) return WERR_INVALID_PARAM;
+       if(n >= val_count) return WERR_NO_MORE_ITEMS;
 
        vk_off = IVAL(&vl[n],0);
        vk_hdr = (VK_HDR *)LOCN(regf->base, vk_off);