s3:net: registry: 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>
Tue, 11 Oct 2011 13:33:26 +0000 (15:33 +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.

source3/utils/net_registry.c

index 008d02129f3fbb43c7ae6f84b31c74cb8935ec73..e059d6cbf4a48efee3b7caf0cbd6c0c44a5351b5 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(argv[0], "convert")
+           && StrCaseCmp(argv[0], "check"))
+       {
+               if (!W_ERROR_IS_OK(registry_init_basic())) {
+                       return -1;
+               }
        }
 
        ret = net_run_function(c, argc, argv, "net registry", func);