summaryrefslogtreecommitdiff
path: root/debian/patches/shutdown0001-startup-implement-bits-of-the-fs-and-io-protocols.patch
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-04-25 14:55:01 +0200
committerJustus Winter <justus@gnupg.org>2016-04-25 14:55:01 +0200
commit588badc5ce114a69903f4903ecce8296ac812966 (patch)
treecc22d340e666327101c08be6e0d3df7067525fe9 /debian/patches/shutdown0001-startup-implement-bits-of-the-fs-and-io-protocols.patch
parent8e86d5786f62cd57d82a9af37fb8be2ae35b8fd1 (diff)
add patch series
Diffstat (limited to 'debian/patches/shutdown0001-startup-implement-bits-of-the-fs-and-io-protocols.patch')
-rw-r--r--debian/patches/shutdown0001-startup-implement-bits-of-the-fs-and-io-protocols.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/debian/patches/shutdown0001-startup-implement-bits-of-the-fs-and-io-protocols.patch b/debian/patches/shutdown0001-startup-implement-bits-of-the-fs-and-io-protocols.patch
new file mode 100644
index 00000000..1e8a868c
--- /dev/null
+++ b/debian/patches/shutdown0001-startup-implement-bits-of-the-fs-and-io-protocols.patch
@@ -0,0 +1,120 @@
+From deb2ac133799e2e5e46ba8ea9204286124cae46c Mon Sep 17 00:00:00 2001
+From: Justus Winter <justus@gnupg.org>
+Date: Sat, 23 Apr 2016 17:52:33 +0200
+Subject: [PATCH hurd 1/3] startup: implement bits of the fs and io protocols
+
+* startup/Makefile: Build fs and io server with default
+implementations.
+* startup/startup.c (demuxer): Add new protocols.
+(S_file_check_access): New function.
+(S_io_restrict_auth): Likewise.
+---
+ startup/Makefile | 4 +++-
+ startup/startup.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
+ 2 files changed, 43 insertions(+), 6 deletions(-)
+
+diff --git a/startup/Makefile b/startup/Makefile
+index ee2ecdd5..67b0be5 100644
+--- a/startup/Makefile
++++ b/startup/Makefile
+@@ -21,13 +21,15 @@ makemode := server
+ SRCS = startup.c
+ OBJS = $(SRCS:.c=.o) \
+ startupServer.o notifyServer.o startup_replyUser.o msgServer.o \
+- startup_notifyUser.o fsysServer.o
++ startup_notifyUser.o fsysServer.o fsServer.o ioServer.o
+ target = startup
+ HURDLIBS = shouldbeinlibc
+
+ # startup does not use libports. Disable the default payload to port
+ # conversion.
+ MIGSFLAGS="-DHURD_DEFAULT_PAYLOAD_TO_PORT=1"
++fsServer-CFLAGS="-DMIG_EOPNOTSUPP=EOPNOTSUPP"
++ioServer-CFLAGS="-DMIG_EOPNOTSUPP=EOPNOTSUPP"
+
+ include ../Makeconf
+
+diff --git a/startup/startup.c b/startup/startup.c
+index 9c45f4b..05b623d 100644
+--- a/startup/startup.c
++++ b/startup/startup.c
+@@ -51,6 +51,7 @@
+ #include <version.h>
+ #include <argp.h>
+ #include <pids.h>
++#include <idvec.h>
+
+ #include "startup_notify_U.h"
+ #include "startup_reply_U.h"
+@@ -58,6 +59,8 @@
+ #include "notify_S.h"
+ #include "mung_msg_S.h"
+
++#include "io_S.h"
++
+ /* host_reboot flags for when we crash. */
+ static int crash_flags = RB_AUTOBOOT;
+
+@@ -498,18 +501,21 @@ run_for_real (char *filename, char *args, int arglen, mach_port_t ctty,
+
+ /** Main program and setup **/
+
++#include "notify_S.h"
++#include "msg_S.h"
++#include "fsys_S.h"
++#include "startup_S.h"
++
+ static int
+ demuxer (mach_msg_header_t *inp,
+ mach_msg_header_t *outp)
+ {
+- extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
+- extern int startup_server (mach_msg_header_t *, mach_msg_header_t *);
+- extern int msg_server (mach_msg_header_t *, mach_msg_header_t *);
+- extern int fsys_server (mach_msg_header_t *, mach_msg_header_t *);
+-
++ error (0, 0, "msgid %d", inp->msgh_id);
+ return (notify_server (inp, outp) ||
+ msg_server (inp, outp) ||
+ fsys_server (inp, outp) ||
++ fs_server (inp, outp) ||
++ io_server (inp, outp) ||
+ startup_server (inp, outp));
+ }
+
+@@ -1703,3 +1709,32 @@ S_fsys_forward (mach_port_t server, mach_port_t requestor,
+ {
+ return EOPNOTSUPP;
+ }
++
++error_t
++S_file_check_access (mach_port_t server,
++ int *allowed)
++{
++ if (server != startup)
++ return EOPNOTSUPP;
++ *allowed = 0;
++}
++
++error_t
++S_io_restrict_auth (mach_port_t server,
++ mach_port_t *newport,
++ mach_msg_type_name_t *newporttype,
++ uid_t *uids, size_t nuids,
++ uid_t *gids, size_t ngids)
++{
++ struct idvec user = { uids, (unsigned) nuids, (unsigned) nuids };
++
++ if (server != startup)
++ return EOPNOTSUPP;
++
++ if (! idvec_contains (&user, 0))
++ return EPERM;
++
++ *newport = server;
++ *newporttype = MACH_MSG_TYPE_COPY_SEND;
++ return 0;
++}
+--
+2.1.4
+