From 52bf1f14d0f2ddecf8acd5f52e440fb791ac3d0f Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Mon, 24 Jun 1996 19:06:04 +0000 Subject: (diskfs_creade_node): Validate owner change before making it. --- libdiskfs/node-create.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libdiskfs') 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; } -- cgit v1.2.3