diff options
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/ldap/basic.c | 20 | ||||
-rw-r--r-- | source4/torture/raw/rename.c | 50 |
2 files changed, 54 insertions, 16 deletions
diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 3ed0b481ea..c2a26f81b8 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -217,7 +217,7 @@ static bool test_error_codes(struct torture_context *tctx, WERROR err; NTSTATUS status; - printf("Testing error codes\n"); + printf("Testing error codes - to make this test pass against SAMBA 4 you have to specify the target!\n"); if (!basedn) { return false; @@ -257,7 +257,7 @@ static bool test_error_codes(struct torture_context *tctx, err = ad_error(rep->r.AddResponse.errormessage, &endptr); err_code_str = win_errstr(err); printf(" - Errorcode: %s; Reason: %s\n", err_code_str, endptr); - if (torture_setting_bool(tctx, "samba4", false)) { + if (!torture_setting_bool(tctx, "samba4", false)) { if ((!W_ERROR_EQUAL(err, WERR_DS_REFERRAL)) || (rep->r.AddResponse.resultcode != 10)) { return false; @@ -269,18 +269,6 @@ static bool test_error_codes(struct torture_context *tctx, } } - printf(" Try a wrong removal\n"); - - msg->type = LDAP_TAG_DelRequest; - msg->r.DelRequest.dn = ""; - - req = ldap_request_send(conn, msg); - if (!req) { - return false; - } - - status = ldap_result_one(req, &rep, LDAP_TAG_DelResponse); - printf(" Try a wrong modification\n"); msg->type = LDAP_TAG_ModifyRequest; @@ -310,7 +298,7 @@ static bool test_error_codes(struct torture_context *tctx, err = ad_error(rep->r.ModifyResponse.errormessage, &endptr); err_code_str = win_errstr(err); printf(" - Errorcode: %s; Reason: %s\n", err_code_str, endptr); - if (torture_setting_bool(tctx, "samba4", false)) { + if (!torture_setting_bool(tctx, "samba4", false)) { if ((!W_ERROR_EQUAL(err, WERR_INVALID_PARAM)) || (rep->r.ModifyResponse.resultcode != 53)) { return false; @@ -349,7 +337,7 @@ static bool test_error_codes(struct torture_context *tctx, err = ad_error(rep->r.DelResponse.errormessage, &endptr); err_code_str = win_errstr(err); printf(" - Errorcode: %s; Reason: %s\n", err_code_str, endptr); - if (torture_setting_bool(tctx, "samba4", false)) { + if (!torture_setting_bool(tctx, "samba4", false)) { if ((!W_ERROR_EQUAL(err, WERR_DS_OBJ_NOT_FOUND)) || (rep->r.DelResponse.resultcode != 32)) { return false; diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c index e91c3b2319..15fed0e3d8 100644 --- a/source4/torture/raw/rename.c +++ b/source4/torture/raw/rename.c @@ -529,6 +529,7 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c const char *dname1 = BASEDIR "\\dir_for_rename"; const char *dname2 = BASEDIR "\\renamed_dir"; const char *fname = BASEDIR "\\dir_for_rename\\file.txt"; + const char *sname = BASEDIR "\\dir_for_rename:a stream:$DATA"; bool ret = true; int fnum = -1; @@ -593,6 +594,55 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c status = smb_raw_rename(cli->tree, &ren_io); CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); + /* Close the file and try the rename. */ + smbcli_close(cli->tree, fnum); + + status = smb_raw_rename(cli->tree, &ren_io); + CHECK_STATUS(status, NT_STATUS_OK); + + /* + * Now try just holding a second handle on the directory and holding + * it open across a rename. This should be allowed. + */ + io.ntcreatex.in.fname = dname2; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF; + + io.ntcreatex.in.access_mask = SEC_STD_READ_CONTROL | + SEC_FILE_READ_ATTRIBUTE | SEC_FILE_READ_EA | SEC_FILE_READ_DATA; + + status = smb_raw_open(cli->tree, tctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + fnum = io.ntcreatex.out.file.fnum; + + ren_io.generic.level = RAW_RENAME_RENAME; + ren_io.rename.in.pattern1 = dname2; + ren_io.rename.in.pattern2 = dname1; + ren_io.rename.in.attrib = 0; + + status = smb_raw_rename(cli->tree, &ren_io); + CHECK_STATUS(status, NT_STATUS_OK); + + /* close our handle to the directory. */ + smbcli_close(cli->tree, fnum); + + /* + * Now try opening a stream on the directory and holding it open + * across a rename. This should be allowed. + */ + io.ntcreatex.in.fname = sname; + + status = smb_raw_open(cli->tree, tctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + fnum = io.ntcreatex.out.file.fnum; + + ren_io.generic.level = RAW_RENAME_RENAME; + ren_io.rename.in.pattern1 = dname1; + ren_io.rename.in.pattern2 = dname2; + ren_io.rename.in.attrib = 0; + + status = smb_raw_rename(cli->tree, &ren_io); + CHECK_STATUS(status, NT_STATUS_OK); + done: if (fnum != -1) { |