summaryrefslogtreecommitdiffstats
path: root/source3/utils/net_registry.c
diff options
context:
space:
mode:
authorGregor Beck <gbeck@sernet.de>2011-06-30 12:08:16 +0200
committerMichael Adam <obnox@samba.org>2011-10-12 22:45:53 +0200
commit502f0b8edcd339a9e47ad1c515303ccd6c164494 (patch)
treee8d8afc793fe22196ad323ed00995010a9cbc62d /source3/utils/net_registry.c
parente430c75d4c275323f5a3ac894647f8ebf2a58a7a (diff)
downloadsamba-502f0b8edcd339a9e47ad1c515303ccd6c164494.tar.gz
samba-502f0b8edcd339a9e47ad1c515303ccd6c164494.tar.xz
samba-502f0b8edcd339a9e47ad1c515303ccd6c164494.zip
s3:net: add command registry check
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/utils/net_registry.c')
-rw-r--r--source3/utils/net_registry.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index 086c4e7ccc..008d02129f 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -35,6 +35,7 @@
#include "../libcli/security/sddl.h"
#include "../libcli/registry/util_reg.h"
#include "passdb/machine_sid.h"
+#include "net_registry_check.h"
/*
*
@@ -1243,6 +1244,54 @@ static int net_registry_convert(struct net_context *c, int argc,
}
/**@}*/
+static int net_registry_check(struct net_context *c, int argc,
+ const char **argv)
+{
+ const char* dbfile;
+ struct check_options opts;
+
+ if (argc > 1|| c->display_usage) {
+ d_printf("%s\n%s",
+ _("Usage:"),
+ _("net registry check [-vraTfl] [-o <ODB>] [--wipe] [<TDB>]\n"
+ " Check a registry database.\n"
+ " -v|--verbose\t be verbose\n"
+ " -r|--repair\t\t interactive repair mode\n"
+ " -a|--auto\t\t noninteractive repair mode\n"
+ " -T|--test\t\t dry run\n"
+ " -f|--force\t\t force\n"
+ " -l|--lock\t\t lock <TDB> while doing the check\n"
+ " -o|--output=<ODB>\t output database\n"
+ " --reg-version=n\t assume database format version {n|1,2,3}\n"
+ " --wipe\t\t create a new database from scratch\n"
+ " --db=<TDB>\t\t registry database to open\n"));
+ return c->display_usage ? 0 : -1;
+ }
+
+ dbfile = c->opt_db ? c->opt_db : (
+ (argc > 0) ? argv[0] :
+ state_path("registry.tdb"));
+ if (dbfile == NULL) {
+ return -1;
+ }
+
+ opts = (struct check_options) {
+ .lock = c->opt_lock || c->opt_long_list_entries,
+ .test = c->opt_testmode,
+ .automatic = c->opt_auto,
+ .verbose = c->opt_verbose,
+ .force = c->opt_force,
+ .repair = c->opt_repair || c->opt_reboot,
+ .version = c->opt_reg_version,
+ .output = c->opt_output,
+ .wipe = c->opt_wipe,
+ .implicit_db = (c->opt_db == NULL) && (argc == 0),
+ };
+
+ return net_registry_check_db(dbfile, &opts);
+}
+
+
/******************************************************************************/
int net_registry(struct net_context *c, int argc, const char **argv)
@@ -1386,6 +1435,14 @@ int net_registry(struct net_context *c, int argc, const char **argv)
N_("net registry convert\n"
" Convert .reg file")
},
+ {
+ "check",
+ net_registry_check,
+ NET_TRANSPORT_LOCAL,
+ N_("Check .reg file"),
+ N_("net registry check\n"
+ " Check .reg file")
+ },
{ NULL, NULL, 0, NULL, NULL }
};