00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
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 }