s3:net: avoid unnecessary initialization of the registry.
authorGregor Beck <gbeck@sernet.de>
Mon, 26 Sep 2011 11:42:15 +0000 (13:42 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 12 Oct 2011 20:45:53 +0000 (22:45 +0200)
This allows for using help without having access to the registry and
prevents update code to run if only a readonly check is to be performed.

Signed-off-by: Michael Adam <obnox@samba.org>
source3/utils/net_registry.c

index 008d02129f3fbb43c7ae6f84b31c74cb8935ec73..1d9546a8bde2eee03541d1a099033a2b6da0d128 100644 (file)
@@ -1446,8 +1446,13 @@ int net_registry(struct net_context *c, int argc, const char **argv)
        { NULL, NULL, 0, NULL, NULL }
        };
 
-       if (!W_ERROR_IS_OK(registry_init_basic())) {
-               return -1;
+       if (!c->display_usage
+           && (strcasecmp_m(argv[0], "convert") != 0)
+           && (strcasecmp_m(argv[0], "check") != 0))
+       {
+               if (!W_ERROR_IS_OK(registry_init_basic())) {
+                       return -1;
+               }
        }
 
        ret = net_run_function(c, argc, argv, "net registry", func);