From 53850c51caf1c4d53ff285b2e5505e0615beeeee Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 14 Apr 2001 00:19:12 +0000 Subject: configure: configure.in: include/config.h.in: include/profile.h: smbd/vfs-wrap.c: smbd/vfs.c: Added fchmod and fchown to VFS (sorry Gerald - but we needed them anyway). smbd/dosmode.c: smbd/files.c: printing/printfsp.c: smbd/close.c: smbd/open.c: Fixed "dos filemode" correctly so there are no race conditions. Forces test of open of file O_WRONLY before allowing fchmod as root. Afterwards, calls standard close function that preserves POSIX locks due to POSIX-me-harder braindamage. :-). Andrew please review this code. Also - in removing the tmpdir param in smbrun an extra NULL parameter was missed in each print_run_command() call (which is a varargs fn.). Now fixed. Jeremy. (This used to be commit 32397e5bc6d995ce7ca37c82d6aedc1e5b1b6fbd) --- source3/include/config.h.in | 6 ++++++ source3/include/profile.h | 6 +++++- source3/include/proto.h | 6 +++++- source3/include/vfs.h | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-) (limited to 'source3/include') diff --git a/source3/include/config.h.in b/source3/include/config.h.in index a60d927976..b13f465691 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -466,6 +466,12 @@ /* Define if you have the execl function. */ #undef HAVE_EXECL +/* Define if you have the fchmod function. */ +#undef HAVE_FCHMOD + +/* Define if you have the fchown function. */ +#undef HAVE_FCHOWN + /* Define if you have the fcvt function. */ #undef HAVE_FCVT diff --git a/source3/include/profile.h b/source3/include/profile.h index b05e1fd9bb..5916614fb7 100644 --- a/source3/include/profile.h +++ b/source3/include/profile.h @@ -35,7 +35,7 @@ enum flush_reason_enum { SEEK_FLUSH, READ_FLUSH, WRITE_FLUSH, READRAW_FLUSH, #define PROF_SHMEM_KEY ((key_t)0x07021999) #define PROF_SHM_MAGIC 0x6349985 -#define PROF_SHM_VERSION 3 +#define PROF_SHM_VERSION 4 /* time values in the following structure are in microseconds */ @@ -80,8 +80,12 @@ struct profile_stats { unsigned syscall_unlink_time; unsigned syscall_chmod_count; unsigned syscall_chmod_time; + unsigned syscall_fchmod_count; + unsigned syscall_fchmod_time; unsigned syscall_chown_count; unsigned syscall_chown_time; + unsigned syscall_fchown_count; + unsigned syscall_fchown_time; unsigned syscall_chdir_count; unsigned syscall_chdir_time; unsigned syscall_getwd_count; diff --git a/source3/include/proto.h b/source3/include/proto.h index 890c2dcf60..5d7398b23f 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -3951,7 +3951,7 @@ BOOL check_name(char *name,connection_struct *conn); /*The following definitions come from smbd/files.c */ -files_struct *file_new(void ); +files_struct *file_new(connection_struct *conn); void file_close_conn(connection_struct *conn); void file_init(void); void file_close_user(int vuid); @@ -4048,6 +4048,8 @@ files_struct *open_file_shared(connection_struct *conn,char *fname, SMB_STRUCT_S int share_mode,int ofun, mode_t mode,int oplock_request, int *Access,int *action); files_struct *open_file_stat(connection_struct *conn, char *fname, SMB_STRUCT_STAT *psbuf, int smb_ofun, int *action); +files_struct *open_file_fchmod(connection_struct *conn, char *fname, SMB_STRUCT_STAT *psbuf); +int close_file_fchmod(files_struct *fsp); files_struct *open_directory(connection_struct *conn, char *fname, SMB_STRUCT_STAT *psbuf, int smb_ofun, mode_t unixmode, int *action); BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op); @@ -4311,7 +4313,9 @@ int vfswrap_fstat(files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf); int vfswrap_lstat(connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf); int vfswrap_unlink(connection_struct *conn, char *path); int vfswrap_chmod(connection_struct *conn, char *path, mode_t mode); +int vfswrap_fchmod(files_struct *fsp, int fd, mode_t mode); int vfswrap_chown(connection_struct *conn, char *path, uid_t uid, gid_t gid); +int vfswrap_fchown(files_struct *fsp, int fd, uid_t uid, gid_t gid); int vfswrap_chdir(connection_struct *conn, char *path); char *vfswrap_getwd(connection_struct *conn, char *path); int vfswrap_utime(connection_struct *conn, char *path, struct utimbuf *times); diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 9ca4bde0c5..51f3df1ec9 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -78,7 +78,9 @@ struct vfs_ops { int (*lstat)(struct connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf); int (*unlink)(struct connection_struct *conn, char *path); int (*chmod)(struct connection_struct *conn, char *path, mode_t mode); + int (*fchmod)(struct files_struct *fsp, int fd, mode_t mode); int (*chown)(struct connection_struct *conn, char *path, uid_t uid, gid_t gid); + int (*fchown)(struct files_struct *fsp, int fd, uid_t uid, gid_t gid); int (*chdir)(struct connection_struct *conn, char *path); char *(*getwd)(struct connection_struct *conn, char *buf); int (*utime)(struct connection_struct *conn, char *path, struct utimbuf *times); -- cgit