still works SMB1
authorStefan Metzmacher <metze@samba.org>
Wed, 15 Aug 2018 08:29:06 +0000 (10:29 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 15 Aug 2018 08:35:21 +0000 (10:35 +0200)
source4/torture/basic/delaywrite.c

index 9e99298af51d78a0367d2b731c5bf46bbb9ef9bf..aca49bc804726b1d96957ce824ed5b3f33adb5ed 100644 (file)
@@ -3172,10 +3172,8 @@ static bool test_delaywrite_delaywrite1_get_info(void *private_data,
        struct torture_context *tctx = state->tctx;
        struct smbcli_state *cli = state->cli1;
        struct smbcli_state *cli2 = state->cli2;
-       struct smbcli_state *tmpcli = NULL;
        union smb_fileinfo t1finfo;
        union smb_fileinfo t2finfo;
-       union smb_fileinfo t2pinfo;
        bool ret = true;
 
        ZERO_STRUCTP(finfo);
@@ -3187,34 +3185,18 @@ static bool test_delaywrite_delaywrite1_get_info(void *private_data,
        ZERO_STRUCT(t2finfo);
        t2finfo.basic_info.level = RAW_FILEINFO_BASIC_INFORMATION;
        t2finfo.basic_info.in.file.fnum = state->fnum2;
-       ZERO_STRUCT(t2pinfo);
-       t2pinfo.basic_info.level = RAW_FILEINFO_BASIC_INFORMATION;
-       t2pinfo.basic_info.in.file.path = state->fname;
 
-       if (state->fnum2 != -1) {
-               GET_INFO_FILE2(t2finfo);
-       }
-       tmpcli = cli2;
-       cli2 = cli;
-       if (0) GET_INFO_PATH(t2pinfo);
-       cli2 = tmpcli;
+       GET_INFO_FILE2(t2finfo);
        GET_INFO_FILE(t1finfo);
-if (0) {
        if (t1finfo.basic_info.out.write_time != t2finfo.basic_info.out.write_time) {
                /*
                 * There was a race, get it again on handle 2,
                 * but then they have to match.
                 */
-       if (state->fnum2 != -1) {
                GET_INFO_FILE2(t2finfo);
        }
-               if (0) GET_INFO_PATH(t2pinfo);
-       }
-       if (state->fnum2 != -1) {
        COMPARE_ALL_TIMES_EQUAL(t1finfo, t2finfo);
-       }
-       COMPARE_ALL_TIMES_EQUAL(t1finfo, t2pinfo);
-}
+
        finfo->basic_info.out = t1finfo.basic_info.out;
 done:
        return ret;
@@ -3264,21 +3246,14 @@ static bool test_delaywrite_delaywrite1_close(void *private_data,
        t2pinfo.basic_info.level = RAW_FILEINFO_BASIC_INFO;
        t2pinfo.basic_info.in.file.path = state->fname;
 
-       if (state->fnum2 != -1) {
-               GET_INFO_FILE2(t2finfo);
-       }
+       GET_INFO_FILE2(t2finfo);
 
-       if (state->fnum2 != -1) {
-               smbcli_close(state->cli2->tree, state->fnum2);
-               state->fnum2 = -1;
-       }
+       smbcli_close(state->cli2->tree, state->fnum2);
+       state->fnum2 = -1;
 
        GET_INFO_PATH(t2pinfo);
-       if (state->fnum2 != -1) {
        COMPARE_ALL_TIMES_EQUAL(t2pinfo, t2finfo);
-       }
 
-       finfo->basic_info.out = t2finfo.basic_info.out;
        finfo->basic_info.out = t2pinfo.basic_info.out;
 
 done:
@@ -3317,12 +3292,12 @@ static bool test_delaywrite_delaywrite1(struct torture_context *tctx,
                torture_result(tctx, TORTURE_FAIL, __location__": unable to open %s", fname);
                goto done;
        }
-       //state.fnum2 = smbcli_open(cli2->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
-       //if (state.fnum2 == -1) {
-       //      ret = false;
-       //      torture_result(tctx, TORTURE_FAIL, __location__": unable to open %s", fname);
-       //      goto done;
-       //}
+       state.fnum2 = smbcli_open(cli2->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
+       if (state.fnum2 == -1) {
+               ret = false;
+               torture_result(tctx, TORTURE_FAIL, __location__": unable to open %s", fname);
+               goto done;
+       }
 
        state.fname = fname;