diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-06-24 19:06:04 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-06-24 19:06:04 +0000 |
commit | 52bf1f14d0f2ddecf8acd5f52e440fb791ac3d0f (patch) | |
tree | 564fffe39fbbe9e092342f9a4bfcf086f3107a35 /libdiskfs/node-create.c | |
parent | 90e7d441d7e32d891050b3f5d6c16ca4bfc764e1 (diff) |
(diskfs_creade_node): Validate owner change before making it.
Diffstat (limited to 'libdiskfs/node-create.c')
-rw-r--r-- | libdiskfs/node-create.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libdiskfs/node-create.c b/libdiskfs/node-create.c index cc9a83a2..6905b5e2 100644 --- a/libdiskfs/node-create.c +++ b/libdiskfs/node-create.c @@ -34,6 +34,7 @@ diskfs_create_node (struct node *dir, { struct node *np; error_t err; + uid_t newuid; if (diskfs_readonly) return EROFS; @@ -46,13 +47,21 @@ diskfs_create_node (struct node *dir, diskfs_drop_dirstat (dir, ds); return err; } + np = *newnode; /* Initialize the on-disk fields. */ if (cred->nuids) - np->dn_stat.st_uid = cred->uids[0]; + { + err = diskfs_validate_owner_change (np, cred->uids[0]); + if (err) + goto change_err; + np->dn_stat.st_uid = cred->uids[0]; else { + err = diskfs_validate_owner_change (np, dir->dn_stat.st_uid); + if (err) + goto change_err; np->dn_stat.st_uid = dir->dn_stat.st_uid; mode &= ~S_ISUID; } |