Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source4/torture/basic/aliases.c

    r414 r745  
    2222#include "libcli/raw/libcliraw.h"
    2323#include "libcli/raw/raw_proto.h"
    24 #include "torture/torture.h"
    2524#include "libcli/libcli.h"
    2625#include "torture/util.h"
     
    385384struct torture_suite *torture_trans2_aliases(TALLOC_CTX *mem_ctx)
    386385{
    387         struct torture_suite *suite = torture_suite_create(mem_ctx, "ALIASES");
     386        struct torture_suite *suite = torture_suite_create(mem_ctx, "aliases");
    388387
    389388        torture_suite_add_1smb_test(suite, "QFILEINFO aliases", qfsinfo_aliases);
  • trunk/server/source4/torture/basic/attr.c

    r414 r745  
    2121
    2222#include "includes.h"
    23 #include "torture/torture.h"
    2423#include "libcli/libcli.h"
    2524#include "torture/util.h"
     25#include "system/filesys.h"
     26#include "libcli/security/secace.h"
    2627
    2728extern int torture_failures;
     
    5152
    5253struct trunc_open_results {
    53         uint_t num;
     54        unsigned int num;
    5455        uint32_t init_attr;
    5556        uint32_t trunc_attr;
     
    9394        int fnum1;
    9495        uint16_t attr;
    95         uint_t i, j, k, l;
     96        unsigned int i, j, k, l;
    9697        int failures = 0;
    9798
     
    123124                                for (l = 0; l < ARRAY_SIZE(attr_results); l++) {
    124125                                        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)",
    126128                                                                k, open_attrs_table[i],
    127129                                                                open_attrs_table[j],
     
    162164                                            open_attrs_table[i] != attr_results[l].init_attr ||
    163165                                            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",
    165168                                                       k, open_attrs_table[i],
    166169                                                       open_attrs_table[j],
    167                                                        (uint_t)attr,
     170                                                       (unsigned int)attr,
    168171                                                       attr_results[l].result_attr);
    169172                                                CHECK_MAX_FAILURES(error_exit);
     
    182185}
    183186
     187bool 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
     309error_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        }
     424error_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  
    2828#include "system/time.h"
    2929#include "libcli/resolve/resolve.h"
    30 #include "librpc/gen_ndr/ndr_nbt.h"
    3130#include "lib/events/events.h"
    32 #include "lib/cmdline/popt_common.h"
    3331#include "param/param.h"
    3432
     
    4442        struct smbcli_options options;
    4543
    46         make_nbt_name_client(&calling, lp_netbios_name(tctx->lp_ctx));
     44        make_nbt_name_client(&calling, lpcfg_netbios_name(tctx->lp_ctx));
    4745
    4846        nbt_choose_called_name(NULL, &called, host, NBT_NAME_SERVER);
     
    5452        }
    5553
    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))) {
    6259                torture_comment(tctx, "Failed to connect with %s\n", host);
    6360                goto failed;
     
    363360        for (i=0;i<100;i++) {
    364361                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);
    366363                event_loop_once(cli->transport->socket->event.ctx);
    367364                if (req->state == SMBCLI_REQUEST_ERROR) {
     
    571568        for (i=0;i<torture_numops;i++)
    572569        {
    573                 size_t buf_size = ((uint_t)random()%(sizeof(buf)-1))+ 1;
     570                size_t buf_size = ((unsigned int)random()%(sizeof(buf)-1))+ 1;
    574571                if (i % 10 == 0) {
    575572                        if (torture_setting_bool(tctx, "progress", true)) {
     
    684681                torture_comment(tctx, "pid %u open %d\n", (unsigned)getpid(), i);
    685682
    686                 msleep(10 * msec);
     683                smb_msleep(10 * msec);
    687684                i++;
    688685                if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
     
    690687                        return false;
    691688                }
    692                 msleep(2 * msec);
     689                smb_msleep(2 * msec);
    693690        }
    694691
     
    816813       
    817814        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));
    819817                CHECK_MAX_FAILURES(error_test1);
    820818                return false;
    821819        }
     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
     839error_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);
    822845       
    823846        fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE);
    824847        if (fnum1 == -1) {
    825848                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));
    849849                return false;
    850850        }
     
    891891        /* Ensure size == 20. */
    892892        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));
    894895                CHECK_MAX_FAILURES(error_test3);
    895896                return false;
     
    897898       
    898899        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");
    900902                CHECK_MAX_FAILURES(error_test3);
    901903                return false;
     
    906908        fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY|O_TRUNC, DENY_NONE);
    907909        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));
    909912                CHECK_MAX_FAILURES(error_test3);
    910913                return false;
     
    912915       
    913916        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));
    915919                return false;
    916920        }
     
    918922        /* Ensure size == 0. */
    919923        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));
    921926                CHECK_MAX_FAILURES(error_test3);
    922927                return false;
     
    924929
    925930        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");
    927933                CHECK_MAX_FAILURES(error_test3);
    928934                return false;
     
    930936        torture_comment(tctx, "finished open test 3\n");
    931937error_test3:   
     938
     939        fnum1 = fnum2 = -1;
    932940        smbcli_unlink(cli1->tree, fname);
    933941
    934942
    935         torture_comment(tctx, "testing ctemp\n");
     943        torture_comment(tctx, "Testing ctemp\n");
    936944        fnum1 = smbcli_ctemp(cli1->tree, "\\", &tmp_path);
    937945        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));
    939948                CHECK_MAX_FAILURES(error_test4);
    940949                return false;
    941950        }
    942951        torture_comment(tctx, "ctemp gave path %s\n", tmp_path);
     952
     953error_test4:
    943954        if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) {
    944955                torture_comment(tctx, "close of temp failed (%s)\n", smbcli_errstr(cli1->tree));
     
    947958                torture_comment(tctx, "unlink of temp failed (%s)\n", smbcli_errstr(cli1->tree));
    948959        }
    949 error_test4:   
     960
    950961        /* Test the non-io opens... */
    951962
     963        torture_comment(tctx, "Test #1 testing 2 non-io opens (no delete)\n");
     964        fnum1 = fnum2 = -1;
    952965        smbcli_setatr(cli2->tree, fname, 0, 0);
    953966        smbcli_unlink(cli2->tree, fname);
    954        
    955         torture_comment(tctx, "TEST #1 testing 2 non-io opens (no delete)\n");
    956        
     967
    957968        fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL,
    958969                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
    959970
    960971        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));
    962974                CHECK_MAX_FAILURES(error_test10);
    963975                return false;
     
    967979                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OPEN_IF, 0, 0);
    968980        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));
    970983                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));
    980984                return false;
    981985        }
     
    983987        torture_comment(tctx, "non-io open test #1 passed.\n");
    984988error_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;
    985999        smbcli_unlink(cli1->tree, fname);
    9861000
    987         torture_comment(tctx, "TEST #2 testing 2 non-io opens (first with delete)\n");
    988        
    9891001        fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL,
    9901002                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
    9911003
    9921004        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));
    9941007                CHECK_MAX_FAILURES(error_test20);
    9951008                return false;
     
    10001013
    10011014        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));
    10031017                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));
    10131018                return false;
    10141019        }
     
    10161021        torture_comment(tctx, "non-io open test #2 passed.\n");
    10171022error_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;
    10181032        smbcli_unlink(cli1->tree, fname);
    10191033
    1020         torture_comment(tctx, "TEST #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
    10221036        fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL,
    10231037                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
    10241038
    10251039        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));
    10271042                CHECK_MAX_FAILURES(error_test30);
    10281043                return false;
     
    10331048
    10341049        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));
    10361052                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));
    10461053                return false;
    10471054        }
     
    10491056        torture_comment(tctx, "non-io open test #3 passed.\n");
    10501057error_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;
    10511068        smbcli_unlink(cli1->tree, fname);
    10521069
    1053         torture_comment(tctx, "TEST #4 testing 2 non-io opens (both with delete)\n");
    1054        
    10551070        fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL,
    10561071                                   NTCREATEX_SHARE_ACCESS_NONE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
    10571072
    10581073        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));
    10601076                CHECK_MAX_FAILURES(error_test40);
    10611077                return false;
     
    10661082
    10671083        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));
    10691086                CHECK_MAX_FAILURES(error_test40);
    10701087                return false;
    10711088        }
    10721089
    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");
    10791091
    10801092        torture_comment(tctx, "non-io open test #4 passed.\n");
    10811093error_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;
    10821104        smbcli_unlink(cli1->tree, fname);
    10831105
    1084         torture_comment(tctx, "TEST #5 testing 2 non-io opens (both with delete - both with file share delete)\n");
    1085        
    10861106        fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL,
    10871107                                   NTCREATEX_SHARE_ACCESS_DELETE, NTCREATEX_DISP_OVERWRITE_IF, 0, 0);
    10881108
    10891109        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));
    10911112                CHECK_MAX_FAILURES(error_test50);
    10921113                return false;
     
    10971118
    10981119        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));
    11001122                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));
    11111123                return false;
    11121124        }
     
    11141126        torture_comment(tctx, "non-io open test #5 passed.\n");
    11151127error_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;
    11181139        smbcli_unlink(cli1->tree, fname);
    11191140
     
    11221143
    11231144        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));
    11251147                CHECK_MAX_FAILURES(error_test60);
    11261148                return false;
     
    11311153
    11321154        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));
    11341157                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));
    11451158                return false;
    11461159        }
     
    11481161        torture_comment(tctx, "non-io open test #6 passed.\n");
    11491162error_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;
    11521174        smbcli_unlink(cli1->tree, fname);
    11531175
     
    11561178
    11571179        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));
    11591182                CHECK_MAX_FAILURES(error_test70);
    11601183                return false;
     
    11651188
    11661189        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));
    11681192                CHECK_MAX_FAILURES(error_test70);
    11691193                return false;
    11701194        }
    11711195
    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");
     1199error_test70:
    11731200
    11741201        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;
    11851210        smbcli_unlink(cli1->tree, fname);
    11861211
     
    12021227        /* Ensure size == 20. */
    12031228        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));
    12051231                CHECK_MAX_FAILURES(error_test80);
    12061232                return false;
     
    12081234       
    12091235        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);
    12111238                CHECK_MAX_FAILURES(error_test80);
    12121239                return false;
     
    12151242        /* Get an exclusive lock on the open file. */
    12161243        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));
    12181246                CHECK_MAX_FAILURES(error_test80);
    12191247                return false;
     
    12281256        /* Ensure size == 0. */
    12291257        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));
    12311260                CHECK_MAX_FAILURES(error_test80);
    12321261                return false;
     
    12341263       
    12351264        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);
    12371267                CHECK_MAX_FAILURES(error_test80);
    12381268                return false;
     
    12551285        smbcli_unlink(cli1->tree, fname);
    12561286
    1257         return correct;
     1287        return failures > 0 ? false : correct;
    12581288}
    12591289
     
    13641394                }
    13651395        }
    1366 
    1367         return true;
    13681396}
    13691397
     
    14571485        NTSTATUS status;
    14581486
    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")) {
    14621490                torture_comment(tctx, "Could not set 'nt status support = yes'\n");
    14631491                goto fail;
     
    14681496        }
    14691497
    1470         if (!lp_set_cmdline(tctx->lp_ctx, "nt status support", "no")) {
     1498        if (!lpcfg_set_cmdline(tctx->lp_ctx, "nt status support", "no")) {
    14711499                torture_comment(tctx, "Could not set 'nt status support = yes'\n");
    14721500                goto fail;
     
    14771505        }
    14781506
    1479         if (!lp_set_cmdline(tctx->lp_ctx, "nt status support",
     1507        if (!lpcfg_set_cmdline(tctx->lp_ctx, "nt status support",
    14801508                            nt_status_support ? "yes":"no")) {
    14811509                torture_comment(tctx, "Could not reset 'nt status support = yes'");
     
    14941522        io.generic.level = RAW_OPEN_NTCREATEX;
    14951523        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
    1496         io.ntcreatex.in.root_fid = 0;
     1524        io.ntcreatex.in.root_fid.fnum = 0;
    14971525        io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
    14981526        io.ntcreatex.in.alloc_size = 1024*1024;
     
    16281656
    16291657                io.generic.level = RAW_OPEN_NTCREATEX;
    1630                 io.ntcreatex.in.root_fid = 0;
     1658                io.ntcreatex.in.root_fid.fnum = 0;
    16311659                io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
    16321660                io.ntcreatex.in.alloc_size = 0;
     
    17241752}
    17251753
     1754/**
     1755  This checks file/dir birthtime
     1756*/
     1757static 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
     1765static 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
    17261869
    17271870NTSTATUS torture_base_init(void)
    17281871{
    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);
    17321875        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);
    17541898        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);
    17581903        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);
    17621907        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);
    17671912        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);
    17811927
    17821928        suite->description = talloc_strdup(suite,
  • trunk/server/source4/torture/basic/charset.c

    r414 r745  
    2121
    2222#include "includes.h"
    23 #include "torture/torture.h"
    24 #include "libcli/raw/libcliraw.h"
    2523#include "libcli/libcli.h"
    2624#include "torture/util.h"
     
    5755        SSVAL(ucs_name, i*2, 0);
    5856
    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)) {
    6058                torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n");
    6159                talloc_free(ucs_name);
     
    7169        io.generic.level = RAW_OPEN_NTCREATEX;
    7270        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
    73         io.ntcreatex.in.root_fid = 0;
     71        io.ntcreatex.in.root_fid.fnum = 0;
    7472        io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
    7573        io.ntcreatex.in.alloc_size = 0;
     
    200198struct torture_suite *torture_charset(TALLOC_CTX *mem_ctx)
    201199{
    202         struct torture_suite *suite = torture_suite_create(mem_ctx, "CHARSET");
     200        struct torture_suite *suite = torture_suite_create(mem_ctx, "charset");
    203201
    204202        torture_suite_add_1smb_test(suite, "Testing composite character (a umlaut)", test_composed);
  • trunk/server/source4/torture/basic/delaywrite.c

    r414 r745  
    112112                }
    113113                fflush(stdout);
    114                 msleep(1 * msec);
     114                smb_msleep(1 * msec);
    115115        }
    116116       
     
    163163        /* 3 second delay to ensure we get past any 2 second time
    164164           granularity (older systems may have that) */
    165         msleep(3 * msec);
     165        smb_msleep(3 * msec);
    166166
    167167        finfo1.all_info.level = RAW_FILEINFO_ALL_INFO;
     
    181181        /* 3 second delay to ensure we get past any 2 second time
    182182           granularity (older systems may have that) */
    183         msleep(3 * msec);
     183        smb_msleep(3 * msec);
    184184
    185185        /* Do a zero length SMBwrite call to truncate. */
     
    232232                }
    233233                fflush(stdout);
    234                 msleep(1 * msec);
     234                smb_msleep(1 * msec);
    235235        }
    236236
     
    242242
    243243        fflush(stdout);
    244         msleep(2 * msec);
     244        smb_msleep(2 * msec);
    245245
    246246        /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
     
    283283                }
    284284                fflush(stdout);
    285                 msleep(1 * msec);
     285                smb_msleep(1 * msec);
    286286        }
    287287
     
    293293
    294294        fflush(stdout);
    295         msleep(2 * msec);
     295        smb_msleep(2 * msec);
    296296
    297297        /* the close should trigger an write time update */
     
    354354        /* 3 second delay to ensure we get past any 2 second time
    355355           granularity (older systems may have that) */
    356         msleep(3 * msec);
     356        smb_msleep(3 * msec);
    357357
    358358        finfo1.all_info.level = RAW_FILEINFO_ALL_INFO;
     
    419419                }
    420420                fflush(stdout);
    421                 msleep(1 * msec);
     421                smb_msleep(1 * msec);
    422422        }
    423423
     
    429429
    430430        fflush(stdout);
    431         msleep(2 * msec);
     431        smb_msleep(2 * msec);
    432432
    433433        /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
     
    468468                }
    469469                fflush(stdout);
    470                 msleep(1 * msec);
     470                smb_msleep(1 * msec);
    471471        }
    472472
     
    536536        /* 3 second delay to ensure we get past any 2 second time
    537537           granularity (older systems may have that) */
    538         msleep(3 * msec);
     538        smb_msleep(3 * msec);
    539539
    540540        finfo1.all_info.level = RAW_FILEINFO_ALL_INFO;
     
    597597                }
    598598                fflush(stdout);
    599                 msleep(1 * msec);
     599                smb_msleep(1 * msec);
    600600        }
    601601
     
    607607
    608608        fflush(stdout);
    609         msleep(2 * msec);
     609        smb_msleep(2 * msec);
    610610
    611611        /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
     
    645645                }
    646646                fflush(stdout);
    647                 msleep(1 * msec);
     647                smb_msleep(1 * msec);
    648648        }
    649649
     
    711711        /* 3 second delay to ensure we get past any 2 second time
    712712           granularity (older systems may have that) */
    713         msleep(3 * msec);
     713        smb_msleep(3 * msec);
    714714
    715715        finfo1.all_info.level = RAW_FILEINFO_ALL_INFO;
     
    777777                }
    778778                fflush(stdout);
    779                 msleep(1 * msec);
     779                smb_msleep(1 * msec);
    780780        }
    781781
     
    787787
    788788        fflush(stdout);
    789         msleep(2 * msec);
     789        smb_msleep(2 * msec);
    790790
    791791        /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
     
    823823                }
    824824                fflush(stdout);
    825                 msleep(1 * msec);
     825                smb_msleep(1 * msec);
    826826        }
    827827
     
    901901        /* 3 second delay to ensure we get past any 2 second time
    902902           granularity (older systems may have that) */
    903         msleep(3 * msec);
     903        smb_msleep(3 * msec);
    904904
    905905        {
     
    10081008                }
    10091009                fflush(stdout);
    1010                 msleep(1 * msec);
     1010                smb_msleep(1 * msec);
    10111011        }
    10121012       
     
    10161016
    10171017        fflush(stdout);
    1018         msleep(2 * msec);
     1018        smb_msleep(2 * msec);
    10191019
    10201020        fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE);
     
    11001100                }
    11011101                fflush(stdout);
    1102                 msleep(1 * msec);
     1102                smb_msleep(1 * msec);
    11031103        }
    11041104       
     
    11321132               nt_time_string(tctx, finfo1.basic_info.out.write_time));
    11331133
    1134         msleep(10 * msec);
     1134        smb_msleep(10 * msec);
    11351135        torture_comment(tctx, "Doing a 10 byte write to extend the file to see if this changes the last write time.\n");
    11361136
     
    11881188                }
    11891189                fflush(stdout);
    1190                 msleep(1*msec);
     1190                smb_msleep(1*msec);
    11911191        }
    11921192       
     
    12591259        }
    12601260
    1261         msleep(1 * msec);
     1261        smb_msleep(1 * msec);
    12621262
    12631263        written =  smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
     
    15741574                        break;
    15751575                }
    1576                 msleep(0.5 * msec);
     1576                smb_msleep(0.5 * msec);
    15771577        }
    15781578
     
    16031603                        break;
    16041604                }
    1605                 msleep(1 * msec);
     1605                smb_msleep(1 * msec);
    16061606        }
    16071607
     
    16131613
    16141614        /* sleep */
    1615         msleep(5 * msec);
     1615        smb_msleep(5 * msec);
    16161616
    16171617        GET_INFO_BOTH(finfo3,pinfo3);
     
    17001700         * doesn't depend on the time since the open
    17011701         */
    1702         msleep(5 * msec);
     1702        smb_msleep(5 * msec);
    17031703
    17041704        /* get the initial times */
     
    17401740                        break;
    17411741                }
    1742                 msleep(0.5 * msec);
     1742                smb_msleep(0.5 * msec);
    17431743        }
    17441744
     
    17461746        COMPARE_WRITE_TIME_GREATER(pinfo1, pinfo0);
    17471747
    1748         msleep(3 * msec);
     1748        smb_msleep(3 * msec);
    17491749
    17501750        /*
     
    17531753         */
    17541754        for (i=0; i < 3; i++) {
    1755                 msleep(2 * msec);
     1755                smb_msleep(2 * msec);
    17561756                /* do a write */
    17571757                torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i);
     
    17681768        }
    17691769
    1770         msleep(3 * msec);
     1770        smb_msleep(3 * msec);
    17711771
    17721772        /* sure any further write doesn't update the write time */
     
    17931793                        break;
    17941794                }
    1795                 msleep(1 * msec);
     1795                smb_msleep(1 * msec);
    17961796        }
    17971797
     
    18031803
    18041804        /* sleep */
    1805         msleep(3 * msec);
     1805        smb_msleep(3 * msec);
    18061806
    18071807        /* get the initial times */
     
    18141814         */
    18151815        for (i=0; i < 3; i++) {
    1816                 msleep(2 * msec);
     1816                smb_msleep(2 * msec);
    18171817                /* do a write */
    18181818                torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i);
     
    18301830
    18311831        /* sleep */
    1832         msleep(3 * msec);
     1832        smb_msleep(3 * msec);
    18331833
    18341834        GET_INFO_BOTH(finfo3,pinfo3);
     
    19151915         * doesn't depend on the time since the open
    19161916         */
    1917         msleep(5 * msec);
     1917        smb_msleep(5 * msec);
    19181918
    19191919        /* get the initial times */
     
    19551955                        break;
    19561956                }
    1957                 msleep(0.5 * msec);
     1957                smb_msleep(0.5 * msec);
    19581958        }
    19591959
     
    19841984                        break;
    19851985                }
    1986                 msleep(1 * msec);
     1986                smb_msleep(1 * msec);
    19871987        }
    19881988
     
    19941994
    19951995        /* sleep */
    1996         msleep(5 * msec);
     1996        smb_msleep(5 * msec);
    19971997
    19981998        GET_INFO_BOTH(finfo3,pinfo3);
     
    20832083         * doesn't depend on the time since the open
    20842084         */
    2085         msleep(5 * msec);
     2085        smb_msleep(5 * msec);
    20862086
    20872087        /* get the initial times */
     
    20942094         */
    20952095        for (i=0; i < 3; i++) {
    2096                 msleep(2 * msec);
     2096                smb_msleep(2 * msec);
    20972097                /* do a write */
    20982098                torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i);
     
    21312131                        break;
    21322132                }
    2133                 msleep(1 * msec);
     2133                smb_msleep(1 * msec);
    21342134        }
    21352135
     
    21412141
    21422142        /* sleep */
    2143         msleep(5 * msec);
     2143        smb_msleep(5 * msec);
    21442144
    21452145        /* get the initial times */
     
    21522152         */
    21532153        for (i=0; i < 3; i++) {
    2154                 msleep(2 * msec);
     2154                smb_msleep(2 * msec);
    21552155                /* do a write */
    21562156                torture_comment(tctx, "Do a truncate write [%d] on the file handle\n", i);
     
    21682168
    21692169        /* sleep */
    2170         msleep(5 * msec);
     2170        smb_msleep(5 * msec);
    21712171
    21722172        GET_INFO_BOTH(finfo2,pinfo2);
     
    21962196                        break;
    21972197                }
    2198                 msleep(1 * msec);
     2198                smb_msleep(1 * msec);
    21992199        }
    22002200
     
    22062206
    22072207        /* sleep */
    2208         msleep(5 * msec);
     2208        smb_msleep(5 * msec);
    22092209
    22102210        GET_INFO_BOTH(finfo3,pinfo3);
     
    22902290
    22912291        /* sleep a bit */
    2292         msleep(5 * msec);
     2292        smb_msleep(5 * msec);
    22932293
    22942294        /* do a write */
     
    23302330                        break;
    23312331                }
    2332                 msleep(0.5 * msec);
     2332                smb_msleep(0.5 * msec);
    23332333        }
    23342334
     
    23592359                        break;
    23602360                }
    2361                 msleep(1 * msec);
     2361                smb_msleep(1 * msec);
    23622362        }
    23632363
     
    23692369
    23702370        /* sleep */
    2371         msleep(5 * msec);
     2371        smb_msleep(5 * msec);
    23722372
    23732373        GET_INFO_BOTH(finfo3,pinfo3);
     
    24902490                        break;
    24912491                }
    2492                 msleep(1 * msec);
     2492                smb_msleep(1 * msec);
    24932493        }
    24942494
     
    25222522                        break;
    25232523                }
    2524                 msleep(1 * msec);
     2524                smb_msleep(1 * msec);
    25252525        }
    25262526
     
    25322532
    25332533        /* sleep */
    2534         msleep(5 * msec);
     2534        smb_msleep(5 * msec);
    25352535
    25362536        GET_INFO_BOTH(finfo5,pinfo5);
     
    26522652                        break;
    26532653                }
    2654                 msleep(1 * msec);
     2654                smb_msleep(1 * msec);
    26552655        }
    26562656
     
    26842684                        break;
    26852685                }
    2686                 msleep(1 * msec);
     2686                smb_msleep(1 * msec);
    26872687        }
    26882688
     
    26942694
    26952695        /* sleep */
    2696         msleep(5 * msec);
     2696        smb_msleep(5 * msec);
    26972697
    26982698        GET_INFO_BOTH(finfo5,pinfo5);
     
    28312831                        break;
    28322832                }
    2833                 msleep(1 * msec);
     2833                smb_msleep(1 * msec);
    28342834        }
    28352835
     
    28632863                        break;
    28642864                }
    2865                 msleep(1 * msec);
     2865                smb_msleep(1 * msec);
    28662866        }
    28672867
     
    28732873
    28742874        /* sleep */
    2875         msleep(5 * msec);
     2875        smb_msleep(5 * msec);
    28762876
    28772877        GET_INFO_BOTH(finfo5,pinfo5);
     
    28992899
    29002900        /* See if we have lost the sticky write time on handle2 */
    2901         msleep(3 * msec);
     2901        smb_msleep(3 * msec);
    29022902        torture_comment(tctx, "Have we lost the sticky write time ?\n");
    29032903
     
    29262926                        break;
    29272927                }
    2928                 msleep(1 * msec);
     2928                smb_msleep(1 * msec);
    29292929        }
    29302930
     
    29532953                        break;
    29542954                }
    2955                 msleep(1 * msec);
     2955                smb_msleep(1 * msec);
    29562956        }
    29572957
     
    31033103struct torture_suite *torture_delay_write(void)
    31043104{
    3105         struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "DELAYWRITE");
     3105        struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "delaywrite");
    31063106
    31073107        torture_suite_add_2smb_test(suite, "finfo update on close", test_finfo_after_write);
  • trunk/server/source4/torture/basic/delete.c

    r414 r745  
    2222#include "includes.h"
    2323#include "libcli/libcli.h"
    24 #include "torture/torture.h"
    2524#include "torture/util.h"
    2625#include "system/filesys.h"
    27 #include "libcli/raw/libcliraw.h"
    2826#include "libcli/raw/raw_proto.h"
    2927
     
    14251423        /* On slow build farm machines it might happen that they are not fast
    14261424         * enogh to delete the file for this test */
    1427         msleep(200);
     1425        smb_msleep(200);
    14281426
    14291427        /* File should not be there. */
     
    15181516        CHECK_STATUS(cli1, NT_STATUS_DELETE_PENDING);
    15191517
     1518        smbcli_close(cli1->tree, dnum2);
     1519        CHECK_STATUS(cli1, NT_STATUS_OK);
     1520
    15201521        return correct;
     1522}
     1523
     1524/* Test 23 - Second directory open fails when delete is pending. */
     1525static 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;
    15211581}
    15221582
     
    15271587{
    15281588        struct torture_suite *suite = torture_suite_create(
    1529                 talloc_autofree_context(),
    1530                 "DELETE");
     1589                talloc_autofree_context(), "delete");
    15311590
    15321591        torture_suite_add_2smb_test(suite, "deltest1", deltest1);
     
    15541613        torture_suite_add_simple_test(suite, "deltest21", deltest21);
    15551614        torture_suite_add_simple_test(suite, "deltest22", deltest22);
     1615        torture_suite_add_2smb_test(suite, "deltest23", deltest23);
    15561616
    15571617        return suite;
  • trunk/server/source4/torture/basic/denytest.c

    r414 r745  
    1919
    2020#include "includes.h"
    21 #include "torture/torture.h"
    2221#include "system/filesys.h"
    23 #include "libcli/raw/libcliraw.h"
    2422#include "libcli/libcli.h"
    2523#include "libcli/security/security.h"
    2624#include "torture/util.h"
    27 #include "torture/smbtorture.h"
    28 #include "libcli/util/clilsa.h"
    2925#include "cxd_known.h"
    3026
     
    14041400
    14051401
    1406 static void progress_bar(struct torture_context *tctx, uint_t i, uint_t total)
     1402static void progress_bar(struct torture_context *tctx, unsigned int i, unsigned int total)
    14071403{
    14081404        if (torture_setting_bool(tctx, "progress", true)) {
     
    14211417        int i;
    14221418        bool correct = true;
    1423         struct timeval tv, tv_start;
     1419        struct timespec tv, tv_start;
    14241420        const char *fnames[2] = {"\\denytest1.dat", "\\denytest1.exe"};
    14251421        int failures=0;
     
    14341430        }
    14351431
    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);
    14391435
    14401436        for (i=0; i<ARRAY_SIZE(denytable1); i++) {
     
    14431439
    14441440                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;
    14451451
    14461452                fnum1 = smbcli_open(cli1->tree, fname,
     
    14691475                        res != denytable1[i].result) {
    14701476                        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;
    14741480                        torture_comment(tctx, "%lld: %s %8s %10s    %8s %10s    %s (correct=%s)\n",
    14751481                               (long long)tdif,
     
    15131519        bool correct = true;
    15141520        const char *fnames[2] = {"\\denytest2.dat", "\\denytest2.exe"};
    1515         struct timeval tv, tv_start;
     1521        struct timespec tv, tv_start;
    15161522        int failures=0;
    15171523
     
    15231529        }
    15241530
    1525         GetTimeOfDay(&tv_start);
     1531        clock_gettime_mono(&tv_start);
    15261532
    15271533        for (i=0; i<ARRAY_SIZE(denytable2); i++) {
     
    15301536
    15311537                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;
    15321548
    15331549                fnum1 = smbcli_open(cli1->tree, fname,
     
    15561572                        res != denytable2[i].result) {
    15571573                        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;
    15611577                        torture_comment(tctx, "%lld: %s %8s %10s    %8s %10s    %s (correct=%s)\n",
    15621578                               (long long)tdif,
     
    17271743 */
    17281744static 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)
    17301747{
    17311748        const struct bit_value share_access_bits[] = {
     
    17471764        int i;
    17481765        bool correct = true;
    1749         struct timeval tv, tv_start;
     1766        struct timespec tv, tv_start;
    17501767        const char *fname;
    17511768        int nbits1 = ARRAY_SIZE(share_access_bits);
     
    17671784        smbcli_close(cli1->tree, fnum1);
    17681785
    1769         GetTimeOfDay(&tv_start);
     1786        clock_gettime_mono(&tv_start);
    17701787
    17711788        io1.ntcreatex.level = RAW_OPEN_NTCREATEX;
    1772         io1.ntcreatex.in.root_fid = 0;
     1789        io1.ntcreatex.in.root_fid.fnum = 0;
    17731790        io1.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
    17741791        io1.ntcreatex.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
     
    17811798        io2 = io1;
    17821799
    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);
    17841801
    17851802        for (i=0;i<torture_numops;i++) {
     
    18551872                                                   &res2);
    18561873               
    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;
    18601877                if (torture_setting_bool(tctx, "showall", false) ||
    18611878                    !NT_STATUS_EQUAL(status2, status2_p) ||
     
    20792096}
    20802097
    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 
    20882098#define CREATEX_NAME "\\createx_dir"
    20892099
     
    21082118        NTSTATUS status;
    21092119
    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
    21192130        status = smb_raw_open(tree, mem_ctx, &open_parms);
    21202131        CHECK_STATUS(status, NT_STATUS_OK);
     
    21302141    int sharemode, const char *fname)
    21312142{
    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;
    21412152}
    21422153
     
    21442155    int sharemode, const char *fname)
    21452156{
    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;
    21552167}
    21562168
     
    21672179
    21682180        /* 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
    21782191        status = smb_raw_open(tree, mem_ctx, &open_parms);
    21792192        CHECK_STATUS(status, NT_STATUS_OK);
     
    21832196
    21842197        /* 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;
    21952208
    21962209        result[CXD_DIR_CREATE_CHILD] =
     
    21992212
    22002213        /* 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;
    22112224
    22122225        result[CXD_DIR_TRAVERSE] =
     
    22252238    struct smbcli_tree *tree, int fnum, TALLOC_CTX *mem_ctx, NTSTATUS *result)
    22262239{
    2227         union smb_read rd = {};
    2228         union smb_write wr = {};
     2240        union smb_read rd;
     2241        union smb_write wr;
    22292242        char buf[256] = "";
    22302243
     2244        memset(&rd, 0, sizeof(rd));
    22312245        rd.readx.level = RAW_READ_READX;
    22322246        rd.readx.in.file.fnum = fnum;
    22332247        rd.readx.in.mincnt = sizeof(buf);
    22342248        rd.readx.in.maxcnt = sizeof(buf);
    2235         rd.readx.out.data = buf;
     2249        rd.readx.out.data = (uint8_t *)buf;
    22362250
    22372251        result[CXD_FILE_READ] = smb_raw_read(tree, &rd);
    22382252
     2253        memset(&wr, 0, sizeof(wr));
    22392254        wr.writex.level = RAW_WRITE_WRITEX;
    22402255        wr.writex.in.file.fnum = fnum;
    22412256        wr.writex.in.count = sizeof(buf);
    2242         wr.writex.in.data = buf;
     2257        wr.writex.in.data = (uint8_t *)buf;
    22432258
    22442259        result[CXD_FILE_WRITE] = smb_raw_write(tree, &wr);
     
    22502265        rd.readx.in.maxcnt = sizeof(buf);
    22512266        rd.readx.in.read_for_execute = 1;
    2252         rd.readx.out.data = buf;
     2267        rd.readx.out.data = (uint8_t *)buf;
    22532268
    22542269        result[CXD_FILE_EXECUTE] = smb_raw_read(tree, &rd);
     
    22602275 * the output. Could use a switch "--noprogress", or direct the progress bar to
    22612276 * stderr? No other solution? */
    2262 static void createx_progress_bar(struct torture_context *tctx, uint_t i,
    2263     uint_t total, uint_t skipped)
     2277static void createx_progress_bar(struct torture_context *tctx, unsigned int i,
     2278    unsigned int total, unsigned int skipped)
    22642279{
    22652280        if (torture_setting_bool(tctx, "progress", true)) {
     
    25822597                            &cxd, est);
    25832598                }
    2584 
    25852599                for (i = 0; i < num_access_bits; i++) {
    25862600                        /* And now run through the single access bits. */
     
    26662680{
    26672681        struct security_descriptor *sd, *sd_orig;
    2668         union smb_open io = {};
     2682        union smb_open io;
    26692683        static TALLOC_CTX *mem_ctx;
    26702684        int fnum, i;
     
    26912705
    26922706        /* create initial file with restrictive SD */
     2707        memset(&io, 0, sizeof(io));
    26932708        io.generic.level = RAW_OPEN_NTTRANS_CREATE;
    26942709        io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
     
    27162731        owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
    27172732
    2718         status = smblsa_sid_check_privilege(cli,
    2719                                             owner_sid,
    2720                                             sec_privilege_name(SEC_PRIV_RESTORE));
     2733        status = torture_check_privilege(cli,
     2734                                         owner_sid,
     2735                                         sec_privilege_name(SEC_PRIV_RESTORE));
    27212736        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));
    27272744        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");
    27292748
    27302749        smbcli_close(cli->tree, fnum);
     
    27742793
    27752794 done:
     2795        smbcli_unlink(cli->tree, MAXIMUM_ALLOWED_FILE);
    27762796        return ret;
    27772797}
  • trunk/server/source4/torture/basic/dir.c

    r414 r745  
    2222#include "includes.h"
    2323#include "libcli/libcli.h"
    24 #include "torture/torture.h"
    2524#include "torture/util.h"
    2625#include "system/filesys.h"
  • trunk/server/source4/torture/basic/disconnect.c

    r414 r745  
    2121
    2222#include "includes.h"
    23 #include "torture/torture.h"
    2423#include "system/filesys.h"
    2524#include "libcli/raw/libcliraw.h"
     
    5049
    5150        io.generic.level = RAW_OPEN_NTCREATEX;
    52         io.ntcreatex.in.root_fid = 0;
     51        io.ntcreatex.in.root_fid.fnum = 0;
    5352        io.ntcreatex.in.flags = 0;
    5453        io.ntcreatex.in.access_mask = SEC_FILE_READ_DATA;
     
    164163                         * failures in the build farm.
    165164                         */
    166                         msleep(200);
     165                        smb_msleep(200);
    167166                }
    168167        }
  • trunk/server/source4/torture/basic/locking.c

    r414 r745  
    2222
    2323#include "includes.h"
    24 #include "libcli/raw/libcliraw.h"
    2524#include "libcli/libcli.h"
    26 #include "torture/smbtorture.h"
    2725#include "torture/util.h"
    2826#include "system/time.h"
     
    4543        int fnum1, fnum2, fnum3;
    4644        time_t t1, t2;
    47         uint_t lock_timeout;
     45        unsigned int lock_timeout;
    4846
    4947        if (!torture_setup_dir(cli1, BASEDIR)) {
     
    109107        torture_comment(tctx, "Testing lock timeout with timeout=%u\n",
    110108                                        lock_timeout);
    111         t1 = time(NULL);
     109        t1 = time_mono(NULL);
    112110        torture_assert(tctx,
    113111                !NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, lock_timeout * 1000, WRITE_LOCK)),
     
    116114        if (!check_error(__location__, cli2, ERRDOS, ERRlock,
    117115                                 NT_STATUS_FILE_LOCK_CONFLICT)) return false;
    118         t2 = time(NULL);
     116        t2 = time_mono(NULL);
    119117
    120118        if (t2 - t1 < 5) {
     
    123121        }
    124122        torture_comment(tctx, "server slept for %u seconds for a %u second timeout\n",
    125                (uint_t)(t2-t1), lock_timeout);
     123               (unsigned int)(t2-t1), lock_timeout);
    126124
    127125        torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum2),
     
    805803struct torture_suite *torture_base_locktest(TALLOC_CTX *mem_ctx)
    806804{
    807         struct torture_suite *suite = torture_suite_create(mem_ctx, "LOCK");
     805        struct torture_suite *suite = torture_suite_create(mem_ctx, "lock");
    808806        torture_suite_add_2smb_test(suite, "LOCK1", torture_locktest1);
    809807        torture_suite_add_1smb_test(suite, "LOCK2", torture_locktest2);
  • trunk/server/source4/torture/basic/mangle_test.c

    r414 r745  
    1919
    2020#include "includes.h"
    21 #include "torture/torture.h"
    2221#include "system/filesys.h"
    2322#include "system/dir.h"
    24 #include "../tdb/include/tdb.h"
     23#include <tdb.h>
    2524#include "../lib/util/util_tdb.h"
    2625#include "libcli/libcli.h"
     
    3130#define NAME_LENGTH 20
    3231
    33 static uint_t total, collisions, failures;
     32static unsigned int total, collisions, failures;
    3433
    3534static bool test_one(struct torture_context *tctx ,struct smbcli_state *cli,
     
    116115{
    117116        const char *chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-$~...";
    118         uint_t max_idx = strlen(chars);
    119         uint_t len;
     117        unsigned int max_idx = strlen(chars);
     118        unsigned int len;
    120119        int i;
    121120        char *p;
  • trunk/server/source4/torture/basic/misc.c

    r414 r745  
    2929#include "lib/events/events.h"
    3030#include "libcli/resolve/resolve.h"
    31 #include "auth/credentials/credentials.h"
    32 #include "librpc/gen_ndr/ndr_nbt.h"
    3331#include "torture/smbtorture.h"
    3432#include "torture/util.h"
     
    7169
    7270        for (i=0;i<torture_numops;i++) {
    73                 uint_t n = (uint_t)random()%10;
     71                unsigned int n = (unsigned int)random()%10;
    7472                if (i % 10 == 0) {
    7573                        if (torture_setting_bool(tctx, "progress", true)) {
     
    234232
    235233/*
     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 */
     238bool 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/*
    236295test how many open files this server supports on the one socket
    237296*/
     
    369428
    370429        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);
    372431                for (function=0;function<0x100;function++) {
    373432                        parms.ioctl.in.request = (device << 16) | function;
     
    425484                unsigned int writeratio;
    426485                int num_parallel_requests;
    427         } *lp_params;
     486        } *lpcfg_params;
    428487};
    429488
    430489/*
    431         init params using lp_parm_xxx
     490        init params using lpcfg_parm_xxx
    432491        return number of unclist entries
    433492*/
     
    444503        lpar->num_parallel_requests = torture_setting_int(
    445504                tctx, "parallel_requests", 5);
    446         lpar->workgroup = lp_workgroup(tctx->lp_ctx);
     505        lpar->workgroup = lpcfg_workgroup(tctx->lp_ctx);
    447506       
    448507        p = torture_setting_string(tctx, "unclist", NULL);
     
    559618       
    560619        /* randomize between writes and reads*/
    561         if (random() % state->lp_params->writeratio == 0) {
     620        if (random() % state->lpcfg_params->writeratio == 0) {
    562621                torture_comment(tctx, "Callback WRITE file:%d (%d/%d)\n",
    563622                                state->nr,state->completed,torture_numops);
     
    567626                wr.writex.in.wmode      = 0             ;
    568627                wr.writex.in.remaining  = 0;
    569                 wr.writex.in.count      = state->lp_params->blocksize;
     628                wr.writex.in.count      = state->lpcfg_params->blocksize;
    570629                wr.writex.in.data       = state->buffer;
    571630                state->readcnt=0;
     
    576635                                "Callback READ file:%d (%d/%d) Offset:%d\n",
    577636                                state->nr,state->completed,torture_numops,
    578                                 (state->readcnt*state->lp_params->blocksize));
     637                                (state->readcnt*state->lpcfg_params->blocksize));
    579638                rd.generic.level = RAW_READ_READX;
    580639                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;
    583642                rd.readx.in.maxcnt      = rd.readx.in.mincnt;
    584643                rd.readx.in.remaining   = 0     ;
    585644                rd.readx.out.data       = state->buffer;
    586645                rd.readx.in.read_for_execute = false;
    587                 if(state->readcnt < state->lp_params->writeblocks){
     646                if(state->readcnt < state->lpcfg_params->writeblocks){
    588647                        state->readcnt++;       
    589648                }else{
     
    623682               
    624683        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));
    627686        wr.generic.level = RAW_WRITE_WRITEX  ;
    628687        wr.writex.in.file.fnum  = state->fnum ;
    629688        wr.writex.in.offset     = state->writecnt *
    630                                         state->lp_params->blocksize;
     689                                        state->lpcfg_params->blocksize;
    631690        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)-
    634693                                                ((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;
    637696        wr.writex.in.data       = state->buffer;
    638697        state->writecnt++;
    639         if(state->writecnt == state->lp_params->writeblocks){
     698        if(state->writecnt == state->lpcfg_params->writeblocks){
    640699                state->mode=READ_WRITE_DATA;
    641700        }
     
    678737        open_parms->openx.in.fname = state->fname;
    679738               
    680         writedata = talloc_size(tctx,state->lp_params->blocksize);
     739        writedata = talloc_size(tctx,state->lpcfg_params->blocksize);
    681740        NT_STATUS_HAVE_NO_MEMORY(writedata);
    682         generate_random_buffer(writedata,state->lp_params->blocksize);
     741        generate_random_buffer(writedata,state->lpcfg_params->blocksize);
    683742        state->buffer=writedata;
    684743        state->writecnt=1;
     
    735794        case READ_WRITE_DATA:
    736795                while (state->num_parallel_requests
    737                        < state->lp_params->num_parallel_requests) {
     796                       < state->lpcfg_params->num_parallel_requests) {
    738797                        NTSTATUS status;
    739798                        status = benchrw_readwrite(tctx,state);
     
    778837        struct benchrw_state *state = con->async.private_data;
    779838        struct torture_context *tctx = state->tctx;
    780         int retry = state->lp_params->retry;
     839        int retry = state->lpcfg_params->retry;
    781840               
    782841        if (NT_STATUS_IS_OK(con->status)) {
     
    817876        smb->in.dest_host=talloc_strdup(mem_ctx,host);
    818877        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);
    821880        smb->in.called_name = strupper_talloc(mem_ctx, host);
    822881        smb->in.service_type=NULL;
    823882        smb->in.credentials=cmdline_credentials;
    824883        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);
    827885        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);
    830888       
    831889        return smb_composite_connect_send(smb,mem_ctx,
    832                                           lp_resolve_context(tctx->lp_ctx),ev);
     890                                          lpcfg_resolve_context(tctx->lp_ctx),ev);
    833891}
    834892
     
    856914        state = talloc_array(tctx, struct benchrw_state *, torture_nprocs);
    857915
    858         /* init params using lp_parm_xxx */
     916        /* init params using lpcfg_parm_xxx */
    859917        num_unc_names = init_benchrw_params(tctx,&lpparams);
    860918       
     
    865923                state[i]->completed=0;
    866924                state[i]->num_parallel_requests=0;
    867                 state[i]->lp_params=&lpparams;
     925                state[i]->lpcfg_params=&lpparams;
    868926                state[i]->nr=i;
    869927                state[i]->dname=talloc_asprintf(tctx,"benchrw%d",i);
  • trunk/server/source4/torture/basic/properties.c

    r414 r745  
    2121
    2222#include "includes.h"
    23 #include "torture/torture.h"
    24 #include "libcli/raw/libcliraw.h"
    2523#include "libcli/libcli.h"
    2624#include "torture/util.h"
  • trunk/server/source4/torture/basic/rename.c

    r414 r745  
    2222#include "includes.h"
    2323#include "libcli/libcli.h"
    24 #include "torture/torture.h"
    2524#include "torture/util.h"
    2625
  • trunk/server/source4/torture/basic/scanner.c

    r414 r745  
    1919
    2020#include "includes.h"
    21 #include "torture/torture.h"
    2221#include "libcli/libcli.h"
    2322#include "torture/util.h"
    24 #include "libcli/raw/libcliraw.h"
    2523#include "libcli/raw/raw_proto.h"
    2624#include "system/filesys.h"
     
    438436check for existance of a nttrans call
    439437****************************************************************************/
    440 static bool scan_nttrans(struct smb_iconv_convenience *iconv_convenience,
    441                          struct smbcli_state *cli, int op, int level,
     438static bool scan_nttrans(struct smbcli_state *cli, int op, int level,
    442439                        int fnum, int dnum, const char *fname)
    443440{
     
    549546        int op, level;
    550547        const char *fname = "\\scanner.dat";
    551         struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(torture->lp_ctx);
    552548        int fnum, dnum;
    553549
     
    559555                printf("Scanning op=%d\n", op);
    560556                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);
    563558                }
    564559
    565560                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);
    568562                }
    569563
    570564                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);
    573566                }
    574567        }
  • trunk/server/source4/torture/basic/secleak.c

    r414 r745  
    2121
    2222#include "includes.h"
    23 #include "torture/torture.h"
    2423#include "libcli/raw/libcliraw.h"
    2524#include "libcli/raw/raw_proto.h"
     
    2827#include "system/time.h"
    2928#include "libcli/smb_composite/smb_composite.h"
    30 #include "libcli/smb_composite/proto.h"
    3129#include "auth/credentials/credentials.h"
    3230#include "param/param.h"
     
    3937        struct smbcli_session_options options;
    4038
    41         lp_smbcli_session_options(tctx->lp_ctx, &options);
     39        lpcfg_smbcli_session_options(tctx->lp_ctx, &options);
    4240
    4341        session = smbcli_session_init(cli->transport, cli, false, options);
    4442        setup.in.sesskey = cli->transport->negotiate.sesskey;
    4543        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);
    4745        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);
    4947
    5048        cli_credentials_set_conf(setup.in.credentials, tctx->lp_ctx);
     
    6563bool torture_sec_leak(struct torture_context *tctx, struct smbcli_state *cli)
    6664{
    67         time_t t1 = time(NULL);
     65        time_t t1 = time_mono(NULL);
    6866        int timelimit = torture_setting_int(tctx, "timelimit", 20);
    6967
    70         while (time(NULL) < t1+timelimit) {
     68        while (time_mono(NULL) < t1+timelimit) {
    7169                if (!try_failed_login(tctx, cli)) {
    7270                        return false;
  • trunk/server/source4/torture/basic/unlink.c

    r414 r745  
    2121
    2222#include "includes.h"
    23 #include "torture/torture.h"
    2423#include "system/filesys.h"
    25 #include "libcli/raw/libcliraw.h"
    2624#include "libcli/libcli.h"
    2725#include "torture/util.h"
     
    6361        smbcli_unlink(cli->tree, fname);
    6462
    65         torture_comment(tctx, "testing unlink after ntcreatex with DELETE access\n");
     63        torture_comment(tctx, "Testing unlink after ntcreatex with DELETE access\n");
    6664
    6765        io.ntcreatex.level = RAW_OPEN_NTCREATEX;
    68         io.ntcreatex.in.root_fid = 0;
     66        io.ntcreatex.in.root_fid.fnum = 0;
    6967        io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
    7068        io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
  • trunk/server/source4/torture/basic/utable.c

    r414 r745  
    1919
    2020#include "includes.h"
    21 #include "torture/torture.h"
    2221#include "system/filesys.h"
    2322#include "system/locale.h"
     
    5150                strncpy(fname, "\\utable\\x", sizeof(fname)-1);
    5251                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,
    5453                                     c2, 2,
    55                                      p, sizeof(fname)-strlen(fname), &len, false);
     54                                     p, sizeof(fname)-strlen(fname), false);
    5655                p[len] = 0;
    5756                strncat(fname,"_a_long_extension",sizeof(fname)-1);
     
    9998
    10099
    101 static char *form_name(struct smb_iconv_convenience *iconv_convenience, int c)
     100static char *form_name(int c)
    102101{
    103102        static char fname[256];
     
    110109        SSVAL(c2, 0, c);
    111110
    112         convert_string_convenience(iconv_convenience, CH_UTF16, CH_UNIX,
     111        len = convert_string(CH_UTF16, CH_UNIX,
    113112                             c2, 2,
    114                              p, sizeof(fname)-strlen(fname), &len, false);
     113                             p, sizeof(fname)-strlen(fname), false);
     114        if (len == -1)
     115                return NULL;
    115116        p[len] = 0;
    116117        return fname;
     
    140141                torture_comment(tctx, "%04x (%c)\n", c, isprint(c)?c:'.');
    141142
    142                 fname = form_name(lp_iconv_convenience(tctx->lp_ctx), c);
     143                fname = form_name(c);
    143144                fnum = smbcli_nt_create_full(cli->tree, fname, 0,
    144145#if 0
Note: See TracChangeset for help on using the changeset viewer.