From 737c0a54731803c84f0f29d96dd40ac819aec3e8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 14 Jun 2012 20:26:28 +0200 Subject: dbwrap: dbwrap_fetch_int32->dbwrap_fetch_int32_bystring Signed-off-by: Michael Adam --- lib/dbwrap/dbwrap.h | 4 ++-- lib/dbwrap/dbwrap_util.c | 4 ++-- source3/lib/sharesec.c | 4 ++-- source3/passdb/pdb_tdb.c | 15 ++++++++------- source3/registry/reg_backend_db.c | 6 ++++-- source3/utils/dbwrap_tool.c | 2 +- source3/winbindd/idmap_tdb.c | 8 ++++---- 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h index 59e5af069e..677dbed765 100644 --- a/lib/dbwrap/dbwrap.h +++ b/lib/dbwrap/dbwrap.h @@ -85,8 +85,8 @@ NTSTATUS dbwrap_store_bystring(struct db_context *db, const char *key, NTSTATUS dbwrap_fetch_bystring(struct db_context *db, TALLOC_CTX *mem_ctx, const char *key, TDB_DATA *value); -NTSTATUS dbwrap_fetch_int32(struct db_context *db, const char *keystr, - int32_t *result); +NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr, + int32_t *result); NTSTATUS dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v); NTSTATUS dbwrap_fetch_uint32(struct db_context *db, const char *keystr, diff --git a/lib/dbwrap/dbwrap_util.c b/lib/dbwrap/dbwrap_util.c index 314a55208c..2865da0244 100644 --- a/lib/dbwrap/dbwrap_util.c +++ b/lib/dbwrap/dbwrap_util.c @@ -26,8 +26,8 @@ #include "dbwrap.h" #include "lib/util/util_tdb.h" -NTSTATUS dbwrap_fetch_int32(struct db_context *db, const char *keystr, - int32_t *result) +NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr, + int32_t *result) { TDB_DATA dbuf; NTSTATUS status; diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c index cb8993cc8e..b53190d488 100644 --- a/source3/lib/sharesec.c +++ b/source3/lib/sharesec.c @@ -156,7 +156,7 @@ bool share_info_db_init(void) return False; } - status = dbwrap_fetch_int32(share_db, vstring, &vers_id); + status = dbwrap_fetch_int32_bystring(share_db, vstring, &vers_id); if (!NT_STATUS_IS_OK(status)) { vers_id = 0; } @@ -171,7 +171,7 @@ bool share_info_db_init(void) return false; } - status = dbwrap_fetch_int32(share_db, vstring, &vers_id); + status = dbwrap_fetch_int32_bystring(share_db, vstring, &vers_id); if (!NT_STATUS_IS_OK(status)) { vers_id = 0; } diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index a090fcd5bb..067c364370 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -451,14 +451,15 @@ static bool tdbsam_open( const char *name ) } /* Check the version */ - status = dbwrap_fetch_int32(db_sam, TDBSAM_VERSION_STRING, &version); + status = dbwrap_fetch_int32_bystring(db_sam, TDBSAM_VERSION_STRING, + &version); if (!NT_STATUS_IS_OK(status)) { version = 0; /* Version not found, assume version 0 */ } /* Get the minor version */ - status = dbwrap_fetch_int32(db_sam, TDBSAM_MINOR_VERSION_STRING, - &minor_version); + status = dbwrap_fetch_int32_bystring( + db_sam, TDBSAM_MINOR_VERSION_STRING, &minor_version); if (!NT_STATUS_IS_OK(status)) { minor_version = 0; /* Minor version not found, assume 0 */ } @@ -493,15 +494,15 @@ static bool tdbsam_open( const char *name ) } /* Re-check the version */ - status = dbwrap_fetch_int32(db_sam, TDBSAM_VERSION_STRING, - &version); + status = dbwrap_fetch_int32_bystring( + db_sam, TDBSAM_VERSION_STRING, &version); if (!NT_STATUS_IS_OK(status)) { version = 0; /* Version not found, assume version 0 */ } /* Re-check the minor version */ - status = dbwrap_fetch_int32(db_sam, TDBSAM_MINOR_VERSION_STRING, - &minor_version); + status = dbwrap_fetch_int32_bystring( + db_sam, TDBSAM_MINOR_VERSION_STRING, &minor_version); if (!NT_STATUS_IS_OK(status)) { minor_version = 0; /* Minor version not found, assume 0 */ } diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index a5bb5d7943..2e8cef75fa 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -72,7 +72,8 @@ static NTSTATUS regdb_trans_do_action(struct db_context *db, void *private_data) int32_t version_id; struct regdb_trans_ctx *ctx = (struct regdb_trans_ctx *)private_data; - status = dbwrap_fetch_int32(db, REGDB_VERSION_KEYNAME, &version_id); + status = dbwrap_fetch_int32_bystring(db, REGDB_VERSION_KEYNAME, + &version_id); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("ERROR: could not fetch registry db version: %s. " @@ -754,7 +755,8 @@ WERROR regdb_init(void) DEBUG(10, ("regdb_init: registry db openend. refcount reset (%d)\n", regdb_refcount)); - status = dbwrap_fetch_int32(regdb, REGDB_VERSION_KEYNAME, &vers_id); + status = dbwrap_fetch_int32_bystring(regdb, REGDB_VERSION_KEYNAME, + &vers_id); if (!NT_STATUS_IS_OK(status)) { DEBUG(10, ("regdb_init: registry version uninitialized " "(got %d), initializing to version %d\n", diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c index c9d88a30e5..677a9adeb4 100644 --- a/source3/utils/dbwrap_tool.c +++ b/source3/utils/dbwrap_tool.c @@ -41,7 +41,7 @@ static int dbwrap_tool_fetch_int32(struct db_context *db, int32_t value; NTSTATUS status; - status = dbwrap_fetch_int32(db, keyname, &value); + status = dbwrap_fetch_int32_bystring(db, keyname, &value); if (!NT_STATUS_IS_OK(status)) { d_printf("Error fetching int32 from key '%s': %s\n", keyname, nt_errstr(status)); diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index f4ea07e613..a9a7e9c71a 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -168,7 +168,7 @@ static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db) #endif DEBUG(0, ("Upgrading winbindd_idmap.tdb from an old version\n")); - status = dbwrap_fetch_int32(db, "IDMAP_VERSION", &vers); + status = dbwrap_fetch_int32_bystring(db, "IDMAP_VERSION", &vers); if (!NT_STATUS_IS_OK(status)) { vers = -1; } @@ -182,7 +182,7 @@ static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db) int32 wm; - status = dbwrap_fetch_int32(db, HWM_USER, &wm); + status = dbwrap_fetch_int32_bystring(db, HWM_USER, &wm); if (!NT_STATUS_IS_OK(status)) { wm = -1; } @@ -200,7 +200,7 @@ static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db) return False; } - status = dbwrap_fetch_int32(db, HWM_GROUP, &wm); + status = dbwrap_fetch_int32_bystring(db, HWM_GROUP, &wm); if (!NT_STATUS_IS_OK(status)) { wm = -1; } @@ -345,7 +345,7 @@ static NTSTATUS idmap_tdb_open_db(struct idmap_domain *dom) } /* check against earlier versions */ - ret = dbwrap_fetch_int32(db, "IDMAP_VERSION", &version); + ret = dbwrap_fetch_int32_bystring(db, "IDMAP_VERSION", &version); if (!NT_STATUS_IS_OK(ret)) { version = -1; } -- cgit