From 7f19a5ab52ac6ecb380a49ec14072d0fd501f9db Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 14 Jun 2012 20:39:27 +0200 Subject: [PATCH] dbwrap: dbwrap_fetch_uint32->dbwrap_fetch_uint32_bystring Signed-off-by: Michael Adam --- lib/dbwrap/dbwrap.h | 4 ++-- lib/dbwrap/dbwrap_util.c | 4 ++-- source3/passdb/account_pol.c | 6 +++--- source3/passdb/pdb_tdb.c | 2 +- source3/torture/torture.c | 4 ++-- source3/utils/dbwrap_tool.c | 2 +- source3/utils/net_idmap_check.c | 4 ++-- source3/utils/net_registry_check.c | 5 +++-- source3/winbindd/idmap_autorid.c | 11 ++++++----- source3/winbindd/idmap_tdb.c | 4 ++-- source3/winbindd/idmap_tdb_common.c | 2 +- 11 files changed, 25 insertions(+), 23 deletions(-) diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h index 7123ca7a615..01425115b74 100644 --- a/lib/dbwrap/dbwrap.h +++ b/lib/dbwrap/dbwrap.h @@ -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, diff --git a/lib/dbwrap/dbwrap_util.c b/lib/dbwrap/dbwrap_util.c index a3876064ad5..7acc3b5e567 100644 --- a/lib/dbwrap/dbwrap_util.c +++ b/lib/dbwrap/dbwrap_util.c @@ -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; diff --git a/source3/passdb/account_pol.c b/source3/passdb/account_pol.c index 4cb185c4947..9c6f40107a9 100644 --- a/source3/passdb/account_pol.c +++ b/source3/passdb/account_pol.c @@ -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; diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 3faa4cf75dd..43e561bd93b 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -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; } diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 5fa633060cd..a9edd615205 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -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)); diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c index 677a9adeb4e..6fb58090e06 100644 --- a/source3/utils/dbwrap_tool.c +++ b/source3/utils/dbwrap_tool.c @@ -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; diff --git a/source3/utils/net_idmap_check.c b/source3/utils/net_idmap_check.c index 1269410beec..4174238298d 100644 --- a/source3/utils/net_idmap_check.c +++ b/source3/utils/net_idmap_check.c @@ -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); diff --git a/source3/utils/net_registry_check.c b/source3/utils/net_registry_check.c index 58cd9f60549..d6c577b89a0 100644 --- a/source3/utils/net_registry_check.c +++ b/source3/utils/net_registry_check.c @@ -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; diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index df63fa99207..d02f34e573f 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -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))); diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index 3e46cf76b78..4c3b4b190a8 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -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; } diff --git a/source3/winbindd/idmap_tdb_common.c b/source3/winbindd/idmap_tdb_common.c index ca6f6d8e082..1c2e3467b25 100644 --- a/source3/winbindd/idmap_tdb_common.c +++ b/source3/winbindd/idmap_tdb_common.c @@ -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; -- 2.11.4.GIT