idmap_autorid: refactor idmap_autorid_loadconfig to use idmap_config_getconfigstr
authorMichael Adam <obnox@samba.org>
Wed, 28 Aug 2013 12:32:19 +0000 (14:32 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 1 Oct 2013 08:49:10 +0000 (10:49 +0200)
Pair-Programmed-with: Atul Kulkarni <atul.kulkarni@in.ibm.com>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Atul Kulkarni <atul.kulkarni@in.ibm.com>
source3/winbindd/idmap_autorid_tdb.c

index 3f5a2e0f7e807b2f5b39c7b9504e4247f58798d7..dbb0265f194d3d367eef79d16692c484cc67a139 100644 (file)
@@ -275,16 +275,13 @@ NTSTATUS idmap_autorid_getconfigstr(struct db_context *db, TALLOC_CTX *mem_ctx,
 struct autorid_global_config *idmap_autorid_loadconfig(struct db_context *db,
                                                       TALLOC_CTX *ctx)
 {
-
-       TDB_DATA data;
        struct autorid_global_config *cfg;
        unsigned long minvalue, rangesize, maxranges;
        NTSTATUS status;
+       char *configstr = NULL;
 
-       status = dbwrap_fetch_bystring(db, ctx, CONFIGKEY, &data);
-
+       status = idmap_autorid_getconfigstr(db, ctx, &configstr);
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10, ("No saved config found\n"));
                return NULL;
        }
 
@@ -293,7 +290,7 @@ struct autorid_global_config *idmap_autorid_loadconfig(struct db_context *db,
                return NULL;
        }
 
-       if (sscanf((char *)data.dptr,
+       if (sscanf(configstr,
                   "minvalue:%lu rangesize:%lu maxranges:%lu",
                   &minvalue, &rangesize, &maxranges) != 3) {
                DEBUG(1,