[SCM] Samba Shared Repository - branch v4-0-test updated -
release-4-0-0alpha3-1961-gd335fd1
Andrew Tridgell
tridge at samba.org
Thu May 29 21:51:03 GMT 2008
The branch, v4-0-test has been updated
via d335fd11637f5e138b08a5e0fcf54b19cef9a646 (commit)
via a6d28e2b330a20e95b745966bb5eb153bdc58ed1 (commit)
via c50e7a15f9a7f2c5821b5ee468f9ade6eaa0ed55 (commit)
via e728596eec2157eefb1fe72789284567f3880388 (commit)
via 1dfa50a48040bdc1166be2dbe1063fd8a79166f8 (commit)
via d1125a303a31fbe08a9bd0064ec132b4d7cbb131 (commit)
via b1d2d388ecff96dfcc17da24796f36c40cbb3eed (commit)
via 81612b7854725837e8487bf97b87bff6548b6ad3 (commit)
via 8159b1598e21daee730e185d025694e27df18d1b (commit)
via 23ffec5d140463c8307fd7e444ae25781ea3d792 (commit)
via 4eb49335d5f0319f9aa47ded5215a2977d3336bf (commit)
via 25d5b94d6a700f2d294e108aeca85cffcd5bbb4f (commit)
via 7bff0691428ed3f75c1a9cbaae692bc9830640e6 (commit)
via ddd0bb32510d615c7b943fb4ce4c9c275b98ab89 (commit)
via c818f56d8ea3ddc6f4cc61e9d5ed6fd195280a5d (commit)
via 8a2a31d050a31308036545414f8d180ec8148f1d (commit)
via 884c32fcef48244bd260026a61790332bd706eb4 (commit)
via c7d2e1bf65a28b6a2efd60585ae8ead2fb486e53 (commit)
via a431d51b113c2e214ccfe7a678ba0a565b020263 (commit)
via 5754cc13514a0f5fe4c47ce53521c256c9d96487 (commit)
via e013ada415ebb25e925f715791757330ba003b43 (commit)
via 46a0b65742bc0e4277da53df9df823abd4a0d150 (commit)
via 5ca7e9590e792dc409c6677321cd14362255964e (commit)
via ad7acbf8bf83c7250dfcbd57f0f4e19e57534a92 (commit)
from 6b202d3780f8ff50e0bdfa4a749c43b5639e4880 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test
- Log -----------------------------------------------------------------
commit d335fd11637f5e138b08a5e0fcf54b19cef9a646
Merge: a6d28e2b330a20e95b745966bb5eb153bdc58ed1 6b202d3780f8ff50e0bdfa4a749c43b5639e4880
Author: Andrew Tridgell <tridge at samba.org>
Date: Fri May 30 07:50:22 2008 +1000
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
commit a6d28e2b330a20e95b745966bb5eb153bdc58ed1
Author: Andrew Tridgell <tridge at samba.org>
Date: Fri May 30 07:28:53 2008 +1000
the docs shows that this is a o16s32 blob
commit c50e7a15f9a7f2c5821b5ee468f9ade6eaa0ed55
Author: Andrew Tridgell <tridge at samba.org>
Date: Fri May 30 07:28:29 2008 +1000
don't emulate broken SMB2 locking behaviour from windows
commit e728596eec2157eefb1fe72789284567f3880388
Merge: 1dfa50a48040bdc1166be2dbe1063fd8a79166f8 3b1f5d10360ed1b26980d748a7c9be6db5977bd3
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 22:23:25 2008 +1000
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
commit 1dfa50a48040bdc1166be2dbe1063fd8a79166f8
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 22:22:42 2008 +1000
don't mask out SEC_FILE_READ_ATTRIBUTE on SMB2
commit d1125a303a31fbe08a9bd0064ec132b4d7cbb131
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 21:32:08 2008 +1000
merged gentest.c and gentest_smb2.c
The one gentest tool now covers both SMB and SMB2, using the command
line switch --smb2 for SMB2
commit b1d2d388ecff96dfcc17da24796f36c40cbb3eed
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 20:46:18 2008 +1000
fixed the error code for bad SMB2 ioctls
commit 81612b7854725837e8487bf97b87bff6548b6ad3
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 19:32:04 2008 +1000
fix from WSPP SMB2 test 11
commit 8159b1598e21daee730e185d025694e27df18d1b
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 19:30:11 2008 +1000
check maximal_access here too
commit 23ffec5d140463c8307fd7e444ae25781ea3d792
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 19:16:44 2008 +1000
test the maximal access return
commit 4eb49335d5f0319f9aa47ded5215a2977d3336bf
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 19:16:26 2008 +1000
added support for returning the maximal access MXAC tag in SMB2 create
commit 25d5b94d6a700f2d294e108aeca85cffcd5bbb4f
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 18:23:33 2008 +1000
querying the ACCESS_INFORMATION is always allowed
commit 7bff0691428ed3f75c1a9cbaae692bc9830640e6
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 18:23:20 2008 +1000
SEC_FILE_READ_ATTRIBUTE is only automatically granted on SMB, not SMB2
commit ddd0bb32510d615c7b943fb4ce4c9c275b98ab89
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu May 29 18:23:00 2008 +1000
fixed offset for maximal access response
commit c818f56d8ea3ddc6f4cc61e9d5ed6fd195280a5d
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed May 28 22:44:54 2008 +1000
check the set of file attributes which are ignored
commit 8a2a31d050a31308036545414f8d180ec8148f1d
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed May 28 22:44:35 2008 +1000
fixed current_op.mismatch for more cases
commit 884c32fcef48244bd260026a61790332bd706eb4
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed May 28 22:44:20 2008 +1000
fixed create_action for truncated files
commit c7d2e1bf65a28b6a2efd60585ae8ead2fb486e53
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed May 28 21:49:04 2008 +1000
added --noacls options and checking for same mismatch in backtracking
commit a431d51b113c2e214ccfe7a678ba0a565b020263
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed May 28 21:48:40 2008 +1000
SMB2 doesn't have NAME_INFORMATION level
commit 5754cc13514a0f5fe4c47ce53521c256c9d96487
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed May 28 21:48:26 2008 +1000
updated comment based on MS-SMB2 docs
commit e013ada415ebb25e925f715791757330ba003b43
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed May 28 20:06:48 2008 +1000
check that we can't change a file to a directory
commit 46a0b65742bc0e4277da53df9df823abd4a0d150
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed May 28 20:06:38 2008 +1000
added testing of some strange read semantics on windows
commit 5ca7e9590e792dc409c6677321cd14362255964e
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed May 28 20:06:22 2008 +1000
generate security descriptors in gentest_smb2
commit ad7acbf8bf83c7250dfcbd57f0f4e19e57534a92
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed May 28 20:06:04 2008 +1000
don't allow a file to be changed to a directory with setfileinfo
-----------------------------------------------------------------------
Summary of changes:
source/libcli/raw/interfaces.h | 9 +-
source/libcli/smb2/create.c | 5 +-
source/ntvfs/ntvfs_generic.c | 2 +
source/ntvfs/posix/pvfs_acl.c | 29 +-
source/ntvfs/posix/pvfs_ioctl.c | 3 +-
source/ntvfs/posix/pvfs_lock.c | 14 +-
source/ntvfs/posix/pvfs_open.c | 37 +-
source/ntvfs/posix/pvfs_qfileinfo.c | 8 +
source/ntvfs/posix/pvfs_setfileinfo.c | 7 +-
source/smb_server/smb2/fileinfo.c | 3 +-
source/smb_server/smb2/fileio.c | 12 +
source/smb_server/smb2/sesssetup.c | 3 +-
source/torture/config.mk | 17 -
source/torture/gentest.c | 1877 ++++++++++++++++++++++--------
source/torture/gentest_smb2.c | 2064 ---------------------------------
source/torture/smb2/create.c | 26 +-
source/torture/smb2/lock.c | 70 ++-
source/torture/smb2/read.c | 61 +-
source/torture/smb2/setinfo.c | 4 +
19 files changed, 1657 insertions(+), 2594 deletions(-)
delete mode 100644 source/torture/gentest_smb2.c
Changeset truncated at 500 lines:
diff --git a/source/libcli/raw/interfaces.h b/source/libcli/raw/interfaces.h
index d170006..19d5189 100644
--- a/source/libcli/raw/interfaces.h
+++ b/source/libcli/raw/interfaces.h
@@ -1354,7 +1354,7 @@ union smb_open {
break; \
} \
} while (0)
- /* SMBNTCreateX interface */
+ /* SMBNTCreateX, nttrans and generic interface */
struct {
enum smb_open_level level;
struct {
@@ -1377,6 +1377,9 @@ union smb_open {
NTTRANS varient of the call */
struct security_descriptor *sec_desc;
struct smb_ea_list *ea_list;
+
+ /* some optional parameters from the SMB2 varient */
+ bool query_maximal_access;
} in;
struct {
union smb_handle file;
@@ -1392,6 +1395,10 @@ union smb_open {
uint16_t file_type;
uint16_t ipc_state;
uint8_t is_directory;
+
+ /* optional return values matching SMB2 tagged
+ values in the call */
+ uint32_t maximal_access;
} out;
} ntcreatex, nttrans, generic;
diff --git a/source/libcli/smb2/create.c b/source/libcli/smb2/create.c
index bff0a15..8a40e56 100644
--- a/source/libcli/smb2/create.c
+++ b/source/libcli/smb2/create.c
@@ -387,12 +387,13 @@ NTSTATUS smb2_create_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx, struct
/* pull out the parsed blobs */
for (i=0;i<io->out.blobs.num_blobs;i++) {
if (strcmp(io->out.blobs.blobs[i].tag, SMB2_CREATE_TAG_MXAC) == 0) {
- /* why 8 bytes not 4?? */
+ /* TODO: this also contains a status field in
+ first 4 bytes */
if (io->out.blobs.blobs[i].data.length != 8) {
smb2_request_destroy(req);
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- io->out.maximal_access = IVAL(io->out.blobs.blobs[i].data.data, 0);
+ io->out.maximal_access = IVAL(io->out.blobs.blobs[i].data.data, 4);
}
if (strcmp(io->out.blobs.blobs[i].tag, SMB2_CREATE_TAG_QFID) == 0) {
if (io->out.blobs.blobs[i].data.length != 32) {
diff --git a/source/ntvfs/ntvfs_generic.c b/source/ntvfs/ntvfs_generic.c
index 9227295..d705758 100644
--- a/source/ntvfs/ntvfs_generic.c
+++ b/source/ntvfs/ntvfs_generic.c
@@ -233,6 +233,7 @@ static NTSTATUS ntvfs_map_open_finish(struct ntvfs_module_context *ntvfs,
io->smb2.out.size = io2->generic.out.size;
io->smb2.out.file_attr = io2->generic.out.attrib;
io->smb2.out.reserved2 = 0;
+ io->smb2.out.maximal_access = io2->generic.out.maximal_access;
break;
default:
@@ -522,6 +523,7 @@ NTSTATUS ntvfs_map_open(struct ntvfs_module_context *ntvfs,
io2->generic.in.fname = io->smb2.in.fname;
io2->generic.in.sec_desc = io->smb2.in.sec_desc;
io2->generic.in.ea_list = &io->smb2.in.eas;
+ io2->generic.in.query_maximal_access = io->smb2.in.query_maximal_access;
/* we don't support timewarp yet */
if (io->smb2.in.timewarp != 0) {
diff --git a/source/ntvfs/posix/pvfs_acl.c b/source/ntvfs/posix/pvfs_acl.c
index 507c22f..9a9200e 100644
--- a/source/ntvfs/posix/pvfs_acl.c
+++ b/source/ntvfs/posix/pvfs_acl.c
@@ -464,7 +464,11 @@ NTSTATUS pvfs_access_check_unix(struct pvfs_state *pvfs,
return NT_STATUS_ACCESS_DENIED;
}
- *access_mask |= SEC_FILE_READ_ATTRIBUTE;
+ if (pvfs->ntvfs->ctx->protocol != PROTOCOL_SMB2) {
+ /* on SMB, this bit is always granted, even if not
+ asked for */
+ *access_mask |= SEC_FILE_READ_ATTRIBUTE;
+ }
return NT_STATUS_OK;
}
@@ -496,7 +500,9 @@ NTSTATUS pvfs_access_check(struct pvfs_state *pvfs,
/* expand the generic access bits to file specific bits */
*access_mask = pvfs_translate_mask(*access_mask);
- *access_mask &= ~SEC_FILE_READ_ATTRIBUTE;
+ if (pvfs->ntvfs->ctx->protocol != PROTOCOL_SMB2) {
+ *access_mask &= ~SEC_FILE_READ_ATTRIBUTE;
+ }
status = pvfs_acl_load(pvfs, name, -1, acl);
if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
@@ -518,8 +524,11 @@ NTSTATUS pvfs_access_check(struct pvfs_state *pvfs,
/* check the acl against the required access mask */
status = sec_access_check(sd, token, *access_mask, access_mask);
- /* this bit is always granted, even if not asked for */
- *access_mask |= SEC_FILE_READ_ATTRIBUTE;
+ if (pvfs->ntvfs->ctx->protocol != PROTOCOL_SMB2) {
+ /* on SMB, this bit is always granted, even if not
+ asked for */
+ *access_mask |= SEC_FILE_READ_ATTRIBUTE;
+ }
talloc_free(acl);
@@ -800,3 +809,15 @@ NTSTATUS pvfs_acl_inherit(struct pvfs_state *pvfs,
return status;
}
+
+/*
+ return the maximum allowed access mask
+*/
+NTSTATUS pvfs_access_maximal_allowed(struct pvfs_state *pvfs,
+ struct ntvfs_request *req,
+ struct pvfs_filename *name,
+ uint32_t *maximal_access)
+{
+ *maximal_access = SEC_FLAG_MAXIMUM_ALLOWED;
+ return pvfs_access_check(pvfs, req, name, maximal_access);
+}
diff --git a/source/ntvfs/posix/pvfs_ioctl.c b/source/ntvfs/posix/pvfs_ioctl.c
index d0360e6..92d3eae 100644
--- a/source/ntvfs/posix/pvfs_ioctl.c
+++ b/source/ntvfs/posix/pvfs_ioctl.c
@@ -73,7 +73,8 @@ NTSTATUS pvfs_ioctl(struct ntvfs_module_context *ntvfs,
case RAW_IOCTL_SMB2:
case RAW_IOCTL_SMB2_NO_HANDLE:
- return NT_STATUS_FS_DRIVER_REQUIRED;
+ /* see WSPP SMB2 test 46 */
+ return NT_STATUS_INVALID_DEVICE_REQUEST;
}
return NT_STATUS_INVALID_LEVEL;
diff --git a/source/ntvfs/posix/pvfs_lock.c b/source/ntvfs/posix/pvfs_lock.c
index baa9288..822b282 100644
--- a/source/ntvfs/posix/pvfs_lock.c
+++ b/source/ntvfs/posix/pvfs_lock.c
@@ -68,13 +68,8 @@ static void pvfs_lock_async_failed(struct pvfs_state *pvfs,
int i,
NTSTATUS status)
{
- /* in SMB2 mode we also try to unlock failing lock */
- if (req->ctx->protocol != PROTOCOL_SMB2) {
- i--;
- }
-
/* undo the locks we just did */
- for (;i>=0;i--) {
+ for (i--;i>=0;i--) {
brl_unlock(pvfs->brl_context,
f->brl_handle,
locks[i].pid,
@@ -390,12 +385,9 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs,
DLIST_ADD(f->pending_list, pending);
return NT_STATUS_OK;
}
- /* in SMB2 mode we also try to unlock failing lock */
- if (req->ctx->protocol != PROTOCOL_SMB2) {
- i--;
- }
+
/* undo the locks we just did */
- for (;i>=0;i--) {
+ for (i--;i>=0;i--) {
brl_unlock(pvfs->brl_context,
f->brl_handle,
locks[i].pid,
diff --git a/source/ntvfs/posix/pvfs_open.c b/source/ntvfs/posix/pvfs_open.c
index 0f08136..dada9f5 100644
--- a/source/ntvfs/posix/pvfs_open.c
+++ b/source/ntvfs/posix/pvfs_open.c
@@ -252,8 +252,12 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
} else {
status = pvfs_access_check_create(pvfs, req, name, &access_mask);
}
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ NT_STATUS_NOT_OK_RETURN(status);
+
+ if (io->generic.in.query_maximal_access) {
+ status = pvfs_access_maximal_allowed(pvfs, req, name,
+ &io->generic.out.maximal_access);
+ NT_STATUS_NOT_OK_RETURN(status);
}
f->ntvfs = h;
@@ -578,6 +582,12 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
status = pvfs_access_check_create(pvfs, req, name, &access_mask);
NT_STATUS_NOT_OK_RETURN(status);
+ if (io->generic.in.query_maximal_access) {
+ status = pvfs_access_maximal_allowed(pvfs, req, name,
+ &io->generic.out.maximal_access);
+ NT_STATUS_NOT_OK_RETURN(status);
+ }
+
/* check that the parent isn't opened with delete on close set */
status = pvfs_resolve_parent(pvfs, req, name, &parent);
if (NT_STATUS_IS_OK(status)) {
@@ -1122,6 +1132,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
uint32_t create_options;
uint32_t share_access;
uint32_t access_mask;
+ uint32_t create_action = NTCREATEX_ACTION_EXISTED;
bool del_on_close;
bool stream_existed, stream_truncate=false;
uint32_t oplock_level = OPLOCK_NONE, oplock_granted;
@@ -1134,6 +1145,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
return ntvfs_map_open(ntvfs, req, io);
}
+ ZERO_STRUCT(io->generic.out);
+
create_options = io->generic.in.create_options;
share_access = io->generic.in.share_access;
access_mask = io->generic.in.access_mask;
@@ -1169,6 +1182,13 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
return NT_STATUS_INVALID_PARAMETER;
}
+ /* we ignore some file_attr bits */
+ io->ntcreatex.in.file_attr &= ~(FILE_ATTRIBUTE_NONINDEXED |
+ FILE_ATTRIBUTE_COMPRESSED |
+ FILE_ATTRIBUTE_REPARSE_POINT |
+ FILE_ATTRIBUTE_SPARSE |
+ FILE_ATTRIBUTE_NORMAL);
+
/* resolve the cifs name to a posix name */
status = pvfs_resolve_name(pvfs, req, io->ntcreatex.in.fname,
PVFS_RESOLVE_STREAMS, &name);
@@ -1210,6 +1230,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
} else {
stream_truncate = true;
}
+ create_action = NTCREATEX_ACTION_TRUNCATED;
break;
case NTCREATEX_DISP_OPEN:
@@ -1228,6 +1249,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
} else {
stream_truncate = true;
}
+ create_action = NTCREATEX_ACTION_TRUNCATED;
break;
case NTCREATEX_DISP_CREATE:
@@ -1272,8 +1294,12 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
/* check the security descriptor */
status = pvfs_access_check(pvfs, req, name, &access_mask);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ NT_STATUS_NOT_OK_RETURN(status);
+
+ if (io->generic.in.query_maximal_access) {
+ status = pvfs_access_maximal_allowed(pvfs, req, name,
+ &io->generic.out.maximal_access);
+ NT_STATUS_NOT_OK_RETURN(status);
}
status = ntvfs_handle_new(pvfs->ntvfs, req, &h);
@@ -1487,7 +1513,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
io->generic.out.oplock_level = oplock_granted;
io->generic.out.file.ntvfs = h;
io->generic.out.create_action = stream_existed?
- NTCREATEX_ACTION_EXISTED:NTCREATEX_ACTION_CREATED;
+ create_action:NTCREATEX_ACTION_CREATED;
+
io->generic.out.create_time = name->dos.create_time;
io->generic.out.access_time = name->dos.access_time;
io->generic.out.write_time = name->dos.write_time;
diff --git a/source/ntvfs/posix/pvfs_qfileinfo.c b/source/ntvfs/posix/pvfs_qfileinfo.c
index c663466..3196cf2 100644
--- a/source/ntvfs/posix/pvfs_qfileinfo.c
+++ b/source/ntvfs/posix/pvfs_qfileinfo.c
@@ -41,6 +41,10 @@ static uint32_t pvfs_fileinfo_access(union smb_fileinfo *info)
needed = 0;
break;
+ case RAW_FILEINFO_ACCESS_INFORMATION:
+ needed = 0;
+ break;
+
case RAW_FILEINFO_SEC_DESC:
needed = 0;
if (info->query_secdesc.in.secinfo_flags & (SECINFO_OWNER|SECINFO_GROUP)) {
@@ -216,6 +220,10 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs,
case RAW_FILEINFO_NAME_INFO:
case RAW_FILEINFO_NAME_INFORMATION:
+ if (req->ctx->protocol == PROTOCOL_SMB2) {
+ /* strange that SMB2 doesn't have this */
+ return NT_STATUS_NOT_SUPPORTED;
+ }
info->name_info.out.fname.s = name->original_name;
return NT_STATUS_OK;
diff --git a/source/ntvfs/posix/pvfs_setfileinfo.c b/source/ntvfs/posix/pvfs_setfileinfo.c
index 0beca75..1dd2c07 100644
--- a/source/ntvfs/posix/pvfs_setfileinfo.c
+++ b/source/ntvfs/posix/pvfs_setfileinfo.c
@@ -457,7 +457,12 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
/* possibly change the attribute */
if (newstats.dos.attrib != h->name->dos.attrib) {
- mode_t mode = pvfs_fileperms(pvfs, newstats.dos.attrib);
+ mode_t mode;
+ if ((newstats.dos.attrib & FILE_ATTRIBUTE_DIRECTORY) &&
+ !(h->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ mode = pvfs_fileperms(pvfs, newstats.dos.attrib);
if (!(h->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY)) {
if (fchmod(h->fd, mode) == -1) {
return pvfs_map_errno(pvfs, errno);
diff --git a/source/smb_server/smb2/fileinfo.c b/source/smb_server/smb2/fileinfo.c
index d6db61e..9420001 100644
--- a/source/smb_server/smb2/fileinfo.c
+++ b/source/smb_server/smb2/fileinfo.c
@@ -55,8 +55,7 @@ static void smb2srv_getinfo_send(struct ntvfs_request *ntvfs)
SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, true, op->info->out.blob.length));
- /* TODO: this is maybe a o16s32_blob */
- SMB2SRV_CHECK(smb2_push_o16s16_blob(&req->out, 0x02, op->info->out.blob));
+ SMB2SRV_CHECK(smb2_push_o16s32_blob(&req->out, 0x02, op->info->out.blob));
SSVAL(req->out.body, 0x06, 0);
smb2srv_send_reply(req);
diff --git a/source/smb_server/smb2/fileio.c b/source/smb_server/smb2/fileio.c
index 086ddc6..2c322ea 100644
--- a/source/smb_server/smb2/fileio.c
+++ b/source/smb_server/smb2/fileio.c
@@ -36,6 +36,18 @@ static void smb2srv_create_send(struct ntvfs_request *ntvfs)
DATA_BLOB blob;
SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_open);
+
+ /* setup the blobs we should give in the reply */
+ if (io->smb2.out.maximal_access != 0) {
+ uint32_t data[2];
+ SIVAL(data, 0, 0);
+ SIVAL(data, 4, io->smb2.out.maximal_access);
+ SMB2SRV_CHECK(smb2_create_blob_add(req, &io->smb2.out.blobs,
+ SMB2_CREATE_TAG_MXAC,
+ data_blob_const(data, 8)));
+ }
+
+
SMB2SRV_CHECK(smb2_create_blob_push(req, &blob, io->smb2.out.blobs));
SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x58, true, blob.length));
diff --git a/source/smb_server/smb2/sesssetup.c b/source/smb_server/smb2/sesssetup.c
index 1aaacf8..d386bfc 100644
--- a/source/smb_server/smb2/sesssetup.c
+++ b/source/smb_server/smb2/sesssetup.c
@@ -158,7 +158,8 @@ static void smb2srv_sesssetup_backend(struct smb2srv_request *req, union smb_ses
}
if (!smb_sess) {
- status = NT_STATUS_USER_SESSION_DELETED;
+ /* see WSPP test suite - test 11 */
+ status = NT_STATUS_REQUEST_NOT_ACCEPTED;
goto failed;
}
diff --git a/source/torture/config.mk b/source/torture/config.mk
index 2857b99..5a1746c 100644
--- a/source/torture/config.mk
+++ b/source/torture/config.mk
@@ -263,23 +263,6 @@ gentest_OBJ_FILES = $(torturesrcdir)/gentest.o
MANPAGES += $(torturesrcdir)/man/gentest.1
#################################
-# Start BINARY gentest_smb2
-[BINARY::gentest_smb2]
-INSTALLDIR = BINDIR
-PRIVATE_DEPENDENCIES = \
- LIBSAMBA-HOSTCONFIG \
- LIBSAMBA-UTIL \
- LIBPOPT \
- POPT_SAMBA \
- POPT_CREDENTIALS \
- LIBCLI_SMB \
- LIBCLI_RAW
-# End BINARY gentest_smb2
-#################################
-
-gentest_smb2_OBJ_FILES = $(torturesrcdir)/gentest_smb2.o
-
-#################################
# Start BINARY masktest
[BINARY::masktest]
INSTALLDIR = BINDIR
diff --git a/source/torture/gentest.c b/source/torture/gentest.c
index 068b6bd..fd6bd5c 100644
--- a/source/torture/gentest.c
+++ b/source/torture/gentest.c
@@ -1,7 +1,9 @@
/*
Unix SMB/CIFS implementation.
- generic testing tool
- Copyright (C) Andrew Tridgell 2003
+
+ generic testing tool - version with both SMB and SMB2 support
+
+ Copyright (C) Andrew Tridgell 2003-2008
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,12 +27,17 @@
#include "libcli/raw/request.h"
#include "libcli/libcli.h"
#include "libcli/raw/libcliraw.h"
+#include "libcli/smb2/smb2.h"
+#include "libcli/smb2/smb2_calls.h"
#include "librpc/gen_ndr/security.h"
+#include "librpc/gen_ndr/ndr_security.h"
#include "auth/credentials/credentials.h"
#include "libcli/resolve/resolve.h"
#include "auth/gensec/gensec.h"
#include "param/param.h"
#include "dynconfig/dynconfig.h"
+#include "libcli/security/security.h"
+#include "libcli/raw/raw_proto.h"
#define NSERVERS 2
#define NINSTANCES 2
@@ -49,14 +56,20 @@ static struct gentest_options {
const char *seeds_file;
int use_preset_seeds;
int fast_reconnect;
+ int mask_indexing;
+ int no_eas;
+ int no_acls;
int skip_cleanup;
+ int valid;
+ int smb2;
} options;
/* mapping between open handles on the server and local handles */
static struct {
bool active;
uint_t instance;
- uint_t server_fnum[NSERVERS];
+ struct smb2_handle smb2_handle[NSERVERS]; /* SMB2 */
+ uint16_t smb_handle[NSERVERS]; /* SMB */
const char *name;
} *open_handles;
static uint_t num_open_handles;
@@ -64,7 +77,8 @@ static uint_t num_open_handles;
/* state information for the servers. We open NINSTANCES connections to
each server */
static struct {
- struct smbcli_state *cli[NINSTANCES];
+ struct smb2_tree *smb2_tree[NINSTANCES];
+ struct smbcli_tree *smb_tree[NINSTANCES];
char *server_name;
char *share_name;
struct cli_credentials *credentials;
@@ -80,7 +94,8 @@ static struct {
/* oplock break info */
static struct {
bool got_break;
- uint16_t fnum;
+ struct smb2_handle smb2_handle;
+ uint16_t smb_handle;
uint16_t handle;
uint8_t level;
bool do_close;
@@ -100,14 +115,19 @@ static struct {
NTSTATUS status;
uint_t opnum;
TALLOC_CTX *mem_ctx;
+ const char *mismatch;
} current_op;
+static struct smb2_handle bad_smb2_handle;
#define BAD_HANDLE 0xFFFE
-static bool oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private);
-static void idle_func(struct smbcli_transport *transport, void *private);
+static bool oplock_handler_smb2(struct smb2_transport *transport, const struct smb2_handle *handle,
+ uint8_t level, void *private_data);
+static void idle_func_smb2(struct smb2_transport *transport, void *private);
--
Samba Shared Repository
More information about the samba-cvs
mailing list