dbwrap: dbwrap_fetch_int32->dbwrap_fetch_int32_bystring
authorVolker Lendecke <vl@samba.org>
Thu, 14 Jun 2012 18:26:28 +0000 (20:26 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 15 Jun 2012 10:14:27 +0000 (12:14 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
lib/dbwrap/dbwrap.h
lib/dbwrap/dbwrap_util.c
source3/lib/sharesec.c
source3/passdb/pdb_tdb.c
source3/registry/reg_backend_db.c
source3/utils/dbwrap_tool.c
source3/winbindd/idmap_tdb.c

index 59e5af069ea4e4aa03cc7515eee406b13cc5af68..677dbed765287bd6f970ab32e973bb7aa80b97fc 100644 (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,
index 314a55208c11a402d28ded2a939b4aca93883640..2865da024406c739decc8a3c8dfaf42aa6b500f6 100644 (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;
index cb8993cc8e19584e47d3b735f7e2972c277a9964..b53190d488d27bec47ca2d7de346ab03065652b9 100644 (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;
        }
index a090fcd5bb4722d1304f43ec075a92ef69c2f237..067c36437031b5d3289c1cd0db466f41f65f3ad7 100644 (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 */
                }
index a5bb5d7943a4d4d16b9497372605683ec42b6c2d..2e8cef75fac11bd10bf5d05861c1f8d02680acb6 100644 (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",
index c9d88a30e56bf101f0fc93d1776b81f1e3ff3e7c..677a9adeb4ec4c9b1c5332f6990e303bbbc63691 100644 (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));
index f4ea07e613cf0bedcb3d8ea498c100113b35a992..a9a7e9c71a64ebe692fa18203dae43a43040fc7c 100644 (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;
        }