dbwrap: dbwrap_fetch_uint32->dbwrap_fetch_uint32_bystring
authorVolker Lendecke <vl@samba.org>
Thu, 14 Jun 2012 18:39:27 +0000 (20:39 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 15 Jun 2012 10:14:28 +0000 (12:14 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
lib/dbwrap/dbwrap.h
lib/dbwrap/dbwrap_util.c
source3/passdb/account_pol.c
source3/passdb/pdb_tdb.c
source3/torture/torture.c
source3/utils/dbwrap_tool.c
source3/utils/net_idmap_check.c
source3/utils/net_registry_check.c
source3/winbindd/idmap_autorid.c
source3/winbindd/idmap_tdb.c
source3/winbindd/idmap_tdb_common.c

index 7123ca7a6152005746a2747913fe1d548a833ef8..01425115b74f360f9b3ebabeef4c5a3b9363d3b2 100644 (file)
@@ -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,
index a3876064ad5f0f1d46716d0827efaf9146c84312..7acc3b5e567e49d1320923a79c0f4724da408482 100644 (file)
@@ -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;
index 4cb185c49479bd60e53cfffcd6b7e58fb60628fd..9c6f40107a9512e68e0d1a768878a6fe8e21f186 100644 (file)
@@ -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, &regval);
+       status = dbwrap_fetch_uint32_bystring(db, name, &regval);
        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;
index 3faa4cf75ddbe33133a30bc599d203c38faf6f7a..43e561bd93bcb87926a6b48fb84d7b830d625eb4 100644 (file)
@@ -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;
        }
index 5fa633060cd1a5e8c92c90e82fa8eb8900f098d8..a9edd6152058bc96bd3c4215d87d05090e2e1c2a 100644 (file)
@@ -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));
index 677a9adeb4ec4c9b1c5332f6990e303bbbc63691..6fb58090e06e86bbc4393b67b7eb25291e80d304 100644 (file)
@@ -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;
index 1269410beeca664ce132a77f96762269e277dc34..4174238298dd2883d4c1168cce7fc494c637b3cf 100644 (file)
@@ -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);
index 58cd9f605497de8b0a240288c0f95a8712261eaa..d6c577b89a0c00b346ddc0638640b5a260234c5d 100644 (file)
@@ -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;
index df63fa99207257bf8a9015c3212c581e123cbc42..d02f34e573f9db1b3bd4df52a27d7d9ec3d8952f 100644 (file)
@@ -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)));
index 3e46cf76b7888e8f09da3b1adfb4852bf8ab0f2f..4c3b4b190a890ac71cbe5495bb9d27b5d88ad05f 100644 (file)
@@ -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;
        }
index ca6f6d8e0829d3ddb3ba6531a6b328a157d0aade..1c2e3467b25f80d3541b5d666deaf73a5cdc1e28 100644 (file)
@@ -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;