[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Tue Nov 17 21:59:04 UTC 2015
The branch, master has been updated
via 8f9bf74 smbd: Simplify check_access()
via c2d5fdb smbd: Use check_access_fsp where appropriate
via c056daf smbd: Factor out check_access_fsp() from check_access()
via c8485dd smbd: Refactor check_access()
via b8467dc smbd: Early return from dos_mode_debug_print
via b367dbc smbd: Add hex value to dos_mode_debug_print
via 0f5c98f smbd: Use dos_mode_debug_print in get_ea_dos_attribute
via 313986b smbd: Use dos_mode_debug_print in dos_mode_from_sbuf
via 053cf16 smbd: Use dos_mode_debug_print in dos_mode_msdfs
via 89deffb smbd: Streamline dos_mode_debug_print
from 5943f92 s4-backupkey: Don't use deprecated data structures
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8f9bf74fbfc15cae10d4cf1249280f82e7410fab
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 17 15:19:31 2015 +0100
smbd: Simplify check_access()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Nov 17 22:58:10 CET 2015 on sn-devel-104
commit c2d5fdb629ecdeaaa284fdbe69e9d061b7f835a2
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 17 15:13:41 2015 +0100
smbd: Use check_access_fsp where appropriate
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c056daf7abc63569fad90b47e02e38acfebfe985
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 17 15:10:42 2015 +0100
smbd: Factor out check_access_fsp() from check_access()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit c8485ddbac397f50c68f6d76468d5c7679da9082
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 17 14:57:50 2015 +0100
smbd: Refactor check_access()
This is a micro-patch to make the next ones just obvious
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b8467dc4923a9efb905fc1e8db3c3029766cdc59
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 17 13:49:30 2015 +0100
smbd: Early return from dos_mode_debug_print
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b367dbc7bda1d0c33b2b8aba9a6e07c01c0a84d8
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 17 13:44:30 2015 +0100
smbd: Add hex value to dos_mode_debug_print
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 0f5c98fac90c6aca0d082687b12657e4acf58e87
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 17 13:43:10 2015 +0100
smbd: Use dos_mode_debug_print in get_ea_dos_attribute
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 313986bb7521da354bd3beb32bfc289e37c06550
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 17 13:41:29 2015 +0100
smbd: Use dos_mode_debug_print in dos_mode_from_sbuf
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 053cf16a3bd7c9c167a2cff9b56576fb94a50cc6
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 17 13:37:14 2015 +0100
smbd: Use dos_mode_debug_print in dos_mode_msdfs
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 89deffb65a251e612e615074525009957123172d
Author: Volker Lendecke <vl at samba.org>
Date: Tue Nov 17 13:21:13 2015 +0100
smbd: Streamline dos_mode_debug_print
One line per flag is a bit overkill
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/smbd/dosmode.c | 61 ++++++++++++++-------------------------
source3/smbd/proto.h | 2 ++
source3/smbd/smb2_ioctl_filesys.c | 7 ++---
source3/smbd/trans2.c | 27 ++++++++++-------
4 files changed, 43 insertions(+), 54 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 72acd4e..0f3eef0 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -31,36 +31,43 @@ static NTSTATUS get_file_handle_for_metadata(connection_struct *conn,
files_struct **ret_fsp,
bool *need_close);
-static void dos_mode_debug_print(uint32_t mode)
+static void dos_mode_debug_print(const char *func, uint32_t mode)
{
- DEBUG(8,("dos_mode returning "));
+ fstring modestr;
+
+ if (DEBUGLEVEL < DBGLVL_INFO) {
+ return;
+ }
+
+ modestr[0] = '\0';
if (mode & FILE_ATTRIBUTE_HIDDEN) {
- DEBUG(8, ("h"));
+ fstrcat(modestr, "h");
}
if (mode & FILE_ATTRIBUTE_READONLY) {
- DEBUG(8, ("r"));
+ fstrcat(modestr, "r");
}
if (mode & FILE_ATTRIBUTE_SYSTEM) {
- DEBUG(8, ("s"));
+ fstrcat(modestr, "s");
}
if (mode & FILE_ATTRIBUTE_DIRECTORY) {
- DEBUG(8, ("d"));
+ fstrcat(modestr, "d");
}
if (mode & FILE_ATTRIBUTE_ARCHIVE) {
- DEBUG(8, ("a"));
+ fstrcat(modestr, "a");
}
if (mode & FILE_ATTRIBUTE_SPARSE) {
- DEBUG(8, ("[sparse]"));
+ fstrcat(modestr, "[sparse]");
}
if (mode & FILE_ATTRIBUTE_OFFLINE) {
- DEBUG(8, ("[offline]"));
+ fstrcat(modestr, "[offline]");
}
if (mode & FILE_ATTRIBUTE_COMPRESSED) {
- DEBUG(8, ("[compressed]"));
+ fstrcat(modestr, "[compressed]");
}
- DEBUG(8,("\n"));
+ DBG_INFO("%s returning (0x%x): \"%s\"\n", func, (unsigned)mode,
+ modestr);
}
static uint32_t filter_mode_by_protocol(uint32_t mode)
@@ -240,15 +247,8 @@ static uint32_t dos_mode_from_sbuf(connection_struct *conn,
result |= set_link_read_only_flag(&smb_fname->st);
- DEBUG(8,("dos_mode_from_sbuf returning "));
-
- if (result & FILE_ATTRIBUTE_HIDDEN) DEBUG(8, ("h"));
- if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
- if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
- if (result & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d"));
- if (result & FILE_ATTRIBUTE_ARCHIVE ) DEBUG(8, ("a"));
+ dos_mode_debug_print(__func__, result);
- DEBUG(8,("\n"));
return result;
}
@@ -367,15 +367,7 @@ static bool get_ea_dos_attribute(connection_struct *conn,
/* FILE_ATTRIBUTE_SPARSE is valid on get but not on set. */
*pattr = (uint32_t)(dosattr & (SAMBA_ATTRIBUTES_MASK|FILE_ATTRIBUTE_SPARSE));
- DEBUG(8,("get_ea_dos_attribute returning (0x%x)", dosattr));
-
- if (dosattr & FILE_ATTRIBUTE_HIDDEN) DEBUG(8, ("h"));
- if (dosattr & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
- if (dosattr & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
- if (dosattr & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d"));
- if (dosattr & FILE_ATTRIBUTE_ARCHIVE ) DEBUG(8, ("a"));
-
- DEBUG(8,("\n"));
+ dos_mode_debug_print(__func__, *pattr);
return True;
}
@@ -539,16 +531,7 @@ uint32_t dos_mode_msdfs(connection_struct *conn,
*/
result |= FILE_ATTRIBUTE_REPARSE_POINT;
- DEBUG(8,("dos_mode_msdfs returning "));
-
- if (result & FILE_ATTRIBUTE_HIDDEN) DEBUG(8, ("h"));
- if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
- if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
- if (result & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d"));
- if (result & FILE_ATTRIBUTE_ARCHIVE ) DEBUG(8, ("a"));
- if (result & FILE_ATTRIBUTE_SPARSE ) DEBUG(8, ("[sparse]"));
-
- DEBUG(8,("\n"));
+ dos_mode_debug_print(__func__, result);
return(result);
}
@@ -653,7 +636,7 @@ uint32_t dos_mode(connection_struct *conn, struct smb_filename *smb_fname)
result = filter_mode_by_protocol(result);
- dos_mode_debug_print(result);
+ dos_mode_debug_print(__func__, result);
return result;
}
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 7926dd6..be51182 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -1079,6 +1079,8 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
/* The following definitions come from smbd/trans2.c */
+NTSTATUS check_access_fsp(const struct files_struct *fsp,
+ uint32_t access_mask);
NTSTATUS check_access(connection_struct *conn,
files_struct *fsp,
const struct smb_filename *smb_fname,
diff --git a/source3/smbd/smb2_ioctl_filesys.c b/source3/smbd/smb2_ioctl_filesys.c
index 187deaf..6e4a785 100644
--- a/source3/smbd/smb2_ioctl_filesys.c
+++ b/source3/smbd/smb2_ioctl_filesys.c
@@ -94,8 +94,7 @@ static NTSTATUS fsctl_set_cmprn(TALLOC_CTX *mem_ctx,
}
/* WRITE_DATA permission is required, WRITE_ATTRIBUTES is not */
- status = check_access(fsp->conn, fsp, NULL,
- FILE_WRITE_DATA);
+ status = check_access_fsp(fsp, FILE_WRITE_DATA);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -141,7 +140,7 @@ static NTSTATUS fsctl_zero_data(TALLOC_CTX *mem_ctx,
}
/* WRITE_DATA permission is required */
- status = check_access(fsp->conn, fsp, NULL, FILE_WRITE_DATA);
+ status = check_access_fsp(fsp, FILE_WRITE_DATA);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -333,7 +332,7 @@ static NTSTATUS fsctl_qar(TALLOC_CTX *mem_ctx,
}
/* READ_DATA permission is required */
- status = check_access(fsp->conn, fsp, NULL, FILE_READ_DATA);
+ status = check_access_fsp(fsp, FILE_READ_DATA);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index e2e4c80..11c97e8 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -54,6 +54,15 @@ static char *store_file_unix_basic_info2(connection_struct *conn,
files_struct *fsp,
const SMB_STRUCT_STAT *psbuf);
+NTSTATUS check_access_fsp(const struct files_struct *fsp,
+ uint32_t access_mask)
+{
+ if (!(fsp->access_mask & access_mask)) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+ return NT_STATUS_OK;
+}
+
/********************************************************************
The canonical "check access" based on object handle or path function.
********************************************************************/
@@ -63,20 +72,16 @@ NTSTATUS check_access(connection_struct *conn,
const struct smb_filename *smb_fname,
uint32_t access_mask)
{
+ NTSTATUS status;
+
if (fsp) {
- if (!(fsp->access_mask & access_mask)) {
- return NT_STATUS_ACCESS_DENIED;
- }
+ status = check_access_fsp(fsp, access_mask);
} else {
- NTSTATUS status = smbd_check_access_rights(conn,
- smb_fname,
- false,
- access_mask);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
+ status = smbd_check_access_rights(conn, smb_fname,
+ false, access_mask);
}
- return NT_STATUS_OK;
+
+ return status;
}
/********************************************************************
--
Samba Shared Repository
More information about the samba-cvs
mailing list