Speed up "net conf list"
authorVolker Lendecke <vl@samba.org>
Sat, 21 Feb 2009 16:01:58 +0000 (17:01 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 26 Feb 2009 10:05:21 +0000 (11:05 +0100)
With 1000 shares in the registry, this changed the time of "net conf list" from
1.1 seconds to .6 seconds.

Signed-off-by: Michael Adam <obnox@samba.org>
lib/smbconf/smbconf.c
source3/lib/smbconf/smbconf_reg.c

index bcab0b97cd9afd276ac956dc1441dd35094735aa..595fd23421482c2704663850c95717f0d4472354 100644 (file)
@@ -203,10 +203,6 @@ WERROR smbconf_get_share(struct smbconf_ctx *ctx,
                         const char *servicename,
                         struct smbconf_service **service)
 {
                         const char *servicename,
                         struct smbconf_service **service)
 {
-       if (!smbconf_share_exists(ctx, servicename)) {
-               return WERR_NO_SUCH_SERVICE;
-       }
-
        return ctx->ops->get_share(ctx, mem_ctx, servicename, service);
 }
 
        return ctx->ops->get_share(ctx, mem_ctx, servicename, service);
 }
 
index e36fa8a2a12ce8d625fce911e5c7caa51322a392..01de193b3c499d32bd65c6b0eef9afea3eb2b6b1 100644 (file)
@@ -896,6 +896,9 @@ static WERROR smbconf_reg_get_share(struct smbconf_ctx *ctx,
        werr = smbconf_reg_open_service_key(tmp_ctx, ctx, servicename,
                                            REG_KEY_READ, &key);
        if (!W_ERROR_IS_OK(werr)) {
        werr = smbconf_reg_open_service_key(tmp_ctx, ctx, servicename,
                                            REG_KEY_READ, &key);
        if (!W_ERROR_IS_OK(werr)) {
+               if (W_ERROR_EQUAL(werr, WERR_BADFILE)) {
+                       werr = WERR_NO_SUCH_SERVICE;
+               }
                goto done;
        }
 
                goto done;
        }