dbwrap: dbwrap_store_int32->dbwrap_store_int32_bystring
[kai/samba.git] / source3 / utils / net_idmap.c
index 3a3ae21f07323096da901633fd38abaa16b35804..28f9ed938eeca636b774adef9ed8b1727abb3dfc 100644 (file)
@@ -131,7 +131,8 @@ static int net_idmap_dump(struct net_context *c, int argc, const char **argv)
        }
        d_fprintf(stderr, _("dumping id mapping from %s\n"), dbfile);
 
-       db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDONLY, 0);
+       db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDONLY, 0,
+                    DBWRAP_LOCK_ORDER_1);
        if (db == NULL) {
                d_fprintf(stderr, _("Could not open idmap db (%s): %s\n"),
                          dbfile, strerror(errno));
@@ -240,7 +241,8 @@ static int net_idmap_restore(struct net_context *c, int argc, const char **argv)
                input = stdin;
        }
 
-       db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644);
+       db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644,
+                    DBWRAP_LOCK_ORDER_1);
        if (db == NULL) {
                d_fprintf(stderr, _("Could not open idmap db (%s): %s\n"),
                          dbfile, strerror(errno));
@@ -283,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"),
@@ -291,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"),
@@ -444,7 +448,8 @@ static int net_idmap_delete(struct net_context *c, int argc, const char **argv)
        }
        d_fprintf(stderr, _("deleting id mapping from %s\n"), dbfile);
 
-       db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDWR, 0);
+       db = db_open(mem_ctx, dbfile, 0, TDB_DEFAULT, O_RDWR, 0,
+                    DBWRAP_LOCK_ORDER_1);
        if (db == NULL) {
                d_fprintf(stderr, _("Could not open idmap db (%s): %s\n"),
                          dbfile, strerror(errno));
@@ -616,7 +621,8 @@ static int net_idmap_aclmapset(struct net_context *c, int argc, const char **arg
        }
 
        if (!(db = db_open(mem_ctx, argv[0], 0, TDB_DEFAULT,
-                          O_RDWR|O_CREAT, 0600))) {
+                          O_RDWR|O_CREAT, 0600,
+                          DBWRAP_LOCK_ORDER_1))) {
                d_fprintf(stderr, _("db_open failed: %s\n"), strerror(errno));
                goto fail;
        }