s3-torture: Correctly cleanup the winreg volatile key test.
authorAndreas Schneider <asn@samba.org>
Thu, 5 Aug 2010 13:35:52 +0000 (15:35 +0200)
committerAndreas Schneider <asn@samba.org>
Thu, 5 Aug 2010 14:11:19 +0000 (16:11 +0200)
Günther please check!

source4/torture/rpc/winreg.c

index 3fe141c714ecae5b375919f2d86b1249953ce08b..f5e92954c345144ec7f32053cb597657c328ca0d 100644 (file)
@@ -2583,7 +2583,7 @@ static bool test_volatile_keys(struct torture_context *tctx,
                               struct policy_handle *handle,
                               int hkey)
 {
-       struct policy_handle new_handle;
+       struct policy_handle new_handle, hive_handle;
        enum winreg_CreateAction action_taken;
 
        torture_comment(tctx, "Testing VOLATILE key\n");
@@ -2657,15 +2657,11 @@ static bool test_volatile_keys(struct torture_context *tctx,
                "failed to close");
 
        torture_assert(tctx,
-               test_CloseKey(b, tctx, handle),
-               "failed to close");
-
-       torture_assert(tctx,
-               test_OpenHive(tctx, b, handle, hkey),
+               test_OpenHive(tctx, b, &hive_handle, hkey),
                "failed top open hive");
 
        torture_assert(tctx,
-               test_OpenKey_opts(tctx, b, handle, TEST_KEY_VOLATILE,
+               test_OpenKey_opts(tctx, b, &hive_handle, TEST_KEY_VOLATILE,
                                  REG_OPTION_VOLATILE,
                                  SEC_FLAG_MAXIMUM_ALLOWED,
                                  &new_handle,
@@ -2673,13 +2669,22 @@ static bool test_volatile_keys(struct torture_context *tctx,
                "failed to open volatile key");
 
        torture_assert(tctx,
-               test_OpenKey_opts(tctx, b, handle, TEST_KEY_VOLATILE,
+               test_OpenKey_opts(tctx, b, &hive_handle, TEST_KEY_VOLATILE,
                                  REG_OPTION_NON_VOLATILE,
                                  SEC_FLAG_MAXIMUM_ALLOWED,
                                  &new_handle,
                                  WERR_BADFILE),
                "failed to open volatile key");
 
+       torture_assert(tctx,
+               test_CloseKey(b, tctx, &hive_handle),
+               "failed to close");
+
+       torture_assert(tctx,
+               test_DeleteKey(b, tctx, handle, TEST_KEY_VOLATILE),
+               "failed to delete key");
+
+
        torture_comment(tctx, "Testing VOLATILE key succeeded\n");
 
        return true;