From 0226428eb9d7c6d3a4984d571622f21e9c82e408 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 2 Apr 2011 11:46:30 +0200 Subject: s3: Use cli_writeall instead of cli_write Signed-off-by: Jeremy Allison --- source3/torture/nbio.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source3/torture/nbio.c') diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c index 664943b681..49ac4b5cec 100644 --- a/source3/torture/nbio.c +++ b/source3/torture/nbio.c @@ -189,13 +189,17 @@ void nb_createx(const char *fname, void nb_writex(int handle, int offset, int size, int ret_size) { int i; + NTSTATUS status; if (buf[0] == 0) memset(buf, 1, sizeof(buf)); i = find_handle(handle); - if (cli_write(c, ftable[i].fd, 0, buf, offset, size) != ret_size) { - printf("(%d) ERROR: write failed on handle %d, fd %d \ -errno %d (%s)\n", line_count, handle, ftable[i].fd, errno, strerror(errno)); + status = cli_writeall(c, ftable[i].fd, 0, (uint8_t *)buf, offset, size, + NULL); + if (!NT_STATUS_IS_OK(status)) { + printf("(%d) ERROR: write failed on handle %d, fd %d " + "error %s\n", line_count, handle, ftable[i].fd, + nt_errstr(status)); exit(1); } -- cgit From 317e19aeb3fbdb21573b6ef1bc8c2af646a7e61e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 29 Apr 2011 11:43:35 +1000 Subject: s3-smb Use FILE_ATTRIBUTE_HIDDEN intead of aHIDDEN This means we use just one constant for this file attribute. Andrew Bartlett --- source3/torture/nbio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/nbio.c') diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c index 49ac4b5cec..ed1a3aa5f3 100644 --- a/source3/torture/nbio.c +++ b/source3/torture/nbio.c @@ -134,7 +134,7 @@ void nb_setup(struct cli_state *cli) void nb_unlink(const char *fname) { - if (!NT_STATUS_IS_OK(cli_unlink(c, fname, aSYSTEM | aHIDDEN))) { + if (!NT_STATUS_IS_OK(cli_unlink(c, fname, aSYSTEM | FILE_ATTRIBUTE_HIDDEN))) { #if NBDEBUG printf("(%d) unlink %s failed (%s)\n", line_count, fname, cli_errstr(c)); -- cgit From 0a3c84b554f3862b3e558f62e67ceb8311b248ce Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 29 Apr 2011 13:23:14 +1000 Subject: s3-smb Use FILE_ATTRIBUTE_SYSTEM intead of aSYSTEM This means we use just one constant for this file attribute. Andrew Bartlett --- source3/torture/nbio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/torture/nbio.c') diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c index ed1a3aa5f3..96584455e4 100644 --- a/source3/torture/nbio.c +++ b/source3/torture/nbio.c @@ -134,7 +134,7 @@ void nb_setup(struct cli_state *cli) void nb_unlink(const char *fname) { - if (!NT_STATUS_IS_OK(cli_unlink(c, fname, aSYSTEM | FILE_ATTRIBUTE_HIDDEN))) { + if (!NT_STATUS_IS_OK(cli_unlink(c, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) { #if NBDEBUG printf("(%d) unlink %s failed (%s)\n", line_count, fname, cli_errstr(c)); -- cgit From 0eca33bbf620678759bbe39efaa74f33f96efb74 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 29 Apr 2011 11:57:02 +1000 Subject: s3-smb Use FILE_ATTRIBUTE_DIRECTORY intead of aDIR This means we use just one constant for this file attribute. Andrew Bartlett --- source3/torture/nbio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/torture/nbio.c') diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c index 96584455e4..085d206a75 100644 --- a/source3/torture/nbio.c +++ b/source3/torture/nbio.c @@ -305,13 +305,13 @@ static NTSTATUS delete_fn(const char *mnt, struct file_info *finfo, printf("asprintf failed\n"); return NT_STATUS_NO_MEMORY; } - if (finfo->mode & aDIR) { + if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) { char *s2; if (asprintf(&s2, "%s\\*", s) == -1) { printf("asprintf failed\n"); return NT_STATUS_NO_MEMORY; } - status = cli_list(c, s2, aDIR, delete_fn, NULL); + status = cli_list(c, s2, FILE_ATTRIBUTE_DIRECTORY, delete_fn, NULL); if (!NT_STATUS_IS_OK(status)) { free(n); free(s2); @@ -336,7 +336,7 @@ void nb_deltree(const char *dname) } total_deleted = 0; - cli_list(c, mask, aDIR, delete_fn, NULL); + cli_list(c, mask, FILE_ATTRIBUTE_DIRECTORY, delete_fn, NULL); free(mask); cli_rmdir(c, dname); -- cgit From 27022587e31769718ab53f4d114e03ac2f205f27 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 6 May 2011 11:47:43 +0200 Subject: s3-libsmb: move protos to libsmb/proto.h Guenther --- source3/torture/nbio.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/torture/nbio.c') diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c index 085d206a75..7634f52b14 100644 --- a/source3/torture/nbio.c +++ b/source3/torture/nbio.c @@ -22,6 +22,7 @@ #include "includes.h" #include "torture/proto.h" #include "../libcli/security/security.h" +#include "libsmb/libsmb.h" #include "libsmb/clirap.h" #define MAX_FILES 1000 -- cgit From 23e23d083602d59ec500b4abfc331a451f6e5dbb Mon Sep 17 00:00:00 2001 From: Björn Baumbach Date: Mon, 7 Feb 2011 11:27:02 +0100 Subject: s3-torture/nbio.c: Fix cli_errstr() usage (part of bug #7864) Convert cli_errstr() to nt_errstr() Signed-off-by: Stefan Metzmacher --- source3/torture/nbio.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'source3/torture/nbio.c') diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c index 7634f52b14..0da6bc084e 100644 --- a/source3/torture/nbio.c +++ b/source3/torture/nbio.c @@ -135,10 +135,13 @@ void nb_setup(struct cli_state *cli) void nb_unlink(const char *fname) { - if (!NT_STATUS_IS_OK(cli_unlink(c, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) { + NTSTATUS status; + + status = cli_unlink(c, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN); + if (!NT_STATUS_IS_OK(status)) { #if NBDEBUG printf("(%d) unlink %s failed (%s)\n", - line_count, fname, cli_errstr(c)); + line_count, fname, nt_errstr(status)); #endif } } @@ -166,7 +169,7 @@ void nb_createx(const char *fname, create_options, 0, &fd); if (!NT_STATUS_IS_OK(status) && handle != -1) { printf("ERROR: cli_ntcreate failed for %s - %s\n", - fname, cli_errstr(c)); + fname, nt_errstr(status)); exit(1); } if (NT_STATUS_IS_OK(status) && handle == -1) { @@ -233,18 +236,24 @@ void nb_close(int handle) void nb_rmdir(const char *fname) { - if (!NT_STATUS_IS_OK(cli_rmdir(c, fname))) { + NTSTATUS status; + + status = cli_rmdir(c, fname); + if (!NT_STATUS_IS_OK(status)) { printf("ERROR: rmdir %s failed (%s)\n", - fname, cli_errstr(c)); + fname, nt_errstr(status)); exit(1); } } void nb_rename(const char *oldname, const char *newname) { - if (!NT_STATUS_IS_OK(cli_rename(c, oldname, newname))) { + NTSTATUS status; + + status = cli_rename(c, oldname, newname); + if (!NT_STATUS_IS_OK(status)) { printf("ERROR: rename %s %s failed (%s)\n", - oldname, newname, cli_errstr(c)); + oldname, newname, nt_errstr(status)); exit(1); } } -- cgit