summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-01-15 16:32:00 +0100
committerVolker Lendecke <vlendec@samba.org>2011-01-15 17:18:54 +0100
commit77f8b004dc15f282a2c7c860453071f2bc576bbb (patch)
treebe955b7b472e2f7dfa1a76d8c396de3e231534d4 /source3/utils
parent50b3458261fbcb304219b753a8690ed8ed9fc2cc (diff)
downloadsamba-77f8b004dc15f282a2c7c860453071f2bc576bbb.tar.gz
samba-77f8b004dc15f282a2c7c860453071f2bc576bbb.tar.bz2
samba-77f8b004dc15f282a2c7c860453071f2bc576bbb.zip
s3: Avoid some calls to cli_errstr
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sat Jan 15 17:18:54 CET 2011 on sn-devel-104
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/smbcacls.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 6a8169d39c..1ac37311b3 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -667,22 +667,25 @@ get fileinfo for filename
static uint16 get_fileinfo(struct cli_state *cli, const char *filename)
{
uint16_t fnum = (uint16_t)-1;
- uint16 mode;
+ uint16 mode = 0;
+ NTSTATUS status;
/* The desired access below is the only one I could find that works
with NT4, W2KP and Samba */
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli, filename, 0, CREATE_ACCESS_READ,
- 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0x0, 0x0, &fnum))) {
- printf("Failed to open %s: %s\n", filename, cli_errstr(cli));
+ status = cli_ntcreate(cli, filename, 0, CREATE_ACCESS_READ,
+ 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_OPEN, 0x0, 0x0, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Failed to open %s: %s\n", filename, nt_errstr(status));
+ return 0;
}
- if (!NT_STATUS_IS_OK(cli_qfileinfo_basic(
- cli, fnum, &mode, NULL, NULL, NULL,
- NULL, NULL, NULL))) {
+ status = cli_qfileinfo_basic(cli, fnum, &mode, NULL, NULL, NULL,
+ NULL, NULL, NULL);
+ if (!NT_STATUS_IS_OK(status)) {
printf("Failed to file info %s: %s\n", filename,
- cli_errstr(cli));
+ nt_errstr(status));
}
cli_close(cli, fnum);
@@ -697,14 +700,16 @@ static struct security_descriptor *get_secdesc(struct cli_state *cli, const char
{
uint16_t fnum = (uint16_t)-1;
struct security_descriptor *sd;
+ NTSTATUS status;
/* The desired access below is the only one I could find that works
with NT4, W2KP and Samba */
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli, filename, 0, CREATE_ACCESS_READ,
- 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0x0, 0x0, &fnum))) {
- printf("Failed to open %s: %s\n", filename, cli_errstr(cli));
+ status = cli_ntcreate(cli, filename, 0, CREATE_ACCESS_READ,
+ 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_OPEN, 0x0, 0x0, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Failed to open %s: %s\n", filename, nt_errstr(status));
return NULL;
}
@@ -732,11 +737,12 @@ static bool set_secdesc(struct cli_state *cli, const char *filename,
/* The desired access below is the only one I could find that works
with NT4, W2KP and Samba */
- if (!NT_STATUS_IS_OK(cli_ntcreate(cli, filename, 0,
- WRITE_DAC_ACCESS|WRITE_OWNER_ACCESS,
- 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0x0, 0x0, &fnum))) {
- printf("Failed to open %s: %s\n", filename, cli_errstr(cli));
+ status = cli_ntcreate(cli, filename, 0,
+ WRITE_DAC_ACCESS|WRITE_OWNER_ACCESS,
+ 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
+ FILE_OPEN, 0x0, 0x0, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Failed to open %s: %s\n", filename, nt_errstr(status));
return false;
}