diff options
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/proto.h | 1 | ||||
-rw-r--r-- | source3/torture/torture.c | 50 |
2 files changed, 32 insertions, 19 deletions
diff --git a/source3/torture/proto.h b/source3/torture/proto.h index 5d7504abfd..56396fe4c0 100644 --- a/source3/torture/proto.h +++ b/source3/torture/proto.h @@ -70,6 +70,7 @@ bool torture_cli_session_setup2(struct cli_state *cli, uint16 *new_vuid); bool torture_close_connection(struct cli_state *c); bool torture_ioctl_test(int dummy); bool torture_chkpath_test(int dummy); +NTSTATUS torture_setup_unix_extensions(struct cli_state *cli); /* The following definitions come from torture/utable.c */ diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 39f5559066..4b5e8b2dfb 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -4347,6 +4347,36 @@ static bool run_opentest(int dummy) return correct; } +NTSTATUS torture_setup_unix_extensions(struct cli_state *cli) +{ + uint16 major, minor; + uint32 caplow, caphigh; + NTSTATUS status; + + if (!SERVER_HAS_UNIX_CIFS(cli)) { + printf("Server doesn't support UNIX CIFS extensions.\n"); + return NT_STATUS_NOT_SUPPORTED; + } + + status = cli_unix_extensions_version(cli, &major, &minor, &caplow, + &caphigh); + if (!NT_STATUS_IS_OK(status)) { + printf("Server didn't return UNIX CIFS extensions: %s\n", + nt_errstr(status)); + return status; + } + + status = cli_set_unix_extensions_capabilities(cli, major, minor, + caplow, caphigh); + if (!NT_STATUS_IS_OK(status)) { + printf("Server doesn't support setting UNIX CIFS extensions: " + "%s.\n", nt_errstr(status)); + return status; + } + + return NT_STATUS_OK; +} + /* Test POSIX open /mkdir calls. */ @@ -4359,8 +4389,6 @@ static bool run_simple_posix_open_test(int dummy) const char *dname = "posix:dir"; char buf[10]; char namebuf[11]; - uint16 major, minor; - uint32 caplow, caphigh; uint16_t fnum1 = (uint16_t)-1; SMB_STRUCT_STAT sbuf; bool correct = false; @@ -4374,27 +4402,11 @@ static bool run_simple_posix_open_test(int dummy) cli_sockopt(cli1, sockops); - if (!SERVER_HAS_UNIX_CIFS(cli1)) { - printf("Server doesn't support UNIX CIFS extensions.\n"); - return false; - } - - status = cli_unix_extensions_version(cli1, &major, &minor, &caplow, - &caphigh); + status = torture_setup_unix_extensions(cli1); if (!NT_STATUS_IS_OK(status)) { - printf("Server didn't return UNIX CIFS extensions: %s\n", - nt_errstr(status)); return false; } - status = cli_set_unix_extensions_capabilities(cli1, major, minor, - caplow, caphigh); - if (!NT_STATUS_IS_OK(status)) { - printf("Server doesn't support setting UNIX CIFS extensions: " - "%s.\n", nt_errstr(status)); - return false; - } - cli_setatr(cli1, fname, 0, 0); cli_posix_unlink(cli1, fname); cli_setatr(cli1, dname, 0, 0); |