server: Properly initialize mode and uid for file and directory objects.

This commit is contained in:
Alexandre Julliard 2009-08-17 17:18:54 +02:00
parent bbb3a85c51
commit 74a63029c7
3 changed files with 6 additions and 3 deletions

View File

@ -1108,7 +1108,7 @@ static int dir_add_to_existing_notify( struct dir *dir )
#endif /* USE_INOTIFY */
struct object *create_dir_obj( struct fd *fd )
struct object *create_dir_obj( struct fd *fd, unsigned int access, mode_t mode )
{
struct dir *dir;
@ -1123,6 +1123,8 @@ struct object *create_dir_obj( struct fd *fd )
dir->inode = NULL;
grab_object( fd );
dir->fd = fd;
dir->mode = mode;
dir->uid = ~(uid_t)0;
set_fd_user( fd, &dir_fd_ops, &dir->obj );
dir_add_to_existing_notify( dir );

View File

@ -147,6 +147,7 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_
if (!file) return NULL;
file->access = access;
file->mode = mode;
file->uid = ~(uid_t)0;
file->fd = fd;
grab_object( fd );
set_fd_user( fd, &file_fd_ops, &file->obj );
@ -206,7 +207,7 @@ static struct object *create_file( const char *nameptr, data_size_t len, unsigne
if (!fd) goto done;
if (S_ISDIR(mode))
obj = create_dir_obj( fd );
obj = create_dir_obj( fd, access, mode );
else if (S_ISCHR(mode) && is_serial_fd( fd ))
obj = create_serial( fd );
else

View File

@ -120,7 +120,7 @@ extern mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner
extern void do_change_notify( int unix_fd );
extern void sigio_callback(void);
extern struct object *create_dir_obj( struct fd *fd );
extern struct object *create_dir_obj( struct fd *fd, unsigned int access, mode_t mode );
/* completion */