Changeset 745 for trunk/server/source4/torture/basic
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source4/torture/basic/aliases.c
r414 r745 22 22 #include "libcli/raw/libcliraw.h" 23 23 #include "libcli/raw/raw_proto.h" 24 #include "torture/torture.h"25 24 #include "libcli/libcli.h" 26 25 #include "torture/util.h" … … 385 384 struct torture_suite *torture_trans2_aliases(TALLOC_CTX *mem_ctx) 386 385 { 387 struct torture_suite *suite = torture_suite_create(mem_ctx, " ALIASES");386 struct torture_suite *suite = torture_suite_create(mem_ctx, "aliases"); 388 387 389 388 torture_suite_add_1smb_test(suite, "QFILEINFO aliases", qfsinfo_aliases); -
trunk/server/source4/torture/basic/attr.c
r414 r745 21 21 22 22 #include "includes.h" 23 #include "torture/torture.h"24 23 #include "libcli/libcli.h" 25 24 #include "torture/util.h" 25 #include "system/filesys.h" 26 #include "libcli/security/secace.h" 26 27 27 28 extern int torture_failures; … … 51 52 52 53 struct trunc_open_results { 53 u int_t num;54 unsigned int num; 54 55 uint32_t init_attr; 55 56 uint32_t trunc_attr; … … 93 94 int fnum1; 94 95 uint16_t attr; 95 u int_t i, j, k, l;96 unsigned int i, j, k, l; 96 97 int failures = 0; 97 98 … … 123 124 for (l = 0; l < ARRAY_SIZE(attr_results); l++) { 124 125 if (attr_results[l].num == k) { 125 torture_comment(tctx, "[%d] trunc open 0x%x -> 0x%x of %s failed - should have succeeded !(%s)\n", 126 torture_result(tctx, TORTURE_FAIL, 127 "[%d] trunc open 0x%x -> 0x%x of %s failed - should have succeeded !(%s)", 126 128 k, open_attrs_table[i], 127 129 open_attrs_table[j], … … 162 164 open_attrs_table[i] != attr_results[l].init_attr || 163 165 open_attrs_table[j] != attr_results[l].trunc_attr) { 164 torture_comment(tctx, "[%d] getatr check failed. [0x%x] trunc [0x%x] got attr 0x%x, should be 0x%x\n", 166 torture_result(tctx, TORTURE_FAIL, 167 "[%d] getatr check failed. [0x%x] trunc [0x%x] got attr 0x%x, should be 0x%x", 165 168 k, open_attrs_table[i], 166 169 open_attrs_table[j], 167 (u int_t)attr,170 (unsigned int)attr, 168 171 attr_results[l].result_attr); 169 172 CHECK_MAX_FAILURES(error_exit); … … 182 185 } 183 186 187 bool torture_winattrtest(struct torture_context *tctx, 188 struct smbcli_state *cli1) 189 { 190 const char *fname = "\\winattr1.file"; 191 const char *dname = "\\winattr1.dir"; 192 int fnum1; 193 uint16_t attr; 194 uint16_t j; 195 uint32_t aceno; 196 int failures = 0; 197 union smb_fileinfo query, query_org; 198 NTSTATUS status; 199 struct security_descriptor *sd1, *sd2; 200 201 202 /* Test winattrs for file */ 203 smbcli_unlink(cli1->tree, fname); 204 205 /* Open a file*/ 206 fnum1 = smbcli_open(cli1->tree, fname, O_RDWR | O_CREAT | O_TRUNC, 207 DENY_NONE); 208 torture_assert(tctx, fnum1 != -1, 209 talloc_asprintf(tctx, "open(1) of %s failed (%s)\n", 210 fname, smbcli_errstr(cli1->tree))); 211 212 213 /* Get security descriptor and store it*/ 214 query_org.generic.level = RAW_FILEINFO_SEC_DESC; 215 query_org.generic.in.file.fnum = fnum1; 216 status = smb_raw_fileinfo(cli1->tree, tctx, &query_org); 217 if(!NT_STATUS_IS_OK(status)){ 218 torture_comment(tctx, "smb_raw_fileinfo(1) of %s failed (%s)\n", 219 fname, nt_errstr(status)); 220 torture_assert_ntstatus_ok(tctx, 221 smbcli_close(cli1->tree, fnum1), 222 talloc_asprintf(tctx, 223 "close(1) of %s failed (%s)\n", 224 fname, smbcli_errstr(cli1->tree))); 225 CHECK_MAX_FAILURES(error_exit_file); 226 } 227 sd1 = query_org.query_secdesc.out.sd; 228 229 torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), 230 talloc_asprintf(tctx, "close(1) of %s failed (%s)\n", 231 fname, smbcli_errstr(cli1->tree))); 232 233 /*Set and get attributes*/ 234 for (j = 0; j < ARRAY_SIZE(open_attrs_table); j++) { 235 torture_assert_ntstatus_ok(tctx, 236 smbcli_setatr(cli1->tree, fname, open_attrs_table[j],0), 237 talloc_asprintf(tctx, "setatr(2) failed (%s)", 238 smbcli_errstr(cli1->tree))); 239 240 torture_assert_ntstatus_ok(tctx, 241 smbcli_getatr(cli1->tree, fname, &attr, NULL, NULL), 242 talloc_asprintf(tctx, "getatr(2) failed (%s)", 243 smbcli_errstr(cli1->tree))); 244 245 /* Check the result */ 246 if((j == 0)&&(attr != FILE_ATTRIBUTE_ARCHIVE)){ 247 torture_comment(tctx, "getatr check failed. \ 248 Attr applied [0x%x], got attr [0x%x], \ 249 should be [0x%x]", 250 open_attrs_table[j], 251 (uint16_t)attr,open_attrs_table[j +1]); 252 CHECK_MAX_FAILURES(error_exit_file); 253 }else{ 254 255 if((j != 0) &&(attr != open_attrs_table[j])){ 256 torture_comment(tctx, "getatr check failed. \ 257 Attr applied [0x%x],got attr 0x%x, \ 258 should be 0x%x ", 259 open_attrs_table[j], (uint16_t)attr, 260 open_attrs_table[j]); 261 CHECK_MAX_FAILURES(error_exit_file); 262 } 263 264 } 265 266 fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY | O_CREAT, 267 DENY_NONE); 268 torture_assert(tctx, fnum1 != -1, 269 talloc_asprintf(tctx, "open(2) of %s failed (%s)\n", 270 fname, smbcli_errstr(cli1->tree))); 271 /*Get security descriptor */ 272 query.query_secdesc.level = RAW_FILEINFO_SEC_DESC; 273 query.query_secdesc.in.file.fnum = fnum1; 274 status = smb_raw_fileinfo(cli1->tree, tctx, &query); 275 if(!NT_STATUS_IS_OK(status)){ 276 torture_comment(tctx, 277 "smb_raw_fileinfo(2) of %s failed (%s)\n", 278 fname, nt_errstr(status)); 279 torture_assert_ntstatus_ok(tctx, 280 smbcli_close(cli1->tree, fnum1), 281 talloc_asprintf(tctx, 282 "close(2) of %s failed (%s)\n", 283 fname, smbcli_errstr(cli1->tree))); 284 CHECK_MAX_FAILURES(error_exit_file); 285 } 286 sd2 = query.query_secdesc.out.sd; 287 288 torture_assert_ntstatus_ok(tctx,smbcli_close(cli1->tree,fnum1), 289 talloc_asprintf(tctx, "close(2) of %s failed (%s)\n", 290 fname, smbcli_errstr(cli1->tree))); 291 292 /*Compare security descriptors -- Must be same*/ 293 for (aceno=0;(sd1->dacl&&aceno < sd1->dacl->num_aces);aceno++){ 294 struct security_ace *ace1 = &sd1->dacl->aces[aceno]; 295 struct security_ace *ace2 = &sd2->dacl->aces[aceno]; 296 297 if(!sec_ace_equal(ace1,ace2)){ 298 torture_comment(tctx, 299 "ACLs changed! Not expected!\n"); 300 CHECK_MAX_FAILURES(error_exit_file); 301 } 302 } 303 304 torture_comment(tctx, "[%d] setattr = [0x%x] got attr 0x%x\n", 305 j, open_attrs_table[j], attr ); 306 307 } 308 309 error_exit_file: 310 smbcli_setatr(cli1->tree, fname, 0, 0); 311 smbcli_unlink(cli1->tree, fname); 312 313 /* Check for Directory. */ 314 315 smbcli_deltree(cli1->tree, dname); 316 smbcli_rmdir(cli1->tree,dname); 317 318 /* Open a directory */ 319 fnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, 320 SEC_RIGHTS_DIR_ALL, 321 FILE_ATTRIBUTE_DIRECTORY, 322 NTCREATEX_SHARE_ACCESS_NONE, 323 NTCREATEX_DISP_OPEN_IF, 324 NTCREATEX_OPTIONS_DIRECTORY, 0); 325 /*smbcli_mkdir(cli1->tree,dname);*/ 326 327 torture_assert(tctx, fnum1 != -1, talloc_asprintf(tctx, 328 "open (1) of %s failed (%s)", 329 dname, smbcli_errstr(cli1->tree))); 330 331 332 /* Get Security Descriptor */ 333 query_org.generic.level = RAW_FILEINFO_SEC_DESC; 334 query_org.generic.in.file.fnum = fnum1; 335 status = smb_raw_fileinfo(cli1->tree, tctx, &query_org); 336 if(!NT_STATUS_IS_OK(status)){ 337 torture_comment(tctx, "smb_raw_fileinfo(1) of %s failed (%s)\n", 338 dname, nt_errstr(status)); 339 torture_assert_ntstatus_ok(tctx, 340 smbcli_close(cli1->tree, fnum1), 341 talloc_asprintf(tctx, 342 "close(1) of %s failed (%s)\n", 343 dname, smbcli_errstr(cli1->tree))); 344 CHECK_MAX_FAILURES(error_exit_dir); 345 } 346 sd1 = query_org.query_secdesc.out.sd; 347 348 torture_assert_ntstatus_ok(tctx, 349 smbcli_close(cli1->tree, fnum1), 350 talloc_asprintf(tctx, 351 "close (1) of %s failed (%s)", dname, 352 smbcli_errstr(cli1->tree))); 353 354 /* Set and get win attributes*/ 355 for (j = 1; j < ARRAY_SIZE(open_attrs_table); j++) { 356 357 torture_assert_ntstatus_ok(tctx, 358 smbcli_setatr(cli1->tree, dname, open_attrs_table[j], 0), 359 talloc_asprintf(tctx, "setatr(2) failed (%s)", 360 smbcli_errstr(cli1->tree))); 361 362 torture_assert_ntstatus_ok(tctx, 363 smbcli_getatr(cli1->tree, dname, &attr, NULL, NULL), 364 talloc_asprintf(tctx, "getatr(2) failed (%s)", 365 smbcli_errstr(cli1->tree))); 366 367 torture_comment(tctx, "[%d] setatt = [0x%x] got attr 0x%x\n", 368 j, open_attrs_table[j], attr ); 369 370 /* Check the result */ 371 if(attr != (open_attrs_table[j]|FILE_ATTRIBUTE_DIRECTORY)){ 372 torture_comment(tctx, "getatr check failed. set attr \ 373 [0x%x], got attr 0x%x, should be 0x%x\n", 374 open_attrs_table[j], 375 (uint16_t)attr, 376 open_attrs_table[j]|FILE_ATTRIBUTE_DIRECTORY); 377 CHECK_MAX_FAILURES(error_exit_dir); 378 } 379 380 fnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, 381 SEC_RIGHTS_DIR_READ, 382 FILE_ATTRIBUTE_DIRECTORY, 383 NTCREATEX_SHARE_ACCESS_NONE, 384 NTCREATEX_DISP_OPEN, 385 0,0); 386 387 torture_assert(tctx, fnum1 != -1, talloc_asprintf(tctx, 388 "open (2) of %s failed (%s)", 389 dname, smbcli_errstr(cli1->tree))); 390 /* Get security descriptor */ 391 query.generic.level = RAW_FILEINFO_SEC_DESC; 392 query.generic.in.file.fnum = fnum1; 393 status = smb_raw_fileinfo(cli1->tree, tctx, &query); 394 if(!NT_STATUS_IS_OK(status)){ 395 torture_comment(tctx, "smb_raw_fileinfo(2) of %s failed\ 396 (%s)\n", dname, nt_errstr(status)); 397 torture_assert_ntstatus_ok(tctx, 398 smbcli_close(cli1->tree, fnum1), 399 talloc_asprintf(tctx, 400 "close (2) of %s failed (%s)", dname, 401 smbcli_errstr(cli1->tree))); 402 CHECK_MAX_FAILURES(error_exit_dir); 403 } 404 sd2 = query.query_secdesc.out.sd; 405 torture_assert_ntstatus_ok(tctx, 406 smbcli_close(cli1->tree, fnum1), 407 talloc_asprintf(tctx, 408 "close (2) of %s failed (%s)", dname, 409 smbcli_errstr(cli1->tree))); 410 411 /* Security descriptor must be same*/ 412 for (aceno=0;(sd1->dacl&&aceno < sd1->dacl->num_aces);aceno++){ 413 struct security_ace *ace1 = &sd1->dacl->aces[aceno]; 414 struct security_ace *ace2 = &sd2->dacl->aces[aceno]; 415 416 if(!sec_ace_equal(ace1,ace2)){ 417 torture_comment(tctx, 418 "ACLs changed! Not expected!\n"); 419 CHECK_MAX_FAILURES(error_exit_dir); 420 } 421 } 422 423 } 424 error_exit_dir: 425 smbcli_deltree(cli1->tree, dname); 426 smbcli_rmdir(cli1->tree,dname); 427 428 if(failures) 429 return false; 430 return true; 431 } -
trunk/server/source4/torture/basic/base.c
r414 r745 28 28 #include "system/time.h" 29 29 #include "libcli/resolve/resolve.h" 30 #include "librpc/gen_ndr/ndr_nbt.h"31 30 #include "lib/events/events.h" 32 #include "lib/cmdline/popt_common.h"33 31 #include "param/param.h" 34 32 … … 44 42 struct smbcli_options options; 45 43 46 make_nbt_name_client(&calling, lp _netbios_name(tctx->lp_ctx));44 make_nbt_name_client(&calling, lpcfg_netbios_name(tctx->lp_ctx)); 47 45 48 46 nbt_choose_called_name(NULL, &called, host, NBT_NAME_SERVER); … … 54 52 } 55 53 56 lp_smbcli_options(tctx->lp_ctx, &options); 57 58 if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), tctx->ev, 59 lp_resolve_context(tctx->lp_ctx), &options, 60 lp_iconv_convenience(tctx->lp_ctx), 61 lp_socket_options(tctx->lp_ctx))) { 54 lpcfg_smbcli_options(tctx->lp_ctx, &options); 55 56 if (!smbcli_socket_connect(cli, host, lpcfg_smb_ports(tctx->lp_ctx), tctx->ev, 57 lpcfg_resolve_context(tctx->lp_ctx), &options, 58 lpcfg_socket_options(tctx->lp_ctx))) { 62 59 torture_comment(tctx, "Failed to connect with %s\n", host); 63 60 goto failed; … … 363 360 for (i=0;i<100;i++) { 364 361 struct smbcli_request *req; 365 req = smb_raw_negotiate_send(cli->transport, lp _unicode(tctx->lp_ctx), PROTOCOL_NT1);362 req = smb_raw_negotiate_send(cli->transport, lpcfg_unicode(tctx->lp_ctx), PROTOCOL_NT1); 366 363 event_loop_once(cli->transport->socket->event.ctx); 367 364 if (req->state == SMBCLI_REQUEST_ERROR) { … … 571 568 for (i=0;i<torture_numops;i++) 572 569 { 573 size_t buf_size = ((u int_t)random()%(sizeof(buf)-1))+ 1;570 size_t buf_size = ((unsigned int)random()%(sizeof(buf)-1))+ 1; 574 571 if (i % 10 == 0) { 575 572 if (torture_setting_bool(tctx, "progress", true)) { … … 684 681 torture_comment(tctx, "pid %u open %d\n", (unsigned)getpid(), i); 685 682 686 msleep(10 * msec);683 smb_msleep(10 * msec); 687 684 i++; 688 685 if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) { … … 690 687 return false; 691 688 } 692 msleep(2 * msec);689 smb_msleep(2 * msec); 693 690 } 694 691 … … 816 813 817 814 if (NT_STATUS_IS_ERR(smbcli_setatr(cli1->tree, fname, FILE_ATTRIBUTE_READONLY, 0))) { 818 torture_comment(tctx, "smbcli_setatr failed (%s)\n", smbcli_errstr(cli1->tree)); 815 torture_result(tctx, TORTURE_FAIL, 816 __location__ ": smbcli_setatr failed (%s)\n", smbcli_errstr(cli1->tree)); 819 817 CHECK_MAX_FAILURES(error_test1); 820 818 return false; 821 819 } 820 821 fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE); 822 if (fnum1 == -1) { 823 torture_result(tctx, TORTURE_FAIL, 824 __location__ ": open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 825 CHECK_MAX_FAILURES(error_test1); 826 return false; 827 } 828 829 /* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */ 830 fnum2 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_ALL); 831 832 if (check_error(__location__, cli1, ERRDOS, ERRnoaccess, 833 NT_STATUS_ACCESS_DENIED)) { 834 torture_comment(tctx, "correct error code ERRDOS/ERRnoaccess returned\n"); 835 } 836 837 torture_comment(tctx, "finished open test 1\n"); 838 839 error_test1: 840 smbcli_close(cli1->tree, fnum1); 841 842 /* Now try not readonly and ensure ERRbadshare is returned. */ 843 844 smbcli_setatr(cli1->tree, fname, 0, 0); 822 845 823 846 fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE); 824 847 if (fnum1 == -1) { 825 848 torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 826 CHECK_MAX_FAILURES(error_test1);827 return false;828 }829 830 /* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */831 fnum2 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_ALL);832 833 if (check_error(__location__, cli1, ERRDOS, ERRnoaccess,834 NT_STATUS_ACCESS_DENIED)) {835 torture_comment(tctx, "correct error code ERRDOS/ERRnoaccess returned\n");836 }837 838 torture_comment(tctx, "finished open test 1\n");839 error_test1:840 smbcli_close(cli1->tree, fnum1);841 842 /* Now try not readonly and ensure ERRbadshare is returned. */843 844 smbcli_setatr(cli1->tree, fname, 0, 0);845 846 fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE);847 if (fnum1 == -1) {848 torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));849 849 return false; 850 850 } … … 891 891 /* Ensure size == 20. */ 892 892 if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { 893 torture_comment(tctx, "(3) getatr failed (%s)\n", smbcli_errstr(cli1->tree)); 893 torture_result(tctx, TORTURE_FAIL, 894 __location__ ": (3) getatr failed (%s)\n", smbcli_errstr(cli1->tree)); 894 895 CHECK_MAX_FAILURES(error_test3); 895 896 return false; … … 897 898 898 899 if (fsize != 20) { 899 torture_comment(tctx, "(3) file size != 20\n"); 900 torture_result(tctx, TORTURE_FAIL, 901 __location__ ": (3) file size != 20\n"); 900 902 CHECK_MAX_FAILURES(error_test3); 901 903 return false; … … 906 908 fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY|O_TRUNC, DENY_NONE); 907 909 if (fnum1 == -1) { 908 torture_comment(tctx, "(3) open (2) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 910 torture_result(tctx, TORTURE_FAIL, 911 __location__ ": (3) open (2) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 909 912 CHECK_MAX_FAILURES(error_test3); 910 913 return false; … … 912 915 913 916 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { 914 torture_comment(tctx, "close2 failed (%s)\n", smbcli_errstr(cli1->tree)); 917 torture_result(tctx, TORTURE_FAIL, 918 __location__ ": close2 failed (%s)\n", smbcli_errstr(cli1->tree)); 915 919 return false; 916 920 } … … 918 922 /* Ensure size == 0. */ 919 923 if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { 920 torture_comment(tctx, "(3) getatr failed (%s)\n", smbcli_errstr(cli1->tree)); 924 torture_result(tctx, TORTURE_FAIL, 925 __location__ ": (3) getatr failed (%s)\n", smbcli_errstr(cli1->tree)); 921 926 CHECK_MAX_FAILURES(error_test3); 922 927 return false; … … 924 929 925 930 if (fsize != 0) { 926 torture_comment(tctx, "(3) file size != 0\n"); 931 torture_result(tctx, TORTURE_FAIL, 932 __location__ ": (3) file size != 0\n"); 927 933 CHECK_MAX_FAILURES(error_test3); 928 934 return false; … … 930 936 torture_comment(tctx, "finished open test 3\n"); 931 937 error_test3: 938 939 fnum1 = fnum2 = -1; 932 940 smbcli_unlink(cli1->tree, fname); 933 941 934 942 935 torture_comment(tctx, " testing ctemp\n");943 torture_comment(tctx, "Testing ctemp\n"); 936 944 fnum1 = smbcli_ctemp(cli1->tree, "\\", &tmp_path); 937 945 if (fnum1 == -1) { 938 torture_comment(tctx, "ctemp failed (%s)\n", smbcli_errstr(cli1->tree)); 946 torture_result(tctx, TORTURE_FAIL, 947 __location__ ": ctemp failed (%s)\n", smbcli_errstr(cli1->tree)); 939 948 CHECK_MAX_FAILURES(error_test4); 940 949 return false; 941 950 } 942 951 torture_comment(tctx, "ctemp gave path %s\n", tmp_path); 952 953 error_test4: 943 954 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { 944 955 torture_comment(tctx, "close of temp failed (%s)\n", smbcli_errstr(cli1->tree)); … … 947 958 torture_comment(tctx, "unlink of temp failed (%s)\n", smbcli_errstr(cli1->tree)); 948 959 } 949 error_test4: 960 950 961 /* Test the non-io opens... */ 951 962 963 torture_comment(tctx, "Test #1 testing 2 non-io opens (no delete)\n"); 964 fnum1 = fnum2 = -1; 952 965 smbcli_setatr(cli2->tree, fname, 0, 0); 953 966 smbcli_unlink(cli2->tree, fname); 954 955 torture_comment(tctx, "TEST #1 testing 2 non-io opens (no delete)\n"); 956 967 957 968 fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, 958 969 NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); 959 970 960 971 if (fnum1 == -1) { 961 torture_comment(tctx, "test 1 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 972 torture_result(tctx, TORTURE_FAIL, 973 __location__ ": Test 1 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 962 974 CHECK_MAX_FAILURES(error_test10); 963 975 return false; … … 967 979 NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0); 968 980 if (fnum2 == -1) { 969 torture_comment(tctx, "test 1 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 981 torture_result(tctx, TORTURE_FAIL, 982 __location__ ": Test 1 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 970 983 CHECK_MAX_FAILURES(error_test10); 971 return false;972 }973 974 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {975 torture_comment(tctx, "test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));976 return false;977 }978 if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {979 torture_comment(tctx, "test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));980 984 return false; 981 985 } … … 983 987 torture_comment(tctx, "non-io open test #1 passed.\n"); 984 988 error_test10: 989 990 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { 991 torture_comment(tctx, "Test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 992 } 993 if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { 994 torture_comment(tctx, "Test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 995 } 996 997 torture_comment(tctx, "Test #2 testing 2 non-io opens (first with delete)\n"); 998 fnum1 = fnum2 = -1; 985 999 smbcli_unlink(cli1->tree, fname); 986 1000 987 torture_comment(tctx, "TEST #2 testing 2 non-io opens (first with delete)\n");988 989 1001 fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, 990 1002 NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); 991 1003 992 1004 if (fnum1 == -1) { 993 torture_comment(tctx, "test 2 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1005 torture_result(tctx, TORTURE_FAIL, 1006 __location__ ": Test 2 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 994 1007 CHECK_MAX_FAILURES(error_test20); 995 1008 return false; … … 1000 1013 1001 1014 if (fnum2 == -1) { 1002 torture_comment(tctx, "test 2 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1015 torture_result(tctx, TORTURE_FAIL, 1016 __location__ ": Test 2 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1003 1017 CHECK_MAX_FAILURES(error_test20); 1004 return false;1005 }1006 1007 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {1008 torture_comment(tctx, "test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));1009 return false;1010 }1011 if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {1012 torture_comment(tctx, "test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));1013 1018 return false; 1014 1019 } … … 1016 1021 torture_comment(tctx, "non-io open test #2 passed.\n"); 1017 1022 error_test20: 1023 1024 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { 1025 torture_comment(tctx, "Test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1026 } 1027 if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { 1028 torture_comment(tctx, "Test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1029 } 1030 1031 fnum1 = fnum2 = -1; 1018 1032 smbcli_unlink(cli1->tree, fname); 1019 1033 1020 torture_comment(tctx, "T EST#3 testing 2 non-io opens (second with delete)\n");1021 1034 torture_comment(tctx, "Test #3 testing 2 non-io opens (second with delete)\n"); 1035 1022 1036 fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, 1023 1037 NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); 1024 1038 1025 1039 if (fnum1 == -1) { 1026 torture_comment(tctx, "test 3 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1040 torture_result(tctx, TORTURE_FAIL, 1041 __location__ ": Test 3 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1027 1042 CHECK_MAX_FAILURES(error_test30); 1028 1043 return false; … … 1033 1048 1034 1049 if (fnum2 == -1) { 1035 torture_comment(tctx, "test 3 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1050 torture_result(tctx, TORTURE_FAIL, 1051 __location__ ": Test 3 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1036 1052 CHECK_MAX_FAILURES(error_test30); 1037 return false;1038 }1039 1040 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {1041 torture_comment(tctx, "test 3 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));1042 return false;1043 }1044 if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {1045 torture_comment(tctx, "test 3 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));1046 1053 return false; 1047 1054 } … … 1049 1056 torture_comment(tctx, "non-io open test #3 passed.\n"); 1050 1057 error_test30: 1058 1059 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { 1060 torture_comment(tctx, "Test 3 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1061 } 1062 if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { 1063 torture_comment(tctx, "Test 3 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1064 } 1065 1066 torture_comment(tctx, "Test #4 testing 2 non-io opens (both with delete)\n"); 1067 fnum1 = fnum2 = -1; 1051 1068 smbcli_unlink(cli1->tree, fname); 1052 1069 1053 torture_comment(tctx, "TEST #4 testing 2 non-io opens (both with delete)\n");1054 1055 1070 fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, 1056 1071 NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); 1057 1072 1058 1073 if (fnum1 == -1) { 1059 torture_comment(tctx, "test 4 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1074 torture_result(tctx, TORTURE_FAIL, 1075 __location__ ": Test 4 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1060 1076 CHECK_MAX_FAILURES(error_test40); 1061 1077 return false; … … 1066 1082 1067 1083 if (fnum2 != -1) { 1068 torture_comment(tctx, "test 4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1084 torture_result(tctx, TORTURE_FAIL, 1085 __location__ ": Test 4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1069 1086 CHECK_MAX_FAILURES(error_test40); 1070 1087 return false; 1071 1088 } 1072 1089 1073 torture_comment(tctx, "test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation"); 1074 1075 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { 1076 torture_comment(tctx, "test 4 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1077 return false; 1078 } 1090 torture_comment(tctx, "Test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation"); 1079 1091 1080 1092 torture_comment(tctx, "non-io open test #4 passed.\n"); 1081 1093 error_test40: 1094 1095 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { 1096 torture_comment(tctx, "Test 4 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1097 } 1098 if (fnum2 != -1 && NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { 1099 torture_comment(tctx, "Test 4 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1100 } 1101 1102 torture_comment(tctx, "Test #5 testing 2 non-io opens (both with delete - both with file share delete)\n"); 1103 fnum1 = fnum2 = -1; 1082 1104 smbcli_unlink(cli1->tree, fname); 1083 1105 1084 torture_comment(tctx, "TEST #5 testing 2 non-io opens (both with delete - both with file share delete)\n");1085 1086 1106 fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, 1087 1107 NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0); 1088 1108 1089 1109 if (fnum1 == -1) { 1090 torture_comment(tctx, "test 5 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1110 torture_result(tctx, TORTURE_FAIL, 1111 __location__ ": Test 5 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1091 1112 CHECK_MAX_FAILURES(error_test50); 1092 1113 return false; … … 1097 1118 1098 1119 if (fnum2 == -1) { 1099 torture_comment(tctx, "test 5 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1120 torture_result(tctx, TORTURE_FAIL, 1121 __location__ ": Test 5 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1100 1122 CHECK_MAX_FAILURES(error_test50); 1101 return false;1102 }1103 1104 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {1105 torture_comment(tctx, "test 5 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));1106 return false;1107 }1108 1109 if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {1110 torture_comment(tctx, "test 5 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));1111 1123 return false; 1112 1124 } … … 1114 1126 torture_comment(tctx, "non-io open test #5 passed.\n"); 1115 1127 error_test50: 1116 torture_comment(tctx, "TEST #6 testing 1 non-io open, one io open\n"); 1117 1128 1129 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { 1130 torture_comment(tctx, "Test 5 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1131 } 1132 1133 if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { 1134 torture_comment(tctx, "Test 5 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1135 } 1136 1137 torture_comment(tctx, "Test #6 testing 1 non-io open, one io open\n"); 1138 fnum1 = fnum2 = -1; 1118 1139 smbcli_unlink(cli1->tree, fname); 1119 1140 … … 1122 1143 1123 1144 if (fnum1 == -1) { 1124 torture_comment(tctx, "test 6 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1145 torture_result(tctx, TORTURE_FAIL, 1146 __location__ ": Test 6 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1125 1147 CHECK_MAX_FAILURES(error_test60); 1126 1148 return false; … … 1131 1153 1132 1154 if (fnum2 == -1) { 1133 torture_comment(tctx, "test 6 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1155 torture_result(tctx, TORTURE_FAIL, 1156 __location__ ": Test 6 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1134 1157 CHECK_MAX_FAILURES(error_test60); 1135 return false;1136 }1137 1138 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {1139 torture_comment(tctx, "test 6 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree));1140 return false;1141 }1142 1143 if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) {1144 torture_comment(tctx, "test 6 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree));1145 1158 return false; 1146 1159 } … … 1148 1161 torture_comment(tctx, "non-io open test #6 passed.\n"); 1149 1162 error_test60: 1150 torture_comment(tctx, "TEST #7 testing 1 non-io open, one io open with delete\n"); 1151 1163 1164 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { 1165 torture_comment(tctx, "Test 6 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1166 } 1167 1168 if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { 1169 torture_comment(tctx, "Test 6 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1170 } 1171 1172 torture_comment(tctx, "Test #7 testing 1 non-io open, one io open with delete\n"); 1173 fnum1 = fnum2 = -1; 1152 1174 smbcli_unlink(cli1->tree, fname); 1153 1175 … … 1156 1178 1157 1179 if (fnum1 == -1) { 1158 torture_comment(tctx, "test 7 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1180 torture_result(tctx, TORTURE_FAIL, 1181 __location__ ": Test 7 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1159 1182 CHECK_MAX_FAILURES(error_test70); 1160 1183 return false; … … 1165 1188 1166 1189 if (fnum2 != -1) { 1167 torture_comment(tctx, "test 7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1190 torture_result(tctx, TORTURE_FAIL, 1191 __location__ ": Test 7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1168 1192 CHECK_MAX_FAILURES(error_test70); 1169 1193 return false; 1170 1194 } 1171 1195 1172 torture_comment(tctx, "test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation"); 1196 torture_comment(tctx, "Test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation"); 1197 1198 torture_comment(tctx, "non-io open test #7 passed.\n"); 1199 error_test70: 1173 1200 1174 1201 if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { 1175 torture_comment(tctx, "test 7 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1176 return false; 1177 } 1178 1179 torture_comment(tctx, "non-io open test #7 passed.\n"); 1180 1181 error_test70: 1182 1183 torture_comment(tctx, "TEST #8 testing one normal open, followed by lock, followed by open with truncate\n"); 1184 1202 torture_comment(tctx, "Test 7 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); 1203 } 1204 if (fnum2 != -1 && NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { 1205 torture_comment(tctx, "Test 7 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); 1206 } 1207 1208 torture_comment(tctx, "Test #8 testing one normal open, followed by lock, followed by open with truncate\n"); 1209 fnum1 = fnum2 = -1; 1185 1210 smbcli_unlink(cli1->tree, fname); 1186 1211 … … 1202 1227 /* Ensure size == 20. */ 1203 1228 if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { 1204 torture_comment(tctx, "(8) getatr (1) failed (%s)\n", smbcli_errstr(cli1->tree)); 1229 torture_result(tctx, TORTURE_FAIL, 1230 __location__ ": (8) getatr (1) failed (%s)\n", smbcli_errstr(cli1->tree)); 1205 1231 CHECK_MAX_FAILURES(error_test80); 1206 1232 return false; … … 1208 1234 1209 1235 if (fsize != 20) { 1210 torture_comment(tctx, "(8) file size != 20\n"); 1236 torture_result(tctx, TORTURE_FAIL, 1237 __location__ ": (8) file size %lu != 20\n", (unsigned long)fsize); 1211 1238 CHECK_MAX_FAILURES(error_test80); 1212 1239 return false; … … 1215 1242 /* Get an exclusive lock on the open file. */ 1216 1243 if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) { 1217 torture_comment(tctx, "(8) lock1 failed (%s)\n", smbcli_errstr(cli1->tree)); 1244 torture_result(tctx, TORTURE_FAIL, 1245 __location__ ": (8) lock1 failed (%s)\n", smbcli_errstr(cli1->tree)); 1218 1246 CHECK_MAX_FAILURES(error_test80); 1219 1247 return false; … … 1228 1256 /* Ensure size == 0. */ 1229 1257 if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { 1230 torture_comment(tctx, "(8) getatr (2) failed (%s)\n", smbcli_errstr(cli1->tree)); 1258 torture_result(tctx, TORTURE_FAIL, 1259 __location__ ": (8) getatr (2) failed (%s)\n", smbcli_errstr(cli1->tree)); 1231 1260 CHECK_MAX_FAILURES(error_test80); 1232 1261 return false; … … 1234 1263 1235 1264 if (fsize != 0) { 1236 torture_comment(tctx, "(8) file size != 0\n"); 1265 torture_result(tctx, TORTURE_FAIL, 1266 __location__ ": (8) file size %lu != 0\n", (unsigned long)fsize); 1237 1267 CHECK_MAX_FAILURES(error_test80); 1238 1268 return false; … … 1255 1285 smbcli_unlink(cli1->tree, fname); 1256 1286 1257 return correct;1287 return failures > 0 ? false : correct; 1258 1288 } 1259 1289 … … 1364 1394 } 1365 1395 } 1366 1367 return true;1368 1396 } 1369 1397 … … 1457 1485 NTSTATUS status; 1458 1486 1459 nt_status_support = lp _nt_status_support(tctx->lp_ctx);1460 1461 if (!lp _set_cmdline(tctx->lp_ctx, "nt status support", "yes")) {1487 nt_status_support = lpcfg_nt_status_support(tctx->lp_ctx); 1488 1489 if (!lpcfg_set_cmdline(tctx->lp_ctx, "nt status support", "yes")) { 1462 1490 torture_comment(tctx, "Could not set 'nt status support = yes'\n"); 1463 1491 goto fail; … … 1468 1496 } 1469 1497 1470 if (!lp _set_cmdline(tctx->lp_ctx, "nt status support", "no")) {1498 if (!lpcfg_set_cmdline(tctx->lp_ctx, "nt status support", "no")) { 1471 1499 torture_comment(tctx, "Could not set 'nt status support = yes'\n"); 1472 1500 goto fail; … … 1477 1505 } 1478 1506 1479 if (!lp _set_cmdline(tctx->lp_ctx, "nt status support",1507 if (!lpcfg_set_cmdline(tctx->lp_ctx, "nt status support", 1480 1508 nt_status_support ? "yes":"no")) { 1481 1509 torture_comment(tctx, "Could not reset 'nt status support = yes'"); … … 1494 1522 io.generic.level = RAW_OPEN_NTCREATEX; 1495 1523 io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; 1496 io.ntcreatex.in.root_fid = 0;1524 io.ntcreatex.in.root_fid.fnum = 0; 1497 1525 io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; 1498 1526 io.ntcreatex.in.alloc_size = 1024*1024; … … 1628 1656 1629 1657 io.generic.level = RAW_OPEN_NTCREATEX; 1630 io.ntcreatex.in.root_fid = 0;1658 io.ntcreatex.in.root_fid.fnum = 0; 1631 1659 io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; 1632 1660 io.ntcreatex.in.alloc_size = 0; … … 1724 1752 } 1725 1753 1754 /** 1755 This checks file/dir birthtime 1756 */ 1757 static void list_fn(struct clilist_file_info *finfo, const char *name, 1758 void *state){ 1759 1760 /* Just to change dir access time*/ 1761 sleep(5); 1762 1763 } 1764 1765 static bool run_birthtimetest(struct torture_context *tctx, 1766 struct smbcli_state *cli) 1767 { 1768 int fnum; 1769 size_t size; 1770 time_t c_time, a_time, m_time, w_time, c_time1; 1771 const char *fname = "\\birthtime.tst"; 1772 const char *dname = "\\birthtime"; 1773 const char *fname2 = "\\birthtime\\birthtime.tst"; 1774 bool correct = true; 1775 uint8_t buf[16]; 1776 1777 1778 smbcli_unlink(cli->tree, fname); 1779 1780 torture_comment(tctx, "Testing Birthtime for File\n"); 1781 1782 /* Save File birthtime/creationtime */ 1783 fnum = smbcli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, 1784 DENY_NONE); 1785 if (NT_STATUS_IS_ERR(smbcli_qfileinfo(cli->tree, fnum, NULL, &size, 1786 &c_time, &a_time, &m_time, NULL, NULL))) { 1787 torture_comment(tctx, "ERROR: qfileinfo failed (%s)\n", 1788 smbcli_errstr(cli->tree)); 1789 correct = false; 1790 } 1791 smbcli_close(cli->tree, fnum); 1792 1793 sleep(10); 1794 1795 /* Change in File attribute changes file change time*/ 1796 smbcli_setatr(cli->tree, fname, FILE_ATTRIBUTE_SYSTEM, 0); 1797 1798 fnum = smbcli_open(cli->tree, fname, O_RDWR | O_CREAT , DENY_NONE); 1799 /* Writing updates modification time*/ 1800 smbcli_smbwrite(cli->tree, fnum, &fname, 0, sizeof(fname)); 1801 /*Reading updates access time */ 1802 smbcli_read(cli->tree, fnum, buf, 0, 13); 1803 smbcli_close(cli->tree, fnum); 1804 1805 if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, fname, &c_time1, 1806 &a_time, &m_time, &w_time, &size, NULL, NULL))) { 1807 torture_comment(tctx, "ERROR: qpathinfo2 failed (%s)\n", 1808 smbcli_errstr(cli->tree)); 1809 correct = false; 1810 } else { 1811 fprintf(stdout, "c_time = %li, c_time1 = %li\n", 1812 (long) c_time, (long) c_time1); 1813 if (c_time1 != c_time) { 1814 torture_comment(tctx, "This system updated file \ 1815 birth times! Not expected!\n"); 1816 correct = false; 1817 } 1818 } 1819 smbcli_unlink(cli->tree, fname); 1820 1821 torture_comment(tctx, "Testing Birthtime for Directory\n"); 1822 1823 /* check if the server does not update the directory birth time 1824 when creating a new file */ 1825 if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, dname))) { 1826 torture_comment(tctx, "ERROR: mkdir failed (%s)\n", 1827 smbcli_errstr(cli->tree)); 1828 correct = false; 1829 } 1830 sleep(3); 1831 if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\birthtime\\", 1832 &c_time,&a_time,&m_time,&w_time, &size, NULL, NULL))){ 1833 torture_comment(tctx, "ERROR: qpathinfo2 failed (%s)\n", 1834 smbcli_errstr(cli->tree)); 1835 correct = false; 1836 } 1837 1838 /* Creating a new file changes dir modification time and change time*/ 1839 smbcli_unlink(cli->tree, fname2); 1840 fnum = smbcli_open(cli->tree, fname2, O_RDWR | O_CREAT | O_TRUNC, 1841 DENY_NONE); 1842 smbcli_smbwrite(cli->tree, fnum, &fnum, 0, sizeof(fnum)); 1843 smbcli_read(cli->tree, fnum, buf, 0, 13); 1844 smbcli_close(cli->tree, fnum); 1845 1846 /* dir listing changes dir access time*/ 1847 smbcli_list(cli->tree, "\\birthtime\\*", 0, list_fn, cli ); 1848 1849 if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\birthtime\\", 1850 &c_time1, &a_time, &m_time,&w_time,&size,NULL,NULL))){ 1851 torture_comment(tctx, "ERROR: qpathinfo2 failed (%s)\n", 1852 smbcli_errstr(cli->tree)); 1853 correct = false; 1854 } else { 1855 fprintf(stdout, "c_time = %li, c_time1 = %li\n", 1856 (long) c_time, (long) c_time1); 1857 if (c_time1 != c_time) { 1858 torture_comment(tctx, "This system updated directory \ 1859 birth times! Not Expected!\n"); 1860 correct = false; 1861 } 1862 } 1863 smbcli_unlink(cli->tree, fname2); 1864 smbcli_rmdir(cli->tree, dname); 1865 1866 return correct; 1867 } 1868 1726 1869 1727 1870 NTSTATUS torture_base_init(void) 1728 1871 { 1729 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), " BASE");1730 1731 torture_suite_add_2smb_test(suite, " FDPASS", run_fdpasstest);1872 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "base"); 1873 1874 torture_suite_add_2smb_test(suite, "fdpass", run_fdpasstest); 1732 1875 torture_suite_add_suite(suite, torture_base_locktest(suite)); 1733 torture_suite_add_1smb_test(suite, "UNLINK", torture_unlinktest); 1734 torture_suite_add_1smb_test(suite, "ATTR", run_attrtest); 1735 torture_suite_add_1smb_test(suite, "TRANS2", run_trans2test); 1736 torture_suite_add_simple_test(suite, "NEGNOWAIT", run_negprot_nowait); 1737 torture_suite_add_1smb_test(suite, "DIR1", torture_dirtest1); 1738 torture_suite_add_1smb_test(suite, "DIR2", torture_dirtest2); 1739 torture_suite_add_1smb_test(suite, "DENY1", torture_denytest1); 1740 torture_suite_add_2smb_test(suite, "DENY2", torture_denytest2); 1741 torture_suite_add_2smb_test(suite, "DENY3", torture_denytest3); 1742 torture_suite_add_1smb_test(suite, "DENYDOS", torture_denydos_sharing); 1743 torture_suite_add_smb_multi_test(suite, "NTDENY1", torture_ntdenytest1); 1744 torture_suite_add_2smb_test(suite, "NTDENY2", torture_ntdenytest2); 1745 torture_suite_add_1smb_test(suite, "TCON", run_tcon_test); 1746 torture_suite_add_1smb_test(suite, "TCONDEV", run_tcon_devtype_test); 1747 torture_suite_add_1smb_test(suite, "VUID", run_vuidtest); 1748 torture_suite_add_2smb_test(suite, "RW1", run_readwritetest); 1749 torture_suite_add_2smb_test(suite, "OPEN", run_opentest); 1750 torture_suite_add_smb_multi_test(suite, "DEFER_OPEN", run_deferopen); 1751 torture_suite_add_1smb_test(suite, "XCOPY", run_xcopy); 1752 torture_suite_add_1smb_test(suite, "IOMETER", run_iometer); 1753 torture_suite_add_1smb_test(suite, "RENAME", torture_test_rename); 1876 torture_suite_add_1smb_test(suite, "unlink", torture_unlinktest); 1877 torture_suite_add_1smb_test(suite, "attr", run_attrtest); 1878 torture_suite_add_1smb_test(suite, "trans2", run_trans2test); 1879 torture_suite_add_1smb_test(suite, "birthtime", run_birthtimetest); 1880 torture_suite_add_simple_test(suite, "negnowait", run_negprot_nowait); 1881 torture_suite_add_1smb_test(suite, "dir1", torture_dirtest1); 1882 torture_suite_add_1smb_test(suite, "dir2", torture_dirtest2); 1883 torture_suite_add_1smb_test(suite, "deny1", torture_denytest1); 1884 torture_suite_add_2smb_test(suite, "deny2", torture_denytest2); 1885 torture_suite_add_2smb_test(suite, "deny3", torture_denytest3); 1886 torture_suite_add_1smb_test(suite, "denydos", torture_denydos_sharing); 1887 torture_suite_add_smb_multi_test(suite, "ntdeny1", torture_ntdenytest1); 1888 torture_suite_add_2smb_test(suite, "ntdeny2", torture_ntdenytest2); 1889 torture_suite_add_1smb_test(suite, "tcon", run_tcon_test); 1890 torture_suite_add_1smb_test(suite, "tcondev", run_tcon_devtype_test); 1891 torture_suite_add_1smb_test(suite, "vuid", run_vuidtest); 1892 torture_suite_add_2smb_test(suite, "rw1", run_readwritetest); 1893 torture_suite_add_2smb_test(suite, "open", run_opentest); 1894 torture_suite_add_smb_multi_test(suite, "defer_open", run_deferopen); 1895 torture_suite_add_1smb_test(suite, "xcopy", run_xcopy); 1896 torture_suite_add_1smb_test(suite, "iometer", run_iometer); 1897 torture_suite_add_1smb_test(suite, "rename", torture_test_rename); 1754 1898 torture_suite_add_suite(suite, torture_test_delete()); 1755 torture_suite_add_1smb_test(suite, "PROPERTIES", torture_test_properties); 1756 torture_suite_add_1smb_test(suite, "MANGLE", torture_mangle); 1757 torture_suite_add_1smb_test(suite, "OPENATTR", torture_openattrtest); 1899 torture_suite_add_1smb_test(suite, "properties", torture_test_properties); 1900 torture_suite_add_1smb_test(suite, "mangle", torture_mangle); 1901 torture_suite_add_1smb_test(suite, "openattr", torture_openattrtest); 1902 torture_suite_add_1smb_test(suite, "winattr", torture_winattrtest); 1758 1903 torture_suite_add_suite(suite, torture_charset(suite)); 1759 torture_suite_add_1smb_test(suite, " CHKPATH", torture_chkpath_test);1760 torture_suite_add_1smb_test(suite, " SECLEAK", torture_sec_leak);1761 torture_suite_add_simple_test(suite, " DISCONNECT", torture_disconnect);1904 torture_suite_add_1smb_test(suite, "chkpath", torture_chkpath_test); 1905 torture_suite_add_1smb_test(suite, "secleak", torture_sec_leak); 1906 torture_suite_add_simple_test(suite, "disconnect", torture_disconnect); 1762 1907 torture_suite_add_suite(suite, torture_delay_write()); 1763 torture_suite_add_simple_test(suite, " SAMBA3ERROR", torture_samba3_errorpaths);1764 torture_suite_add_1smb_test(suite, " CASETABLE", torture_casetable);1765 torture_suite_add_1smb_test(suite, " UTABLE", torture_utable);1766 torture_suite_add_simple_test(suite, " SMB", torture_smb_scan);1908 torture_suite_add_simple_test(suite, "samba3error", torture_samba3_errorpaths); 1909 torture_suite_add_1smb_test(suite, "casetable", torture_casetable); 1910 torture_suite_add_1smb_test(suite, "utable", torture_utable); 1911 torture_suite_add_simple_test(suite, "smb", torture_smb_scan); 1767 1912 torture_suite_add_suite(suite, torture_trans2_aliases(suite)); 1768 torture_suite_add_1smb_test(suite, "TRANS2-SCAN", torture_trans2_scan); 1769 torture_suite_add_1smb_test(suite, "NTTRANS", torture_nttrans_scan); 1770 torture_suite_add_1smb_test(suite, "CREATEX_ACCESS", torture_createx_access); 1771 torture_suite_add_2smb_test(suite, "CREATEX_SHAREMODES_FILE", torture_createx_sharemodes_file); 1772 torture_suite_add_2smb_test(suite, "CREATEX_SHAREMODES_DIR", torture_createx_sharemodes_dir); 1773 torture_suite_add_1smb_test(suite, "MAXIMUM_ALLOWED", torture_maximum_allowed); 1774 1775 torture_suite_add_simple_test(suite, "BENCH-HOLDCON", torture_holdcon); 1776 torture_suite_add_simple_test(suite, "BENCH-READWRITE", run_benchrw); 1777 torture_suite_add_smb_multi_test(suite, "BENCH-TORTURE", run_torture); 1778 torture_suite_add_1smb_test(suite, "SCAN-PIPE_NUMBER", run_pipe_number); 1779 torture_suite_add_1smb_test(suite, "SCAN-IOCTL", torture_ioctl_test); 1780 torture_suite_add_smb_multi_test(suite, "SCAN-MAXFID", run_maxfidtest); 1913 torture_suite_add_1smb_test(suite, "trans2-scan", torture_trans2_scan); 1914 torture_suite_add_1smb_test(suite, "nttrans", torture_nttrans_scan); 1915 torture_suite_add_1smb_test(suite, "createx_access", torture_createx_access); 1916 torture_suite_add_2smb_test(suite, "createx_sharemodes_file", torture_createx_sharemodes_file); 1917 torture_suite_add_2smb_test(suite, "createx_sharemodes_dir", torture_createx_sharemodes_dir); 1918 torture_suite_add_1smb_test(suite, "maximum_allowed", torture_maximum_allowed); 1919 1920 torture_suite_add_simple_test(suite, "bench-holdcon", torture_holdcon); 1921 torture_suite_add_1smb_test(suite, "bench-holdopen", torture_holdopen); 1922 torture_suite_add_simple_test(suite, "bench-readwrite", run_benchrw); 1923 torture_suite_add_smb_multi_test(suite, "bench-torture", run_torture); 1924 torture_suite_add_1smb_test(suite, "scan-pipe_number", run_pipe_number); 1925 torture_suite_add_1smb_test(suite, "scan-ioctl", torture_ioctl_test); 1926 torture_suite_add_smb_multi_test(suite, "scan-maxfid", run_maxfidtest); 1781 1927 1782 1928 suite->description = talloc_strdup(suite, -
trunk/server/source4/torture/basic/charset.c
r414 r745 21 21 22 22 #include "includes.h" 23 #include "torture/torture.h"24 #include "libcli/raw/libcliraw.h"25 23 #include "libcli/libcli.h" 26 24 #include "torture/util.h" … … 57 55 SSVAL(ucs_name, i*2, 0); 58 56 59 if (!convert_string_talloc_convenience(ucs_name, lp _iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname, &i, false)) {57 if (!convert_string_talloc_convenience(ucs_name, lpcfg_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname, &i, false)) { 60 58 torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n"); 61 59 talloc_free(ucs_name); … … 71 69 io.generic.level = RAW_OPEN_NTCREATEX; 72 70 io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; 73 io.ntcreatex.in.root_fid = 0;71 io.ntcreatex.in.root_fid.fnum = 0; 74 72 io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; 75 73 io.ntcreatex.in.alloc_size = 0; … … 200 198 struct torture_suite *torture_charset(TALLOC_CTX *mem_ctx) 201 199 { 202 struct torture_suite *suite = torture_suite_create(mem_ctx, " CHARSET");200 struct torture_suite *suite = torture_suite_create(mem_ctx, "charset"); 203 201 204 202 torture_suite_add_1smb_test(suite, "Testing composite character (a umlaut)", test_composed); -
trunk/server/source4/torture/basic/delaywrite.c
r414 r745 112 112 } 113 113 fflush(stdout); 114 msleep(1 * msec);114 smb_msleep(1 * msec); 115 115 } 116 116 … … 163 163 /* 3 second delay to ensure we get past any 2 second time 164 164 granularity (older systems may have that) */ 165 msleep(3 * msec);165 smb_msleep(3 * msec); 166 166 167 167 finfo1.all_info.level = RAW_FILEINFO_ALL_INFO; … … 181 181 /* 3 second delay to ensure we get past any 2 second time 182 182 granularity (older systems may have that) */ 183 msleep(3 * msec);183 smb_msleep(3 * msec); 184 184 185 185 /* Do a zero length SMBwrite call to truncate. */ … … 232 232 } 233 233 fflush(stdout); 234 msleep(1 * msec);234 smb_msleep(1 * msec); 235 235 } 236 236 … … 242 242 243 243 fflush(stdout); 244 msleep(2 * msec);244 smb_msleep(2 * msec); 245 245 246 246 /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */ … … 283 283 } 284 284 fflush(stdout); 285 msleep(1 * msec);285 smb_msleep(1 * msec); 286 286 } 287 287 … … 293 293 294 294 fflush(stdout); 295 msleep(2 * msec);295 smb_msleep(2 * msec); 296 296 297 297 /* the close should trigger an write time update */ … … 354 354 /* 3 second delay to ensure we get past any 2 second time 355 355 granularity (older systems may have that) */ 356 msleep(3 * msec);356 smb_msleep(3 * msec); 357 357 358 358 finfo1.all_info.level = RAW_FILEINFO_ALL_INFO; … … 419 419 } 420 420 fflush(stdout); 421 msleep(1 * msec);421 smb_msleep(1 * msec); 422 422 } 423 423 … … 429 429 430 430 fflush(stdout); 431 msleep(2 * msec);431 smb_msleep(2 * msec); 432 432 433 433 /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */ … … 468 468 } 469 469 fflush(stdout); 470 msleep(1 * msec);470 smb_msleep(1 * msec); 471 471 } 472 472 … … 536 536 /* 3 second delay to ensure we get past any 2 second time 537 537 granularity (older systems may have that) */ 538 msleep(3 * msec);538 smb_msleep(3 * msec); 539 539 540 540 finfo1.all_info.level = RAW_FILEINFO_ALL_INFO; … … 597 597 } 598 598 fflush(stdout); 599 msleep(1 * msec);599 smb_msleep(1 * msec); 600 600 } 601 601 … … 607 607 608 608 fflush(stdout); 609 msleep(2 * msec);609 smb_msleep(2 * msec); 610 610 611 611 /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */ … … 645 645 } 646 646 fflush(stdout); 647 msleep(1 * msec);647 smb_msleep(1 * msec); 648 648 } 649 649 … … 711 711 /* 3 second delay to ensure we get past any 2 second time 712 712 granularity (older systems may have that) */ 713 msleep(3 * msec);713 smb_msleep(3 * msec); 714 714 715 715 finfo1.all_info.level = RAW_FILEINFO_ALL_INFO; … … 777 777 } 778 778 fflush(stdout); 779 msleep(1 * msec);779 smb_msleep(1 * msec); 780 780 } 781 781 … … 787 787 788 788 fflush(stdout); 789 msleep(2 * msec);789 smb_msleep(2 * msec); 790 790 791 791 /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */ … … 823 823 } 824 824 fflush(stdout); 825 msleep(1 * msec);825 smb_msleep(1 * msec); 826 826 } 827 827 … … 901 901 /* 3 second delay to ensure we get past any 2 second time 902 902 granularity (older systems may have that) */ 903 msleep(3 * msec);903 smb_msleep(3 * msec); 904 904 905 905 { … … 1008 1008 } 1009 1009 fflush(stdout); 1010 msleep(1 * msec);1010 smb_msleep(1 * msec); 1011 1011 } 1012 1012 … … 1016 1016 1017 1017 fflush(stdout); 1018 msleep(2 * msec);1018 smb_msleep(2 * msec); 1019 1019 1020 1020 fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE); … … 1100 1100 } 1101 1101 fflush(stdout); 1102 msleep(1 * msec);1102 smb_msleep(1 * msec); 1103 1103 } 1104 1104 … … 1132 1132 nt_time_string(tctx, finfo1.basic_info.out.write_time)); 1133 1133 1134 msleep(10 * msec);1134 smb_msleep(10 * msec); 1135 1135 torture_comment(tctx, "Doing a 10 byte write to extend the file to see if this changes the last write time.\n"); 1136 1136 … … 1188 1188 } 1189 1189 fflush(stdout); 1190 msleep(1*msec);1190 smb_msleep(1*msec); 1191 1191 } 1192 1192 … … 1259 1259 } 1260 1260 1261 msleep(1 * msec);1261 smb_msleep(1 * msec); 1262 1262 1263 1263 written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1); … … 1574 1574 break; 1575 1575 } 1576 msleep(0.5 * msec);1576 smb_msleep(0.5 * msec); 1577 1577 } 1578 1578 … … 1603 1603 break; 1604 1604 } 1605 msleep(1 * msec);1605 smb_msleep(1 * msec); 1606 1606 } 1607 1607 … … 1613 1613 1614 1614 /* sleep */ 1615 msleep(5 * msec);1615 smb_msleep(5 * msec); 1616 1616 1617 1617 GET_INFO_BOTH(finfo3,pinfo3); … … 1700 1700 * doesn't depend on the time since the open 1701 1701 */ 1702 msleep(5 * msec);1702 smb_msleep(5 * msec); 1703 1703 1704 1704 /* get the initial times */ … … 1740 1740 break; 1741 1741 } 1742 msleep(0.5 * msec);1742 smb_msleep(0.5 * msec); 1743 1743 } 1744 1744 … … 1746 1746 COMPARE_WRITE_TIME_GREATER(pinfo1, pinfo0); 1747 1747 1748 msleep(3 * msec);1748 smb_msleep(3 * msec); 1749 1749 1750 1750 /* … … 1753 1753 */ 1754 1754 for (i=0; i < 3; i++) { 1755 msleep(2 * msec);1755 smb_msleep(2 * msec); 1756 1756 /* do a write */ 1757 1757 torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i); … … 1768 1768 } 1769 1769 1770 msleep(3 * msec);1770 smb_msleep(3 * msec); 1771 1771 1772 1772 /* sure any further write doesn't update the write time */ … … 1793 1793 break; 1794 1794 } 1795 msleep(1 * msec);1795 smb_msleep(1 * msec); 1796 1796 } 1797 1797 … … 1803 1803 1804 1804 /* sleep */ 1805 msleep(3 * msec);1805 smb_msleep(3 * msec); 1806 1806 1807 1807 /* get the initial times */ … … 1814 1814 */ 1815 1815 for (i=0; i < 3; i++) { 1816 msleep(2 * msec);1816 smb_msleep(2 * msec); 1817 1817 /* do a write */ 1818 1818 torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i); … … 1830 1830 1831 1831 /* sleep */ 1832 msleep(3 * msec);1832 smb_msleep(3 * msec); 1833 1833 1834 1834 GET_INFO_BOTH(finfo3,pinfo3); … … 1915 1915 * doesn't depend on the time since the open 1916 1916 */ 1917 msleep(5 * msec);1917 smb_msleep(5 * msec); 1918 1918 1919 1919 /* get the initial times */ … … 1955 1955 break; 1956 1956 } 1957 msleep(0.5 * msec);1957 smb_msleep(0.5 * msec); 1958 1958 } 1959 1959 … … 1984 1984 break; 1985 1985 } 1986 msleep(1 * msec);1986 smb_msleep(1 * msec); 1987 1987 } 1988 1988 … … 1994 1994 1995 1995 /* sleep */ 1996 msleep(5 * msec);1996 smb_msleep(5 * msec); 1997 1997 1998 1998 GET_INFO_BOTH(finfo3,pinfo3); … … 2083 2083 * doesn't depend on the time since the open 2084 2084 */ 2085 msleep(5 * msec);2085 smb_msleep(5 * msec); 2086 2086 2087 2087 /* get the initial times */ … … 2094 2094 */ 2095 2095 for (i=0; i < 3; i++) { 2096 msleep(2 * msec);2096 smb_msleep(2 * msec); 2097 2097 /* do a write */ 2098 2098 torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i); … … 2131 2131 break; 2132 2132 } 2133 msleep(1 * msec);2133 smb_msleep(1 * msec); 2134 2134 } 2135 2135 … … 2141 2141 2142 2142 /* sleep */ 2143 msleep(5 * msec);2143 smb_msleep(5 * msec); 2144 2144 2145 2145 /* get the initial times */ … … 2152 2152 */ 2153 2153 for (i=0; i < 3; i++) { 2154 msleep(2 * msec);2154 smb_msleep(2 * msec); 2155 2155 /* do a write */ 2156 2156 torture_comment(tctx, "Do a truncate write [%d] on the file handle\n", i); … … 2168 2168 2169 2169 /* sleep */ 2170 msleep(5 * msec);2170 smb_msleep(5 * msec); 2171 2171 2172 2172 GET_INFO_BOTH(finfo2,pinfo2); … … 2196 2196 break; 2197 2197 } 2198 msleep(1 * msec);2198 smb_msleep(1 * msec); 2199 2199 } 2200 2200 … … 2206 2206 2207 2207 /* sleep */ 2208 msleep(5 * msec);2208 smb_msleep(5 * msec); 2209 2209 2210 2210 GET_INFO_BOTH(finfo3,pinfo3); … … 2290 2290 2291 2291 /* sleep a bit */ 2292 msleep(5 * msec);2292 smb_msleep(5 * msec); 2293 2293 2294 2294 /* do a write */ … … 2330 2330 break; 2331 2331 } 2332 msleep(0.5 * msec);2332 smb_msleep(0.5 * msec); 2333 2333 } 2334 2334 … … 2359 2359 break; 2360 2360 } 2361 msleep(1 * msec);2361 smb_msleep(1 * msec); 2362 2362 } 2363 2363 … … 2369 2369 2370 2370 /* sleep */ 2371 msleep(5 * msec);2371 smb_msleep(5 * msec); 2372 2372 2373 2373 GET_INFO_BOTH(finfo3,pinfo3); … … 2490 2490 break; 2491 2491 } 2492 msleep(1 * msec);2492 smb_msleep(1 * msec); 2493 2493 } 2494 2494 … … 2522 2522 break; 2523 2523 } 2524 msleep(1 * msec);2524 smb_msleep(1 * msec); 2525 2525 } 2526 2526 … … 2532 2532 2533 2533 /* sleep */ 2534 msleep(5 * msec);2534 smb_msleep(5 * msec); 2535 2535 2536 2536 GET_INFO_BOTH(finfo5,pinfo5); … … 2652 2652 break; 2653 2653 } 2654 msleep(1 * msec);2654 smb_msleep(1 * msec); 2655 2655 } 2656 2656 … … 2684 2684 break; 2685 2685 } 2686 msleep(1 * msec);2686 smb_msleep(1 * msec); 2687 2687 } 2688 2688 … … 2694 2694 2695 2695 /* sleep */ 2696 msleep(5 * msec);2696 smb_msleep(5 * msec); 2697 2697 2698 2698 GET_INFO_BOTH(finfo5,pinfo5); … … 2831 2831 break; 2832 2832 } 2833 msleep(1 * msec);2833 smb_msleep(1 * msec); 2834 2834 } 2835 2835 … … 2863 2863 break; 2864 2864 } 2865 msleep(1 * msec);2865 smb_msleep(1 * msec); 2866 2866 } 2867 2867 … … 2873 2873 2874 2874 /* sleep */ 2875 msleep(5 * msec);2875 smb_msleep(5 * msec); 2876 2876 2877 2877 GET_INFO_BOTH(finfo5,pinfo5); … … 2899 2899 2900 2900 /* See if we have lost the sticky write time on handle2 */ 2901 msleep(3 * msec);2901 smb_msleep(3 * msec); 2902 2902 torture_comment(tctx, "Have we lost the sticky write time ?\n"); 2903 2903 … … 2926 2926 break; 2927 2927 } 2928 msleep(1 * msec);2928 smb_msleep(1 * msec); 2929 2929 } 2930 2930 … … 2953 2953 break; 2954 2954 } 2955 msleep(1 * msec);2955 smb_msleep(1 * msec); 2956 2956 } 2957 2957 … … 3103 3103 struct torture_suite *torture_delay_write(void) 3104 3104 { 3105 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), " DELAYWRITE");3105 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "delaywrite"); 3106 3106 3107 3107 torture_suite_add_2smb_test(suite, "finfo update on close", test_finfo_after_write); -
trunk/server/source4/torture/basic/delete.c
r414 r745 22 22 #include "includes.h" 23 23 #include "libcli/libcli.h" 24 #include "torture/torture.h"25 24 #include "torture/util.h" 26 25 #include "system/filesys.h" 27 #include "libcli/raw/libcliraw.h"28 26 #include "libcli/raw/raw_proto.h" 29 27 … … 1425 1423 /* On slow build farm machines it might happen that they are not fast 1426 1424 * enogh to delete the file for this test */ 1427 msleep(200);1425 smb_msleep(200); 1428 1426 1429 1427 /* File should not be there. */ … … 1518 1516 CHECK_STATUS(cli1, NT_STATUS_DELETE_PENDING); 1519 1517 1518 smbcli_close(cli1->tree, dnum2); 1519 CHECK_STATUS(cli1, NT_STATUS_OK); 1520 1520 1521 return correct; 1522 } 1523 1524 /* Test 23 - Second directory open fails when delete is pending. */ 1525 static bool deltest23(struct torture_context *tctx, 1526 struct smbcli_state *cli1, 1527 struct smbcli_state *cli2) 1528 { 1529 int dnum1 = -1; 1530 int dnum2 = -1; 1531 bool correct = true; 1532 NTSTATUS status; 1533 1534 del_clean_area(cli1, cli2); 1535 1536 /* Test 23 -- Basic delete on close for directories. */ 1537 1538 /* Open a directory */ 1539 dnum1 = smbcli_nt_create_full(cli1->tree, dname, 0, 1540 SEC_FILE_READ_DATA| 1541 SEC_FILE_WRITE_DATA| 1542 SEC_STD_DELETE, 1543 FILE_ATTRIBUTE_DIRECTORY, 1544 NTCREATEX_SHARE_ACCESS_READ| 1545 NTCREATEX_SHARE_ACCESS_WRITE| 1546 NTCREATEX_SHARE_ACCESS_DELETE, 1547 NTCREATEX_DISP_CREATE, 1548 NTCREATEX_OPTIONS_DIRECTORY, 0); 1549 1550 torture_assert(tctx, dnum1 != -1, talloc_asprintf(tctx, 1551 "open of %s failed: %s!", 1552 dname, smbcli_errstr(cli1->tree))); 1553 1554 correct &= check_delete_on_close(tctx, cli1, dnum1, dname, false, 1555 __location__); 1556 1557 /* Set delete on close */ 1558 status = smbcli_nt_delete_on_close(cli1->tree, dnum1, true); 1559 1560 /* Attempt opening the directory again. It should fail. */ 1561 dnum2 = smbcli_nt_create_full(cli1->tree, dname, 0, 1562 SEC_FILE_READ_DATA| 1563 SEC_FILE_WRITE_DATA| 1564 SEC_STD_DELETE, 1565 FILE_ATTRIBUTE_DIRECTORY, 1566 NTCREATEX_SHARE_ACCESS_READ| 1567 NTCREATEX_SHARE_ACCESS_WRITE| 1568 NTCREATEX_SHARE_ACCESS_DELETE, 1569 NTCREATEX_DISP_OPEN, 1570 NTCREATEX_OPTIONS_DIRECTORY, 0); 1571 1572 torture_assert(tctx, dnum2 == -1, talloc_asprintf(tctx, 1573 "open of %s succeeded: %s. It should have failed " 1574 "with NT_STATUS_DELETE_PENDING", 1575 dname, smbcli_errstr(cli1->tree))); 1576 1577 torture_assert_ntstatus_equal(tctx, smbcli_nt_error(cli1->tree), 1578 NT_STATUS_DELETE_PENDING, "smbcli_open failed"); 1579 1580 return true; 1521 1581 } 1522 1582 … … 1527 1587 { 1528 1588 struct torture_suite *suite = torture_suite_create( 1529 talloc_autofree_context(), 1530 "DELETE"); 1589 talloc_autofree_context(), "delete"); 1531 1590 1532 1591 torture_suite_add_2smb_test(suite, "deltest1", deltest1); … … 1554 1613 torture_suite_add_simple_test(suite, "deltest21", deltest21); 1555 1614 torture_suite_add_simple_test(suite, "deltest22", deltest22); 1615 torture_suite_add_2smb_test(suite, "deltest23", deltest23); 1556 1616 1557 1617 return suite; -
trunk/server/source4/torture/basic/denytest.c
r414 r745 19 19 20 20 #include "includes.h" 21 #include "torture/torture.h"22 21 #include "system/filesys.h" 23 #include "libcli/raw/libcliraw.h"24 22 #include "libcli/libcli.h" 25 23 #include "libcli/security/security.h" 26 24 #include "torture/util.h" 27 #include "torture/smbtorture.h"28 #include "libcli/util/clilsa.h"29 25 #include "cxd_known.h" 30 26 … … 1404 1400 1405 1401 1406 static void progress_bar(struct torture_context *tctx, u int_t i, uint_t total)1402 static void progress_bar(struct torture_context *tctx, unsigned int i, unsigned int total) 1407 1403 { 1408 1404 if (torture_setting_bool(tctx, "progress", true)) { … … 1421 1417 int i; 1422 1418 bool correct = true; 1423 struct time valtv, tv_start;1419 struct timespec tv, tv_start; 1424 1420 const char *fnames[2] = {"\\denytest1.dat", "\\denytest1.exe"}; 1425 1421 int failures=0; … … 1434 1430 } 1435 1431 1436 torture_comment(tctx, " testing %d entries\n", (int)ARRAY_SIZE(denytable1));1437 1438 GetTimeOfDay(&tv_start);1432 torture_comment(tctx, "Testing %d entries\n", (int)ARRAY_SIZE(denytable1)); 1433 1434 clock_gettime_mono(&tv_start); 1439 1435 1440 1436 for (i=0; i<ARRAY_SIZE(denytable1); i++) { … … 1443 1439 1444 1440 progress_bar(tctx, i, ARRAY_SIZE(denytable1)); 1441 1442 if (!torture_setting_bool(tctx, "deny_fcb_support", true) && 1443 (denytable1[i].deny1 == DENY_FCB || 1444 denytable1[i].deny2 == DENY_FCB)) 1445 continue; 1446 1447 if (!torture_setting_bool(tctx, "deny_dos_support", true) && 1448 (denytable1[i].deny1 == DENY_DOS || 1449 denytable1[i].deny2 == DENY_DOS)) 1450 continue; 1445 1451 1446 1452 fnum1 = smbcli_open(cli1->tree, fname, … … 1469 1475 res != denytable1[i].result) { 1470 1476 int64_t tdif; 1471 GetTimeOfDay(&tv);1472 tdif = usec_time_diff(&tv, &tv_start);1473 tdif /= 1000 ;1477 clock_gettime_mono(&tv); 1478 tdif = nsec_time_diff(&tv, &tv_start); 1479 tdif /= 1000000; 1474 1480 torture_comment(tctx, "%lld: %s %8s %10s %8s %10s %s (correct=%s)\n", 1475 1481 (long long)tdif, … … 1513 1519 bool correct = true; 1514 1520 const char *fnames[2] = {"\\denytest2.dat", "\\denytest2.exe"}; 1515 struct time valtv, tv_start;1521 struct timespec tv, tv_start; 1516 1522 int failures=0; 1517 1523 … … 1523 1529 } 1524 1530 1525 GetTimeOfDay(&tv_start);1531 clock_gettime_mono(&tv_start); 1526 1532 1527 1533 for (i=0; i<ARRAY_SIZE(denytable2); i++) { … … 1530 1536 1531 1537 progress_bar(tctx, i, ARRAY_SIZE(denytable1)); 1538 1539 if (!torture_setting_bool(tctx, "deny_fcb_support", true) && 1540 (denytable1[i].deny1 == DENY_FCB || 1541 denytable1[i].deny2 == DENY_FCB)) 1542 continue; 1543 1544 if (!torture_setting_bool(tctx, "deny_dos_support", true) && 1545 (denytable1[i].deny1 == DENY_DOS || 1546 denytable1[i].deny2 == DENY_DOS)) 1547 continue; 1532 1548 1533 1549 fnum1 = smbcli_open(cli1->tree, fname, … … 1556 1572 res != denytable2[i].result) { 1557 1573 int64_t tdif; 1558 GetTimeOfDay(&tv);1559 tdif = usec_time_diff(&tv, &tv_start);1560 tdif /= 1000 ;1574 clock_gettime_mono(&tv); 1575 tdif = nsec_time_diff(&tv, &tv_start); 1576 tdif /= 1000000; 1561 1577 torture_comment(tctx, "%lld: %s %8s %10s %8s %10s %s (correct=%s)\n", 1562 1578 (long long)tdif, … … 1727 1743 */ 1728 1744 static bool torture_ntdenytest(struct torture_context *tctx, 1729 struct smbcli_state *cli1, struct smbcli_state *cli2, int client) 1745 struct smbcli_state *cli1, 1746 struct smbcli_state *cli2, int client) 1730 1747 { 1731 1748 const struct bit_value share_access_bits[] = { … … 1747 1764 int i; 1748 1765 bool correct = true; 1749 struct time valtv, tv_start;1766 struct timespec tv, tv_start; 1750 1767 const char *fname; 1751 1768 int nbits1 = ARRAY_SIZE(share_access_bits); … … 1767 1784 smbcli_close(cli1->tree, fnum1); 1768 1785 1769 GetTimeOfDay(&tv_start);1786 clock_gettime_mono(&tv_start); 1770 1787 1771 1788 io1.ntcreatex.level = RAW_OPEN_NTCREATEX; 1772 io1.ntcreatex.in.root_fid = 0;1789 io1.ntcreatex.in.root_fid.fnum = 0; 1773 1790 io1.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; 1774 1791 io1.ntcreatex.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE; … … 1781 1798 io2 = io1; 1782 1799 1783 torture_comment(tctx, " testing %d entries on %s\n", torture_numops, fname);1800 torture_comment(tctx, "Testing %d entries on %s\n", torture_numops, fname); 1784 1801 1785 1802 for (i=0;i<torture_numops;i++) { … … 1855 1872 &res2); 1856 1873 1857 GetTimeOfDay(&tv);1858 tdif = usec_time_diff(&tv, &tv_start);1859 tdif /= 1000 ;1874 clock_gettime_mono(&tv); 1875 tdif = nsec_time_diff(&tv, &tv_start); 1876 tdif /= 1000000; 1860 1877 if (torture_setting_bool(tctx, "showall", false) || 1861 1878 !NT_STATUS_EQUAL(status2, status2_p) || … … 2079 2096 } 2080 2097 2081 #define FILL_NTCREATEX(_struct, _init...) \2082 do { \2083 (_struct)->generic.level = RAW_OPEN_NTCREATEX; \2084 (_struct)->ntcreatex.in \2085 = (typeof((_struct)->ntcreatex.in)) {_init};\2086 } while (0)2087 2088 2098 #define CREATEX_NAME "\\createx_dir" 2089 2099 … … 2108 2118 NTSTATUS status; 2109 2119 2110 FILL_NTCREATEX(&open_parms, 2111 .flags = 0, 2112 .access_mask = SEC_RIGHTS_FILE_ALL, 2113 .file_attr = FILE_ATTRIBUTE_NORMAL, 2114 .share_access = 0, 2115 .open_disposition = NTCREATEX_DISP_CREATE, 2116 .create_options = 0, 2117 .fname = fname, 2118 ); 2120 ZERO_STRUCT(open_parms); 2121 open_parms.generic.level = RAW_OPEN_NTCREATEX; 2122 open_parms.ntcreatex.in.flags = 0; 2123 open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; 2124 open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; 2125 open_parms.ntcreatex.in.share_access = 0; 2126 open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; 2127 open_parms.ntcreatex.in.create_options = 0; 2128 open_parms.ntcreatex.in.fname = fname; 2129 2119 2130 status = smb_raw_open(tree, mem_ctx, &open_parms); 2120 2131 CHECK_STATUS(status, NT_STATUS_OK); … … 2130 2141 int sharemode, const char *fname) 2131 2142 { 2132 FILL_NTCREATEX(open_parms,2133 .flags = 0,2134 .access_mask = accessmode,2135 .file_attr = FILE_ATTRIBUTE_DIRECTORY,2136 .share_access = sharemode,2137 .open_disposition = NTCREATEX_DISP_OPEN_IF,2138 .create_options = NTCREATEX_OPTIONS_DIRECTORY,2139 .fname = fname,2140 );2143 ZERO_STRUCTP(open_parms); 2144 open_parms->generic.level = RAW_OPEN_NTCREATEX; 2145 open_parms->ntcreatex.in.flags = 0; 2146 open_parms->ntcreatex.in.access_mask = accessmode; 2147 open_parms->ntcreatex.in.file_attr = FILE_ATTRIBUTE_DIRECTORY; 2148 open_parms->ntcreatex.in.share_access = sharemode; 2149 open_parms->ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF; 2150 open_parms->ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY; 2151 open_parms->ntcreatex.in.fname = fname; 2141 2152 } 2142 2153 … … 2144 2155 int sharemode, const char *fname) 2145 2156 { 2146 FILL_NTCREATEX(open_parms, 2147 .flags = 0, 2148 .access_mask = accessmode, 2149 .file_attr = FILE_ATTRIBUTE_NORMAL, 2150 .share_access = sharemode, 2151 .open_disposition = NTCREATEX_DISP_OPEN_IF, 2152 .create_options = 0, 2153 .fname = fname, 2154 ); 2157 ZERO_STRUCTP(open_parms); 2158 open_parms->generic.level = RAW_OPEN_NTCREATEX; 2159 open_parms->ntcreatex.in.flags = 0; 2160 open_parms->ntcreatex.in.access_mask = accessmode; 2161 open_parms->ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; 2162 open_parms->ntcreatex.in.share_access = sharemode; 2163 open_parms->ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF; 2164 open_parms->ntcreatex.in.create_options = 0; 2165 open_parms->ntcreatex.in.fname = fname; 2166 open_parms->ntcreatex.in.root_fid.fnum = 0; 2155 2167 } 2156 2168 … … 2167 2179 2168 2180 /* bypass original handle to guarantee creation */ 2169 FILL_NTCREATEX(&open_parms, 2170 .flags = 0, 2171 .access_mask = SEC_RIGHTS_FILE_ALL, 2172 .file_attr = FILE_ATTRIBUTE_NORMAL, 2173 .share_access = 0, 2174 .open_disposition = NTCREATEX_DISP_CREATE, 2175 .create_options = 0, 2176 .fname = CREATEX_NAME "\\" KNOWN, 2177 ); 2181 ZERO_STRUCT(open_parms); 2182 open_parms.generic.level = RAW_OPEN_NTCREATEX; 2183 open_parms.ntcreatex.in.flags = 0; 2184 open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; 2185 open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; 2186 open_parms.ntcreatex.in.share_access = 0; 2187 open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; 2188 open_parms.ntcreatex.in.create_options = 0; 2189 open_parms.ntcreatex.in.fname = CREATEX_NAME "\\" KNOWN; 2190 2178 2191 status = smb_raw_open(tree, mem_ctx, &open_parms); 2179 2192 CHECK_STATUS(status, NT_STATUS_OK); … … 2183 2196 2184 2197 /* try to create a child */ 2185 FILL_NTCREATEX(&open_parms,2186 .flags = 0,2187 .access_mask = SEC_RIGHTS_FILE_ALL,2188 .file_attr = FILE_ATTRIBUTE_NORMAL,2189 .share_access = 0,2190 .open_disposition = NTCREATEX_DISP_CREATE,2191 .create_options = 0,2192 .fname = CHILD,2193 .root_fid = fnum,2194 );2198 ZERO_STRUCT(open_parms); 2199 open_parms.generic.level = RAW_OPEN_NTCREATEX; 2200 open_parms.ntcreatex.in.flags = 0; 2201 open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; 2202 open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; 2203 open_parms.ntcreatex.in.share_access = 0; 2204 open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; 2205 open_parms.ntcreatex.in.create_options = 0; 2206 open_parms.ntcreatex.in.fname = CHILD; 2207 open_parms.ntcreatex.in.root_fid.fnum = fnum; 2195 2208 2196 2209 result[CXD_DIR_CREATE_CHILD] = … … 2199 2212 2200 2213 /* try to traverse dir to known good file */ 2201 FILL_NTCREATEX(&open_parms,2202 .flags = 0,2203 .access_mask = SEC_RIGHTS_FILE_ALL,2204 .file_attr = FILE_ATTRIBUTE_NORMAL,2205 .share_access = 0,2206 .open_disposition = NTCREATEX_DISP_OPEN,2207 .create_options = 0,2208 .fname = KNOWN,2209 .root_fid = fnum,2210 );2214 ZERO_STRUCT(open_parms); 2215 open_parms.generic.level = RAW_OPEN_NTCREATEX; 2216 open_parms.ntcreatex.in.flags = 0; 2217 open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; 2218 open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; 2219 open_parms.ntcreatex.in.share_access = 0; 2220 open_parms.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; 2221 open_parms.ntcreatex.in.create_options = 0; 2222 open_parms.ntcreatex.in.fname = KNOWN; 2223 open_parms.ntcreatex.in.root_fid.fnum = fnum; 2211 2224 2212 2225 result[CXD_DIR_TRAVERSE] = … … 2225 2238 struct smbcli_tree *tree, int fnum, TALLOC_CTX *mem_ctx, NTSTATUS *result) 2226 2239 { 2227 union smb_read rd = {};2228 union smb_write wr = {};2240 union smb_read rd; 2241 union smb_write wr; 2229 2242 char buf[256] = ""; 2230 2243 2244 memset(&rd, 0, sizeof(rd)); 2231 2245 rd.readx.level = RAW_READ_READX; 2232 2246 rd.readx.in.file.fnum = fnum; 2233 2247 rd.readx.in.mincnt = sizeof(buf); 2234 2248 rd.readx.in.maxcnt = sizeof(buf); 2235 rd.readx.out.data = buf;2249 rd.readx.out.data = (uint8_t *)buf; 2236 2250 2237 2251 result[CXD_FILE_READ] = smb_raw_read(tree, &rd); 2238 2252 2253 memset(&wr, 0, sizeof(wr)); 2239 2254 wr.writex.level = RAW_WRITE_WRITEX; 2240 2255 wr.writex.in.file.fnum = fnum; 2241 2256 wr.writex.in.count = sizeof(buf); 2242 wr.writex.in.data = buf;2257 wr.writex.in.data = (uint8_t *)buf; 2243 2258 2244 2259 result[CXD_FILE_WRITE] = smb_raw_write(tree, &wr); … … 2250 2265 rd.readx.in.maxcnt = sizeof(buf); 2251 2266 rd.readx.in.read_for_execute = 1; 2252 rd.readx.out.data = buf;2267 rd.readx.out.data = (uint8_t *)buf; 2253 2268 2254 2269 result[CXD_FILE_EXECUTE] = smb_raw_read(tree, &rd); … … 2260 2275 * the output. Could use a switch "--noprogress", or direct the progress bar to 2261 2276 * stderr? No other solution? */ 2262 static void createx_progress_bar(struct torture_context *tctx, u int_t i,2263 u int_t total, uint_t skipped)2277 static void createx_progress_bar(struct torture_context *tctx, unsigned int i, 2278 unsigned int total, unsigned int skipped) 2264 2279 { 2265 2280 if (torture_setting_bool(tctx, "progress", true)) { … … 2582 2597 &cxd, est); 2583 2598 } 2584 2585 2599 for (i = 0; i < num_access_bits; i++) { 2586 2600 /* And now run through the single access bits. */ … … 2666 2680 { 2667 2681 struct security_descriptor *sd, *sd_orig; 2668 union smb_open io = {};2682 union smb_open io; 2669 2683 static TALLOC_CTX *mem_ctx; 2670 2684 int fnum, i; … … 2691 2705 2692 2706 /* create initial file with restrictive SD */ 2707 memset(&io, 0, sizeof(io)); 2693 2708 io.generic.level = RAW_OPEN_NTTRANS_CREATE; 2694 2709 io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; … … 2716 2731 owner_sid = dom_sid_string(tctx, sd_orig->owner_sid); 2717 2732 2718 status = smblsa_sid_check_privilege(cli,2719 2720 2733 status = torture_check_privilege(cli, 2734 owner_sid, 2735 sec_privilege_name(SEC_PRIV_RESTORE)); 2721 2736 has_restore_privilege = NT_STATUS_IS_OK(status); 2722 torture_comment(tctx, "Checked SEC_PRIV_RESTORE - %s\n", has_restore_privilege?"Yes":"No"); 2723 2724 status = smblsa_sid_check_privilege(cli, 2725 owner_sid, 2726 sec_privilege_name(SEC_PRIV_BACKUP)); 2737 torture_comment(tctx, "Checked SEC_PRIV_RESTORE for %s - %s\n", 2738 owner_sid, 2739 has_restore_privilege?"Yes":"No"); 2740 2741 status = torture_check_privilege(cli, 2742 owner_sid, 2743 sec_privilege_name(SEC_PRIV_BACKUP)); 2727 2744 has_backup_privilege = NT_STATUS_IS_OK(status); 2728 torture_comment(tctx, "Checked SEC_PRIV_BACKUP - %s\n", has_backup_privilege?"Yes":"No"); 2745 torture_comment(tctx, "Checked SEC_PRIV_BACKUP for %s - %s\n", 2746 owner_sid, 2747 has_backup_privilege?"Yes":"No"); 2729 2748 2730 2749 smbcli_close(cli->tree, fnum); … … 2774 2793 2775 2794 done: 2795 smbcli_unlink(cli->tree, MAXIMUM_ALLOWED_FILE); 2776 2796 return ret; 2777 2797 } -
trunk/server/source4/torture/basic/dir.c
r414 r745 22 22 #include "includes.h" 23 23 #include "libcli/libcli.h" 24 #include "torture/torture.h"25 24 #include "torture/util.h" 26 25 #include "system/filesys.h" -
trunk/server/source4/torture/basic/disconnect.c
r414 r745 21 21 22 22 #include "includes.h" 23 #include "torture/torture.h"24 23 #include "system/filesys.h" 25 24 #include "libcli/raw/libcliraw.h" … … 50 49 51 50 io.generic.level = RAW_OPEN_NTCREATEX; 52 io.ntcreatex.in.root_fid = 0;51 io.ntcreatex.in.root_fid.fnum = 0; 53 52 io.ntcreatex.in.flags = 0; 54 53 io.ntcreatex.in.access_mask = SEC_FILE_READ_DATA; … … 164 163 * failures in the build farm. 165 164 */ 166 msleep(200);165 smb_msleep(200); 167 166 } 168 167 } -
trunk/server/source4/torture/basic/locking.c
r414 r745 22 22 23 23 #include "includes.h" 24 #include "libcli/raw/libcliraw.h"25 24 #include "libcli/libcli.h" 26 #include "torture/smbtorture.h"27 25 #include "torture/util.h" 28 26 #include "system/time.h" … … 45 43 int fnum1, fnum2, fnum3; 46 44 time_t t1, t2; 47 u int_t lock_timeout;45 unsigned int lock_timeout; 48 46 49 47 if (!torture_setup_dir(cli1, BASEDIR)) { … … 109 107 torture_comment(tctx, "Testing lock timeout with timeout=%u\n", 110 108 lock_timeout); 111 t1 = time (NULL);109 t1 = time_mono(NULL); 112 110 torture_assert(tctx, 113 111 !NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK)), … … 116 114 if (!check_error(__location__, cli2, ERRDOS, ERRlock, 117 115 NT_STATUS_FILE_LOCK_CONFLICT)) return false; 118 t2 = time (NULL);116 t2 = time_mono(NULL); 119 117 120 118 if (t2 - t1 < 5) { … … 123 121 } 124 122 torture_comment(tctx, "server slept for %u seconds for a %u second timeout\n", 125 (u int_t)(t2-t1), lock_timeout);123 (unsigned int)(t2-t1), lock_timeout); 126 124 127 125 torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum2), … … 805 803 struct torture_suite *torture_base_locktest(TALLOC_CTX *mem_ctx) 806 804 { 807 struct torture_suite *suite = torture_suite_create(mem_ctx, " LOCK");805 struct torture_suite *suite = torture_suite_create(mem_ctx, "lock"); 808 806 torture_suite_add_2smb_test(suite, "LOCK1", torture_locktest1); 809 807 torture_suite_add_1smb_test(suite, "LOCK2", torture_locktest2); -
trunk/server/source4/torture/basic/mangle_test.c
r414 r745 19 19 20 20 #include "includes.h" 21 #include "torture/torture.h"22 21 #include "system/filesys.h" 23 22 #include "system/dir.h" 24 #include "../tdb/include/tdb.h"23 #include <tdb.h> 25 24 #include "../lib/util/util_tdb.h" 26 25 #include "libcli/libcli.h" … … 31 30 #define NAME_LENGTH 20 32 31 33 static u int_t total, collisions, failures;32 static unsigned int total, collisions, failures; 34 33 35 34 static bool test_one(struct torture_context *tctx ,struct smbcli_state *cli, … … 116 115 { 117 116 const char *chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-$~..."; 118 u int_t max_idx = strlen(chars);119 u int_t len;117 unsigned int max_idx = strlen(chars); 118 unsigned int len; 120 119 int i; 121 120 char *p; -
trunk/server/source4/torture/basic/misc.c
r414 r745 29 29 #include "lib/events/events.h" 30 30 #include "libcli/resolve/resolve.h" 31 #include "auth/credentials/credentials.h"32 #include "librpc/gen_ndr/ndr_nbt.h"33 31 #include "torture/smbtorture.h" 34 32 #include "torture/util.h" … … 71 69 72 70 for (i=0;i<torture_numops;i++) { 73 u int_t n = (uint_t)random()%10;71 unsigned int n = (unsigned int)random()%10; 74 72 if (i % 10 == 0) { 75 73 if (torture_setting_bool(tctx, "progress", true)) { … … 234 232 235 233 /* 234 open a file N times on the server and just hold them open 235 used for testing performance when there are N file handles 236 alopenn 237 */ 238 bool torture_holdopen(struct torture_context *tctx, 239 struct smbcli_state *cli) 240 { 241 int i, fnum; 242 const char *fname = "\\holdopen.dat"; 243 NTSTATUS status; 244 245 smbcli_unlink(cli->tree, fname); 246 247 fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); 248 if (fnum == -1) { 249 torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); 250 return false; 251 } 252 253 smbcli_close(cli->tree, fnum); 254 255 for (i=0;i<torture_numops;i++) { 256 union smb_open op; 257 258 op.generic.level = RAW_OPEN_NTCREATEX; 259 op.ntcreatex.in.root_fid.fnum = 0; 260 op.ntcreatex.in.flags = 0; 261 op.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA; 262 op.ntcreatex.in.create_options = 0; 263 op.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; 264 op.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_MASK; 265 op.ntcreatex.in.alloc_size = 0; 266 op.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; 267 op.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; 268 op.ntcreatex.in.security_flags = 0; 269 op.ntcreatex.in.fname = fname; 270 status = smb_raw_open(cli->tree, tctx, &op); 271 if (!NT_STATUS_IS_OK(status)) { 272 torture_warning(tctx, "open %d failed\n", i); 273 continue; 274 } 275 276 if (torture_setting_bool(tctx, "progress", true)) { 277 torture_comment(tctx, "opened %d file\r", i); 278 fflush(stdout); 279 } 280 } 281 282 torture_comment(tctx, "\nStarting pings\n"); 283 284 while (1) { 285 struct smb_echo ec; 286 287 status = smb_raw_echo(cli->transport, &ec); 288 torture_comment(tctx, "."); 289 fflush(stdout); 290 sleep(15); 291 } 292 } 293 294 /* 236 295 test how many open files this server supports on the one socket 237 296 */ … … 369 428 370 429 for (device=0;device<0x100;device++) { 371 torture_comment(tctx, " testing device=0x%x\n", device);430 torture_comment(tctx, "Testing device=0x%x\n", device); 372 431 for (function=0;function<0x100;function++) { 373 432 parms.ioctl.in.request = (device << 16) | function; … … 425 484 unsigned int writeratio; 426 485 int num_parallel_requests; 427 } *lp _params;486 } *lpcfg_params; 428 487 }; 429 488 430 489 /* 431 init params using lp_parm_xxx 490 init params using lpcfg_parm_xxx 432 491 return number of unclist entries 433 492 */ … … 444 503 lpar->num_parallel_requests = torture_setting_int( 445 504 tctx, "parallel_requests", 5); 446 lpar->workgroup = lp _workgroup(tctx->lp_ctx);505 lpar->workgroup = lpcfg_workgroup(tctx->lp_ctx); 447 506 448 507 p = torture_setting_string(tctx, "unclist", NULL); … … 559 618 560 619 /* randomize between writes and reads*/ 561 if (random() % state->lp _params->writeratio == 0) {620 if (random() % state->lpcfg_params->writeratio == 0) { 562 621 torture_comment(tctx, "Callback WRITE file:%d (%d/%d)\n", 563 622 state->nr,state->completed,torture_numops); … … 567 626 wr.writex.in.wmode = 0 ; 568 627 wr.writex.in.remaining = 0; 569 wr.writex.in.count = state->lp _params->blocksize;628 wr.writex.in.count = state->lpcfg_params->blocksize; 570 629 wr.writex.in.data = state->buffer; 571 630 state->readcnt=0; … … 576 635 "Callback READ file:%d (%d/%d) Offset:%d\n", 577 636 state->nr,state->completed,torture_numops, 578 (state->readcnt*state->lp _params->blocksize));637 (state->readcnt*state->lpcfg_params->blocksize)); 579 638 rd.generic.level = RAW_READ_READX; 580 639 rd.readx.in.file.fnum = state->fnum ; 581 rd.readx.in.offset = state->readcnt*state->lp _params->blocksize;582 rd.readx.in.mincnt = state->lp _params->blocksize;640 rd.readx.in.offset = state->readcnt*state->lpcfg_params->blocksize; 641 rd.readx.in.mincnt = state->lpcfg_params->blocksize; 583 642 rd.readx.in.maxcnt = rd.readx.in.mincnt; 584 643 rd.readx.in.remaining = 0 ; 585 644 rd.readx.out.data = state->buffer; 586 645 rd.readx.in.read_for_execute = false; 587 if(state->readcnt < state->lp _params->writeblocks){646 if(state->readcnt < state->lpcfg_params->writeblocks){ 588 647 state->readcnt++; 589 648 }else{ … … 623 682 624 683 torture_comment(tctx, "Write initial test file:%d (%d/%d)\n",state->nr, 625 (state->writecnt+1)*state->lp _params->blocksize,626 (state->lp _params->writeblocks*state->lp_params->blocksize));684 (state->writecnt+1)*state->lpcfg_params->blocksize, 685 (state->lpcfg_params->writeblocks*state->lpcfg_params->blocksize)); 627 686 wr.generic.level = RAW_WRITE_WRITEX ; 628 687 wr.writex.in.file.fnum = state->fnum ; 629 688 wr.writex.in.offset = state->writecnt * 630 state->lp _params->blocksize;689 state->lpcfg_params->blocksize; 631 690 wr.writex.in.wmode = 0 ; 632 wr.writex.in.remaining = (state->lp _params->writeblocks *633 state->lp _params->blocksize)-691 wr.writex.in.remaining = (state->lpcfg_params->writeblocks * 692 state->lpcfg_params->blocksize)- 634 693 ((state->writecnt+1)*state-> 635 lp _params->blocksize);636 wr.writex.in.count = state->lp _params->blocksize;694 lpcfg_params->blocksize); 695 wr.writex.in.count = state->lpcfg_params->blocksize; 637 696 wr.writex.in.data = state->buffer; 638 697 state->writecnt++; 639 if(state->writecnt == state->lp _params->writeblocks){698 if(state->writecnt == state->lpcfg_params->writeblocks){ 640 699 state->mode=READ_WRITE_DATA; 641 700 } … … 678 737 open_parms->openx.in.fname = state->fname; 679 738 680 writedata = talloc_size(tctx,state->lp _params->blocksize);739 writedata = talloc_size(tctx,state->lpcfg_params->blocksize); 681 740 NT_STATUS_HAVE_NO_MEMORY(writedata); 682 generate_random_buffer(writedata,state->lp _params->blocksize);741 generate_random_buffer(writedata,state->lpcfg_params->blocksize); 683 742 state->buffer=writedata; 684 743 state->writecnt=1; … … 735 794 case READ_WRITE_DATA: 736 795 while (state->num_parallel_requests 737 < state->lp _params->num_parallel_requests) {796 < state->lpcfg_params->num_parallel_requests) { 738 797 NTSTATUS status; 739 798 status = benchrw_readwrite(tctx,state); … … 778 837 struct benchrw_state *state = con->async.private_data; 779 838 struct torture_context *tctx = state->tctx; 780 int retry = state->lp _params->retry;839 int retry = state->lpcfg_params->retry; 781 840 782 841 if (NT_STATUS_IS_OK(con->status)) { … … 817 876 smb->in.dest_host=talloc_strdup(mem_ctx,host); 818 877 smb->in.service=talloc_strdup(mem_ctx,share); 819 smb->in.dest_ports=lp _smb_ports(tctx->lp_ctx);820 smb->in.socket_options = lp _socket_options(tctx->lp_ctx);878 smb->in.dest_ports=lpcfg_smb_ports(tctx->lp_ctx); 879 smb->in.socket_options = lpcfg_socket_options(tctx->lp_ctx); 821 880 smb->in.called_name = strupper_talloc(mem_ctx, host); 822 881 smb->in.service_type=NULL; 823 882 smb->in.credentials=cmdline_credentials; 824 883 smb->in.fallback_to_anonymous=false; 825 smb->in.iconv_convenience = lp_iconv_convenience(tctx->lp_ctx); 826 smb->in.gensec_settings = lp_gensec_settings(mem_ctx, tctx->lp_ctx); 884 smb->in.gensec_settings = lpcfg_gensec_settings(mem_ctx, tctx->lp_ctx); 827 885 smb->in.workgroup=workgroup; 828 lp _smbcli_options(tctx->lp_ctx, &smb->in.options);829 lp _smbcli_session_options(tctx->lp_ctx, &smb->in.session_options);886 lpcfg_smbcli_options(tctx->lp_ctx, &smb->in.options); 887 lpcfg_smbcli_session_options(tctx->lp_ctx, &smb->in.session_options); 830 888 831 889 return smb_composite_connect_send(smb,mem_ctx, 832 lp _resolve_context(tctx->lp_ctx),ev);890 lpcfg_resolve_context(tctx->lp_ctx),ev); 833 891 } 834 892 … … 856 914 state = talloc_array(tctx, struct benchrw_state *, torture_nprocs); 857 915 858 /* init params using lp _parm_xxx */916 /* init params using lpcfg_parm_xxx */ 859 917 num_unc_names = init_benchrw_params(tctx,&lpparams); 860 918 … … 865 923 state[i]->completed=0; 866 924 state[i]->num_parallel_requests=0; 867 state[i]->lp _params=&lpparams;925 state[i]->lpcfg_params=&lpparams; 868 926 state[i]->nr=i; 869 927 state[i]->dname=talloc_asprintf(tctx,"benchrw%d",i); -
trunk/server/source4/torture/basic/properties.c
r414 r745 21 21 22 22 #include "includes.h" 23 #include "torture/torture.h"24 #include "libcli/raw/libcliraw.h"25 23 #include "libcli/libcli.h" 26 24 #include "torture/util.h" -
trunk/server/source4/torture/basic/rename.c
r414 r745 22 22 #include "includes.h" 23 23 #include "libcli/libcli.h" 24 #include "torture/torture.h"25 24 #include "torture/util.h" 26 25 -
trunk/server/source4/torture/basic/scanner.c
r414 r745 19 19 20 20 #include "includes.h" 21 #include "torture/torture.h"22 21 #include "libcli/libcli.h" 23 22 #include "torture/util.h" 24 #include "libcli/raw/libcliraw.h"25 23 #include "libcli/raw/raw_proto.h" 26 24 #include "system/filesys.h" … … 438 436 check for existance of a nttrans call 439 437 ****************************************************************************/ 440 static bool scan_nttrans(struct smb_iconv_convenience *iconv_convenience, 441 struct smbcli_state *cli, int op, int level, 438 static bool scan_nttrans(struct smbcli_state *cli, int op, int level, 442 439 int fnum, int dnum, const char *fname) 443 440 { … … 549 546 int op, level; 550 547 const char *fname = "\\scanner.dat"; 551 struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(torture->lp_ctx);552 548 int fnum, dnum; 553 549 … … 559 555 printf("Scanning op=%d\n", op); 560 556 for (level = 0; level <= 50; level++) { 561 scan_nttrans(iconv_convenience, 562 cli, op, level, fnum, dnum, fname); 557 scan_nttrans(cli, op, level, fnum, dnum, fname); 563 558 } 564 559 565 560 for (level = 0x100; level <= 0x130; level++) { 566 scan_nttrans(iconv_convenience, 567 cli, op, level, fnum, dnum, fname); 561 scan_nttrans(cli, op, level, fnum, dnum, fname); 568 562 } 569 563 570 564 for (level = 1000; level < 1050; level++) { 571 scan_nttrans(iconv_convenience, 572 cli, op, level, fnum, dnum, fname); 565 scan_nttrans(cli, op, level, fnum, dnum, fname); 573 566 } 574 567 } -
trunk/server/source4/torture/basic/secleak.c
r414 r745 21 21 22 22 #include "includes.h" 23 #include "torture/torture.h"24 23 #include "libcli/raw/libcliraw.h" 25 24 #include "libcli/raw/raw_proto.h" … … 28 27 #include "system/time.h" 29 28 #include "libcli/smb_composite/smb_composite.h" 30 #include "libcli/smb_composite/proto.h"31 29 #include "auth/credentials/credentials.h" 32 30 #include "param/param.h" … … 39 37 struct smbcli_session_options options; 40 38 41 lp _smbcli_session_options(tctx->lp_ctx, &options);39 lpcfg_smbcli_session_options(tctx->lp_ctx, &options); 42 40 43 41 session = smbcli_session_init(cli->transport, cli, false, options); 44 42 setup.in.sesskey = cli->transport->negotiate.sesskey; 45 43 setup.in.capabilities = cli->transport->negotiate.capabilities; 46 setup.in.workgroup = lp _workgroup(tctx->lp_ctx);44 setup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx); 47 45 setup.in.credentials = cli_credentials_init(session); 48 setup.in.gensec_settings = lp _gensec_settings(tctx, tctx->lp_ctx);46 setup.in.gensec_settings = lpcfg_gensec_settings(tctx, tctx->lp_ctx); 49 47 50 48 cli_credentials_set_conf(setup.in.credentials, tctx->lp_ctx); … … 65 63 bool torture_sec_leak(struct torture_context *tctx, struct smbcli_state *cli) 66 64 { 67 time_t t1 = time (NULL);65 time_t t1 = time_mono(NULL); 68 66 int timelimit = torture_setting_int(tctx, "timelimit", 20); 69 67 70 while (time (NULL) < t1+timelimit) {68 while (time_mono(NULL) < t1+timelimit) { 71 69 if (!try_failed_login(tctx, cli)) { 72 70 return false; -
trunk/server/source4/torture/basic/unlink.c
r414 r745 21 21 22 22 #include "includes.h" 23 #include "torture/torture.h"24 23 #include "system/filesys.h" 25 #include "libcli/raw/libcliraw.h"26 24 #include "libcli/libcli.h" 27 25 #include "torture/util.h" … … 63 61 smbcli_unlink(cli->tree, fname); 64 62 65 torture_comment(tctx, " testing unlink after ntcreatex with DELETE access\n");63 torture_comment(tctx, "Testing unlink after ntcreatex with DELETE access\n"); 66 64 67 65 io.ntcreatex.level = RAW_OPEN_NTCREATEX; 68 io.ntcreatex.in.root_fid = 0;66 io.ntcreatex.in.root_fid.fnum = 0; 69 67 io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; 70 68 io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE; -
trunk/server/source4/torture/basic/utable.c
r414 r745 19 19 20 20 #include "includes.h" 21 #include "torture/torture.h"22 21 #include "system/filesys.h" 23 22 #include "system/locale.h" … … 51 50 strncpy(fname, "\\utable\\x", sizeof(fname)-1); 52 51 p = fname+strlen(fname); 53 convert_string_convenience(lp_iconv_convenience(tctx->lp_ctx),CH_UTF16, CH_UNIX,52 len = convert_string(CH_UTF16, CH_UNIX, 54 53 c2, 2, 55 p, sizeof(fname)-strlen(fname), &len,false);54 p, sizeof(fname)-strlen(fname), false); 56 55 p[len] = 0; 57 56 strncat(fname,"_a_long_extension",sizeof(fname)-1); … … 99 98 100 99 101 static char *form_name( struct smb_iconv_convenience *iconv_convenience,int c)100 static char *form_name(int c) 102 101 { 103 102 static char fname[256]; … … 110 109 SSVAL(c2, 0, c); 111 110 112 convert_string_convenience(iconv_convenience,CH_UTF16, CH_UNIX,111 len = convert_string(CH_UTF16, CH_UNIX, 113 112 c2, 2, 114 p, sizeof(fname)-strlen(fname), &len, false); 113 p, sizeof(fname)-strlen(fname), false); 114 if (len == -1) 115 return NULL; 115 116 p[len] = 0; 116 117 return fname; … … 140 141 torture_comment(tctx, "%04x (%c)\n", c, isprint(c)?c:'.'); 141 142 142 fname = form_name( lp_iconv_convenience(tctx->lp_ctx),c);143 fname = form_name(c); 143 144 fnum = smbcli_nt_create_full(cli->tree, fname, 0, 144 145 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.