1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

ldb_get_value_by_id: Fix the return of the default value

The return of the values of a certain key has been broken since I've introduced the default value.
Now the behaviour is correct: If no default value exists, start with index zero to fetch the other values. Otherwise let zero be the default value and enumerate the others starting with one.
This commit is contained in:
Matthias Dieter Wallnöfer 2008-09-13 12:10:00 +02:00 committed by Jelmer Vernooij
parent 036b650ee4
commit f58f74949d

View File

@ -1,7 +1,8 @@
/* /*
Unix SMB/CIFS implementation. Unix SMB/CIFS implementation.
Registry interface Registry interface
Copyright (C) Jelmer Vernooij 2004-2007. Copyright (C) 2004-2007, Jelmer Vernooij, jelmer@samba.org
Copyright (C) 2008 Matthias Dieter Wallnöfer, mwallnoefer@yahoo.de
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -318,24 +319,24 @@ static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct hive_key *k,
{ {
struct ldb_key_data *kd = talloc_get_type(k, struct ldb_key_data); struct ldb_key_data *kd = talloc_get_type(k, struct ldb_key_data);
if (idx == 0) { /* if default value exists, give it back */
/* default value */ if (W_ERROR_IS_OK(ldb_get_default_value(mem_ctx, k, name, data_type, data)))
return ldb_get_default_value(mem_ctx, k, name, data_type, data); if (idx == 0)
} else { return WERR_OK;
/* normal value */ else
--idx;
/* Do the search if necessary */ /* Do the search if necessary */
if (kd->values == NULL) { if (kd->values == NULL) {
W_ERROR_NOT_OK_RETURN(cache_values(kd)); W_ERROR_NOT_OK_RETURN(cache_values(kd));
}
if (idx >= kd->value_count)
return WERR_NO_MORE_ITEMS;
reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm),
kd->values[idx], name, data_type, data);
} }
if (idx >= kd->value_count)
return WERR_NO_MORE_ITEMS;
reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm),
kd->values[idx], name, data_type, data);
return WERR_OK; return WERR_OK;
} }