modules/vfs_fake_perms.c

説明を見る。
00001 /* 
00002  * Fake Perms VFS module.  Implements passthrough operation of all VFS
00003  * calls to disk functions, except for file permissions, which are now
00004  * mode 0700 for the current uid/gid.
00005  *
00006  * Copyright (C) Tim Potter, 1999-2000
00007  * Copyright (C) Alexander Bokovoy, 2002
00008  * Copyright (C) Andrew Bartlett, 2002
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *  
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *  
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023  */
00024 
00025 #include "includes.h"
00026 
00027 extern struct current_user current_user;
00028 
00029 #undef DBGC_CLASS
00030 #define DBGC_CLASS DBGC_VFS
00031 
00032 static int fake_perms_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf)
00033 {
00034         int ret = -1;
00035 
00036         ret = SMB_VFS_NEXT_STAT(handle, fname, sbuf);
00037         if (ret == 0) {
00038                 if (S_ISDIR(sbuf->st_mode)) {
00039                         sbuf->st_mode = S_IFDIR | S_IRWXU;
00040                 } else {
00041                         sbuf->st_mode = S_IRWXU;
00042                 }
00043                 sbuf->st_uid = current_user.ut.uid;
00044                 sbuf->st_gid = current_user.ut.gid;
00045         }
00046 
00047         return ret;
00048 }
00049 
00050 static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
00051 {
00052         int ret = -1;
00053 
00054         ret = SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
00055         if (ret == 0) {
00056                 if (S_ISDIR(sbuf->st_mode)) {
00057                         sbuf->st_mode = S_IFDIR | S_IRWXU;
00058                 } else {
00059                         sbuf->st_mode = S_IRWXU;
00060                 }
00061                 sbuf->st_uid = current_user.ut.uid;
00062                 sbuf->st_gid = current_user.ut.gid;
00063         }
00064         return ret;
00065 }
00066 
00067 /* VFS operations structure */
00068 
00069 static vfs_op_tuple fake_perms_ops[] = {        
00070         {SMB_VFS_OP(fake_perms_stat),   SMB_VFS_OP_STAT,        SMB_VFS_LAYER_TRANSPARENT},
00071         {SMB_VFS_OP(fake_perms_fstat),  SMB_VFS_OP_FSTAT,       SMB_VFS_LAYER_TRANSPARENT},
00072 
00073         {SMB_VFS_OP(NULL),              SMB_VFS_OP_NOOP,        SMB_VFS_LAYER_NOOP}
00074 };
00075 
00076 NTSTATUS vfs_fake_perms_init(void);
00077 NTSTATUS vfs_fake_perms_init(void)
00078 {
00079         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "fake_perms", fake_perms_ops);
00080 }

Sambaに対してSat Aug 29 21:23:07 2009に生成されました。  doxygen 1.4.7