summaryrefslogtreecommitdiffstats
path: root/source3/torture
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
commit80b4dc47132ce5c4b0212cab8e719f950c9d29f3 (patch)
tree9f9e38c62ba54f57ef308c964b79582eebcd3455 /source3/torture
parent0af5edf919cc954e1273c92dee4f3264cdb46d80 (diff)
downloadsamba-80b4dc47132ce5c4b0212cab8e719f950c9d29f3.tar.gz
samba-80b4dc47132ce5c4b0212cab8e719f950c9d29f3.tar.xz
samba-80b4dc47132ce5c4b0212cab8e719f950c9d29f3.zip
Ensure we have WinXP-like semantics for checking TIDs and FIDs.
Add torture test to ensure this is so. Jeremy. (This used to be commit e07dd4d93d2bf6ed83dd055efd29d11f5cd66a36)
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/torture.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 5935c8c06e..0db4630845 100644
--- a/source3/torture/torture.c
+++ b/source3/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}};