diff options
-rw-r--r-- | source3/utils/dbwrap_tool.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c index 406e89ee4de..ffca6b6d62a 100644 --- a/source3/utils/dbwrap_tool.c +++ b/source3/utils/dbwrap_tool.c @@ -411,6 +411,7 @@ int main(int argc, const char **argv) enum dbwrap_type type; const char *valuestr = "0"; int persistent = 0; + int non_persistent = 0; int tdb_flags = TDB_DEFAULT; TALLOC_CTX *mem_ctx = talloc_stackframe(); @@ -420,7 +421,13 @@ int main(int argc, const char **argv) struct poptOption popt_options[] = { POPT_AUTOHELP POPT_COMMON_SAMBA - { "persistent", 0, POPT_ARG_NONE, &persistent, 0, "treat the database as persistent", NULL }, + { "non-persistent", 0, POPT_ARG_NONE, &non_persistent, 0, + "treat the database as non-persistent " + "(CAVEAT: This mode might wipe your database!)", + NULL }, + { "persistent", 0, POPT_ARG_NONE, &persistent, 0, + "treat the database as persistent", + NULL }, POPT_TABLEEND }; int opt; @@ -463,6 +470,16 @@ int main(int argc, const char **argv) goto done; } + if ((persistent == 0 && non_persistent == 0) || + (persistent == 1 && non_persistent == 1)) + { + d_fprintf(stderr, "ERROR: you must specify exactly one " + "of --persistent and --non-persistent\n"); + goto done; + } else if (non_persistent == 1) { + tdb_flags |= TDB_CLEAR_IF_FIRST; + } + dbname = extra_argv[0]; opname = extra_argv[1]; @@ -563,10 +580,6 @@ int main(int argc, const char **argv) goto done; } - if (persistent == 0) { - tdb_flags |= TDB_CLEAR_IF_FIRST; - } - switch (op) { case OP_FETCH: case OP_STORE: |