diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-27 22:08:53 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-27 22:08:53 +0200 |
commit | 420b95fe7e0a4ed6b01d89aa3fbdfec45de8829d (patch) | |
tree | 5d3b206c2fd25744d87287678f64e52c8f53abbf /debian/patches/random-fixes0007-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch | |
parent | 8faccce60ee5736e6e75c0f74620dfa68ab24b90 (diff) |
add patch series
Diffstat (limited to 'debian/patches/random-fixes0007-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch')
-rw-r--r-- | debian/patches/random-fixes0007-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/debian/patches/random-fixes0007-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch b/debian/patches/random-fixes0007-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch new file mode 100644 index 00000000..14ca1d01 --- /dev/null +++ b/debian/patches/random-fixes0007-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch @@ -0,0 +1,128 @@ +From aace82ecbe4cd7841ed873c67d3788a8d169a16a Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 27 Sep 2015 16:26:03 +0200 +Subject: [PATCH hurd 07/10] trans/passwd: 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 mild bug. The classes and buckets given to +`trivfs_startup' end up in the dynamic vectors too, making the object +lookup code use the more complicated code path. + +* trans/password.c: Convert to dynamic classes and buckets. +--- + trans/password.c | 48 +++++++++++++++++++++++++++--------------------- + 1 file changed, 27 insertions(+), 21 deletions(-) + +diff --git a/trans/password.c b/trans/password.c +index 344b78b..9ffcaa0 100644 +--- a/trans/password.c ++++ b/trans/password.c +@@ -39,6 +39,10 @@ const char *argp_program_version = STANDARD_HURD_VERSION (password); + /* Port bucket we service requests on. */ + struct port_bucket *port_bucket; + ++/* Our port classes. */ ++struct port_class *trivfs_control_class; ++struct port_class *trivfs_protid_class; ++ + /* Trivfs hooks. */ + int trivfs_fstype = FSTYPE_MISC; + int trivfs_fsid = 0; +@@ -46,12 +50,6 @@ int trivfs_support_read = 0; + int trivfs_support_write = 0; + int trivfs_support_exec = 0; + int trivfs_allow_open = 0; +- +-struct port_class *trivfs_protid_portclasses[1]; +-struct port_class *trivfs_cntl_portclasses[1]; +-int trivfs_protid_nportclasses = 1; +-int trivfs_cntl_nportclasses = 1; +- + + static int + password_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp) +@@ -75,15 +73,23 @@ main (int argc, char *argv[]) + if (bootstrap == MACH_PORT_NULL) + error (1, 0, "must be started as a translator"); + +- port_bucket = ports_create_bucket (); +- trivfs_cntl_portclasses[0] = ports_create_class (trivfs_clean_cntl, 0); +- trivfs_protid_portclasses[0] = ports_create_class (trivfs_clean_protid, 0); +- ++ err = trivfs_add_port_bucket (&port_bucket); ++ if (err) ++ error (1, 0, "error creating port bucket"); ++ ++ err = trivfs_add_control_port_class (&trivfs_control_class); ++ if (err) ++ error (1, 0, "error creating control port class"); ++ ++ 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, +- trivfs_cntl_portclasses[0], port_bucket, +- trivfs_protid_portclasses[0], port_bucket, +- &fsys); ++ trivfs_control_class, port_bucket, ++ trivfs_protid_class, port_bucket, ++ &fsys); + mach_port_deallocate (mach_task_self (), bootstrap); + if (err) + error (3, err, "Contacting parent"); +@@ -114,17 +120,17 @@ trivfs_goaway (struct trivfs_control *fsys, int flags) + int count; + + /* Stop new requests. */ +- ports_inhibit_class_rpcs (trivfs_cntl_portclasses[0]); +- ports_inhibit_class_rpcs (trivfs_protid_portclasses[0]); ++ ports_inhibit_class_rpcs (trivfs_control_class); ++ ports_inhibit_class_rpcs (trivfs_protid_class); + + /* Are there any extant user ports for the /servers/password file? */ +- count = ports_count_class (trivfs_protid_portclasses[0]); ++ count = ports_count_class (trivfs_protid_class); + if (count > 0 && !(flags & FSYS_GOAWAY_FORCE)) + { + /* We won't go away, so start things going again... */ +- ports_enable_class (trivfs_protid_portclasses[0]); +- ports_resume_class_rpcs (trivfs_cntl_portclasses[0]); +- ports_resume_class_rpcs (trivfs_protid_portclasses[0]); ++ ports_enable_class (trivfs_protid_class); ++ ports_resume_class_rpcs (trivfs_control_class); ++ ports_resume_class_rpcs (trivfs_protid_class); + + return EBUSY; + } +@@ -153,7 +159,7 @@ S_password_check_user (struct trivfs_protid *cred, uid_t user, char *pw, + return EOPNOTSUPP; + + if (cred->pi.bucket != port_bucket || +- cred->pi.class != trivfs_protid_portclasses[0]) ++ cred->pi.class != trivfs_protid_class) + { + ports_port_deref (cred); + return EOPNOTSUPP; +@@ -201,7 +207,7 @@ S_password_check_group (struct trivfs_protid *cred, uid_t group, char *pw, + return EOPNOTSUPP; + + if (cred->pi.bucket != port_bucket || +- cred->pi.class != trivfs_protid_portclasses[0]) ++ cred->pi.class != trivfs_protid_class) + { + ports_port_deref (cred); + return EOPNOTSUPP; +-- +2.1.4 + |