summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2002-12-09 09:26:17 +0000
committerRichard Sharpe <sharpe@samba.org>2002-12-09 09:26:17 +0000
commit2ad2557d1136e24549277e8a6c6b19fd37b7c091 (patch)
tree761141e893dfd6fc6fa87a163622b1558001aec7 /source3
parentc5d23bdb8002fd509b17de13b43bdc5271298ef6 (diff)
downloadsamba-2ad2557d1136e24549277e8a6c6b19fd37b7c091.tar.gz
samba-2ad2557d1136e24549277e8a6c6b19fd37b7c091.tar.bz2
samba-2ad2557d1136e24549277e8a6c6b19fd37b7c091.zip
Handle the creation of more parts of the tree ... Still have to do SK records
and the data parts of the VK records. Also have to code up routines that can iterate across keys and values, as well as return values associated with a particular key, etc. (This used to be commit 8dd608f7adeab33655b7eb139185108a69f64906)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/editreg.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/source3/utils/editreg.c b/source3/utils/editreg.c
index c5952de3a8..348436df4f 100644
--- a/source3/utils/editreg.c
+++ b/source3/utils/editreg.c
@@ -357,7 +357,7 @@ typedef struct val_key_s {
typedef struct val_list_s {
int val_count;
- VAL_KEY vals[1];
+ VAL_KEY *vals[1];
} VAL_LIST;
#ifndef MAXSUBAUTHS
@@ -769,6 +769,7 @@ VAL_KEY *process_vk(REGF *regf, VK_HDR *vk_hdr, int size)
char val_name[1024], data_value[1024];
int nam_len, dat_len, flag, dat_type, dat_off, vk_id;
char *val_type;
+ VAL_KEY *tmp = NULL;
if (!vk_hdr) return NULL;
@@ -782,9 +783,23 @@ VAL_KEY *process_vk(REGF *regf, VK_HDR *vk_hdr, int size)
val_name[nam_len] = '\0';
flag = SVAL(&vk_hdr->flag);
dat_type = IVAL(&vk_hdr->dat_type);
+ dat_len = IVAL(&vk_hdr->dat_len); /* If top bit, offset contains data */
- if (flag & 0x01)
+ tmp = (VAL_KEY *)malloc(sizeof(VAL_KEY));
+ if (!tmp) {
+ goto error;
+ }
+ bzero(tmp, sizeof(VAL_KEY));
+ tmp->has_name = flag;
+ tmp->data_type = dat_type;
+
+ if (flag & 0x01) {
strncpy(val_name, vk_hdr->dat_name, nam_len);
+ tmp->name = strdup(val_name);
+ if (!tmp->name) {
+ goto error;
+ }
+ }
else
strncpy(val_name, "<No Name>", 10);
@@ -796,6 +811,10 @@ VAL_KEY *process_vk(REGF *regf, VK_HDR *vk_hdr, int size)
fprintf(stdout, " %s : %s : \n", val_name, val_type);
+ return tmp;
+
+ error:
+ /* XXX: FIXME, free the partially allocated struct */
return NULL;
}
@@ -807,17 +826,32 @@ VAL_LIST *process_vl(REGF *regf, VL_TYPE vl, int count, int size)
{
int i, vk_off;
VK_HDR *vk_hdr;
+ VAL_LIST *tmp = NULL;
if (-size < (count+1)*sizeof(int)){
fprintf(stderr, "Error in VL header format. Size less than space required. %d\n", -size);
return NULL;
}
+ tmp = (VAL_LIST *)malloc(sizeof(VAL_LIST) + (count - 1) * sizeof(VAL_KEY *));
+ if (!tmp) {
+ goto error;
+ }
+
for (i=0; i<count; i++) {
vk_off = IVAL(&vl[i]);
vk_hdr = (VK_HDR *)LOCN(regf->base, vk_off);
- process_vk(regf, vk_hdr, BLK_SIZE(vk_hdr));
+ tmp->vals[i] = process_vk(regf, vk_hdr, BLK_SIZE(vk_hdr));
+ if (!tmp->vals[i]){
+ goto error;
+ }
}
+
+ return tmp;
+
+ error:
+ /* XXX: FIXME, free the partially allocated structure */
+ return NULL;
}
/*
@@ -867,6 +901,7 @@ KEY_LIST *process_lf(REGF *regf, LF_HDR *lf_hdr, int size)
return tmp;
error:
+ /* XXX: FIXME, free the partially allocated structure */
return NULL;
}