diff options
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/smb2/util.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c index 8ab61c7934..5dca5c3184 100644 --- a/source4/torture/smb2/util.c +++ b/source4/torture/smb2/util.c @@ -301,6 +301,37 @@ bool torture_smb2_tree_connect(struct torture_context *tctx, return true; } +/** + * do a smb2 session setup (without a tree connect) + */ +bool torture_smb2_session_setup(struct torture_context *tctx, + struct smb2_transport *transport, + TALLOC_CTX *mem_ctx, + struct smb2_session **_session) +{ + NTSTATUS status; + struct smb2_session *session; + struct cli_credentials *credentials = cmdline_credentials; + + session = smb2_session_init(transport, + lpcfg_gensec_settings(tctx, tctx->lp_ctx), + mem_ctx, true); + + if (session == NULL) { + return false; + } + + status = smb2_session_setup_spnego(session, credentials); + if (!NT_STATUS_IS_OK(status)) { + printf("session setup failed: %s\n", nt_errstr(status)); + talloc_free(session); + return false; + } + + *_session = session; + + return true; +} /* open a smb2 connection |