summaryrefslogtreecommitdiff
path: root/source/torture/torture.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-04-09 22:32:04 +0000
committerJeremy Allison <jra@samba.org>2003-04-09 22:32:04 +0000
commite07dd4d93d2bf6ed83dd055efd29d11f5cd66a36 (patch)
treeca2cb48f6c912556144b6cb1b534597d095b38f5 /source/torture/torture.c
parent101abce5a18064ccc9fbc585ef7a2aa082fde706 (diff)
downloadsamba-e07dd4d93d2bf6ed83dd055efd29d11f5cd66a36.tar.gz
Ensure we have WinXP-like semantics for checking TIDs and FIDs.
Add torture test to ensure this is so. Jeremy.
Diffstat (limited to 'source/torture/torture.c')
-rw-r--r--source/torture/torture.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/source/torture/torture.c b/source/torture/torture.c
index 5935c8c06e4..0db4630845a 100644
--- a/source/torture/torture.c
+++ b/source/torture/torture.c
@@ -171,6 +171,22 @@ BOOL torture_open_connection(struct cli_state **c)
return True;
}
+BOOL torture_cli_session_setup2(struct cli_state *cli, uint16 *new_vuid)
+{
+ uint16 old_vuid = cli->vuid;
+ fstring old_user_name;
+ size_t passlen = strlen(password);
+ BOOL ret;
+
+ fstrcpy(old_user_name, cli->user_name);
+ cli->vuid = 0;
+ ret = cli_session_setup(cli, username, password, passlen, password, passlen, workgroup);
+ *new_vuid = cli->vuid;
+ cli->vuid = old_vuid;
+ fstrcpy(cli->user_name, old_user_name);
+ return ret;
+}
+
BOOL torture_close_connection(struct cli_state *c)
{
@@ -1935,6 +1951,54 @@ static BOOL run_fdpasstest(int dummy)
return True;
}
+static BOOL run_fdsesstest(int dummy)
+{
+ struct cli_state *cli;
+ uint16 new_vuid;
+ uint16 saved_vuid;
+ const char *fname = "\\fdsess.tst";
+ int fnum1;
+ pstring buf;
+
+ if (!torture_open_connection(&cli))
+ return False;
+ cli_sockopt(cli, sockops);
+
+ if (!torture_cli_session_setup2(cli, &new_vuid))
+ return False;
+
+ printf("starting fdsesstest\n");
+
+ cli_unlink(cli, fname);
+
+ fnum1 = cli_open(cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE);
+ if (fnum1 == -1) {
+ printf("open of %s failed (%s)\n", fname, cli_errstr(cli));
+ return False;
+ }
+
+ if (cli_write(cli, fnum1, 0, "hello world\n", 0, 13) != 13) {
+ printf("write failed (%s)\n", cli_errstr(cli));
+ return False;
+ }
+
+ saved_vuid = cli->vuid;
+ cli->vuid = new_vuid;
+
+ if (cli_read(cli, fnum1, buf, 0, 13) == 13) {
+ printf("read succeeded! nasty security hole [%s]\n",
+ buf);
+ return False;
+ }
+
+ cli_close(cli, fnum1);
+ cli_unlink(cli, fname);
+
+ torture_close_connection(cli);
+
+ printf("finished fdsesstest\n");
+ return True;
+}
/*
This test checks that
@@ -4448,6 +4512,7 @@ static struct {
{"TCON2", run_tcon2_test, 0},
{"IOCTL", torture_ioctl_test, 0},
{"CHKPATH", torture_chkpath_test, 0},
+ {"FDSESS", run_fdsesstest, 0},
{NULL, NULL, 0}};