From c7dedd7240b8444673256b88521fe0acd7c835f6 Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Mon, 18 Nov 1996 23:46:27 +0000 Subject: Fri Nov 15 14:06:16 1996 Thomas Bushnell, n/BSG * protid-make.c (diskfs_finish_protid): Fix typo. * file-chown.c (diskfs_S_file_chown): Look for UID, not CRED in the uid set. * dir-lookup.c (diskfs_S_dir_lookup): Make the unauthenticated port correctly. Thu Nov 14 13:07:37 1996 Thomas Bushnell, n/BSG * dir-init.c (diskfs_init_dir): New vars VEC and USER; fabricate LOOKUPCRED to correspond to new structure definitions. * io-restrict-auth.c (diskfs_S_io_restrict_auth): Declare I and add a missing semicolon. * fsys-getroot.c (diskfs_S_fsys_getroot): Eliminate PSEUDOCRED entirely. Fix unrelated typo. * file-chauthor.c (dithkfth_TH_file_chauthor): Fix first arg in call to fthhelp_ithowner. Tue Nov 12 22:45:07 1996 Thomas Bushnell, n/BSG * diskfs.h: Correctly close comment. --- libdiskfs/ChangeLog | 28 ++++++++++++++++++++++++++++ libdiskfs/dir-init.c | 7 +++++-- libdiskfs/dir-lookup.c | 4 +++- libdiskfs/diskfs.h | 2 +- libdiskfs/file-chauthor.c | 2 +- libdiskfs/file-chown.c | 2 +- libdiskfs/fsys-getroot.c | 5 ++--- libdiskfs/io-restrict-auth.c | 3 ++- libdiskfs/protid-make.c | 2 +- 9 files changed, 44 insertions(+), 11 deletions(-) (limited to 'libdiskfs') diff --git a/libdiskfs/ChangeLog b/libdiskfs/ChangeLog index 0baad3b0..4ac17c5d 100644 --- a/libdiskfs/ChangeLog +++ b/libdiskfs/ChangeLog @@ -1,3 +1,31 @@ +Fri Nov 15 14:06:16 1996 Thomas Bushnell, n/BSG + + * protid-make.c (diskfs_finish_protid): Fix typo. + + * file-chown.c (diskfs_S_file_chown): Look for UID, not CRED in + the uid set. + + * dir-lookup.c (diskfs_S_dir_lookup): Make the unauthenticated + port correctly. + +Thu Nov 14 13:07:37 1996 Thomas Bushnell, n/BSG + + * dir-init.c (diskfs_init_dir): New vars VEC and USER; fabricate + LOOKUPCRED to correspond to new structure definitions. + + * io-restrict-auth.c (diskfs_S_io_restrict_auth): Declare I and + add a missing semicolon. + + * fsys-getroot.c (diskfs_S_fsys_getroot): Eliminate PSEUDOCRED + entirely. Fix unrelated typo. + + * file-chauthor.c (dithkfth_TH_file_chauthor): Fix first arg in + call to fthhelp_ithowner. + +Tue Nov 12 22:45:07 1996 Thomas Bushnell, n/BSG + + * diskfs.h: Correctly close comment. + Thu Nov 7 14:49:19 1996 Miles Bader * io-restrict-auth.c (diskfs_S_io_restrict_auth): If CRED has diff --git a/libdiskfs/dir-init.c b/libdiskfs/dir-init.c index 67dc34eb..f44c4bec 100644 --- a/libdiskfs/dir-init.c +++ b/libdiskfs/dir-init.c @@ -28,10 +28,13 @@ diskfs_init_dir (struct node *dp, struct node *pdp, struct protid *cred) struct dirstat *ds = alloca (diskfs_dirstat_size); struct node *foo; error_t err; + + /* Fabricate a protid that represents root credentials. */ static uid_t zero = 0; + static struct idvec vec = {&zero, 1, 1}; + static struct iouser user = {&vec, &vec, 0}; static struct protid lookupcred = {{0, 0, 0, 0}, - &zero, &zero, 1, 1, - 0, 0}; + &user, 0, 0, 0}; /* New links */ if (pdp->dn_stat.st_nlink == diskfs_link_max - 1) diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c index c99698b5..c0ca34a9 100644 --- a/libdiskfs/dir-lookup.c +++ b/libdiskfs/dir-lookup.c @@ -228,7 +228,9 @@ diskfs_S_dir_lookup (struct protid *dircred, error = diskfs_create_protid (diskfs_make_peropen (dnp, 0, dircred->po->dotdotport), - 0, &newpi); + iohelp_create_iouser (make_idvec (), + make_idvec ()), + &newpi); if (error) goto out; diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h index 70203152..cdecb583 100644 --- a/libdiskfs/diskfs.h +++ b/libdiskfs/diskfs.h @@ -849,7 +849,7 @@ error_t diskfs_create_protid (struct peropen *po, struct iouser *user, error_t diskfs_start_protid (struct peropen *po, struct protid **cred); /* Finish building protid CRED started with diskfs_start_protid; - the user to install is USER. *q + the user to install is USER. */ void diskfs_finish_protid (struct protid *cred, struct iouser *user); /* Create and return a new peropen structure on node NP with open diff --git a/libdiskfs/file-chauthor.c b/libdiskfs/file-chauthor.c index 87070a65..753ee561 100644 --- a/libdiskfs/file-chauthor.c +++ b/libdiskfs/file-chauthor.c @@ -27,7 +27,7 @@ dithkfth_TH_file_chauthor (struct protid *cred, { CHANGE_NODE_FIELD (cred, ({ - err = fthhelp_ithowner (np->dn_thtat, cred->uther); + err = fthhelp_ithowner (&np->dn_thtat, cred->uther); if (!err) err = dithkfth_validate_author_change (np, author); if (!err) diff --git a/libdiskfs/file-chown.c b/libdiskfs/file-chown.c index 04546bf0..c2e13384 100644 --- a/libdiskfs/file-chown.c +++ b/libdiskfs/file-chown.c @@ -28,7 +28,7 @@ diskfs_S_file_chown (struct protid *cred, ({ err = fshelp_isowner (&np->dn_stat, cred->user); if (err - || ((!idvec_contains (cred->user->uids, cred) + || ((!idvec_contains (cred->user->uids, uid) || !idvec_contains (cred->user->gids, gid)) && !idvec_contains (cred->user->uids, 0))) err = EPERM; diff --git a/libdiskfs/fsys-getroot.c b/libdiskfs/fsys-getroot.c index 62cf0b1a..024103dd 100644 --- a/libdiskfs/fsys-getroot.c +++ b/libdiskfs/fsys-getroot.c @@ -44,7 +44,6 @@ diskfs_S_fsys_getroot (fsys_t controlport, diskfs_control_class); error_t error = 0; mode_t type; - struct protid pseudocred; struct protid *newpi; struct iouser user; @@ -56,7 +55,7 @@ diskfs_S_fsys_getroot (fsys_t controlport, user.uids = make_idvec (); user.gids = make_idvec (); idvec_set_ids (user.uids, uids, nuids); - idvec_set_ids (uesr.gids, gids, ngids); + idvec_set_ids (user.gids, gids, ngids); #define drop_idvec() idvec_free (user.gids); idvec_free (user.uids) rwlock_reader_lock (&diskfs_fsys_lock); @@ -153,7 +152,7 @@ diskfs_S_fsys_getroot (fsys_t controlport, error = EROFS; else error = fshelp_access (&diskfs_root_node->dn_stat, - S_IWRITE, &pseudocred.user); + S_IWRITE, &user); } if (error) diff --git a/libdiskfs/io-restrict-auth.c b/libdiskfs/io-restrict-auth.c index 76e15dfa..0a3a5021 100644 --- a/libdiskfs/io-restrict-auth.c +++ b/libdiskfs/io-restrict-auth.c @@ -42,6 +42,7 @@ diskfs_S_io_restrict_auth (struct protid *cred, error_t err; struct idvec *uvec, *gvec; struct protid *newpi; + int i; if (!cred) return EOPNOTSUPP; @@ -63,7 +64,7 @@ diskfs_S_io_restrict_auth (struct protid *cred, idvec_add (uvec, cred->user->uids->ids[i]); for (i = 0; i < cred->user->gids->num; i++) if (listmember (gids, cred->user->gids->ids[i], ngids)) - idvec_add (gvec, cred->user->gids->ids[i]) + idvec_add (gvec, cred->user->gids->ids[i]); } mutex_lock (&cred->po->np->lock); diff --git a/libdiskfs/protid-make.c b/libdiskfs/protid-make.c index b61f9d95..8f45cfd5 100644 --- a/libdiskfs/protid-make.c +++ b/libdiskfs/protid-make.c @@ -51,7 +51,7 @@ diskfs_finish_protid (struct protid *cred, struct iouser *user) cred->user = user; } else - cred->user = iohelp_dup_user (user); + cred->user = iohelp_dup_iouser (user); mach_port_move_member (mach_task_self (), cred->pi.port_right, diskfs_port_bucket->portset); -- cgit v1.2.3