s4:torture/smb2/session: invalidate credential cache
authorRalph Boehme <slow@samba.org>
Thu, 8 Nov 2018 14:42:46 +0000 (15:42 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 13 Nov 2018 10:13:03 +0000 (11:13 +0100)
Invalidate credential cache before connecting to the server, otherwise
we will reuse the credentials from the credential cache populated by the
preceeding tests.

Also invalidate it at the end, otherwise subsequent tests might run into
problems if the credentials expire while authenticating.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13661

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/torture/smb2/session.c

index 7dc9ba19ee6e7970944c8d563e5e2248b55b4eab..65cc53ba33715bb3c11105157688dbec14a7837a 100644 (file)
@@ -1073,6 +1073,8 @@ static bool test_session_expire1i(struct torture_context *tctx,
        torture_assert_int_equal(tctx, use_kerberos, CRED_MUST_USE_KERBEROS,
                                 "please use -k yes");
 
+       cli_credentials_invalidate_ccache(credentials, CRED_SPECIFIED);
+
        lpcfg_set_option(tctx->lp_ctx, "gensec_gssapi:requested_life_time=4");
 
        lpcfg_smbcli_options(tctx->lp_ctx, &options);
@@ -1167,6 +1169,8 @@ static bool test_session_expire1i(struct torture_context *tctx,
 
        ret = true;
 done:
+       cli_credentials_invalidate_ccache(credentials, CRED_SPECIFIED);
+
        if (h1 != NULL) {
                smb2_util_close(tree, *h1);
        }
@@ -1236,6 +1240,8 @@ static bool test_session_expire2i(struct torture_context *tctx,
        torture_assert_int_equal(tctx, use_kerberos, CRED_MUST_USE_KERBEROS,
                                 "please use -k yes");
 
+       cli_credentials_invalidate_ccache(credentials, CRED_SPECIFIED);
+
        lpcfg_set_option(tctx->lp_ctx, "gensec_gssapi:requested_life_time=4");
 
        lpcfg_smbcli_options(tctx->lp_ctx, &options);
@@ -1547,6 +1553,8 @@ static bool test_session_expire2i(struct torture_context *tctx,
 
        ret = true;
 done:
+       cli_credentials_invalidate_ccache(credentials, CRED_SPECIFIED);
+
        if (h1 != NULL) {
                smb2_util_close(tree, *h1);
        }