1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

dbwrap: dbwrap_fetch_int32->dbwrap_fetch_int32_bystring

Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Volker Lendecke 2012-06-14 20:26:28 +02:00 committed by Michael Adam
parent 9afd4be688
commit 737c0a5473
7 changed files with 23 additions and 20 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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;
}

View File

@ -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 */
}

View File

@ -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",

View File

@ -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));

View File

@ -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;
}