2005-11-18 09:31:33 +03:00
/*
Unix SMB / CIFS implementation .
SMB2 setinfo individual test suite
Copyright ( C ) Andrew Tridgell 2005
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
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2005-11-18 09:31:33 +03:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2005-11-18 09:31:33 +03:00
*/
# include "includes.h"
# include "system/time.h"
2005-12-28 18:38:36 +03:00
# include "libcli/smb2/smb2.h"
2006-01-03 20:27:33 +03:00
# include "libcli/smb2/smb2_calls.h"
2005-11-18 09:31:33 +03:00
2006-03-25 19:01:28 +03:00
# include "torture/torture.h"
2006-02-04 17:08:24 +03:00
# include "torture/smb2/proto.h"
2006-06-29 11:03:09 +04:00
# include "libcli/security/security.h"
# include "librpc/gen_ndr/ndr_security.h"
2013-03-27 00:26:49 +04:00
static bool find_returned_ea ( union smb_fileinfo * finfo2 ,
const char * eaname ,
const char * eavalue )
{
unsigned int i ;
unsigned int num_eas = finfo2 - > all_eas . out . num_eas ;
struct ea_struct * eas = finfo2 - > all_eas . out . eas ;
for ( i = 0 ; i < num_eas ; i + + ) {
if ( eas [ i ] . name . s = = NULL ) {
continue ;
}
/* Windows capitalizes returned EA names. */
if ( strcasecmp_m ( eas [ i ] . name . s , eaname ) ) {
continue ;
}
if ( eavalue = = NULL & & eas [ i ] . value . length = = 0 ) {
/* Null value, found it ! */
return true ;
}
if ( eas [ i ] . value . length = = strlen ( eavalue ) & &
memcmp ( eas [ i ] . value . data ,
eavalue ,
strlen ( eavalue ) ) = = 0 ) {
return true ;
}
}
return false ;
}
2005-11-18 09:31:33 +03:00
# define BASEDIR ""
2009-07-05 03:16:23 +04:00
# define FAIL_UNLESS(__cond) \
do { \
if ( __cond ) { } else { \
torture_result ( tctx , TORTURE_FAIL , " %s) condition violated: %s \n " , \
__location__ , # __cond ) ; \
ret = false ; goto done ; \
} \
} while ( 0 )
2005-11-18 09:31:33 +03:00
/* basic testing of all SMB2 setinfo calls
for each call we test that it succeeds , and where possible test
for consistency between the calls .
*/
2009-07-05 03:16:23 +04:00
bool torture_smb2_setinfo ( struct torture_context * tctx )
2005-11-18 09:31:33 +03:00
{
struct smb2_tree * tree ;
2007-10-07 02:28:14 +04:00
bool ret = true ;
2005-11-18 09:31:33 +03:00
struct smb2_handle handle ;
char * fname ;
2005-11-19 08:55:08 +03:00
union smb_fileinfo finfo2 ;
2005-11-18 09:31:33 +03:00
union smb_setfileinfo sfinfo ;
2006-06-29 11:03:09 +04:00
struct security_ace ace ;
struct security_descriptor * sd ;
struct dom_sid * test_sid ;
2006-09-10 14:43:31 +04:00
NTSTATUS status , status2 = NT_STATUS_OK ;
2005-11-18 09:31:33 +03:00
const char * call_name ;
time_t basetime = ( time ( NULL ) - 86400 ) & ~ 1 ;
int n = time ( NULL ) % 100 ;
2013-03-27 00:26:49 +04:00
struct ea_struct ea ;
2005-11-18 09:31:33 +03:00
2005-12-02 06:18:34 +03:00
ZERO_STRUCT ( handle ) ;
2009-07-05 03:16:23 +04:00
fname = talloc_asprintf ( tctx , BASEDIR " fnum_test_%d.txt " , n ) ;
2005-11-18 09:31:33 +03:00
2009-07-05 03:16:23 +04:00
if ( ! torture_smb2_connection ( tctx , & tree ) ) {
2007-10-07 02:28:14 +04:00
return false ;
2005-11-18 09:31:33 +03:00
}
# define RECREATE_FILE(fname) do { \
smb2_util_close ( tree , handle ) ; \
2016-02-22 17:40:50 +03:00
status = smb2_create_complex_file ( tctx , tree , fname , & handle ) ; \
2005-11-18 09:31:33 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) { \
2012-02-28 15:53:29 +04:00
torture_result ( tctx , TORTURE_FAIL , " (%s) ERROR: open of %s failed (%s) \n " , \
2005-11-18 09:31:33 +03:00
__location__ , fname , nt_errstr ( status ) ) ; \
2007-10-07 02:28:14 +04:00
ret = false ; \
2005-11-18 09:31:33 +03:00
goto done ; \
} } while ( 0 )
# define RECREATE_BOTH do { \
RECREATE_FILE ( fname ) ; \
} while ( 0 )
RECREATE_BOTH ;
# define CHECK_CALL(call, rightstatus) do { \
call_name = # call ; \
sfinfo . generic . level = RAW_SFILEINFO_ # # call ; \
2006-03-13 01:48:25 +03:00
sfinfo . generic . in . file . handle = handle ; \
2005-11-18 09:31:33 +03:00
status = smb2_setinfo_file ( tree , & sfinfo ) ; \
if ( ! NT_STATUS_EQUAL ( status , rightstatus ) ) { \
2009-07-05 03:16:23 +04:00
torture_result ( tctx , TORTURE_FAIL , " (%s) %s - %s (should be %s) \n " , __location__ , # call , \
2005-11-18 09:31:33 +03:00
nt_errstr ( status ) , nt_errstr ( rightstatus ) ) ; \
2007-10-07 02:28:14 +04:00
ret = false ; \
2006-07-01 18:21:21 +04:00
goto done ; \
2005-11-18 09:31:33 +03:00
} \
2005-11-19 08:55:08 +03:00
} while ( 0 )
2005-11-18 09:31:33 +03:00
# define CHECK1(call) \
do { if ( NT_STATUS_IS_OK ( status ) ) { \
finfo2 . generic . level = RAW_FILEINFO_ # # call ; \
2006-03-13 01:48:25 +03:00
finfo2 . generic . in . file . handle = handle ; \
2009-07-05 03:16:23 +04:00
status2 = smb2_getinfo_file ( tree , tctx , & finfo2 ) ; \
2005-11-18 09:31:33 +03:00
if ( ! NT_STATUS_IS_OK ( status2 ) ) { \
2009-07-05 03:16:23 +04:00
torture_result ( tctx , TORTURE_FAIL , " (%s) %s - %s \n " , __location__ , # call , nt_errstr ( status2 ) ) ; \
2007-10-07 02:28:14 +04:00
ret = false ; \
2006-07-01 18:21:21 +04:00
goto done ; \
2005-11-18 09:31:33 +03:00
} \
} } while ( 0 )
# define CHECK_VALUE(call, stype, field, value) do { \
CHECK1 ( call ) ; \
if ( NT_STATUS_IS_OK ( status ) & & NT_STATUS_IS_OK ( status2 ) & & finfo2 . stype . out . field ! = value ) { \
2009-07-05 03:16:23 +04:00
torture_result ( tctx , TORTURE_FAIL , " (%s) %s - %s/%s should be 0x%x - 0x%x \n " , __location__ , \
2005-11-18 09:31:33 +03:00
call_name , # stype , # field , \
2010-01-05 20:42:54 +03:00
( unsigned int ) value , ( unsigned int ) finfo2 . stype . out . field ) ; \
2016-02-22 17:40:50 +03:00
torture_smb2_all_info ( tctx , tree , handle ) ; \
2007-10-07 02:28:14 +04:00
ret = false ; \
2006-07-01 18:21:21 +04:00
goto done ; \
2005-11-18 09:31:33 +03:00
} } while ( 0 )
# define CHECK_TIME(call, stype, field, value) do { \
CHECK1 ( call ) ; \
if ( NT_STATUS_IS_OK ( status ) & & NT_STATUS_IS_OK ( status2 ) & & nt_time_to_unix ( finfo2 . stype . out . field ) ! = value ) { \
2009-07-05 03:16:23 +04:00
torture_result ( tctx , TORTURE_FAIL , " (%s) %s - %s/%s should be 0x%x - 0x%x \n " , __location__ , \
2005-11-18 09:31:33 +03:00
call_name , # stype , # field , \
2010-01-05 20:42:54 +03:00
( unsigned int ) value , \
( unsigned int ) nt_time_to_unix ( finfo2 . stype . out . field ) ) ; \
2009-07-05 03:16:23 +04:00
torture_warning ( tctx , " \t %s " , timestring ( tctx , value ) ) ; \
torture_warning ( tctx , " \t %s \n " , nt_time_string ( tctx , finfo2 . stype . out . field ) ) ; \
2016-02-22 17:40:50 +03:00
torture_smb2_all_info ( tctx , tree , handle ) ; \
2007-10-07 02:28:14 +04:00
ret = false ; \
2006-07-01 18:21:21 +04:00
goto done ; \
2005-11-18 09:31:33 +03:00
} } while ( 0 )
# define CHECK_STATUS(status, correct) do { \
if ( ! NT_STATUS_EQUAL ( status , correct ) ) { \
2009-07-05 03:16:23 +04:00
torture_result ( tctx , TORTURE_FAIL , " (%s) Incorrect status %s - should be %s \n " , \
2005-11-18 09:31:33 +03:00
__location__ , nt_errstr ( status ) , nt_errstr ( correct ) ) ; \
2007-10-07 02:28:14 +04:00
ret = false ; \
2005-11-18 09:31:33 +03:00
goto done ; \
} } while ( 0 )
2016-02-22 17:40:50 +03:00
torture_smb2_all_info ( tctx , tree , handle ) ;
2005-11-18 09:31:33 +03:00
2010-04-11 22:56:48 +04:00
torture_comment ( tctx , " Test basic_information level \n " ) ;
2005-11-18 09:31:33 +03:00
basetime + = 86400 ;
unix_to_nt_time ( & sfinfo . basic_info . in . create_time , basetime + 100 ) ;
unix_to_nt_time ( & sfinfo . basic_info . in . access_time , basetime + 200 ) ;
unix_to_nt_time ( & sfinfo . basic_info . in . write_time , basetime + 300 ) ;
unix_to_nt_time ( & sfinfo . basic_info . in . change_time , basetime + 400 ) ;
sfinfo . basic_info . in . attrib = FILE_ATTRIBUTE_READONLY ;
CHECK_CALL ( BASIC_INFORMATION , NT_STATUS_OK ) ;
CHECK_TIME ( SMB2_ALL_INFORMATION , all_info2 , create_time , basetime + 100 ) ;
CHECK_TIME ( SMB2_ALL_INFORMATION , all_info2 , access_time , basetime + 200 ) ;
CHECK_TIME ( SMB2_ALL_INFORMATION , all_info2 , write_time , basetime + 300 ) ;
CHECK_TIME ( SMB2_ALL_INFORMATION , all_info2 , change_time , basetime + 400 ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , attrib , FILE_ATTRIBUTE_READONLY ) ;
2009-07-05 03:16:23 +04:00
torture_comment ( tctx , " a zero time means don't change \n " ) ;
2005-11-18 09:31:33 +03:00
unix_to_nt_time ( & sfinfo . basic_info . in . create_time , 0 ) ;
unix_to_nt_time ( & sfinfo . basic_info . in . access_time , 0 ) ;
unix_to_nt_time ( & sfinfo . basic_info . in . write_time , 0 ) ;
unix_to_nt_time ( & sfinfo . basic_info . in . change_time , 0 ) ;
sfinfo . basic_info . in . attrib = FILE_ATTRIBUTE_NORMAL ;
CHECK_CALL ( BASIC_INFORMATION , NT_STATUS_OK ) ;
CHECK_TIME ( SMB2_ALL_INFORMATION , all_info2 , create_time , basetime + 100 ) ;
CHECK_TIME ( SMB2_ALL_INFORMATION , all_info2 , access_time , basetime + 200 ) ;
CHECK_TIME ( SMB2_ALL_INFORMATION , all_info2 , write_time , basetime + 300 ) ;
CHECK_TIME ( SMB2_ALL_INFORMATION , all_info2 , change_time , basetime + 400 ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , attrib , FILE_ATTRIBUTE_NORMAL ) ;
2009-07-05 03:16:23 +04:00
torture_comment ( tctx , " change the attribute \n " ) ;
2005-11-19 08:55:08 +03:00
sfinfo . basic_info . in . attrib = FILE_ATTRIBUTE_HIDDEN ;
CHECK_CALL ( BASIC_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , attrib , FILE_ATTRIBUTE_HIDDEN ) ;
2009-07-05 03:16:23 +04:00
torture_comment ( tctx , " zero attrib means don't change \n " ) ;
2005-11-19 08:55:08 +03:00
sfinfo . basic_info . in . attrib = 0 ;
CHECK_CALL ( BASIC_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , attrib , FILE_ATTRIBUTE_HIDDEN ) ;
2009-07-05 03:16:23 +04:00
torture_comment ( tctx , " can't change a file to a directory \n " ) ;
2008-05-28 14:06:48 +04:00
sfinfo . basic_info . in . attrib = FILE_ATTRIBUTE_DIRECTORY ;
CHECK_CALL ( BASIC_INFORMATION , NT_STATUS_INVALID_PARAMETER ) ;
2009-07-05 03:16:23 +04:00
torture_comment ( tctx , " restore attribute \n " ) ;
2005-11-19 08:55:08 +03:00
sfinfo . basic_info . in . attrib = FILE_ATTRIBUTE_NORMAL ;
CHECK_CALL ( BASIC_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , attrib , FILE_ATTRIBUTE_NORMAL ) ;
2010-04-11 22:56:48 +04:00
torture_comment ( tctx , " Test disposition_information level \n " ) ;
2005-11-18 09:31:33 +03:00
sfinfo . disposition_info . in . delete_on_close = 1 ;
CHECK_CALL ( DISPOSITION_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , delete_pending , 1 ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , nlink , 0 ) ;
sfinfo . disposition_info . in . delete_on_close = 0 ;
CHECK_CALL ( DISPOSITION_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , delete_pending , 0 ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , nlink , 1 ) ;
2010-04-11 22:56:48 +04:00
torture_comment ( tctx , " Test allocation_information level \n " ) ;
2005-11-18 09:31:33 +03:00
sfinfo . allocation_info . in . alloc_size = 0 ;
CHECK_CALL ( ALLOCATION_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , size , 0 ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , alloc_size , 0 ) ;
sfinfo . allocation_info . in . alloc_size = 4096 ;
CHECK_CALL ( ALLOCATION_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , alloc_size , 4096 ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , size , 0 ) ;
2010-04-11 22:56:48 +04:00
torture_comment ( tctx , " Test end_of_file_info level \n " ) ;
2005-11-18 09:31:33 +03:00
sfinfo . end_of_file_info . in . size = 37 ;
CHECK_CALL ( END_OF_FILE_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , size , 37 ) ;
sfinfo . end_of_file_info . in . size = 7 ;
CHECK_CALL ( END_OF_FILE_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , size , 7 ) ;
2010-04-11 22:56:48 +04:00
torture_comment ( tctx , " Test position_information level \n " ) ;
2005-11-18 09:31:33 +03:00
sfinfo . position_information . in . position = 123456 ;
CHECK_CALL ( POSITION_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( POSITION_INFORMATION , position_information , position , 123456 ) ;
2005-11-19 08:55:08 +03:00
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , position , 123456 ) ;
2005-11-18 09:31:33 +03:00
2010-04-11 22:56:48 +04:00
torture_comment ( tctx , " Test mode_information level \n " ) ;
2005-11-18 09:31:33 +03:00
sfinfo . mode_information . in . mode = 2 ;
CHECK_CALL ( MODE_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( MODE_INFORMATION , mode_information , mode , 2 ) ;
2005-11-19 08:55:08 +03:00
CHECK_VALUE ( SMB2_ALL_INFORMATION , all_info2 , mode , 2 ) ;
2005-11-18 09:31:33 +03:00
sfinfo . mode_information . in . mode = 1 ;
CHECK_CALL ( MODE_INFORMATION , NT_STATUS_INVALID_PARAMETER ) ;
sfinfo . mode_information . in . mode = 0 ;
CHECK_CALL ( MODE_INFORMATION , NT_STATUS_OK ) ;
CHECK_VALUE ( MODE_INFORMATION , mode_information , mode , 0 ) ;
2010-04-11 22:56:48 +04:00
torture_comment ( tctx , " Test sec_desc level \n " ) ;
2006-06-29 11:03:09 +04:00
ZERO_STRUCT ( finfo2 ) ;
finfo2 . query_secdesc . in . secinfo_flags =
SECINFO_OWNER |
SECINFO_GROUP |
SECINFO_DACL ;
CHECK1 ( SEC_DESC ) ;
sd = finfo2 . query_secdesc . out . sd ;
2009-07-05 03:16:23 +04:00
test_sid = dom_sid_parse_talloc ( tctx , SID_NT_AUTHENTICATED_USERS ) ;
2006-06-29 18:00:57 +04:00
ZERO_STRUCT ( ace ) ;
2006-06-29 11:03:09 +04:00
ace . type = SEC_ACE_TYPE_ACCESS_ALLOWED ;
ace . flags = 0 ;
ace . access_mask = SEC_STD_ALL ;
ace . trustee = * test_sid ;
status = security_descriptor_dacl_add ( sd , & ace ) ;
CHECK_STATUS ( status , NT_STATUS_OK ) ;
2009-07-05 03:16:23 +04:00
torture_comment ( tctx , " add a new ACE to the DACL \n " ) ;
2006-06-29 11:03:09 +04:00
sfinfo . set_secdesc . in . secinfo_flags = finfo2 . query_secdesc . in . secinfo_flags ;
sfinfo . set_secdesc . in . sd = sd ;
CHECK_CALL ( SEC_DESC , NT_STATUS_OK ) ;
2009-07-05 03:16:23 +04:00
FAIL_UNLESS ( smb2_util_verify_sd ( tctx , tree , handle , sd ) ) ;
2006-06-29 11:03:09 +04:00
2009-07-05 03:16:23 +04:00
torture_comment ( tctx , " remove it again \n " ) ;
2006-06-29 11:03:09 +04:00
status = security_descriptor_dacl_del ( sd , test_sid ) ;
CHECK_STATUS ( status , NT_STATUS_OK ) ;
sfinfo . set_secdesc . in . secinfo_flags = finfo2 . query_secdesc . in . secinfo_flags ;
sfinfo . set_secdesc . in . sd = sd ;
CHECK_CALL ( SEC_DESC , NT_STATUS_OK ) ;
2009-07-05 03:16:23 +04:00
FAIL_UNLESS ( smb2_util_verify_sd ( tctx , tree , handle , sd ) ) ;
2006-06-29 11:03:09 +04:00
2013-03-27 00:26:49 +04:00
torture_comment ( tctx , " Check zero length EA's behavior \n " ) ;
/* Set a new EA. */
sfinfo . full_ea_information . in . eas . num_eas = 1 ;
ea . flags = 0 ;
ea . name . private_length = 6 ;
ea . name . s = " NewEA " ;
ea . value = data_blob_string_const ( " testme " ) ;
sfinfo . full_ea_information . in . eas . eas = & ea ;
CHECK_CALL ( FULL_EA_INFORMATION , NT_STATUS_OK ) ;
/* Does it still exist ? */
finfo2 . generic . level = RAW_FILEINFO_SMB2_ALL_EAS ;
finfo2 . generic . in . file . handle = handle ;
finfo2 . all_eas . in . continue_flags = 1 ;
status2 = smb2_getinfo_file ( tree , tctx , & finfo2 ) ;
if ( ! NT_STATUS_IS_OK ( status2 ) ) {
torture_result ( tctx , TORTURE_FAIL , " (%s) %s - %s \n " , __location__ ,
" SMB2_ALL_EAS " , nt_errstr ( status2 ) ) ;
ret = false ;
goto done ;
}
/* Note on Windows EA name is returned capitalized. */
if ( ! find_returned_ea ( & finfo2 , " NewEA " , " testme " ) ) {
torture_result ( tctx , TORTURE_FAIL , " (%s) Missing EA 'NewEA' \n " , __location__ ) ;
ret = false ;
}
/* Now zero it out (should delete it) */
sfinfo . full_ea_information . in . eas . num_eas = 1 ;
ea . flags = 0 ;
ea . name . private_length = 6 ;
ea . name . s = " NewEA " ;
ea . value = data_blob_null ;
sfinfo . full_ea_information . in . eas . eas = & ea ;
CHECK_CALL ( FULL_EA_INFORMATION , NT_STATUS_OK ) ;
/* Does it still exist ? */
finfo2 . generic . level = RAW_FILEINFO_SMB2_ALL_EAS ;
finfo2 . generic . in . file . handle = handle ;
finfo2 . all_eas . in . continue_flags = 1 ;
status2 = smb2_getinfo_file ( tree , tctx , & finfo2 ) ;
if ( ! NT_STATUS_IS_OK ( status2 ) ) {
torture_result ( tctx , TORTURE_FAIL , " (%s) %s - %s \n " , __location__ ,
" SMB2_ALL_EAS " , nt_errstr ( status2 ) ) ;
ret = false ;
goto done ;
}
if ( find_returned_ea ( & finfo2 , " NewEA " , NULL ) ) {
torture_result ( tctx , TORTURE_FAIL , " (%s) EA 'NewEA' should be deleted \n " , __location__ ) ;
ret = false ;
}
/* Set a zero length EA. */
sfinfo . full_ea_information . in . eas . num_eas = 1 ;
ea . flags = 0 ;
ea . name . private_length = 6 ;
ea . name . s = " ZeroEA " ;
ea . value = data_blob_null ;
sfinfo . full_ea_information . in . eas . eas = & ea ;
CHECK_CALL ( FULL_EA_INFORMATION , NT_STATUS_OK ) ;
/* Does it still exist ? */
finfo2 . generic . level = RAW_FILEINFO_SMB2_ALL_EAS ;
finfo2 . generic . in . file . handle = handle ;
finfo2 . all_eas . in . continue_flags = 1 ;
status2 = smb2_getinfo_file ( tree , tctx , & finfo2 ) ;
if ( ! NT_STATUS_IS_OK ( status2 ) ) {
torture_result ( tctx , TORTURE_FAIL , " (%s) %s - %s \n " , __location__ ,
" SMB2_ALL_EAS " , nt_errstr ( status2 ) ) ;
ret = false ;
goto done ;
}
/* Over SMB2 ZeroEA should not exist. */
if ( ! find_returned_ea ( & finfo2 , " EAONE " , " VALUE1 " ) ) {
torture_result ( tctx , TORTURE_FAIL , " (%s) Missing EA 'EAONE' \n " , __location__ ) ;
ret = false ;
}
if ( ! find_returned_ea ( & finfo2 , " SECONDEA " , " ValueTwo " ) ) {
torture_result ( tctx , TORTURE_FAIL , " (%s) Missing EA 'SECONDEA' \n " , __location__ ) ;
ret = false ;
}
if ( find_returned_ea ( & finfo2 , " ZeroEA " , NULL ) ) {
torture_result ( tctx , TORTURE_FAIL , " (%s) Found null EA 'ZeroEA' \n " , __location__ ) ;
ret = false ;
}
2005-11-18 09:31:33 +03:00
done :
status = smb2_util_close ( tree , handle ) ;
if ( NT_STATUS_IS_ERR ( status ) ) {
2009-07-05 03:16:23 +04:00
torture_warning ( tctx , " Failed to delete %s - %s \n " , fname , nt_errstr ( status ) ) ;
2005-11-18 09:31:33 +03:00
}
smb2_util_unlink ( tree , fname ) ;
return ret ;
}