1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

dbwrap: dbwrap_store_int32->dbwrap_store_int32_bystring

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

View File

@ -87,8 +87,8 @@ NTSTATUS dbwrap_fetch_bystring(struct db_context *db, TALLOC_CTX *mem_ctx,
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_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_store_uint32(struct db_context *db, const char *keystr,

View File

@ -51,8 +51,8 @@ NTSTATUS dbwrap_fetch_int32_bystring(struct db_context *db, const char *keystr,
return NT_STATUS_OK;
}
NTSTATUS dbwrap_store_int32(struct db_context *db, const char *keystr,
int32_t v)
NTSTATUS dbwrap_store_int32_bystring(struct db_context *db, const char *keystr,
int32_t v)
{
struct db_record *rec;
int32_t v_store;

View File

@ -192,8 +192,8 @@ bool share_info_db_init(void)
if ((vers_id == SHARE_DATABASE_VERSION_V1) || (IREV(vers_id) == SHARE_DATABASE_VERSION_V1)) {
/* Written on a bigendian machine with old fetch_int code. Save as le. */
status = dbwrap_store_int32(share_db, vstring,
SHARE_DATABASE_VERSION_V2);
status = dbwrap_store_int32_bystring(
share_db, vstring, SHARE_DATABASE_VERSION_V2);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("dbwrap_store_int32 failed: %s\n",
nt_errstr(status)));
@ -208,8 +208,8 @@ bool share_info_db_init(void)
DEBUG(0, ("traverse failed\n"));
goto cancel;
}
status = dbwrap_store_int32(share_db, vstring,
SHARE_DATABASE_VERSION_V2);
status = dbwrap_store_int32_bystring(
share_db, vstring, SHARE_DATABASE_VERSION_V2);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("dbwrap_store_int32 failed: %s\n",
nt_errstr(status)));
@ -224,8 +224,8 @@ bool share_info_db_init(void)
DEBUG(0, ("traverse failed\n"));
goto cancel;
}
status = dbwrap_store_int32(share_db, vstring,
SHARE_DATABASE_VERSION_V3);
status = dbwrap_store_int32_bystring(
share_db, vstring, SHARE_DATABASE_VERSION_V3);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("dbwrap_store_int32 failed: %s\n",
nt_errstr(status)));

View File

@ -392,16 +392,16 @@ static bool tdbsam_convert(struct db_context **pp_db, const char *name, int32 fr
goto cancel;
}
status = dbwrap_store_int32(db, TDBSAM_VERSION_STRING,
TDBSAM_VERSION);
status = dbwrap_store_int32_bystring(db, TDBSAM_VERSION_STRING,
TDBSAM_VERSION);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("tdbsam_convert: Could not store tdbsam version: "
"%s\n", nt_errstr(status)));
goto cancel;
}
status = dbwrap_store_int32(db, TDBSAM_MINOR_VERSION_STRING,
TDBSAM_MINOR_VERSION);
status = dbwrap_store_int32_bystring(db, TDBSAM_MINOR_VERSION_STRING,
TDBSAM_MINOR_VERSION);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("tdbsam_convert: Could not store tdbsam minor "
"version: %s\n", nt_errstr(status)));

View File

@ -66,7 +66,7 @@ bool run_dbwrap_watch1(int dummy)
}
TALLOC_FREE(rec);
status = dbwrap_store_int32(db, keystr, 1);
status = dbwrap_store_int32_bystring(db, keystr, 1);
if (!NT_STATUS_IS_OK(status)) {
fprintf(stderr, "dbwrap_store_int32 failed: %s\n",
nt_errstr(status));

View File

@ -285,7 +285,8 @@ static int net_idmap_restore(struct net_context *c, int argc, const char **argv)
break;
}
} else if (sscanf(line, "USER HWM %lu", &idval) == 1) {
status = dbwrap_store_int32(db, "USER HWM", idval);
status = dbwrap_store_int32_bystring(
db, "USER HWM", idval);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr,
_("Could not store USER HWM: %s\n"),
@ -293,7 +294,8 @@ static int net_idmap_restore(struct net_context *c, int argc, const char **argv)
break;
}
} else if (sscanf(line, "GROUP HWM %lu", &idval) == 1) {
status = dbwrap_store_int32(db, "GROUP HWM", idval);
status = dbwrap_store_int32_bystring(
db, "GROUP HWM", idval);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr,
_("Could not store GROUP HWM: %s\n"),

View File

@ -193,7 +193,7 @@ static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db)
wm = dom->low_id;
}
status = dbwrap_store_int32(db, HWM_USER, wm);
status = dbwrap_store_int32_bystring(db, HWM_USER, wm);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Unable to byteswap user hwm in idmap "
"database: %s\n", nt_errstr(status)));
@ -211,7 +211,7 @@ static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db)
wm = dom->low_id;
}
status = dbwrap_store_int32(db, HWM_GROUP, wm);
status = dbwrap_store_int32_bystring(db, HWM_GROUP, wm);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Unable to byteswap group hwm in idmap "
"database: %s\n", nt_errstr(status)));
@ -235,7 +235,8 @@ static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db)
return False;
}
status = dbwrap_store_int32(db, "IDMAP_VERSION", IDMAP_VERSION);
status = dbwrap_store_int32_bystring(db, "IDMAP_VERSION",
IDMAP_VERSION);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Unable to store idmap version in database: %s\n",
nt_errstr(status)));