summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-16 11:15:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:53 -0500
commit7cbc768376ed0a839afca64aeea99cd53d0fbc6f (patch)
tree116b18a6fc59ec306275f32c136201f83708e5fc /source4/torture
parent6eabc2a711446819e0694bd56eb71ea7f101ae66 (diff)
downloadsamba-7cbc768376ed0a839afca64aeea99cd53d0fbc6f.tar.gz
samba-7cbc768376ed0a839afca64aeea99cd53d0fbc6f.tar.bz2
samba-7cbc768376ed0a839afca64aeea99cd53d0fbc6f.zip
r4777: added a smb_composite_sesssetup() async composite function. This
encapsulates all the different session setup methods, including the multi-pass spnego code. I have hooked this into all the places that previously used the RAW_SESSSETUP_GENERIC method, and have removed the old RAW_SESSSETUP_GENERIC code from clisession.c and clitree.c. A nice side effect is that these two modules are now very simple again, back to being "raw" session setup handling, which was what was originally intended. I have also used this to replace the session setup code in the smb_composite_connect() code, and used that to build a very simple replacement for smbcli_tree_full_connection(). As a result, smbclient, smbtorture and all our other SMB connection code now goes via these composite async functions. That should give them a good workout! (This used to be commit 080d0518bc7d6fd4bc3ef783e7d4d2e3275d0799)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/basic/secleak.c16
-rw-r--r--source4/torture/raw/context.c50
-rw-r--r--source4/torture/rpc/xplogin.c22
3 files changed, 43 insertions, 45 deletions
diff --git a/source4/torture/basic/secleak.c b/source4/torture/basic/secleak.c
index a2d992cfc7..4ff34e166f 100644
--- a/source4/torture/basic/secleak.c
+++ b/source4/torture/basic/secleak.c
@@ -23,22 +23,22 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
#include "system/time.h"
+#include "libcli/composite/composite.h"
static BOOL try_failed_login(struct smbcli_state *cli)
{
NTSTATUS status;
- union smb_sesssetup setup;
+ struct smb_composite_sesssetup setup;
struct smbcli_session *session;
session = smbcli_session_init(cli->transport);
- setup.generic.level = RAW_SESSSETUP_GENERIC;
- setup.generic.in.sesskey = cli->transport->negotiate.sesskey;
- setup.generic.in.capabilities = cli->transport->negotiate.capabilities;
- setup.generic.in.password = "INVALID-PASSWORD";
- setup.generic.in.user = "INVALID-USERNAME";
- setup.generic.in.domain = "INVALID-DOMAIN";
+ setup.in.sesskey = cli->transport->negotiate.sesskey;
+ setup.in.capabilities = cli->transport->negotiate.capabilities;
+ setup.in.password = "INVALID-PASSWORD";
+ setup.in.user = "INVALID-USERNAME";
+ setup.in.domain = "INVALID-DOMAIN";
- status = smb_raw_session_setup(session, session, &setup);
+ status = smb_composite_sesssetup(session, &setup);
talloc_free(session);
if (NT_STATUS_IS_OK(status)) {
printf("Allowed session setup with invalid credentials?!\n");
diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c
index 20b93792df..4f1c6337eb 100644
--- a/source4/torture/raw/context.c
+++ b/source4/torture/raw/context.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/libcliraw.h"
#include "librpc/gen_ndr/ndr_security.h"
+#include "libcli/composite/composite.h"
#define BASEDIR "\\rawcontext"
@@ -61,7 +62,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
struct smbcli_session *session2;
struct smbcli_session *session3;
struct smbcli_tree *tree;
- union smb_sesssetup setup;
+ struct smb_composite_sesssetup setup;
union smb_open io;
union smb_write wr;
union smb_close cl;
@@ -82,33 +83,31 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("create a second security context on the same transport\n");
session = smbcli_session_init(cli->transport);
- setup.generic.level = RAW_SESSSETUP_GENERIC;
- setup.generic.in.sesskey = cli->transport->negotiate.sesskey;
- setup.generic.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
- setup.generic.in.password = password;
- setup.generic.in.user = username;
- setup.generic.in.domain = domain;
+ setup.in.sesskey = cli->transport->negotiate.sesskey;
+ setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
+ setup.in.password = password;
+ setup.in.user = username;
+ setup.in.domain = domain;
- status = smb_raw_session_setup(session, mem_ctx, &setup);
+ status = smb_composite_sesssetup(session, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
- session->vuid = setup.generic.out.vuid;
+ session->vuid = setup.out.vuid;
printf("create a third security context on the same transport, with vuid set\n");
session2 = smbcli_session_init(cli->transport);
session2->vuid = session->vuid;
- setup.generic.level = RAW_SESSSETUP_GENERIC;
- setup.generic.in.sesskey = cli->transport->negotiate.sesskey;
- setup.generic.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
- setup.generic.in.password = password;
- setup.generic.in.user = username;
- setup.generic.in.domain = domain;
-
- status = smb_raw_session_setup(session2, mem_ctx, &setup);
+ setup.in.sesskey = cli->transport->negotiate.sesskey;
+ setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
+ setup.in.password = password;
+ setup.in.user = username;
+ setup.in.domain = domain;
+
+ status = smb_composite_sesssetup(session2, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
- session2->vuid = setup.generic.out.vuid;
+ session2->vuid = setup.out.vuid;
printf("vuid1=%d vuid2=%d vuid3=%d\n", cli->session->vuid, session->vuid, session2->vuid);
CHECK_NOT_VALUE(session->vuid, session2->vuid);
@@ -119,14 +118,13 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
session3 = smbcli_session_init(cli->transport);
session3->vuid = session->vuid;
- setup.generic.level = RAW_SESSSETUP_GENERIC;
- setup.generic.in.sesskey = cli->transport->negotiate.sesskey;
- setup.generic.in.capabilities = 0; /* force a non extended security login (should fail) */
- setup.generic.in.password = password;
- setup.generic.in.user = username;
- setup.generic.in.domain = domain;
-
- status = smb_raw_session_setup(session3, mem_ctx, &setup);
+ setup.in.sesskey = cli->transport->negotiate.sesskey;
+ setup.in.capabilities = 0; /* force a non extended security login (should fail) */
+ setup.in.password = password;
+ setup.in.user = username;
+ setup.in.domain = domain;
+
+ status = smb_composite_sesssetup(session3, &setup);
CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
talloc_free(session3);
diff --git a/source4/torture/rpc/xplogin.c b/source4/torture/rpc/xplogin.c
index d8a8a4e2e9..6dcd456fdb 100644
--- a/source4/torture/rpc/xplogin.c
+++ b/source4/torture/rpc/xplogin.c
@@ -26,6 +26,7 @@
#include "librpc/gen_ndr/ndr_samr.h"
#include "librpc/gen_ndr/ndr_netlogon.h"
#include "librpc/gen_ndr/ndr_srvsvc.h"
+#include "libcli/composite/composite.h"
static int destroy_transport(void *ptr)
{
@@ -106,7 +107,7 @@ static NTSTATUS anon_ipc(struct smbcli_transport *transport,
{
struct smbcli_tree *tree;
struct smbcli_session *session;
- union smb_sesssetup setup;
+ struct smb_composite_sesssetup setup;
union smb_tcon tcon;
TALLOC_CTX *mem_ctx;
NTSTATUS status;
@@ -122,22 +123,21 @@ static NTSTATUS anon_ipc(struct smbcli_transport *transport,
}
/* prepare a session setup to establish a security context */
- setup.generic.level = RAW_SESSSETUP_GENERIC;
- setup.generic.in.sesskey = transport->negotiate.sesskey;
- setup.generic.in.capabilities = transport->negotiate.capabilities;
- setup.generic.in.password = NULL;
- setup.generic.in.user = "";
- setup.generic.in.domain = "";
- setup.generic.in.capabilities &= ~CAP_EXTENDED_SECURITY;
-
- status = smb_raw_session_setup(session, mem_ctx, &setup);
+ setup.in.sesskey = transport->negotiate.sesskey;
+ setup.in.capabilities = transport->negotiate.capabilities;
+ setup.in.password = NULL;
+ setup.in.user = "";
+ setup.in.domain = "";
+ setup.in.capabilities &= ~CAP_EXTENDED_SECURITY;
+
+ status = smb_composite_sesssetup(session, &setup);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(session);
talloc_free(mem_ctx);
return NT_STATUS_UNSUCCESSFUL;
}
- session->vuid = setup.generic.out.vuid;
+ session->vuid = setup.out.vuid;
talloc_set_destructor(session, destroy_session);