summaryrefslogtreecommitdiff
path: root/source3/smbd/file_access.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-14 15:34:42 +0200
committerVolker Lendecke <vl@samba.org>2009-05-26 17:48:23 +0200
commit49ca690b4b22ee6e597179059c9442e94c5bd423 (patch)
treead233a9bcfee2d467824290448ca366219dbd301 /source3/smbd/file_access.c
parent52f2f9449f8d53aa9181d656a4b54a007c80fa81 (diff)
downloadsamba-49ca690b4b22ee6e597179059c9442e94c5bd423.tar.gz
samba-49ca690b4b22ee6e597179059c9442e94c5bd423.tar.bz2
samba-49ca690b4b22ee6e597179059c9442e94c5bd423.zip
Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STAT
This patch introduces struct stat_ex { dev_t st_ex_dev; ino_t st_ex_ino; mode_t st_ex_mode; nlink_t st_ex_nlink; uid_t st_ex_uid; gid_t st_ex_gid; dev_t st_ex_rdev; off_t st_ex_size; struct timespec st_ex_atime; struct timespec st_ex_mtime; struct timespec st_ex_ctime; struct timespec st_ex_btime; /* birthtime */ blksize_t st_ex_blksize; blkcnt_t st_ex_blocks; }; typedef struct stat_ex SMB_STRUCT_STAT; It is really large because due to the friendly libc headers playing macro tricks with fields like st_ino, so I renamed them to st_ex_xxx. Why this change? To support birthtime, we already have quite a few #ifdef's at places where it does not really belong. With a stat struct that we control, we can consolidate the nanosecond timestamps and the birthtime deep in the VFS stat calls. At this moment it is triggered by a request to support the birthtime field for GPFS. GPFS does not extend the system level struct stat, but instead has a separate call that gets us the additional information beyond posix. Without being able to do that within the VFS stat calls, that support would have to be scattered around the main smbd code. It will very likely break all the onefs modules, but I think the changes will be reasonably easy to do.
Diffstat (limited to 'source3/smbd/file_access.c')
-rw-r--r--source3/smbd/file_access.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c
index abffcd2f4f..a248dd9f3b 100644
--- a/source3/smbd/file_access.c
+++ b/source3/smbd/file_access.c
@@ -80,7 +80,7 @@ bool can_delete_file_in_directory(connection_struct *conn, const char *fname)
/* fast paths first */
- if (!S_ISDIR(sbuf.st_mode)) {
+ if (!S_ISDIR(sbuf.st_ex_mode)) {
return False;
}
if (conn->server_info->utok.uid == 0 || conn->admin_user) {
@@ -90,7 +90,7 @@ bool can_delete_file_in_directory(connection_struct *conn, const char *fname)
#ifdef S_ISVTX
/* sticky bit means delete only by owner or root. */
- if (sbuf.st_mode & S_ISVTX) {
+ if (sbuf.st_ex_mode & S_ISVTX) {
SMB_STRUCT_STAT sbuf_file;
if(SMB_VFS_STAT(conn, fname, &sbuf_file) != 0) {
if (errno == ENOENT) {
@@ -105,7 +105,7 @@ bool can_delete_file_in_directory(connection_struct *conn, const char *fname)
* for bug #3348. Don't assume owning sticky bit
* directory means write access allowed.
*/
- if (conn->server_info->utok.uid != sbuf_file.st_uid) {
+ if (conn->server_info->utok.uid != sbuf_file.st_ex_uid) {
return False;
}
}
@@ -156,17 +156,17 @@ bool can_access_file_data(connection_struct *conn, const char *fname, SMB_STRUCT
}
/* Check primary owner access. */
- if (conn->server_info->utok.uid == psbuf->st_uid) {
+ if (conn->server_info->utok.uid == psbuf->st_ex_uid) {
switch (access_mask) {
case FILE_READ_DATA:
- return (psbuf->st_mode & S_IRUSR) ? True : False;
+ return (psbuf->st_ex_mode & S_IRUSR) ? True : False;
case FILE_WRITE_DATA:
- return (psbuf->st_mode & S_IWUSR) ? True : False;
+ return (psbuf->st_ex_mode & S_IWUSR) ? True : False;
default: /* FILE_READ_DATA|FILE_WRITE_DATA */
- if ((psbuf->st_mode & (S_IWUSR|S_IRUSR)) == (S_IWUSR|S_IRUSR)) {
+ if ((psbuf->st_ex_mode & (S_IWUSR|S_IRUSR)) == (S_IWUSR|S_IRUSR)) {
return True;
} else {
return False;