summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2003-04-20 21:43:07 +0000
committerRichard Sharpe <sharpe@samba.org>2003-04-20 21:43:07 +0000
commit6f499782dcf6bd621f5e076046bffdc714fa01f9 (patch)
tree4d58181e398b0eacfc141cf43037048fce14b6e9 /source3
parent963eff4b181cdd038e019c5a2a2bd0ab9dea222f (diff)
downloadsamba-6f499782dcf6bd621f5e076046bffdc714fa01f9.tar.gz
samba-6f499782dcf6bd621f5e076046bffdc714fa01f9.tar.bz2
samba-6f499782dcf6bd621f5e076046bffdc714fa01f9.zip
Well, we can now add keys and values and delete keys and values ...
Lots more to do, like handling regular expressions for keys, and input of the security descriptors, etc. However, I now have to work on writing the in-memory tree out to a file in a format that Windows can understand. (This used to be commit 562b36510c704eba84b036aacdb1f984339afafc)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/editreg.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/utils/editreg.c b/source3/utils/editreg.c
index 5e79df1a14..b35e278ab0 100644
--- a/source3/utils/editreg.c
+++ b/source3/utils/editreg.c
@@ -981,10 +981,10 @@ void *str_to_val(int type, char *val, int *len)
if (!dwordp) return NULL;
/* Allow for ddddd and 0xhhhhh and 0ooooo */
if (strncmp(val, "0x", 2) == 0 || strncmp(val, "0X", 2) == 0) {
- sscanf(val, "0[xX]%X", dwordp);
+ sscanf(&val[2], "%X", dwordp);
}
else if (*val == '0') {
- sscanf(val, "0%o", dwordp);
+ sscanf(&val[1], "%o", dwordp);
}
else {
sscanf(val, "%d", dwordp);
@@ -1018,7 +1018,9 @@ VAL_KEY *nt_add_reg_value(REG_KEY *key, char *name, int type, char *value)
assert(type != REG_TYPE_DELETE); /* We never process deletes here */
for (i = 0; i < key->values->val_count; i++) {
- if (strcmp(name, key->values->vals[i]->name) == 0){ /* Change the value */
+ if ((!key->values->vals[i]->has_name && !*name) ||
+ (key->values->vals[i]->has_name &&
+ strcmp(name, key->values->vals[i]->name) == 0)){ /* Change the value */
free(key->values->vals[i]->data_blk);
key->values->vals[i]->data_blk = str_to_val(type, value, &
key->values->vals[i]->data_len);
@@ -3272,7 +3274,7 @@ int main(int argc, char *argv[])
if (reg_val) nt_delete_val_key(reg_val);
}
else {
- reg_val = nt_add_reg_value(tmp, reg_val->name, val->type,
+ reg_val = nt_add_reg_value(tmp, val->name, val->type,
val->val);
}