diff options
author | Volker Lendecke <vl@samba.org> | 2009-11-29 16:04:21 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-11-29 16:12:51 +0100 |
commit | 603a3ba19efb0d1757c7a9ef158d2fe907e48238 (patch) | |
tree | 0694076b4ba5cced966eb230f4e14825b1d41d1b | |
parent | 51bedf939568717424edd7732e1e315faa333849 (diff) | |
download | samba-603a3ba19efb0d1757c7a9ef158d2fe907e48238.tar.gz samba-603a3ba19efb0d1757c7a9ef158d2fe907e48238.tar.bz2 samba-603a3ba19efb0d1757c7a9ef158d2fe907e48238.zip |
s3: Factor out torture_setup_unix_extensions
-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); |