summaryrefslogtreecommitdiffstats
path: root/source3/torture/torture.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-29 16:04:21 +0100
committerVolker Lendecke <vl@samba.org>2009-11-29 16:12:51 +0100
commit603a3ba19efb0d1757c7a9ef158d2fe907e48238 (patch)
tree0694076b4ba5cced966eb230f4e14825b1d41d1b /source3/torture/torture.c
parent51bedf939568717424edd7732e1e315faa333849 (diff)
downloadsamba-603a3ba19efb0d1757c7a9ef158d2fe907e48238.tar.gz
samba-603a3ba19efb0d1757c7a9ef158d2fe907e48238.tar.xz
samba-603a3ba19efb0d1757c7a9ef158d2fe907e48238.zip
s3: Factor out torture_setup_unix_extensions
Diffstat (limited to 'source3/torture/torture.c')
-rw-r--r--source3/torture/torture.c50
1 files changed, 31 insertions, 19 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 39f55590669..4b5e8b2dfb8 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);