[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Sat Jan 15 09:19:01 MST 2011
The branch, master has been updated
via 77f8b00 s3: Avoid some calls to cli_errstr
via 50b3458 s3: Convert cli_set_secdesc to cli_trans
via 4fc5699 s3: Fix some nonempty blank lines
from 3f6ae94 s4:samr RPC server - always interpret filter integer values as signed
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 77f8b004dc15f282a2c7c860453071f2bc576bbb
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jan 15 16:32:00 2011 +0100
s3: Avoid some calls to cli_errstr
Autobuild-User: Volker Lendecke <vlendec at samba.org>
Autobuild-Date: Sat Jan 15 17:18:54 CET 2011 on sn-devel-104
commit 50b3458261fbcb304219b753a8690ed8ed9fc2cc
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jan 15 16:20:37 2011 +0100
s3: Convert cli_set_secdesc to cli_trans
commit 4fc5699a79c4b7ff85c855755002583e8e963193
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jan 15 16:07:31 2011 +0100
s3: Fix some nonempty blank lines
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 3 +-
source3/libsmb/clisecdesc.c | 59 ++++++++++++++------------------------
source3/libsmb/libsmb_xattr.c | 6 ++-
source3/utils/net_rpc_printer.c | 10 ++++--
source3/utils/smbcacls.c | 56 +++++++++++++++++++++----------------
5 files changed, 66 insertions(+), 68 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 338c27d..0e66a52 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2508,7 +2508,8 @@ NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
TALLOC_CTX *mem_ctx);
-bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, struct security_descriptor *sd);
+NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
+ struct security_descriptor *sd);
/* The following definitions come from libsmb/clispnego.c */
diff --git a/source3/libsmb/clisecdesc.c b/source3/libsmb/clisecdesc.c
index 6e7beef..5543ce5 100644
--- a/source3/libsmb/clisecdesc.c
+++ b/source3/libsmb/clisecdesc.c
@@ -2,17 +2,17 @@
Unix SMB/CIFS implementation.
client security descriptor functions
Copyright (C) Andrew Tridgell 2000
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -70,14 +70,11 @@ struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fn
/****************************************************************************
set the security descriptor for a open file
****************************************************************************/
-bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, struct security_descriptor *sd)
+NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
+ struct security_descriptor *sd)
{
- char param[8];
- char *rparam=NULL, *rdata=NULL;
- unsigned int rparam_count=0, rdata_count=0;
+ uint8_t param[8];
uint32 sec_info = 0;
- TALLOC_CTX *frame = talloc_stackframe();
- bool ret = False;
uint8 *data;
size_t len;
NTSTATUS status;
@@ -86,7 +83,7 @@ bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, struct security_descr
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("marshall_sec_desc failed: %s\n",
nt_errstr(status)));
- goto cleanup;
+ return status;
}
SIVAL(param, 0, fnum);
@@ -99,32 +96,20 @@ bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, struct security_descr
sec_info |= SECINFO_GROUP;
SSVAL(param, 4, sec_info);
- if (!cli_send_nt_trans(cli,
- NT_TRANSACT_SET_SECURITY_DESC,
- 0,
- NULL, 0, 0,
- param, 8, 0,
- (char *)data, len, 0)) {
- DEBUG(1,("Failed to send NT_TRANSACT_SET_SECURITY_DESC\n"));
- goto cleanup;
- }
-
-
- if (!cli_receive_nt_trans(cli,
- &rparam, &rparam_count,
- &rdata, &rdata_count)) {
- DEBUG(1,("NT_TRANSACT_SET_SECURITY_DESC failed\n"));
- goto cleanup;
+ status = cli_trans(talloc_tos(), cli, SMBnttrans,
+ NULL, -1, /* name, fid */
+ NT_TRANSACT_SET_SECURITY_DESC, 0,
+ NULL, 0, 0, /* setup */
+ param, 8, 0, /* param */
+ data, len, 0, /* data */
+ NULL, /* recv_flags2 */
+ NULL, 0, NULL, /* rsetup */
+ NULL, 0, NULL, /* rparam */
+ NULL, 0, NULL); /* rdata */
+ TALLOC_FREE(data);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Failed to send NT_TRANSACT_SET_SECURITY_DESC: %s\n",
+ nt_errstr(status)));
}
-
- ret = True;
-
- cleanup:
-
- SAFE_FREE(rparam);
- SAFE_FREE(rdata);
-
- TALLOC_FREE(frame);
-
- return ret;
+ return status;
}
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index 7086808..155a6b9 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -1513,6 +1513,7 @@ cacl_set(SMBCCTX *context,
bool numeric = True;
char *targetpath = NULL;
struct cli_state *targetcli = NULL;
+ NTSTATUS status;
/* the_acl will be null for REMOVE_ALL operations */
if (the_acl) {
@@ -1666,9 +1667,10 @@ cacl_set(SMBCCTX *context,
return -1;
}
- if (!cli_set_secdesc(targetcli, fnum, sd)) {
+ status = cli_set_secdesc(targetcli, fnum, sd);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(5, ("ERROR: secdesc set failed: %s\n",
- cli_errstr(targetcli)));
+ nt_errstr(status)));
ret = -1;
}
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index 8408235..470d61a 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -231,12 +231,14 @@ NTSTATUS net_copy_fileattr(struct net_context *c,
}
if (copy_acls) {
+ NTSTATUS status;
/* set acls */
- if (!cli_set_secdesc(cli_share_dst, fnum_dst, sd)) {
- DEBUG(0,("could not set secdesc on %s: %s\n",
- dst_name, cli_errstr(cli_share_dst)));
- nt_status = cli_nt_error(cli_share_dst);
+ status = cli_set_secdesc(cli_share_dst, fnum_dst, sd);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("could not set secdesc on %s: %s\n",
+ dst_name, nt_errstr(status)));
+ nt_status = status;
goto out;
}
}
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 2800ed9..1ac3731 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -1,22 +1,22 @@
/*
Unix SMB/CIFS implementation.
ACL get/set utility
-
+
Copyright (C) Andrew Tridgell 2000
Copyright (C) Tim Potter 2000
Copyright (C) Jeremy Allison 2000
Copyright (C) Jelmer Vernooij 2003
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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;
}
@@ -727,21 +732,24 @@ static bool set_secdesc(struct cli_state *cli, const char *filename,
{
uint16_t fnum = (uint16_t)-1;
bool result=true;
+ 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,
- 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;
}
- if (!cli_set_secdesc(cli, fnum, sd)) {
+ status = cli_set_secdesc(cli, fnum, sd);
+ if (!NT_STATUS_IS_OK(status)) {
printf("ERROR: security description set failed: %s\n",
- cli_errstr(cli));
+ nt_errstr(status));
result=false;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list