registry: Avoid mapping registry return codes: return the right value in the first...
authorJelmer Vernooij <jelmer@samba.org>
Fri, 18 Jan 2008 02:00:00 +0000 (03:00 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Fri, 18 Jan 2008 02:42:00 +0000 (03:42 +0100)
source/lib/registry/local.c
source/lib/registry/samba.c
source/lib/registry/tests/registry.c
source/rpc_server/winreg/rpc_winreg.c

index fa59f255966c0154fd870f2f0499efd0dc9d86e6..3e463100c9cb80380f02066cfd3b6a45010f8c91 100644 (file)
@@ -140,7 +140,7 @@ WERROR local_get_predefined_key(struct registry_context *ctx,
        }
 
        if (mp == NULL)
-               return WERR_NOT_FOUND;
+               return WERR_BADFILE;
 
        *key = reg_import_hive_key(ctx, mp->key,
                                   mp->path.predefined_key,
index 02f3363bab97366e806eaf393425c5e1854cb7bf..599385e73c210819a59d539aae946966fe4421ed 100644 (file)
@@ -42,7 +42,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
 
        error = reg_open_hive(ctx, location, auth_info, creds, lp_ctx, &hive);
 
-       if (W_ERROR_EQUAL(error, WERR_NOT_FOUND))
+       if (W_ERROR_EQUAL(error, WERR_BADFILE))
                error = reg_open_ldb_file(ctx, location, auth_info,
                                          creds, lp_ctx, &hive);
 
index 59e31f55dc15415b13c6d681080abe59b7ae1421..06783e6a75676afec31bdac0ce0fcacaf769c01f 100644 (file)
@@ -53,7 +53,7 @@ static bool test_get_predefined_unknown(struct torture_context *tctx,
        WERROR error;
 
        error = reg_get_predefined_key(rctx, 1337, &root);
-       torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
+       torture_assert_werr_equal(tctx, error, WERR_BADFILE,
                                  "getting predefined key failed");
        return true;
 }
index 3c00944d595a8df0922509c29c8591f134aa81d9..681e3b918f870afc11f38ce47c81539fbd3ee8c0 100644 (file)
@@ -356,13 +356,6 @@ static WERROR dcesrv_winreg_OpenKey(struct dcesrv_call_state *dce_call,
                r->out.handle = &newh->wire_handle;
        } else {
                talloc_free(newh);
-               /*
-                * Windows expects WERR_BADFILE when a particular key
-                * is not found.  If we receive WERR_NOT_FOUND from the lower
-                * layer calls, translate it here to return what is expected.
-                */
-               if (W_ERROR_EQUAL(result, WERR_NOT_FOUND))
-                       return WERR_BADFILE;
        }
 
        return result;