summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/smb_build/input.pm1
-rw-r--r--source4/build/smb_build/output.pm2
-rw-r--r--source4/dsdb/samdb/ldb_modules/config.mk52
-rw-r--r--source4/ntvfs/config.mk2
-rw-r--r--source4/ntvfs/posix/pvfs_qfileinfo.c9
-rw-r--r--source4/ntvfs/posix/pvfs_read.c2
-rw-r--r--source4/ntvfs/posix/pvfs_write.c2
-rw-r--r--source4/param/config.mk2
-rw-r--r--source4/smb_server/smb/reply.c3
-rw-r--r--source4/static_deps.mk16
-rw-r--r--source4/torture/gentest.c7
-rw-r--r--source4/torture/gentest_smb2.c37
-rw-r--r--source4/torture/smb2/lock.c12
-rw-r--r--source4/torture/smb2/read.c55
14 files changed, 145 insertions, 57 deletions
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index a76da496d9..53a051a3c7 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -84,7 +84,6 @@ sub check_module($$$)
return if ($mod->{ENABLE} ne "YES");
-
if (exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE})) {
$mod->{INIT_FUNCTION_TYPE} = $INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE};
} else {
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index f9f12c3a73..76c6d3fc8f 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -52,7 +52,7 @@ sub generate_shared_library($)
$lib->{RESULT_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}";
$lib->{OUTPUT_SHARED_LIBRARY} = "-l$link_name";
- $lib->{TARGET_SHARED_LIBRARY} = $lib->{RESULT_SHARED_LIBRARY};
+ $lib->{TARGET_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_DEBUGNAME}";
}
sub generate_merged_obj($)
diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk
index eae190a85f..388b67c6d1 100644
--- a/source4/dsdb/samdb/ldb_modules/config.mk
+++ b/source4/dsdb/samdb/ldb_modules/config.mk
@@ -8,7 +8,7 @@ INIT_FUNCTION = LDB_MODULE(objectguid)
# End MODULE ldb_objectguid
################################################
-ldb_objectguid_OBJ_FILES = dsdb/samdb/ldb_modules/objectguid.o
+ldb_objectguid_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/objectguid.o
################################################
# Start MODULE ldb_repl_meta_data
@@ -22,7 +22,7 @@ INIT_FUNCTION = LDB_MODULE(repl_meta_data)
################################################
ldb_repl_meta_data_OBJ_FILES = \
- dsdb/samdb/ldb_modules/repl_meta_data.o
+ $(dsdbsrcdir)/samdb/ldb_modules/repl_meta_data.o
################################################
# Start MODULE ldb_dsdb_cache
@@ -35,7 +35,7 @@ INIT_FUNCTION = LDB_MODULE(dsdb_cache)
################################################
ldb_dsdb_cache_OBJ_FILES = \
- dsdb/samdb/ldb_modules/dsdb_cache.o
+ $(dsdbsrcdir)/samdb/ldb_modules/dsdb_cache.o
################################################
# Start MODULE ldb_schema_fsmo
@@ -48,7 +48,7 @@ INIT_FUNCTION = LDB_MODULE(schema_fsmo)
################################################
ldb_schema_fsmo_OBJ_FILES = \
- dsdb/samdb/ldb_modules/schema_fsmo.o
+ $(dsdbsrcdir)/samdb/ldb_modules/schema_fsmo.o
################################################
# Start MODULE ldb_naming_fsmo
@@ -61,7 +61,7 @@ INIT_FUNCTION = LDB_MODULE(naming_fsmo)
################################################
ldb_naming_fsmo_OBJ_FILES = \
- dsdb/samdb/ldb_modules/naming_fsmo.o
+ $(dsdbsrcdir)/samdb/ldb_modules/naming_fsmo.o
################################################
# Start MODULE ldb_pdc_fsmo
@@ -74,7 +74,7 @@ INIT_FUNCTION = LDB_MODULE(pdc_fsmo)
################################################
ldb_pdc_fsmo_OBJ_FILES = \
- dsdb/samdb/ldb_modules/pdc_fsmo.o
+ $(dsdbsrcdir)/samdb/ldb_modules/pdc_fsmo.o
################################################
# Start MODULE ldb_samldb
@@ -88,7 +88,7 @@ INIT_FUNCTION = LDB_MODULE(samldb)
################################################
ldb_samldb_OBJ_FILES = \
- dsdb/samdb/ldb_modules/samldb.o
+ $(dsdbsrcdir)/samdb/ldb_modules/samldb.o
################################################
# Start MODULE ldb_samba3sam
@@ -102,7 +102,7 @@ PRIVATE_DEPENDENCIES = LIBTALLOC SMBPASSWD NSS_WRAPPER LIBSECURITY \
################################################
ldb_samba3sam_OBJ_FILES = \
- dsdb/samdb/ldb_modules/samba3sam.o
+ $(dsdbsrcdir)/samdb/ldb_modules/samba3sam.o
################################################
# Start MODULE ldb_simple_ldap_map
@@ -117,7 +117,7 @@ ALIASES = entryuuid nsuniqueid
################################################
ldb_simple_ldap_map_OBJ_FILES = \
- dsdb/samdb/ldb_modules/simple_ldap_map.o
+ $(dsdbsrcdir)/samdb/ldb_modules/simple_ldap_map.o
# ################################################
# # Start MODULE ldb_proxy
@@ -141,7 +141,7 @@ INIT_FUNCTION = LDB_MODULE(rootdse)
# End MODULE ldb_rootdse
################################################
-ldb_rootdse_OBJ_FILES = dsdb/samdb/ldb_modules/rootdse.o
+ldb_rootdse_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/rootdse.o
################################################
# Start MODULE ldb_password_hash
@@ -154,7 +154,7 @@ PRIVATE_DEPENDENCIES = HEIMDAL_HDB_KEYS LIBTALLOC HEIMDAL_KRB5 LDAP_ENCODE \
# End MODULE ldb_password_hash
################################################
-ldb_password_hash_OBJ_FILES = dsdb/samdb/ldb_modules/password_hash.o
+ldb_password_hash_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/password_hash.o
################################################
# Start MODULE ldb_local_password
@@ -166,7 +166,7 @@ INIT_FUNCTION = LDB_MODULE(local_password)
# End MODULE ldb_local_password
################################################
-ldb_local_password_OBJ_FILES = dsdb/samdb/ldb_modules/local_password.o
+ldb_local_password_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/local_password.o
################################################
# Start MODULE ldb_kludge_acl
@@ -179,7 +179,7 @@ INIT_FUNCTION = LDB_MODULE(kludge_acl)
# End MODULE ldb_kludge_acl
################################################
-ldb_kludge_acl_OBJ_FILES = dsdb/samdb/ldb_modules/kludge_acl.o
+ldb_kludge_acl_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/kludge_acl.o
################################################
# Start MODULE ldb_extended_dn
@@ -191,7 +191,7 @@ INIT_FUNCTION = LDB_MODULE(extended_dn)
# End MODULE ldb_extended_dn
################################################
-ldb_extended_dn_OBJ_FILES = dsdb/samdb/ldb_modules/extended_dn.o
+ldb_extended_dn_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/extended_dn.o
################################################
# Start MODULE ldb_show_deleted
@@ -203,7 +203,7 @@ INIT_FUNCTION = LDB_MODULE(show_deleted)
# End MODULE ldb_show_deleted
################################################
-ldb_show_deleted_OBJ_FILES = dsdb/samdb/ldb_modules/show_deleted.o
+ldb_show_deleted_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/show_deleted.o
################################################
# Start MODULE ldb_partition
@@ -215,7 +215,7 @@ INIT_FUNCTION = LDB_MODULE(partition)
# End MODULE ldb_partition
################################################
-ldb_partition_OBJ_FILES = dsdb/samdb/ldb_modules/partition.o
+ldb_partition_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/partition.o
################################################
# Start MODULE ldb_schema
@@ -227,7 +227,7 @@ INIT_FUNCTION = LDB_MODULE(schema)
# End MODULE ldb_schema
################################################
-ldb_schema_OBJ_FILES = $(addprefix dsdb/samdb/ldb_modules/, schema.o schema_syntax.o)
+ldb_schema_OBJ_FILES = $(addprefix $(dsdbsrcdir)/samdb/ldb_modules/, schema.o schema_syntax.o)
################################################
# Start MODULE ldb_update_kt
@@ -240,7 +240,7 @@ INIT_FUNCTION = LDB_MODULE(update_kt)
# End MODULE ldb_update_kt
################################################
-ldb_update_keytab_OBJ_FILES = dsdb/samdb/ldb_modules/update_keytab.o
+ldb_update_keytab_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/update_keytab.o
################################################
# Start MODULE ldb_objectclass
@@ -253,7 +253,7 @@ SUBSYSTEM = LIBLDB
# End MODULE ldb_objectclass
################################################
-ldb_objectclass_OBJ_FILES = dsdb/samdb/ldb_modules/objectclass.o
+ldb_objectclass_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/objectclass.o
################################################
# Start MODULE ldb_subtree_rename
@@ -265,7 +265,7 @@ SUBSYSTEM = LIBLDB
# End MODULE ldb_subtree_rename
################################################
-ldb_subtree_rename_OBJ_FILES = dsdb/samdb/ldb_modules/subtree_rename.o
+ldb_subtree_rename_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/subtree_rename.o
################################################
# Start MODULE ldb_subtree_rename
@@ -277,7 +277,7 @@ SUBSYSTEM = LIBLDB
# End MODULE ldb_subtree_rename
################################################
-ldb_subtree_delete_OBJ_FILES = dsdb/samdb/ldb_modules/subtree_delete.o
+ldb_subtree_delete_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/subtree_delete.o
################################################
# Start MODULE ldb_linked_attributes
@@ -290,7 +290,7 @@ SUBSYSTEM = LIBLDB
# End MODULE ldb_linked_attributes
################################################
-ldb_linked_attributes_OBJ_FILES = dsdb/samdb/ldb_modules/linked_attributes.o
+ldb_linked_attributes_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/linked_attributes.o
################################################
# Start MODULE ldb_ranged_results
@@ -302,7 +302,7 @@ SUBSYSTEM = LIBLDB
# End MODULE ldb_ranged_results
################################################
-ldb_ranged_results_OBJ_FILES = dsdb/samdb/ldb_modules/ranged_results.o
+ldb_ranged_results_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/ranged_results.o
################################################
# Start MODULE ldb_anr
@@ -315,7 +315,7 @@ SUBSYSTEM = LIBLDB
# End MODULE ldb_anr
################################################
-ldb_anr_OBJ_FILES = dsdb/samdb/ldb_modules/anr.o
+ldb_anr_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/anr.o
################################################
# Start MODULE ldb_normalise
@@ -328,7 +328,7 @@ SUBSYSTEM = LIBLDB
# End MODULE ldb_normalise
################################################
-ldb_normalise_OBJ_FILES = dsdb/samdb/ldb_modules/normalise.o
+ldb_normalise_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/normalise.o
################################################
# Start MODULE ldb_instancetype
@@ -341,5 +341,5 @@ SUBSYSTEM = LIBLDB
# End MODULE ldb_instancetype
################################################
-ldb_instancetype_OBJ_FILES = dsdb/samdb/ldb_modules/instancetype.o
+ldb_instancetype_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/instancetype.o
diff --git a/source4/ntvfs/config.mk b/source4/ntvfs/config.mk
index bf34c4082a..593c526edb 100644
--- a/source4/ntvfs/config.mk
+++ b/source4/ntvfs/config.mk
@@ -27,7 +27,7 @@ PRIVATE_DEPENDENCIES = \
# End MODULE ntvfs_smb2
################################################
-ntvfs_smb2_OBJ_FILES = ntvfs/smb2/vfs_smb2.o
+ntvfs_smb2_OBJ_FILES = $(ntvfssrcdir)/smb2/vfs_smb2.o
################################################
diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c
index 6e3092b744..c663466985 100644
--- a/source4/ntvfs/posix/pvfs_qfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_qfileinfo.c
@@ -178,6 +178,15 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs,
case RAW_FILEINFO_ALL_EAS:
return pvfs_query_all_eas(pvfs, req, name, fd, &info->all_eas.out);
+ case RAW_FILEINFO_SMB2_ALL_EAS: {
+ NTSTATUS status = pvfs_query_all_eas(pvfs, req, name, fd, &info->all_eas.out);
+ if (NT_STATUS_IS_OK(status) &&
+ info->all_eas.out.num_eas == 0) {
+ return NT_STATUS_NO_EAS_ON_FILE;
+ }
+ return status;
+ }
+
case RAW_FILEINFO_IS_NAME_VALID:
return NT_STATUS_OK;
diff --git a/source4/ntvfs/posix/pvfs_read.c b/source4/ntvfs/posix/pvfs_read.c
index a01a8a57e3..8e1a59473f 100644
--- a/source4/ntvfs/posix/pvfs_read.c
+++ b/source4/ntvfs/posix/pvfs_read.c
@@ -46,7 +46,7 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
}
if (f->handle->fd == -1) {
- return NT_STATUS_FILE_IS_A_DIRECTORY;
+ return NT_STATUS_INVALID_DEVICE_REQUEST;
}
mask = SEC_FILE_READ_DATA;
diff --git a/source4/ntvfs/posix/pvfs_write.c b/source4/ntvfs/posix/pvfs_write.c
index dda8c83407..1f662f13fc 100644
--- a/source4/ntvfs/posix/pvfs_write.c
+++ b/source4/ntvfs/posix/pvfs_write.c
@@ -45,7 +45,7 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
}
if (f->handle->fd == -1) {
- return NT_STATUS_FILE_IS_A_DIRECTORY;
+ return NT_STATUS_INVALID_DEVICE_REQUEST;
}
if (!(f->access_mask & (SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA))) {
diff --git a/source4/param/config.mk b/source4/param/config.mk
index c169ce157e..6af9dab5d9 100644
--- a/source4/param/config.mk
+++ b/source4/param/config.mk
@@ -13,7 +13,7 @@ PUBLIC_HEADERS += param/param.h
PC_FILES += $(paramsrcdir)/samba-hostconfig.pc
[SUBSYSTEM::PROVISION]
-PRIVATE_DEPENDENCIES = LIBPYTHON
+PRIVATE_DEPENDENCIES = LIBPYTHON swig_ldb
PROVISION_OBJ_FILES = $(paramsrcdir)/provision.o
diff --git a/source4/smb_server/smb/reply.c b/source4/smb_server/smb/reply.c
index d28f4b6072..d7ed052ba0 100644
--- a/source4/smb_server/smb/reply.c
+++ b/source4/smb_server/smb/reply.c
@@ -2195,7 +2195,8 @@ void smbsrv_reply_ntcreate_and_X(struct smbsrv_request *req)
/* we use a couple of bits of the create options internally */
if (io->ntcreatex.in.create_options & NTCREATEX_OPTIONS_PRIVATE_MASK) {
- return NT_STATUS_INVALID_PARAMETER;
+ smbsrv_send_error(req, NT_STATUS_INVALID_PARAMETER);
+ return;
}
/* we need a neater way to handle this alignment */
diff --git a/source4/static_deps.mk b/source4/static_deps.mk
index de59d76e28..085eae938d 100644
--- a/source4/static_deps.mk
+++ b/source4/static_deps.mk
@@ -1,17 +1,17 @@
# These should also be autogenerated at some point
# perhaps by some perl scripts run from config.status ?
#
-librpc/gen_ndr/misc.h: idl
-librpc/ndr/libndr.h: librpc/ndr/libndr_proto.h librpc/gen_ndr/misc.h
-librpc/rpc/dcerpc.h: librpc/rpc/dcerpc_proto.h
-auth/credentials/credentials.h: auth/credentials/credentials_proto.h
-libcli/nbt/libnbt.h: libcli/nbt/nbt_proto.h
-lib/charset/charset.h: lib/charset/charset_proto.h
+$(gen_ndrsrcdir)/misc.h: idl
+$(ndrsrcdir)/libndr.h: $(ndrsrcdir)/libndr_proto.h $(gen_ndrsrcdir)/misc.h
+$(dcerpcsrcdir)/dcerpc.h: $(dcerpcsrcdir)/dcerpc_proto.h
+$(authsrcdir)/credentials/credentials.h: $(authsrcdir)/credentials/credentials_proto.h
+$(libclisrcdir)/nbt/libnbt.h: $(libclisrcdir)/nbt/nbt_proto.h
+$(libcharsetsrcdir)/charset.h: $(libcharsetsrcdir)/charset_proto.h
include/includes.h: \
include/config.h \
- lib/charset/charset.h \
- librpc/gen_ndr/misc.h
+ $(libcharsetsrcdir)/charset.h \
+ $(gen_ndrsrcdir)/misc.h
heimdal_basics: \
$(heimdalsrcdir)/lib/hdb/hdb_asn1.h \
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index cd33074b4f..068b6bdc2f 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -49,6 +49,7 @@ static struct gentest_options {
const char *seeds_file;
int use_preset_seeds;
int fast_reconnect;
+ int skip_cleanup;
} options;
/* mapping between open handles on the server and local handles */
@@ -1865,6 +1866,11 @@ static bool handler_notify(int instance)
static void wipe_files(void)
{
int i;
+
+ if (options.skip_cleanup) {
+ return;
+ }
+
for (i=0;i<NSERVERS;i++) {
int n = smbcli_deltree(servers[i].cli[0]->tree, "\\gentest");
if (n == -1) {
@@ -2196,6 +2202,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
{"unclist", 0, POPT_ARG_STRING, NULL, OPT_UNCLIST, "unclist", NULL},
{"seedsfile", 0, POPT_ARG_STRING, &options.seeds_file, 0, "seed file", NULL},
{ "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "[DOMAIN/]USERNAME[%PASSWORD]" },
+ {"skip-cleanup", 0, POPT_ARG_NONE, &options.skip_cleanup, 0, "don't delete files at start", NULL},
POPT_COMMON_SAMBA
POPT_COMMON_CONNECTION
POPT_COMMON_CREDENTIALS
diff --git a/source4/torture/gentest_smb2.c b/source4/torture/gentest_smb2.c
index 3e705dc60d..60bf6264c2 100644
--- a/source4/torture/gentest_smb2.c
+++ b/source4/torture/gentest_smb2.c
@@ -56,6 +56,7 @@ static struct gentest_options {
int mask_indexing;
int no_eas;
int skip_cleanup;
+ int valid;
} options;
/* mapping between open handles on the server and local handles */
@@ -510,7 +511,7 @@ static uint32_t gen_bits_mask(uint_t mask)
*/
static uint32_t gen_bits_mask2(uint32_t mask1, uint32_t mask2)
{
- if (gen_chance(10)) return gen_bits_mask(mask2);
+ if (!options.valid && gen_chance(10)) return gen_bits_mask(mask2);
return gen_bits_mask(mask1);
}
@@ -519,21 +520,25 @@ static uint32_t gen_bits_mask2(uint32_t mask1, uint32_t mask2)
*/
static uint64_t gen_reserved8(void)
{
+ if (options.valid) return 0;
return gen_bits_mask(0xFF);
}
static uint64_t gen_reserved16(void)
{
+ if (options.valid) return 0;
return gen_bits_mask(0xFFFF);
}
static uint64_t gen_reserved32(void)
{
+ if (options.valid) return 0;
return gen_bits_mask(0xFFFFFFFF);
}
static uint64_t gen_reserved64(void)
{
+ if (options.valid) return 0;
return gen_bits_mask(0xFFFFFFFF) | (((uint64_t)gen_bits_mask(0xFFFFFFFF))<<32);
}
@@ -552,7 +557,7 @@ static bool gen_bool(void)
*/
static uint16_t gen_lock_flags(void)
{
- if (gen_chance(5)) return gen_bits_mask(0xFFFF);
+ if (!options.valid && gen_chance(5)) return gen_bits_mask(0xFFFF);
if (gen_chance(20)) return gen_bits_mask(0x1F);
if (gen_chance(50)) return SMB2_LOCK_FLAG_UNLOCK;
return gen_bits_mask(SMB2_LOCK_FLAG_SHARED |
@@ -573,9 +578,12 @@ static off_t gen_lock_count(void)
*/
static uint32_t gen_access_mask(void)
{
+ uint32_t ret;
if (gen_chance(70)) return SEC_FLAG_MAXIMUM_ALLOWED;
if (gen_chance(70)) return SEC_FILE_ALL;
- return gen_bits_mask(0xFFFFFFFF);
+ ret = gen_bits_mask(0xFFFFFFFF);
+ if (options.valid) ret &= ~SEC_MASK_INVALID;
+ return ret;
}
/*
@@ -583,7 +591,7 @@ static uint32_t gen_access_mask(void)
*/
static uint32_t gen_create_options(void)
{
- if (gen_chance(20)) return gen_bits_mask(0xFFFFFFFF);
+ if (!options.valid && gen_chance(20)) return gen_bits_mask(0xFFFFFFFF);
if (gen_chance(50)) return 0;
return gen_bits_mask(NTCREATEX_OPTIONS_DELETE_ON_CLOSE | NTCREATEX_OPTIONS_DIRECTORY);
}
@@ -594,7 +602,7 @@ static uint32_t gen_create_options(void)
static uint32_t gen_open_disp(void)
{
if (gen_chance(50)) return NTCREATEX_DISP_OPEN_IF;
- if (gen_chance(10)) return gen_bits_mask(0xFFFFFFFF);
+ if (!options.valid && gen_chance(10)) return gen_bits_mask(0xFFFFFFFF);
return gen_int_range(0, 5);
}
@@ -603,7 +611,12 @@ static uint32_t gen_open_disp(void)
*/
static uint32_t gen_attrib(void)
{
- if (gen_chance(20)) return gen_bits_mask(0xFFFFFFFF);
+ uint32_t ret;
+ if (gen_chance(20)) {
+ ret = gen_bits_mask(0xFFFFFFFF);
+ if (options.valid) ret &= FILE_ATTRIBUTE_ALL_MASK;
+ return ret;
+ }
return gen_bits_mask(FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY);
}
@@ -1097,10 +1110,7 @@ static bool handler_create(int instance)
parm[0].in.security_flags = gen_bits_levels(3, 90, 0x0, 70, 0x3, 100, 0xFF);
parm[0].in.oplock_level = gen_bits_levels(3, 90, 0x0, 70, 0x9, 100, 0xFF);
parm[0].in.impersonation_level = gen_bits_levels(3, 90, 0x0, 70, 0x3, 100, 0xFFFFFFFF);
- parm[0].in.create_flags = gen_bits_levels(2, 90, 0x0, 100, 0xFFFFFFFF);
- if (gen_chance(2)) {
- parm[0].in.create_flags |= gen_bits_mask(0xFFFFFFFF);
- }
+ parm[0].in.create_flags = gen_reserved64();
parm[0].in.reserved = gen_reserved64();
parm[0].in.desired_access = gen_access_mask();
parm[0].in.file_attributes = gen_attrib();
@@ -1115,6 +1125,12 @@ static bool handler_create(int instance)
parm[0].in.oplock_level = 0;
}
+ if (options.valid) {
+ parm[0].in.security_flags &= 3;
+ parm[0].in.oplock_level &= 9;
+ parm[0].in.impersonation_level &= 3;
+ }
+
GEN_COPY_PARM;
GEN_CALL(smb2_create(tree, current_op.mem_ctx, &parm[i]));
@@ -1926,6 +1942,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
{"maskindexing", 0, POPT_ARG_NONE, &options.mask_indexing, 0, "mask out the indexed file attrib", NULL},
{"noeas", 0, POPT_ARG_NONE, &options.no_eas, 0, "don't use extended attributes", NULL},
{"skip-cleanup", 0, POPT_ARG_NONE, &options.skip_cleanup, 0, "don't delete files at start", NULL},
+ {"valid", 0, POPT_ARG_NONE, &options.valid, 0, "generate only valid fields", NULL},
POPT_COMMON_SAMBA
POPT_COMMON_CONNECTION
POPT_COMMON_CREDENTIALS
diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c
index 4e21045a33..5a36ac3eae 100644
--- a/source4/torture/smb2/lock.c
+++ b/source4/torture/smb2/lock.c
@@ -252,12 +252,20 @@ static bool test_valid_request(struct torture_context *torture, struct smb2_tree
lck.in.lock_count = 1;
el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
status = smb2_lock(tree, &lck);
- CHECK_STATUS(status, NT_STATUS_OK);
+ if (torture_setting_bool(torture, "windows", false)) {
+ CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+ } else {
+ CHECK_STATUS(status, NT_STATUS_OK);
+ }
lck.in.lock_count = 1;
el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
status = smb2_lock(tree, &lck);
- CHECK_STATUS(status, NT_STATUS_OK);
+ if (torture_setting_bool(torture, "windows", false)) {
+ CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+ } else {
+ CHECK_STATUS(status, NT_STATUS_OK);
+ }
lck.in.lock_count = 1;
el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
diff --git a/source4/torture/smb2/read.c b/source4/torture/smb2/read.c
index 3e1d077b7d..62240f35ba 100644
--- a/source4/torture/smb2/read.c
+++ b/source4/torture/smb2/read.c
@@ -38,13 +38,13 @@
#define CHECK_VALUE(v, correct) do { \
if ((v) != (correct)) { \
- printf("(%s) Incorrect value %s=%d - should be %d\n", \
- __location__, #v, v, correct); \
+ printf("(%s) Incorrect value %s=%u - should be %u\n", \
+ __location__, #v, (unsigned)v, (unsigned)correct); \
ret = false; \
goto done; \
}} while (0)
-static bool test_read(struct torture_context *torture, struct smb2_tree *tree)
+static bool test_read_eof(struct torture_context *torture, struct smb2_tree *tree)
{
bool ret = true;
NTSTATUS status;
@@ -126,13 +126,60 @@ done:
return ret;
}
+
+static bool test_read_position(struct torture_context *torture, struct smb2_tree *tree)
+{
+ bool ret = true;
+ NTSTATUS status;
+ struct smb2_handle h;
+ uint8_t buf[70000];
+ struct smb2_read rd;
+ TALLOC_CTX *tmp_ctx = talloc_new(tree);
+ union smb_fileinfo info;
+
+ ZERO_STRUCT(buf);
+
+ status = torture_smb2_testfile(tree, "lock1.txt", &h);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = smb2_util_write(tree, h, buf, 0, ARRAY_SIZE(buf));
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ ZERO_STRUCT(rd);
+ rd.in.file.handle = h;
+ rd.in.length = 10;
+ rd.in.offset = 0;
+ rd.in.min_count = 1;
+
+ status = smb2_read(tree, tmp_ctx, &rd);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VALUE(rd.out.data.length, 10);
+
+ info.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
+ info.generic.in.file.handle = h;
+
+ status = smb2_getinfo_file(tree, tmp_ctx, &info);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ if (torture_setting_bool(torture, "windows", false)) {
+ CHECK_VALUE(info.all_info2.out.position, 0);
+ } else {
+ CHECK_VALUE(info.all_info2.out.position, 10);
+ }
+
+
+done:
+ talloc_free(tmp_ctx);
+ return ret;
+}
+
/* basic testing of SMB2 read
*/
struct torture_suite *torture_smb2_read_init(void)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "READ");
- torture_suite_add_1smb2_test(suite, "READ", test_read);
+ torture_suite_add_1smb2_test(suite, "EOF", test_read_eof);
+ torture_suite_add_1smb2_test(suite, "POSITION", test_read_position);
suite->description = talloc_strdup(suite, "SMB2-READ tests");