diff options
author | Michael Adam <obnox@samba.org> | 2012-01-30 12:07:07 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2012-02-03 11:10:30 +0100 |
commit | a4fd3eb4a906df3289a0401e41c1703f58cee046 (patch) | |
tree | 83d178e8264a0e1557862b44240508a93e7bf8c0 | |
parent | adb9b7fbf06509457107dab514ed216adf78e222 (diff) | |
download | samba-a4fd3eb4a906df3289a0401e41c1703f58cee046.tar.gz samba-a4fd3eb4a906df3289a0401e41c1703f58cee046.tar.bz2 samba-a4fd3eb4a906df3289a0401e41c1703f58cee046.zip |
s4:torture: add a torture_smb2_session_setup() utility function
-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 |