Ignore:
Timestamp:
Nov 25, 2016, 8:04:54 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.7

Location:
vendor/current/source4/torture
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/torture/raw/read.c

    r988 r989  
    2020#include "includes.h"
    2121#include "libcli/raw/libcliraw.h"
     22#include "libcli/raw/raw_proto.h"
    2223#include "system/time.h"
    2324#include "system/filesys.h"
     
    374375        const char *test_data = "TEST DATA";
    375376        unsigned int seed = time(NULL);
     377        struct smbcli_request *smbreq = NULL;
     378        unsigned int i;
    376379
    377380        buf = talloc_zero_array(tctx, uint8_t, maxsize);
     
    422425
    423426        smbcli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
     427
     428        printf("Checking reserved fields are [0]\n");
     429        io.readx.in.file.fnum = fnum;
     430        io.readx.in.offset = 0;
     431        io.readx.in.remaining = 0;
     432        io.readx.in.read_for_execute = false;
     433        io.readx.in.mincnt = strlen(test_data);
     434        io.readx.in.maxcnt = strlen(test_data);
     435        smbreq = smb_raw_read_send(cli->tree, &io);
     436        if (smbreq == NULL) {
     437                ret = false;
     438                torture_fail_goto(tctx, done, "smb_raw_read_send failed\n");
     439        }
     440        if (!smbcli_request_receive(smbreq) ||
     441             smbcli_request_is_error(smbreq)) {
     442                status = smbcli_request_destroy(smbreq);
     443                torture_fail_goto(tctx, done, "receive failed\n");
     444        }
     445
     446        if (smbreq->in.wct != 12) {
     447                ret = false;
     448                printf("Incorrect wct %u (should be 12)\n",
     449                        (unsigned int)smbreq->in.wct);
     450                status = smbcli_request_destroy(smbreq);
     451                torture_fail_goto(tctx, done, "bad wct\n");
     452        }
     453
     454        /* Ensure VWV8 - WVW11 are zero. */
     455        for (i = 8; i < 12; i++) {
     456                uint16_t br = SVAL(smbreq->in.vwv, VWV(i));
     457                if (br != 0) {
     458                        status = smbcli_request_destroy(smbreq);
     459                        ret = false;
     460                        printf("reserved field %u is %u not zero\n",
     461                                i,
     462                                (unsigned int)br);
     463                        torture_fail_goto(tctx, done, "bad reserved field\n");
     464                }
     465        }
     466
     467        smbcli_request_destroy(smbreq);
    424468
    425469        printf("Trying small read\n");
  • vendor/current/source4/torture/rpc/lsa.c

    r988 r989  
    31843184        int kvno = cli_credentials_get_kvno(credentials);
    31853185        int expected_kvno = 0;
    3186         krb5uint32 t_kvno = 0;
     3186        krb5int32 t_kvno = 0;
    31873187        const char *host = torture_setting_string(tctx, "host", NULL);
    31883188        krb5_error_code k5ret;
  • vendor/current/source4/torture/smb2/getinfo.c

    r988 r989  
    127127}
    128128
     129/*
     130  test granted access when desired access includes
     131  FILE_EXECUTE and does not include FILE_READ_DATA
     132*/
     133static bool torture_smb2_fileinfo_grant_read(struct torture_context *tctx)
     134{
     135        struct smb2_tree *tree;
     136        bool ret;
     137        struct smb2_handle hfile, hdir;
     138        NTSTATUS status;
     139        uint32_t file_granted_access, dir_granted_access;
     140
     141        ret = torture_smb2_connection(tctx, &tree);
     142        torture_assert(tctx, ret, "connection failed");
     143
     144        status = torture_smb2_testfile_access(
     145            tree, FNAME, &hfile, SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE);
     146        torture_assert_ntstatus_ok(tctx, status,
     147                                   "Unable to create test file " FNAME "\n");
     148        status =
     149            torture_smb2_get_allinfo_access(tree, hfile, &file_granted_access);
     150        torture_assert_ntstatus_ok(tctx, status,
     151                                   "Unable to query test file access ");
     152        torture_assert_int_equal(tctx, file_granted_access,
     153                                 SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE,
     154                                 "granted file access ");
     155        smb2_util_close(tree, hfile);
     156
     157        status = torture_smb2_testdir_access(
     158            tree, DNAME, &hdir, SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE);
     159        torture_assert_ntstatus_ok(tctx, status,
     160                                   "Unable to create test dir " DNAME "\n");
     161        status =
     162            torture_smb2_get_allinfo_access(tree, hdir, &dir_granted_access);
     163        torture_assert_ntstatus_ok(tctx, status,
     164                                   "Unable to query test dir access ");
     165        torture_assert_int_equal(tctx, dir_granted_access,
     166                                 SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE,
     167                                 "granted dir access ");
     168        smb2_util_close(tree, hdir);
     169
     170        return true;
     171}
    129172
    130173/*
     
    445488        torture_suite_add_simple_test(suite, "qsec_buffercheck",
    446489                                      torture_smb2_qsec_buffercheck);
     490        torture_suite_add_simple_test(suite, "granted",
     491                                      torture_smb2_fileinfo_grant_read);
    447492        return suite;
    448493}
  • vendor/current/source4/torture/smb2/ioctl.c

    r988 r989  
    274274{
    275275        bool ok;
     276        uint32_t initial_access = desired_access;
     277
     278        if (size > 0) {
     279                initial_access |= SEC_FILE_APPEND_DATA;
     280        }
    276281
    277282        smb2_util_unlink(tree, fname);
     
    280285                             fname,
    281286                             fh,
    282                              desired_access,
     287                             initial_access,
    283288                             file_attributes);
    284         torture_assert(torture, ok, "file open");
     289        torture_assert(torture, ok, "file create");
    285290
    286291        if (size > 0) {
     
    288293                torture_assert(torture, ok, "write pattern");
    289294        }
     295
     296        if (initial_access != desired_access) {
     297                smb2_util_close(tree, *fh);
     298                ok = test_setup_open(torture, tree, mem_ctx,
     299                                     fname,
     300                                     fh,
     301                                     desired_access,
     302                                     file_attributes);
     303                torture_assert(torture, ok, "file open");
     304        }
     305
    290306        return true;
    291307}
     
    12401256        enum ndr_err_code ndr_ret;
    12411257        bool ok;
    1242 
    1243         /* no read permission on src */
    1244         ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
    1245                                    1, /* 1 chunk */
     1258        /* read permission on src */
     1259        ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
    12461260                                   &src_h, 4096, /* fill 4096 byte src file */
    1247                                    SEC_RIGHTS_FILE_WRITE,
    1248                                    &dest_h, 0,  /* 0 byte dest file */
    1249                                    SEC_RIGHTS_FILE_ALL,
    1250                                    &cc_copy,
    1251                                    &ioctl);
     1261                                   SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE,
     1262                                   &dest_h, 0, /* 0 byte dest file */
     1263                                   SEC_RIGHTS_FILE_ALL, &cc_copy, &ioctl);
     1264        if (!ok) {
     1265                torture_fail(torture, "setup copy chunk error");
     1266        }
     1267
     1268        cc_copy.chunks[0].source_off = 0;
     1269        cc_copy.chunks[0].target_off = 0;
     1270        cc_copy.chunks[0].length = 4096;
     1271
     1272        ndr_ret = ndr_push_struct_blob(
     1273            &ioctl.smb2.in.out, tmp_ctx, &cc_copy,
     1274            (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
     1275        torture_assert_ndr_success(torture, ndr_ret,
     1276                                   "ndr_push_srv_copychunk_copy");
     1277
     1278        status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
     1279        torture_assert_ntstatus_equal(torture, status, NT_STATUS_OK,
     1280                                      "FSCTL_SRV_COPYCHUNK");
     1281
     1282        smb2_util_close(tree, src_h);
     1283        smb2_util_close(tree, dest_h);
     1284
     1285        /* execute permission on src */
     1286        ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
     1287                                   &src_h, 4096, /* fill 4096 byte src file */
     1288                                   SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE,
     1289                                   &dest_h, 0, /* 0 byte dest file */
     1290                                   SEC_RIGHTS_FILE_ALL, &cc_copy, &ioctl);
     1291        if (!ok) {
     1292                torture_fail(torture, "setup copy chunk error");
     1293        }
     1294
     1295        cc_copy.chunks[0].source_off = 0;
     1296        cc_copy.chunks[0].target_off = 0;
     1297        cc_copy.chunks[0].length = 4096;
     1298
     1299        ndr_ret = ndr_push_struct_blob(
     1300            &ioctl.smb2.in.out, tmp_ctx, &cc_copy,
     1301            (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
     1302        torture_assert_ndr_success(torture, ndr_ret,
     1303                                   "ndr_push_srv_copychunk_copy");
     1304
     1305        status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
     1306        torture_assert_ntstatus_equal(torture, status, NT_STATUS_OK,
     1307                                      "FSCTL_SRV_COPYCHUNK");
     1308
     1309        smb2_util_close(tree, src_h);
     1310        smb2_util_close(tree, dest_h);
     1311
     1312        /* neither read nor execute permission on src */
     1313        ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
     1314                                   &src_h, 4096, /* fill 4096 byte src file */
     1315                                   SEC_FILE_READ_ATTRIBUTE, &dest_h,
     1316                                   0, /* 0 byte dest file */
     1317                                   SEC_RIGHTS_FILE_ALL, &cc_copy, &ioctl);
    12521318        if (!ok) {
    12531319                torture_fail(torture, "setup copy chunk error");
     
    12731339
    12741340        /* no write permission on dest */
    1275         ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
    1276                                    1, /* 1 chunk */
    1277                                    &src_h, 4096, /* fill 4096 byte src file */
    1278                                    SEC_RIGHTS_FILE_ALL,
    1279                                    &dest_h, 0,  /* 0 byte dest file */
    1280                                    (SEC_RIGHTS_FILE_READ
    1281                                     | SEC_RIGHTS_FILE_EXECUTE),
    1282                                    &cc_copy,
    1283                                    &ioctl);
     1341        ok = test_setup_copy_chunk(
     1342            torture, tree, tmp_ctx, 1, /* 1 chunk */
     1343            &src_h, 4096,             /* fill 4096 byte src file */
     1344            SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE, &dest_h,
     1345            0, /* 0 byte dest file */
     1346            (SEC_RIGHTS_FILE_ALL &
     1347             ~(SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA)),
     1348            &cc_copy, &ioctl);
    12841349        if (!ok) {
    12851350                torture_fail(torture, "setup copy chunk error");
     
    13051370
    13061371        /* no read permission on dest */
    1307         ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
    1308                                    1, /* 1 chunk */
     1372        ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
    13091373                                   &src_h, 4096, /* fill 4096 byte src file */
    1310                                    SEC_RIGHTS_FILE_ALL,
    1311                                    &dest_h, 0,  /* 0 byte dest file */
    1312                                    (SEC_RIGHTS_FILE_WRITE
    1313                                     | SEC_RIGHTS_FILE_EXECUTE),
    1314                                    &cc_copy,
    1315                                    &ioctl);
     1374                                   SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE,
     1375                                   &dest_h, 0, /* 0 byte dest file */
     1376                                   (SEC_RIGHTS_FILE_ALL & ~SEC_FILE_READ_DATA),
     1377                                   &cc_copy, &ioctl);
    13161378        if (!ok) {
    13171379                torture_fail(torture, "setup copy chunk error");
     
    24782540        smb2_util_close(tree, fh);
    24792541
     2542        talloc_free(tmp_ctx);
     2543        return true;
     2544}
     2545
     2546static bool test_ioctl_compress_notsup_get(struct torture_context *torture,
     2547                                           struct smb2_tree *tree)
     2548{
     2549        struct smb2_handle fh;
     2550        NTSTATUS status;
     2551        TALLOC_CTX *tmp_ctx = talloc_new(tree);
     2552        bool ok;
     2553        uint16_t compression_fmt;
     2554
     2555        ok = test_setup_create_fill(torture, tree, tmp_ctx,
     2556                                    FNAME, &fh, 0, SEC_RIGHTS_FILE_ALL,
     2557                                    FILE_ATTRIBUTE_NORMAL);
     2558        torture_assert(torture, ok, "setup compression file");
     2559
     2560        /* skip if the server DOES support compression */
     2561        status = test_ioctl_compress_fs_supported(torture, tree, tmp_ctx, &fh,
     2562                                                  &ok);
     2563        torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FS");
     2564        if (ok) {
     2565                smb2_util_close(tree, fh);
     2566                torture_skip(torture, "FS compression supported\n");
     2567        }
     2568
     2569        /*
     2570         * Despite not supporting compression, we should get a successful
     2571         * response indicating that the file is uncompressed - like WS2016.
     2572         */
     2573        status = test_ioctl_compress_get(torture, tmp_ctx, tree, fh,
     2574                                         &compression_fmt);
     2575        torture_assert_ntstatus_ok(torture, status, "FSCTL_GET_COMPRESSION");
     2576
     2577        torture_assert(torture, (compression_fmt == COMPRESSION_FORMAT_NONE),
     2578                       "initial compression state not NONE");
     2579
     2580        smb2_util_close(tree, fh);
     2581        talloc_free(tmp_ctx);
     2582        return true;
     2583}
     2584
     2585static bool test_ioctl_compress_notsup_set(struct torture_context *torture,
     2586                                           struct smb2_tree *tree)
     2587{
     2588        struct smb2_handle fh;
     2589        NTSTATUS status;
     2590        TALLOC_CTX *tmp_ctx = talloc_new(tree);
     2591        bool ok;
     2592
     2593        ok = test_setup_create_fill(torture, tree, tmp_ctx,
     2594                                    FNAME, &fh, 0, SEC_RIGHTS_FILE_ALL,
     2595                                    FILE_ATTRIBUTE_NORMAL);
     2596        torture_assert(torture, ok, "setup compression file");
     2597
     2598        /* skip if the server DOES support compression */
     2599        status = test_ioctl_compress_fs_supported(torture, tree, tmp_ctx, &fh,
     2600                                                  &ok);
     2601        torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FS");
     2602        if (ok) {
     2603                smb2_util_close(tree, fh);
     2604                torture_skip(torture, "FS compression supported\n");
     2605        }
     2606
     2607        status = test_ioctl_compress_set(torture, tmp_ctx, tree, fh,
     2608                                         COMPRESSION_FORMAT_DEFAULT);
     2609        torture_assert_ntstatus_equal(torture, status,
     2610                                      NT_STATUS_NOT_SUPPORTED,
     2611                                      "FSCTL_GET_COMPRESSION");
     2612
     2613        smb2_util_close(tree, fh);
    24802614        talloc_free(tmp_ctx);
    24812615        return true;
     
    48504984        torture_suite_add_1smb2_test(suite, "compress_perms",
    48514985                                     test_ioctl_compress_perms);
     4986        torture_suite_add_1smb2_test(suite, "compress_notsup_get",
     4987                                     test_ioctl_compress_notsup_get);
     4988        torture_suite_add_1smb2_test(suite, "compress_notsup_set",
     4989                                     test_ioctl_compress_notsup_set);
    48524990        torture_suite_add_1smb2_test(suite, "network_interface_info",
    48534991                                     test_ioctl_network_interface_info);
  • vendor/current/source4/torture/smb2/lock.c

    r988 r989  
    30303030done:
    30313031        smb2_util_close(tree, h);
     3032        smb2_deltree(tree, BASEDIR);
     3033        return ret;
     3034}
     3035
     3036/**
     3037 * Test lock interaction between smbd and ctdb with tombstone records.
     3038 *
     3039 * Re-locking an unlocked record could lead to a deadlock between
     3040 * smbd and ctdb. Make sure we don't regress.
     3041 *
     3042 * https://bugzilla.samba.org/show_bug.cgi?id=12005
     3043 * https://bugzilla.samba.org/show_bug.cgi?id=10008
     3044 */
     3045static bool test_deadlock(struct torture_context *torture,
     3046                          struct smb2_tree *tree)
     3047{
     3048        NTSTATUS status;
     3049        bool ret = true;
     3050        struct smb2_handle _h;
     3051        struct smb2_handle *h = NULL;
     3052        uint8_t buf[200];
     3053        const char *fname = BASEDIR "\\deadlock.txt";
     3054
     3055        if (!lpcfg_clustering(torture->lp_ctx)) {
     3056                torture_skip(torture, "Test must be run on a ctdb cluster\n");
     3057                return true;
     3058        }
     3059
     3060        status = torture_smb2_testdir(tree, BASEDIR, &_h);
     3061        torture_assert_ntstatus_ok(torture, status,
     3062                                   "torture_smb2_testdir failed");
     3063        smb2_util_close(tree, _h);
     3064
     3065        status = torture_smb2_testfile(tree, fname, &_h);
     3066        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3067                                        "torture_smb2_testfile failed");
     3068        h = &_h;
     3069
     3070        ZERO_STRUCT(buf);
     3071        status = smb2_util_write(tree, *h, buf, 0, ARRAY_SIZE(buf));
     3072        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3073                                        "smb2_util_write failed");
     3074
     3075        status = test_smb2_lock(tree, *h, 0, 1, true);
     3076        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3077                                        "test_smb2_lock failed");
     3078
     3079        status = test_smb2_unlock(tree, *h, 0, 1);
     3080        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3081                                        "test_smb2_unlock failed");
     3082
     3083        status = test_smb2_lock(tree, *h, 0, 1, true);
     3084        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3085                                        "test_smb2_lock failed");
     3086
     3087        status = test_smb2_unlock(tree, *h, 0, 1);
     3088        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3089                                        "test_smb2_unlock failed");
     3090
     3091done:
     3092        if (h != NULL) {
     3093                smb2_util_close(tree, *h);
     3094        }
    30323095        smb2_deltree(tree, BASEDIR);
    30333096        return ret;
     
    30693132        torture_suite_add_1smb2_test(suite, "truncate", test_truncate);
    30703133        torture_suite_add_1smb2_test(suite, "replay", test_replay);
     3134        torture_suite_add_1smb2_test(suite, "ctdb-delrec-deadlock", test_deadlock);
    30713135
    30723136        suite->description = talloc_strdup(suite, "SMB2-LOCK tests");
  • vendor/current/source4/torture/smb2/read.c

    r988 r989  
    2828
    2929
    30 #define CHECK_STATUS(status, correct) do { \
    31         if (!NT_STATUS_EQUAL(status, correct)) { \
    32                 printf("(%s) Incorrect status %s - should be %s\n", \
    33                        __location__, nt_errstr(status), nt_errstr(correct)); \
    34                 ret = false; \
    35                 goto done; \
    36         }} while (0)
    37 
    38 #define CHECK_VALUE(v, correct) do { \
    39         if ((v) != (correct)) { \
    40                 printf("(%s) Incorrect value %s=%u - should be %u\n", \
    41                        __location__, #v, (unsigned)v, (unsigned)correct); \
    42                 ret = false; \
    43                 goto done; \
    44         }} while (0)
     30#define CHECK_STATUS(_status, _expected) \
     31        torture_assert_ntstatus_equal_goto(torture, _status, _expected, \
     32                 ret, done, "Incorrect status")
     33
     34#define CHECK_VALUE(v, correct) \
     35        torture_assert_int_equal_goto(torture, v, correct, \
     36                 ret, done, "Incorrect value")
    4537
    4638#define FNAME "smb2_readtest.dat"
     
    235227}
    236228
     229static bool test_read_access(struct torture_context *torture,
     230                             struct smb2_tree *tree)
     231{
     232        bool ret = true;
     233        NTSTATUS status;
     234        struct smb2_handle h;
     235        uint8_t buf[64 * 1024];
     236        struct smb2_read rd;
     237        TALLOC_CTX *tmp_ctx = talloc_new(tree);
     238
     239        ZERO_STRUCT(buf);
     240
     241        /* create a file */
     242        smb2_util_unlink(tree, FNAME);
     243
     244        status = torture_smb2_testfile(tree, FNAME, &h);
     245        CHECK_STATUS(status, NT_STATUS_OK);
     246
     247        status = smb2_util_write(tree, h, buf, 0, ARRAY_SIZE(buf));
     248        CHECK_STATUS(status, NT_STATUS_OK);
     249
     250        status = smb2_util_close(tree, h);
     251        CHECK_STATUS(status, NT_STATUS_OK);
     252
     253        /* open w/ READ access - success */
     254        status = torture_smb2_testfile_access(
     255            tree, FNAME, &h, SEC_FILE_READ_ATTRIBUTE | SEC_FILE_READ_DATA);
     256        CHECK_STATUS(status, NT_STATUS_OK);
     257
     258        ZERO_STRUCT(rd);
     259        rd.in.file.handle = h;
     260        rd.in.length = 5;
     261        rd.in.offset = 0;
     262        status = smb2_read(tree, tree, &rd);
     263        CHECK_STATUS(status, NT_STATUS_OK);
     264
     265        status = smb2_util_close(tree, h);
     266        CHECK_STATUS(status, NT_STATUS_OK);
     267
     268        /* open w/ EXECUTE access - success */
     269        status = torture_smb2_testfile_access(
     270            tree, FNAME, &h, SEC_FILE_READ_ATTRIBUTE | SEC_FILE_EXECUTE);
     271        CHECK_STATUS(status, NT_STATUS_OK);
     272
     273        ZERO_STRUCT(rd);
     274        rd.in.file.handle = h;
     275        rd.in.length = 5;
     276        rd.in.offset = 0;
     277        status = smb2_read(tree, tree, &rd);
     278        CHECK_STATUS(status, NT_STATUS_OK);
     279
     280        status = smb2_util_close(tree, h);
     281        CHECK_STATUS(status, NT_STATUS_OK);
     282
     283        /* open without READ or EXECUTE access - access denied */
     284        status = torture_smb2_testfile_access(tree, FNAME, &h,
     285                                              SEC_FILE_READ_ATTRIBUTE);
     286        CHECK_STATUS(status, NT_STATUS_OK);
     287
     288        ZERO_STRUCT(rd);
     289        rd.in.file.handle = h;
     290        rd.in.length = 5;
     291        rd.in.offset = 0;
     292        status = smb2_read(tree, tree, &rd);
     293        CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
     294
     295        status = smb2_util_close(tree, h);
     296        CHECK_STATUS(status, NT_STATUS_OK);
     297
     298done:
     299        talloc_free(tmp_ctx);
     300        return ret;
     301}
    237302
    238303/*
     
    246311        torture_suite_add_1smb2_test(suite, "position", test_read_position);
    247312        torture_suite_add_1smb2_test(suite, "dir", test_read_dir);
     313        torture_suite_add_1smb2_test(suite, "access", test_read_access);
    248314
    249315        suite->description = talloc_strdup(suite, "SMB2-READ tests");
  • vendor/current/source4/torture/smb2/replay.c

    r988 r989  
    9595#define BASEDIR "replaytestdir"
    9696
    97 static struct {
     97struct break_info {
    9898        struct torture_context *tctx;
    9999        struct smb2_handle handle;
     
    103103        int failures;
    104104        NTSTATUS failure_status;
    105 } break_info;
     105};
     106
     107static struct break_info break_info;
     108
     109static void torture_reset_break_info(struct torture_context *tctx,
     110                                     struct break_info *r)
     111{
     112        ZERO_STRUCTP(r);
     113        r->tctx = tctx;
     114}
    106115
    107116static void torture_oplock_ack_callback(struct smb2_request *req)
     
    161170        req->async.private_data = NULL;
    162171        return true;
     172}
     173
     174/**
     175 * Timer handler function notifies the registering function that time is up
     176 */
     177static void timeout_cb(struct tevent_context *ev,
     178                       struct tevent_timer *te,
     179                       struct timeval current_time,
     180                       void *private_data)
     181{
     182        bool *timesup = (bool *)private_data;
     183        *timesup = true;
     184        return;
     185}
     186
     187/**
     188 *  Wait a short period of time to receive a single oplock break request
     189 */
     190static void torture_wait_for_oplock_break(struct torture_context *tctx)
     191{
     192        TALLOC_CTX *tmp_ctx = talloc_new(NULL);
     193        struct tevent_timer *te = NULL;
     194        struct timeval ne;
     195        bool timesup = false;
     196        int old_count = break_info.count;
     197
     198        /* Wait .1 seconds for an oplock break */
     199        ne = tevent_timeval_current_ofs(0, 100000);
     200
     201        te = tevent_add_timer(tctx->ev, tmp_ctx, ne, timeout_cb, &timesup);
     202        if (te == NULL) {
     203                torture_comment(tctx, "Failed to wait for an oplock break. "
     204                                      "test results may not be accurate.");
     205                goto done;
     206        }
     207
     208        while (!timesup && break_info.count < old_count + 1) {
     209                if (tevent_loop_once(tctx->ev) != 0) {
     210                        torture_comment(tctx, "Failed to wait for an oplock "
     211                                              "break. test results may not be "
     212                                              "accurate.");
     213                        goto done;
     214                }
     215        }
     216
     217done:
     218        /*
     219         * We don't know if the timed event fired and was freed, we received
     220         * our oplock break, or some other event triggered the loop.  Thus,
     221         * we create a tmp_ctx to be able to safely free/remove the timed
     222         * event in all 3 cases.
     223         */
     224        talloc_free(tmp_ctx);
     225
     226        return;
    163227}
    164228
     
    14291493}
    14301494
     1495static bool test_channel_sequence_table(struct torture_context *tctx,
     1496                                        struct smb2_tree *tree,
     1497                                        bool do_replay,
     1498                                        uint16_t opcode)
     1499{
     1500        NTSTATUS status;
     1501        TALLOC_CTX *mem_ctx = talloc_new(tctx);
     1502        struct smb2_handle handle;
     1503        struct smb2_handle *phandle = NULL;
     1504        struct smb2_create io;
     1505        struct GUID create_guid = GUID_random();
     1506        bool ret = true;
     1507        const char *fname = BASEDIR "\\channel_sequence.dat";
     1508        uint16_t csn = 0;
     1509        uint16_t limit = UINT16_MAX - 0x7fff;
     1510        int i;
     1511        struct {
     1512                uint16_t csn;
     1513                bool csn_rand_low;
     1514                bool csn_rand_high;
     1515                NTSTATUS expected_status;
     1516        } tests[] = {
     1517                {
     1518                        .csn                    = 0,
     1519                        .expected_status        = NT_STATUS_OK,
     1520                },{
     1521                        .csn                    = 0x7fff + 1,
     1522                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1523                },{
     1524                        .csn                    = 0x7fff + 2,
     1525                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1526                },{
     1527                        .csn                    = -1,
     1528                        .csn_rand_high          = true,
     1529                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1530                },{
     1531                        .csn                    = 0xffff,
     1532                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1533                },{
     1534                        .csn                    = 0x7fff,
     1535                        .expected_status        = NT_STATUS_OK,
     1536                },{
     1537                        .csn                    = 0x7ffe,
     1538                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1539                },{
     1540                        .csn                    = 0,
     1541                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1542                },{
     1543                        .csn                    = -1,
     1544                        .csn_rand_low           = true,
     1545                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1546                },{
     1547                        .csn                    = 0x7fff + 1,
     1548                        .expected_status        = NT_STATUS_OK,
     1549                },{
     1550                        .csn                    = 0xffff,
     1551                        .expected_status        = NT_STATUS_OK,
     1552                },{
     1553                        .csn                    = 0,
     1554                        .expected_status        = NT_STATUS_OK,
     1555                },{
     1556                        .csn                    = 1,
     1557                        .expected_status        = NT_STATUS_OK,
     1558                },{
     1559                        .csn                    = 0,
     1560                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1561                },{
     1562                        .csn                    = 1,
     1563                        .expected_status        = NT_STATUS_OK,
     1564                },{
     1565                        .csn                    = 0xffff,
     1566                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1567                }
     1568        };
     1569
     1570        smb2cli_session_reset_channel_sequence(tree->session->smbXcli, 0);
     1571
     1572        csn = smb2cli_session_current_channel_sequence(tree->session->smbXcli);
     1573        torture_comment(tctx, "Testing create with channel sequence number: 0x%04x\n", csn);
     1574
     1575        smb2_oplock_create_share(&io, fname,
     1576                        smb2_util_share_access("RWD"),
     1577                        smb2_util_oplock_level("b"));
     1578        io.in.durable_open = false;
     1579        io.in.durable_open_v2 = true;
     1580        io.in.create_guid = create_guid;
     1581        io.in.timeout = UINT32_MAX;
     1582
     1583        torture_assert_ntstatus_ok_goto(tctx,
     1584                smb2_create(tree, mem_ctx, &io),
     1585                ret, done, "failed to call smb2_create");
     1586
     1587        handle = io.out.file.handle;
     1588        phandle = &handle;
     1589
     1590        for (i=0; i <ARRAY_SIZE(tests); i++) {
     1591
     1592                const char *opstr = "";
     1593                union smb_fileinfo qfinfo;
     1594
     1595                csn = tests[i].csn;
     1596
     1597                if (tests[i].csn_rand_low) {
     1598                        csn = rand() % limit;
     1599                } else if (tests[i].csn_rand_high) {
     1600                        csn = rand() % limit + 0x7fff;
     1601                }
     1602
     1603                switch (opcode) {
     1604                case SMB2_OP_WRITE:
     1605                        opstr = "write";
     1606                        break;
     1607                case SMB2_OP_IOCTL:
     1608                        opstr = "ioctl";
     1609                        break;
     1610                case SMB2_OP_SETINFO:
     1611                        opstr = "setinfo";
     1612                        break;
     1613                default:
     1614                        break;
     1615                }
     1616
     1617                smb2cli_session_reset_channel_sequence(tree->session->smbXcli, csn);
     1618                csn = smb2cli_session_current_channel_sequence(tree->session->smbXcli);
     1619
     1620                torture_comment(tctx, "Testing %s (replay: %s) with CSN 0x%04x, expecting: %s\n",
     1621                        opstr, do_replay ? "true" : "false", csn,
     1622                        nt_errstr(tests[i].expected_status));
     1623
     1624                if (do_replay) {
     1625                        smb2cli_session_start_replay(tree->session->smbXcli);
     1626                }
     1627
     1628                switch (opcode) {
     1629                case SMB2_OP_WRITE: {
     1630                        DATA_BLOB blob = data_blob_talloc(tctx, NULL, 255);
     1631
     1632                        generate_random_buffer(blob.data, blob.length);
     1633
     1634                        status = smb2_util_write(tree, handle, blob.data, 0, blob.length);
     1635                        if (NT_STATUS_IS_OK(status)) {
     1636                                struct smb2_read rd;
     1637
     1638                                rd = (struct smb2_read) {
     1639                                        .in.file.handle = handle,
     1640                                        .in.length = blob.length,
     1641                                        .in.offset = 0
     1642                                };
     1643
     1644                                torture_assert_ntstatus_ok_goto(tctx,
     1645                                        smb2_read(tree, tree, &rd),
     1646                                        ret, done, "failed to read after write");
     1647
     1648                                torture_assert_data_blob_equal(tctx,
     1649                                        rd.out.data, blob,
     1650                                        "read/write mismatch");
     1651                        }
     1652                        break;
     1653                }
     1654                case SMB2_OP_IOCTL: {
     1655                        union smb_ioctl ioctl;
     1656                        ioctl = (union smb_ioctl) {
     1657                                .smb2.level = RAW_IOCTL_SMB2,
     1658                                .smb2.in.file.handle = handle,
     1659                                .smb2.in.function = FSCTL_CREATE_OR_GET_OBJECT_ID,
     1660                                .smb2.in.max_response_size = 64,
     1661                                .smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL
     1662                        };
     1663                        status = smb2_ioctl(tree, mem_ctx, &ioctl.smb2);
     1664                        break;
     1665                }
     1666                case SMB2_OP_SETINFO: {
     1667                        union smb_setfileinfo sfinfo;
     1668                        ZERO_STRUCT(sfinfo);
     1669                        sfinfo.generic.level = RAW_SFILEINFO_POSITION_INFORMATION;
     1670                        sfinfo.generic.in.file.handle = handle;
     1671                        sfinfo.position_information.in.position = 0x1000;
     1672                        status = smb2_setinfo_file(tree, &sfinfo);
     1673                        break;
     1674                }
     1675                default:
     1676                        break;
     1677                }
     1678
     1679                qfinfo = (union smb_fileinfo) {
     1680                        .generic.level = RAW_SFILEINFO_POSITION_INFORMATION,
     1681                        .generic.in.file.handle = handle
     1682                };
     1683
     1684                torture_assert_ntstatus_ok_goto(tctx,
     1685                        smb2_getinfo_file(tree, mem_ctx, &qfinfo),
     1686                        ret, done, "failed to read after write");
     1687
     1688                if (do_replay) {
     1689                        smb2cli_session_stop_replay(tree->session->smbXcli);
     1690                }
     1691
     1692                torture_assert_ntstatus_equal_goto(tctx,
     1693                        status, tests[i].expected_status,
     1694                        ret, done, "got unexpected failure code");
     1695
     1696        }
     1697done:
     1698        if (phandle != NULL) {
     1699                smb2_util_close(tree, *phandle);
     1700        }
     1701
     1702        smb2_util_unlink(tree, fname);
     1703
     1704        return ret;
     1705}
     1706
     1707static bool test_channel_sequence(struct torture_context *tctx,
     1708                                  struct smb2_tree *tree)
     1709{
     1710        TALLOC_CTX *mem_ctx = talloc_new(tctx);
     1711        bool ret = true;
     1712        const char *fname = BASEDIR "\\channel_sequence.dat";
     1713        struct smb2_transport *transport1 = tree->session->transport;
     1714        struct smb2_handle handle;
     1715        uint32_t server_capabilities;
     1716        uint16_t opcodes[] = { SMB2_OP_WRITE, SMB2_OP_IOCTL, SMB2_OP_SETINFO };
     1717        int i;
     1718
     1719        if (smbXcli_conn_protocol(transport1->conn) < PROTOCOL_SMB3_00) {
     1720                torture_skip(tctx, "SMB 3.X Dialect family required for "
     1721                                   "Replay tests\n");
     1722        }
     1723
     1724        server_capabilities = smb2cli_conn_server_capabilities(
     1725                                        tree->session->transport->conn);
     1726        if (!(server_capabilities & SMB2_CAP_MULTI_CHANNEL)) {
     1727                torture_skip(tctx,
     1728                             "Server does not support multi-channel.");
     1729        }
     1730
     1731        torture_comment(tctx, "Testing channel sequence numbers\n");
     1732
     1733        torture_assert_ntstatus_ok_goto(tctx,
     1734                torture_smb2_testdir(tree, BASEDIR, &handle),
     1735                ret, done, "failed to setup test directory");
     1736
     1737        smb2_util_close(tree, handle);
     1738        smb2_util_unlink(tree, fname);
     1739
     1740        for (i=0; i <ARRAY_SIZE(opcodes); i++) {
     1741                torture_assert(tctx,
     1742                        test_channel_sequence_table(tctx, tree, false, opcodes[i]),
     1743                        "failed to test CSN without replay flag");
     1744                torture_assert(tctx,
     1745                        test_channel_sequence_table(tctx, tree, true, opcodes[i]),
     1746                        "failed to test CSN with replay flag");
     1747        }
     1748
     1749done:
     1750
     1751        smb2_util_unlink(tree, fname);
     1752        smb2_deltree(tree, BASEDIR);
     1753
     1754        talloc_free(tree);
     1755        talloc_free(mem_ctx);
     1756
     1757        return ret;
     1758}
     1759
    14311760/**
    14321761 * Test Durablity V2 Create Replay Detection on Multi Channel
     
    19572286}
    19582287
     2288
     2289/**
     2290 * Test Error Codes when a DurableHandleReqV2 with matching CreateGuid is
     2291 * re-sent with or without SMB2_FLAGS_REPLAY_OPERATION
     2292 */
     2293static bool test_replay6(struct torture_context *tctx, struct smb2_tree *tree)
     2294{
     2295        NTSTATUS status;
     2296        TALLOC_CTX *mem_ctx = talloc_new(tctx);
     2297        struct smb2_handle _h;
     2298        struct smb2_handle *h = NULL;
     2299        struct smb2_create io, ref1;
     2300        union smb_fileinfo qfinfo;
     2301        struct GUID create_guid = GUID_random();
     2302        bool ret = true;
     2303        const char *fname = BASEDIR "\\replay6.dat";
     2304        struct smb2_transport *transport = tree->session->transport;
     2305
     2306        if (smbXcli_conn_protocol(transport->conn) < PROTOCOL_SMB3_00) {
     2307                torture_skip(tctx, "SMB 3.X Dialect family required for "
     2308                                   "replay tests\n");
     2309        }
     2310
     2311        torture_reset_break_info(tctx, &break_info);
     2312        tree->session->transport->oplock.handler = torture_oplock_ack_handler;
     2313        tree->session->transport->oplock.private_data = tree;
     2314
     2315        torture_comment(tctx, "Error Codes for DurableHandleReqV2 Replay\n");
     2316        smb2_util_unlink(tree, fname);
     2317        status = torture_smb2_testdir(tree, BASEDIR, &_h);
     2318        CHECK_STATUS(status, NT_STATUS_OK);
     2319        smb2_util_close(tree, _h);
     2320        torture_wait_for_oplock_break(tctx);
     2321        CHECK_VAL(break_info.count, 0);
     2322        torture_reset_break_info(tctx, &break_info);
     2323
     2324        smb2_oplock_create_share(&io, fname,
     2325                        smb2_util_share_access("RWD"),
     2326                        smb2_util_oplock_level("b"));
     2327        io.in.durable_open = false;
     2328        io.in.durable_open_v2 = true;
     2329        io.in.persistent_open = false;
     2330        io.in.create_guid = create_guid;
     2331        io.in.timeout = UINT32_MAX;
     2332
     2333        status = smb2_create(tree, mem_ctx, &io);
     2334        CHECK_STATUS(status, NT_STATUS_OK);
     2335        ref1 = io;
     2336        _h = io.out.file.handle;
     2337        h = &_h;
     2338        CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
     2339        CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
     2340        CHECK_VAL(io.out.durable_open, false);
     2341        CHECK_VAL(io.out.durable_open_v2, true);
     2342
     2343        io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
     2344        io.in.create_disposition = NTCREATEX_DISP_OPEN;
     2345        smb2cli_session_start_replay(tree->session->smbXcli);
     2346        status = smb2_create(tree, mem_ctx, &io);
     2347        smb2cli_session_stop_replay(tree->session->smbXcli);
     2348        CHECK_STATUS(status, NT_STATUS_OK);
     2349        CHECK_CREATE_OUT(&io, &ref1);
     2350        torture_wait_for_oplock_break(tctx);
     2351        CHECK_VAL(break_info.count, 0);
     2352        torture_reset_break_info(tctx, &break_info);
     2353
     2354        qfinfo = (union smb_fileinfo) {
     2355                .generic.level = RAW_SFILEINFO_POSITION_INFORMATION,
     2356                .generic.in.file.handle = *h
     2357        };
     2358        torture_comment(tctx, "Trying getinfo\n");
     2359        status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
     2360        CHECK_STATUS(status, NT_STATUS_OK);
     2361        CHECK_VAL(qfinfo.position_information.out.position, 0);
     2362
     2363        smb2cli_session_start_replay(tree->session->smbXcli);
     2364        status = smb2_create(tree, mem_ctx, &io);
     2365        smb2cli_session_stop_replay(tree->session->smbXcli);
     2366        CHECK_STATUS(status, NT_STATUS_OK);
     2367        torture_assert_u64_not_equal_goto(tctx,
     2368                io.out.file.handle.data[0],
     2369                ref1.out.file.handle.data[0],
     2370                ret, done, "data 0");
     2371        torture_assert_u64_not_equal_goto(tctx,
     2372                io.out.file.handle.data[1],
     2373                ref1.out.file.handle.data[1],
     2374                ret, done, "data 1");
     2375        torture_wait_for_oplock_break(tctx);
     2376        CHECK_VAL(break_info.count, 1);
     2377        CHECK_VAL(break_info.level, smb2_util_oplock_level("s"));
     2378        torture_reset_break_info(tctx, &break_info);
     2379
     2380        /*
     2381         * Resend the matching Durable V2 Create without
     2382         * SMB2_FLAGS_REPLAY_OPERATION. This triggers an oplock break and still
     2383         * gets NT_STATUS_DUPLICATE_OBJECTID
     2384         */
     2385        status = smb2_create(tree, mem_ctx, &io);
     2386        CHECK_STATUS(status, NT_STATUS_DUPLICATE_OBJECTID);
     2387        torture_wait_for_oplock_break(tctx);
     2388        CHECK_VAL(break_info.count, 0);
     2389        torture_reset_break_info(tctx, &break_info);
     2390
     2391        /*
     2392         * According to MS-SMB2 3.3.5.9.10 if Durable V2 Create is replayed and
     2393         * FileAttributes or CreateDisposition do not match the earlier Create
     2394         * request the Server fails request with
     2395         * NT_STATUS_INVALID_PARAMETER. But through this test we see that server
     2396         * does not really care about changed FileAttributes or
     2397         * CreateDisposition.
     2398         */
     2399        io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
     2400        io.in.create_disposition = NTCREATEX_DISP_OPEN;
     2401        smb2cli_session_start_replay(tree->session->smbXcli);
     2402        status = smb2_create(tree, mem_ctx, &io);
     2403        smb2cli_session_stop_replay(tree->session->smbXcli);
     2404        CHECK_STATUS(status, NT_STATUS_OK);
     2405        torture_assert_u64_not_equal_goto(tctx,
     2406                io.out.file.handle.data[0],
     2407                ref1.out.file.handle.data[0],
     2408                ret, done, "data 0");
     2409        torture_assert_u64_not_equal_goto(tctx,
     2410                io.out.file.handle.data[1],
     2411                ref1.out.file.handle.data[1],
     2412                ret, done, "data 1");
     2413        torture_wait_for_oplock_break(tctx);
     2414        CHECK_VAL(break_info.count, 0);
     2415
     2416done:
     2417        if (h != NULL) {
     2418                smb2_util_close(tree, *h);
     2419        }
     2420
     2421        smb2_util_unlink(tree, fname);
     2422        smb2_deltree(tree, BASEDIR);
     2423
     2424        talloc_free(tree);
     2425        talloc_free(mem_ctx);
     2426
     2427        return ret;
     2428}
     2429
    19592430struct torture_suite *torture_smb2_replay_init(void)
    19602431{
     
    19722443        torture_suite_add_1smb2_test(suite, "replay-dhv2-lease3",  test_replay_dhv2_lease3);
    19732444        torture_suite_add_1smb2_test(suite, "replay-dhv2-lease-oplock",  test_replay_dhv2_lease_oplock);
     2445        torture_suite_add_1smb2_test(suite, "channel-sequence", test_channel_sequence);
    19742446        torture_suite_add_1smb2_test(suite, "replay3", test_replay3);
    19752447        torture_suite_add_1smb2_test(suite, "replay4", test_replay4);
    19762448        torture_suite_add_1smb2_test(suite, "replay5", test_replay5);
     2449        torture_suite_add_1smb2_test(suite, "replay6", test_replay6);
    19772450
    19782451        suite->description = talloc_strdup(suite, "SMB2 REPLAY tests");
  • vendor/current/source4/torture/smb2/smb2.c

    r988 r989  
    171171        torture_suite_add_suite(suite, torture_smb2_session_init());
    172172        torture_suite_add_suite(suite, torture_smb2_replay_init());
     173        torture_suite_add_simple_test(suite, "dosmode", torture_smb2_dosmode);
    173174
    174175        torture_suite_add_suite(suite, torture_smb2_doc_init());
  • vendor/current/source4/torture/smb2/util.c

    r988 r989  
    262262}
    263263
     264/*
     265  get granted access of a file handle
     266*/
     267NTSTATUS torture_smb2_get_allinfo_access(struct smb2_tree *tree,
     268                                         struct smb2_handle handle,
     269                                         uint32_t *granted_access)
     270{
     271        NTSTATUS status;
     272        TALLOC_CTX *tmp_ctx = talloc_new(tree);
     273        union smb_fileinfo io;
     274
     275        io.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
     276        io.generic.in.file.handle = handle;
     277
     278        status = smb2_getinfo_file(tree, tmp_ctx, &io);
     279        if (!NT_STATUS_IS_OK(status)) {
     280                DEBUG(0, ("getinfo failed - %s\n", nt_errstr(status)));
     281                goto out;
     282        }
     283
     284        *granted_access = io.all_info2.out.access_mask;
     285
     286out:
     287        talloc_free(tmp_ctx);
     288        return status;
     289}
     290
    264291/**
    265292 * open a smb2 tree connect
     
    429456}
    430457
    431 
    432458/*
    433459  create and return a handle to a test file
    434 */
    435 NTSTATUS torture_smb2_testfile(struct smb2_tree *tree, const char *fname,
    436                                struct smb2_handle *handle)
     460  with a specific access mask
     461*/
     462NTSTATUS torture_smb2_testfile_access(struct smb2_tree *tree, const char *fname,
     463                                      struct smb2_handle *handle,
     464                                      uint32_t desired_access)
    437465{
    438466        struct smb2_create io;
     
    441469        ZERO_STRUCT(io);
    442470        io.in.oplock_level = 0;
    443         io.in.desired_access = SEC_RIGHTS_FILE_ALL;
     471        io.in.desired_access = desired_access;
    444472        io.in.file_attributes   = FILE_ATTRIBUTE_NORMAL;
    445473        io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
     
    460488
    461489/*
     490  create and return a handle to a test file
     491*/
     492NTSTATUS torture_smb2_testfile(struct smb2_tree *tree, const char *fname,
     493                               struct smb2_handle *handle)
     494{
     495        return torture_smb2_testfile_access(tree, fname, handle,
     496                                            SEC_RIGHTS_FILE_ALL);
     497}
     498
     499/*
    462500  create and return a handle to a test directory
    463 */
    464 NTSTATUS torture_smb2_testdir(struct smb2_tree *tree, const char *fname,
    465                               struct smb2_handle *handle)
     501  with specific desired access
     502*/
     503NTSTATUS torture_smb2_testdir_access(struct smb2_tree *tree, const char *fname,
     504                                     struct smb2_handle *handle,
     505                                     uint32_t desired_access)
    466506{
    467507        struct smb2_create io;
     
    470510        ZERO_STRUCT(io);
    471511        io.in.oplock_level = 0;
    472         io.in.desired_access = SEC_RIGHTS_DIR_ALL;
     512        io.in.desired_access = desired_access;
    473513        io.in.file_attributes   = FILE_ATTRIBUTE_DIRECTORY;
    474514        io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
     
    485525}
    486526
     527/*
     528  create and return a handle to a test directory
     529*/
     530NTSTATUS torture_smb2_testdir(struct smb2_tree *tree, const char *fname,
     531                              struct smb2_handle *handle)
     532{
     533        return torture_smb2_testdir_access(tree, fname, handle,
     534                                           SEC_RIGHTS_DIR_ALL);
     535}
    487536
    488537/*
  • vendor/current/source4/torture/smb2/wscript_build

    r988 r989  
    55        smb2.c durable_open.c durable_v2_open.c oplock.c dir.c lease.c create.c
    66        acls.c read.c compound.c streams.c ioctl.c rename.c
    7         session.c delete-on-close.c replay.c notify_disabled.c''',
     7        session.c delete-on-close.c replay.c notify_disabled.c dosmode.c''',
    88        subsystem='smbtorture',
    99        deps='LIBCLI_SMB2 POPT_CREDENTIALS torture NDR_IOCTL',
  • vendor/current/source4/torture/vfs/vfs.c

    r988 r989  
    108108
    109109        torture_suite_add_suite(suite, torture_vfs_fruit());
     110        torture_suite_add_suite(suite, torture_acl_xattr());
    110111
    111112        torture_register_suite(suite);
  • vendor/current/source4/torture/wscript_build

    r988 r989  
    270270
    271271bld.SAMBA_MODULE('TORTURE_VFS',
    272         source='vfs/vfs.c vfs/fruit.c',
     272        source='vfs/vfs.c vfs/fruit.c vfs/acl_xattr.c',
    273273        subsystem='smbtorture',
    274274        deps='LIBCLI_SMB POPT_CREDENTIALS TORTURE_UTIL smbclient-raw TORTURE_RAW',
Note: See TracChangeset for help on using the changeset viewer.