server: Properly initialize mode and uid for file and directory objects.
This commit is contained in:
parent
bbb3a85c51
commit
74a63029c7
|
@ -1108,7 +1108,7 @@ static int dir_add_to_existing_notify( struct dir *dir )
|
||||||
|
|
||||||
#endif /* USE_INOTIFY */
|
#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;
|
struct dir *dir;
|
||||||
|
|
||||||
|
@ -1123,6 +1123,8 @@ struct object *create_dir_obj( struct fd *fd )
|
||||||
dir->inode = NULL;
|
dir->inode = NULL;
|
||||||
grab_object( fd );
|
grab_object( fd );
|
||||||
dir->fd = fd;
|
dir->fd = fd;
|
||||||
|
dir->mode = mode;
|
||||||
|
dir->uid = ~(uid_t)0;
|
||||||
set_fd_user( fd, &dir_fd_ops, &dir->obj );
|
set_fd_user( fd, &dir_fd_ops, &dir->obj );
|
||||||
|
|
||||||
dir_add_to_existing_notify( dir );
|
dir_add_to_existing_notify( dir );
|
||||||
|
|
|
@ -147,6 +147,7 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, mode_
|
||||||
if (!file) return NULL;
|
if (!file) return NULL;
|
||||||
file->access = access;
|
file->access = access;
|
||||||
file->mode = mode;
|
file->mode = mode;
|
||||||
|
file->uid = ~(uid_t)0;
|
||||||
file->fd = fd;
|
file->fd = fd;
|
||||||
grab_object( fd );
|
grab_object( fd );
|
||||||
set_fd_user( fd, &file_fd_ops, &file->obj );
|
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 (!fd) goto done;
|
||||||
|
|
||||||
if (S_ISDIR(mode))
|
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 ))
|
else if (S_ISCHR(mode) && is_serial_fd( fd ))
|
||||||
obj = create_serial( fd );
|
obj = create_serial( fd );
|
||||||
else
|
else
|
||||||
|
|
|
@ -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 do_change_notify( int unix_fd );
|
||||||
extern void sigio_callback(void);
|
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 */
|
/* completion */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue