[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 13/23: trans/proxy-defpager: convert to trivfs dynamic classes an
From: |
Samuel Thibault |
Subject: |
[hurd] 13/23: trans/proxy-defpager: convert to trivfs dynamic classes and buckets |
Date: |
Tue, 13 Oct 2015 00:09:55 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit fcf89e5bb006f71ecf5c46b7248216c3dee7e4b8
Author: Justus Winter <address@hidden>
Date: Sun Sep 27 17:23:13 2015 +0200
trans/proxy-defpager: convert to trivfs dynamic classes and buckets
libtrivfs contains two ways of managing more than one port class and
bucket. There is the old way of using a statically allocated array
with explicit length, and the new way with dynamically allocated
vectors.
Converting all users to the new way of handling multiple classes
and/or buckets, we can simplify the code in libtrivfs. In many cases,
the code will be simpler and more expressive for the user.
This also fixes a severe bug. As no classes are given to
`trivfs_startup', they are created and inserted into the dynamic
vector of classes. The helper function `allowed', however, used the
first item of the previously used static array, which is NULL. This
circumvented the typecheck, allowing the default pager protocol to be
spoken over control ports, likely resulting in a crash.
* trans/proxy-defpager.c: Convert to dynamic classes and buckets.
---
trans/proxy-defpager.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/trans/proxy-defpager.c b/trans/proxy-defpager.c
index 5fe8ffd..662f269 100644
--- a/trans/proxy-defpager.c
+++ b/trans/proxy-defpager.c
@@ -30,11 +30,14 @@
static mach_port_t real_defpager, dev_master;
+/* Our port class. */
+struct port_class *trivfs_protid_class;
+
static error_t
allowed (mach_port_t port, int mode)
{
- struct trivfs_protid *cred = ports_lookup_port
- (0, port, trivfs_protid_portclasses[0]);
+ struct trivfs_protid *cred
+ = ports_lookup_port (0, port, trivfs_protid_class);
if (!cred)
return MIG_BAD_ID;
error_t result = (cred->po->openmodes & mode) ? 0 : EACCES;
@@ -266,8 +269,12 @@ main (int argc, char **argv)
trivfs_fsid = getpid ();
+ err = trivfs_add_protid_port_class (&trivfs_protid_class);
+ if (err)
+ error (1, 0, "error creating protid port class");
+
/* Reply to our parent. */
- err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys);
+ err = trivfs_startup (bootstrap, 0, 0, 0, trivfs_protid_class, 0, &fsys);
mach_port_deallocate (mach_task_self (), bootstrap);
if (err)
error (4, err, "Contacting parent");
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 21/23: Make netfs_S_io_reauthenticate handle allocation errors, (continued)
- [hurd] 21/23: Make netfs_S_io_reauthenticate handle allocation errors, Samuel Thibault, 2015/10/12
- [hurd] 20/23: Drop duplicate port deallocation, Samuel Thibault, 2015/10/12
- [hurd] 14/23: libtrivfs: optimize the object lookup code, Samuel Thibault, 2015/10/12
- [hurd] 23/23: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2015/10/12
- [hurd] 10/23: trans/magic: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 04/23: libdiskfs: fflush stdout when pausing, Samuel Thibault, 2015/10/12
- [hurd] 11/23: trans/new-fifo: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 07/23: pflocal: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 09/23: trans/ifsock: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 12/23: trans/passwd: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/12
- [hurd] 13/23: trans/proxy-defpager: convert to trivfs dynamic classes and buckets,
Samuel Thibault <=
- [hurd] 17/23: libdiskfs: fflush stdout when pausing, Samuel Thibault, 2015/10/15
- [hurd] 22/23: Make dir_lookup create files with user permissions enabled, Samuel Thibault, 2015/10/15
- [hurd] 16/23: Minor documentation changes, Samuel Thibault, 2015/10/15
- [hurd] 03/23: libdiskfs: improve error handling, Samuel Thibault, 2015/10/15
- [hurd] 02/23: exec: add missing include, Samuel Thibault, 2015/10/15
- [hurd] 05/23: exec: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/15
- [hurd] 01/23: libports: remove unused variables, Samuel Thibault, 2015/10/15
- [hurd] 06/23: pfinet: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/15
- [hurd] 08/23: trans/crash: convert to trivfs dynamic classes and buckets, Samuel Thibault, 2015/10/15