mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
dbwrap: dbwrap_fetch_uint32->dbwrap_fetch_uint32_bystring
Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
parent
749314fcf9
commit
7f19a5ab52
@ -89,8 +89,8 @@ NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr,
|
||||
int32_t *result);
|
||||
NTSTATUS dbwrap_store_int32_bystring(struct db_context *db, const char *keystr,
|
||||
int32_t v);
|
||||
NTSTATUS dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
|
||||
uint32_t *val);
|
||||
NTSTATUS dbwrap_fetch_uint32_bystring(struct db_context *db,
|
||||
const char *keystr, uint32_t *val);
|
||||
NTSTATUS dbwrap_store_uint32(struct db_context *db, const char *keystr,
|
||||
uint32_t v);
|
||||
NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
|
||||
|
@ -74,8 +74,8 @@ NTSTATUS dbwrap_store_int32_bystring(struct db_context *db, const char *keystr,
|
||||
return status;
|
||||
}
|
||||
|
||||
NTSTATUS dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
|
||||
uint32_t *val)
|
||||
NTSTATUS dbwrap_fetch_uint32_bystring(struct db_context *db,
|
||||
const char *keystr, uint32_t *val)
|
||||
{
|
||||
TDB_DATA dbuf;
|
||||
NTSTATUS status;
|
||||
|
@ -233,7 +233,7 @@ bool init_account_policy(void)
|
||||
}
|
||||
}
|
||||
|
||||
status = dbwrap_fetch_uint32(db, vstring, &version);
|
||||
status = dbwrap_fetch_uint32_bystring(db, vstring, &version);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
version = 0;
|
||||
}
|
||||
@ -250,7 +250,7 @@ bool init_account_policy(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
status = dbwrap_fetch_uint32(db, vstring, &version);
|
||||
status = dbwrap_fetch_uint32_bystring(db, vstring, &version);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
version = 0;
|
||||
}
|
||||
@ -340,7 +340,7 @@ bool account_policy_get(enum pdb_policy_type type, uint32_t *value)
|
||||
return False;
|
||||
}
|
||||
|
||||
status = dbwrap_fetch_uint32(db, name, ®val);
|
||||
status = dbwrap_fetch_uint32_bystring(db, name, ®val);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(1, ("account_policy_get: tdb_fetch_uint32 failed for type %d (%s), returning 0\n", type, name));
|
||||
return False;
|
||||
|
@ -329,7 +329,7 @@ static bool tdbsam_upgrade_next_rid(struct db_context *db)
|
||||
bool ok = false;
|
||||
NTSTATUS status;
|
||||
|
||||
status = dbwrap_fetch_uint32(db, NEXT_RID_STRING, &rid);
|
||||
status = dbwrap_fetch_uint32_bystring(db, NEXT_RID_STRING, &rid);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -8656,7 +8656,7 @@ static bool run_local_dbtrans(int dummy)
|
||||
break;
|
||||
}
|
||||
|
||||
status = dbwrap_fetch_uint32(db, "transtest", &val);
|
||||
status = dbwrap_fetch_uint32_bystring(db, "transtest", &val);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf(__location__ "dbwrap_fetch_uint32 failed: %s\n",
|
||||
nt_errstr(status));
|
||||
@ -8669,7 +8669,7 @@ static bool run_local_dbtrans(int dummy)
|
||||
}
|
||||
}
|
||||
|
||||
status = dbwrap_fetch_uint32(db, "transtest", &val2);
|
||||
status = dbwrap_fetch_uint32_bystring(db, "transtest", &val2);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf(__location__ "dbwrap_fetch_uint32 failed: %s\n",
|
||||
nt_errstr(status));
|
||||
|
@ -59,7 +59,7 @@ static int dbwrap_tool_fetch_uint32(struct db_context *db,
|
||||
uint32_t value;
|
||||
NTSTATUS ret;
|
||||
|
||||
ret = dbwrap_fetch_uint32(db, keyname, &value);
|
||||
ret = dbwrap_fetch_uint32_bystring(db, keyname, &value);
|
||||
if (NT_STATUS_IS_OK(ret)) {
|
||||
d_printf("%u\n", value);
|
||||
return 0;
|
||||
|
@ -394,7 +394,7 @@ static bool check_version(struct check_ctx* ctx) {
|
||||
char action = 's';
|
||||
struct check_actions* act = &ctx->action;
|
||||
|
||||
status = dbwrap_fetch_uint32(ctx->db, key, &version);
|
||||
status = dbwrap_fetch_uint32_bystring(ctx->db, key, &version);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("No version number, assume 2\n");
|
||||
action = get_action(&act->no_version, NULL, NULL);
|
||||
@ -424,7 +424,7 @@ static void check_hwm(struct check_ctx* ctx, const char* key, uint32_t target) {
|
||||
NTSTATUS status;
|
||||
struct check_actions* act = &ctx->action;
|
||||
|
||||
status = dbwrap_fetch_uint32(ctx->db, key, &hwm);
|
||||
status = dbwrap_fetch_uint32_bystring(ctx->db, key, &hwm);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("No %s should be %d\n", key, target);
|
||||
action = get_action(&act->invalid_hwm, NULL, NULL);
|
||||
|
@ -844,7 +844,8 @@ static bool get_version(struct check_ctx *ctx) {
|
||||
uint32_t info_version = 0;
|
||||
NTSTATUS status;
|
||||
|
||||
status = dbwrap_fetch_uint32(ctx->idb, "INFO/version", &info_version);
|
||||
status = dbwrap_fetch_uint32_bystring(ctx->idb, "INFO/version",
|
||||
&info_version);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("Warning: no INFO/version found!\n");
|
||||
/* info_version = guess_version(ctx); */
|
||||
@ -923,7 +924,7 @@ dbwrap_store_uint32_verbose(struct db_context *db, const char *key, uint32_t nva
|
||||
uint32_t oval;
|
||||
NTSTATUS status;
|
||||
|
||||
status = dbwrap_fetch_uint32(db, key, &oval);
|
||||
status = dbwrap_fetch_uint32_bystring(db, key, &oval);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
if (nval == oval) {
|
||||
goto done;
|
||||
|
@ -68,7 +68,7 @@ static NTSTATUS idmap_autorid_get_domainrange_action(struct db_context *db,
|
||||
|
||||
cfg = (struct autorid_domain_config *)private_data;
|
||||
|
||||
ret = dbwrap_fetch_uint32(db, cfg->sid, &(cfg->domainnum));
|
||||
ret = dbwrap_fetch_uint32_bystring(db, cfg->sid, &(cfg->domainnum));
|
||||
|
||||
if (NT_STATUS_IS_OK(ret)) {
|
||||
/* entry is already present*/
|
||||
@ -78,7 +78,7 @@ static NTSTATUS idmap_autorid_get_domainrange_action(struct db_context *db,
|
||||
DEBUG(10, ("Acquiring new range for domain %s\n", cfg->sid));
|
||||
|
||||
/* fetch the current HWM */
|
||||
ret = dbwrap_fetch_uint32(db, HWM, &hwm);
|
||||
ret = dbwrap_fetch_uint32_bystring(db, HWM, &hwm);
|
||||
if (!NT_STATUS_IS_OK(ret)) {
|
||||
DEBUG(1, ("Fatal error while fetching current "
|
||||
"HWM value: %s\n", nt_errstr(ret)));
|
||||
@ -146,7 +146,8 @@ static NTSTATUS idmap_autorid_get_domainrange(struct autorid_domain_config *dom,
|
||||
* if it is not found create a mapping in a transaction unless
|
||||
* read-only mode has been set
|
||||
*/
|
||||
ret = dbwrap_fetch_uint32(autorid_db, dom->sid, &(dom->domainnum));
|
||||
ret = dbwrap_fetch_uint32_bystring(autorid_db, dom->sid,
|
||||
&(dom->domainnum));
|
||||
|
||||
if (!NT_STATUS_IS_OK(ret)) {
|
||||
if (read_only) {
|
||||
@ -605,7 +606,7 @@ static NTSTATUS idmap_autorid_init_hwm(const char *hwm) {
|
||||
NTSTATUS status;
|
||||
uint32_t hwmval;
|
||||
|
||||
status = dbwrap_fetch_uint32(autorid_db, hwm, &hwmval);
|
||||
status = dbwrap_fetch_uint32_bystring(autorid_db, hwm, &hwmval);
|
||||
if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
|
||||
status = dbwrap_trans_store_int32(autorid_db, hwm, 0);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
@ -843,7 +844,7 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom)
|
||||
/* read previously stored config and current HWM */
|
||||
storedconfig = idmap_autorid_loadconfig(talloc_tos());
|
||||
|
||||
status = dbwrap_fetch_uint32(autorid_db, HWM, &hwm);
|
||||
status = dbwrap_fetch_uint32_bystring(autorid_db, HWM, &hwm);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(1, ("Fatal error while fetching current "
|
||||
"HWM value: %s\n", nt_errstr(status)));
|
||||
|
@ -258,12 +258,12 @@ static NTSTATUS idmap_tdb_init_hwm(struct idmap_domain *dom)
|
||||
ctx = talloc_get_type(dom->private_data,
|
||||
struct idmap_tdb_common_context);
|
||||
|
||||
status = dbwrap_fetch_uint32(ctx->db, HWM_USER, &low_uid);
|
||||
status = dbwrap_fetch_uint32_bystring(ctx->db, HWM_USER, &low_uid);
|
||||
if (!NT_STATUS_IS_OK(status) || low_uid < dom->low_id) {
|
||||
update_uid = true;
|
||||
}
|
||||
|
||||
status = dbwrap_fetch_uint32(ctx->db, HWM_GROUP, &low_gid);
|
||||
status = dbwrap_fetch_uint32_bystring(ctx->db, HWM_GROUP, &low_gid);
|
||||
if (!NT_STATUS_IS_OK(status) || low_gid < dom->low_id) {
|
||||
update_gid = true;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ static NTSTATUS idmap_tdb_common_allocate_id_action(struct db_context *db,
|
||||
|
||||
state = (struct idmap_tdb_common_allocate_id_context *)private_data;
|
||||
|
||||
ret = dbwrap_fetch_uint32(db, state->hwmkey, &hwm);
|
||||
ret = dbwrap_fetch_uint32_bystring(db, state->hwmkey, &hwm);
|
||||
if (!NT_STATUS_IS_OK(ret)) {
|
||||
ret = NT_STATUS_INTERNAL_DB_ERROR;
|
||||
goto done;
|
||||
|
Loading…
x
Reference in New Issue
Block a user