bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] Add a new exec_exec_file_name RPC


From: Emilio Pozuelo Monfort
Subject: [PATCH 1/3] Add a new exec_exec_file_name RPC
Date: Wed, 26 May 2010 00:15:37 +0200

---
 doc/hurd.texi   |    8 ++++----
 exec/exec.c     |   44 ++++++++++++++++++++++++++++++++++++++++----
 exec/hashexec.c |   10 +++++++---
 exec/priv.h     |    3 ++-
 hurd/exec.defs  |   18 ++++++++++++++++--
 hurd/version.h  |    2 +-
 6 files changed, 70 insertions(+), 15 deletions(-)

diff --git a/doc/hurd.texi b/doc/hurd.texi
index 098bebf..c0238f9 100644
--- a/doc/hurd.texi
+++ b/doc/hurd.texi
@@ -102,7 +102,7 @@ This file documents the GNU Hurd kernel component.  This 
edition of the
 documentation was last updated for version @value{VERSION} of the Hurd.
 
 Copyright @copyright{} 1994, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
-2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to make and distribute verbatim copies of
@@ -2770,14 +2770,14 @@ If the setuid/setgid transformation adds a new uid or 
gid to the user's
 authentication handle that was not previously present (as opposed to
 merely reordering them), then the @code{EXEC_SECURE} and
 @code{EXEC_NEWTASK} flags should both be added in the call to
address@hidden
address@hidden
 
 The server then needs to open a new port onto the executed file which
 will not share any file pointers with the port the user passed in,
 opened with @code{O_READ}.  Finally, all the information (mutated
 appropriately for setuid/setgid) should be sent to the execserver with
address@hidden  Whatever error code @code{exec_exec} returns should
-returned to the caller of @code{file_exec}.
address@hidden  Whatever error code @code{exec_exec_file_name}
+returns should be returned to the caller of @code{file_exec}.
 
 @node File Locking
 @subsection File Locking
diff --git a/exec/exec.c b/exec/exec.c
index 272b789..6b0f721 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -1,5 +1,5 @@
 /* GNU Hurd standard exec server.
-   Copyright (C) 1992,93,94,95,96,98,99,2000,01,02,04
+   Copyright (C) 1992,93,94,95,96,98,99,2000,01,02,04,10
        Free Software Foundation, Inc.
    Written by Roland McGrath.
 
@@ -1338,6 +1338,7 @@ static error_t
 do_exec (file_t file,
         task_t oldtask,
         int flags,
+        char *filename,
         char *argv, mach_msg_type_number_t argvlen, boolean_t argv_copy,
         char *envp, mach_msg_type_number_t envplen, boolean_t envp_copy,
         mach_port_t *dtable, mach_msg_type_number_t dtablesize,
@@ -1433,7 +1434,7 @@ do_exec (file_t file,
     {
       /* Check for a #! executable file.  */
       check_hashbang (&e,
-                     file, oldtask, flags,
+                     file, oldtask, flags, filename,
                      argv, argvlen, argv_copy,
                      envp, envplen, envp_copy,
                      dtable, dtablesize, dtable_copy,
@@ -2036,6 +2037,7 @@ do_exec (file_t file,
   return e.error;
 }
 
+/* Deprecated.  */
 kern_return_t
 S_exec_exec (struct trivfs_protid *protid,
             file_t file,
@@ -2052,6 +2054,40 @@ S_exec_exec (struct trivfs_protid *protid,
             mach_port_t *deallocnames, mach_msg_type_number_t ndeallocnames,
             mach_port_t *destroynames, mach_msg_type_number_t ndestroynames)
 {
+  return S_exec_exec_file_name (protid,
+                               file,
+                               oldtask,
+                               flags,
+                               "",
+                               argv, argvlen, argv_copy,
+                               envp, envplen, envp_copy,
+                               dtable, dtablesize,
+                               dtable_copy,
+                               portarray, nports,
+                               portarray_copy,
+                               intarray, nints,
+                               intarray_copy,
+                               deallocnames, ndeallocnames,
+                               destroynames, ndestroynames);
+}
+
+kern_return_t
+S_exec_exec_file_name (struct trivfs_protid *protid,
+                      file_t file,
+                      task_t oldtask,
+                      int flags,
+                      char *filename,
+                      char *argv, mach_msg_type_number_t argvlen, boolean_t 
argv_copy,
+                      char *envp, mach_msg_type_number_t envplen, boolean_t 
envp_copy,
+                      mach_port_t *dtable, mach_msg_type_number_t dtablesize,
+                      boolean_t dtable_copy,
+                      mach_port_t *portarray, mach_msg_type_number_t nports,
+                      boolean_t portarray_copy,
+                      int *intarray, mach_msg_type_number_t nints,
+                      boolean_t intarray_copy,
+                      mach_port_t *deallocnames, mach_msg_type_number_t 
ndeallocnames,
+                      mach_port_t *destroynames, mach_msg_type_number_t 
ndestroynames)
+{
   if (! protid)
     return EOPNOTSUPP;
 
@@ -2092,7 +2128,7 @@ S_exec_exec (struct trivfs_protid *protid,
                                         trivfs_protid_portclasses[0]);
                  if (protid)
                    {
-                     err = do_exec (file, oldtask, 0,
+                     err = do_exec (file, oldtask, 0, filename,
                                     argv, argvlen, argv_copy,
                                     envp, envplen, envp_copy,
                                     dtable, dtablesize, dtable_copy,
@@ -2139,7 +2175,7 @@ S_exec_exec (struct trivfs_protid *protid,
   /* There were no user-specified exec servers,
      or none of them could be found.  */
 
-  return do_exec (file, oldtask, flags,
+  return do_exec (file, oldtask, flags, filename,
                  argv, argvlen, argv_copy,
                  envp, envplen, envp_copy,
                  dtable, dtablesize, dtable_copy,
diff --git a/exec/hashexec.c b/exec/hashexec.c
index 2aa3844..6be8dfe 100644
--- a/exec/hashexec.c
+++ b/exec/hashexec.c
@@ -1,5 +1,5 @@
 /* GNU Hurd standard exec server, #! script execution support.
-   Copyright (C) 1995,96,97,98,99,2000,02 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,99,2000,02,10 Free Software Foundation, Inc.
    Written by Roland McGrath.
 
 This file is part of the GNU Hurd.
@@ -35,6 +35,7 @@ check_hashbang (struct execdata *e,
                file_t file,
                task_t oldtask,
                int flags,
+               char *file_name_exec,
                char *argv, u_int argvlen, boolean_t argv_copy,
                char *envp, u_int envplen, boolean_t envp_copy,
                mach_port_t *dtable, u_int dtablesize, boolean_t dtable_copy,
@@ -225,7 +226,8 @@ check_hashbang (struct execdata *e,
            file_name = NULL;
          else if (! (flags & EXEC_SECURE))
            {
-             /* Try to figure out the file's name.  We guess that if ARGV[0]
+             /* Try to figure out the file's name.  If FILE_NAME_EXEC is not 
NULL,
+                then it's the file's name.  Otherwise we guess that if ARGV[0]
                 contains a slash, it might be the name of the file; and that
                 if it contains no slash, looking for files named by ARGV[0] in
                 the `PATH' environment variable might find it.  */
@@ -278,7 +280,9 @@ check_hashbang (struct execdata *e,
              else
                name = argv;
 
-             if (strchr (name, '/') != NULL)
+             if (file_name_exec && strcmp (file_name_exec, ""))
+               error = lookup (name = file_name_exec, 0, &name_file);
+             else if (strchr (name, '/') != NULL)
                error = lookup (name, 0, &name_file);
              else if ((error = hurd_catch_signal
                        (sigmask (SIGBUS) | sigmask (SIGSEGV),
diff --git a/exec/priv.h b/exec/priv.h
index 7cee15e..92b7263 100644
--- a/exec/priv.h
+++ b/exec/priv.h
@@ -1,5 +1,5 @@
 /* GNU Hurd standard exec server, private declarations.
-   Copyright (C) 1992,93,94,95,96,99,2000,02, 04 Free Software Foundation, Inc.
+   Copyright (C) 1992,93,94,95,96,99,2000,02,04,10 Free Software Foundation, 
Inc.
    Written by Roland McGrath.
 
 This file is part of the GNU Hurd.
@@ -171,6 +171,7 @@ void check_hashbang (struct execdata *e,
                     file_t file,
                     task_t oldtask,
                     int flags,
+                    char *filename,
                     char *argv, u_int argvlen, boolean_t argv_copy,
                     char *envp, u_int envplen, boolean_t envp_copy,
                     mach_port_t *dtable, u_int dtablesize,
diff --git a/hurd/exec.defs b/hurd/exec.defs
index 2888fb1..d8a242a 100644
--- a/hurd/exec.defs
+++ b/hurd/exec.defs
@@ -1,5 +1,5 @@
 /* Interface definitions for the exec servers.
-   Copyright (C) 1991,92,93,94,95,2001 Free Software Foundation, Inc.
+   Copyright (C) 1991,92,93,94,95,2001,10 Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -29,6 +29,7 @@ EXEC_IMPORTS
 
 INTR_INTERFACE
 
+/* Deprecated: Use exec_exec_file_name instead.  */
 routine exec_exec (
        execserver: file_t;
        file: mach_port_send_t;
@@ -42,7 +43,20 @@ routine exec_exec (
        deallocnames: mach_port_name_array_t;
        destroynames: mach_port_name_array_t);
 
-skip;                          /* obsolete exec_startup */
+routine exec_exec_file_name (
+       execserver: file_t;
+       file: mach_port_send_t;
+       oldtask: task_t;
+       flags: int;
+       filename: string_t;
+       argv: data_t SCP;
+       envp: data_t SCP;
+       dtable: portarray_t SCP;
+       portarray: portarray_t SCP;
+       intarray: intarray_t SCP;
+       deallocnames: mach_port_name_array_t;
+       destroynames: mach_port_name_array_t);
+
 
 /* This call is made by the bootstrapping filesystem to give the
    execserver its auth handle.  */
diff --git a/hurd/version.h b/hurd/version.h
index 9b85b5a..fd7847d 100644
--- a/hurd/version.h
+++ b/hurd/version.h
@@ -3,4 +3,4 @@
    and will only ever be increased.  This will be bumped whenever either
    the RPC interfaces or the library APIs change.  */
 
-#define HURD_INTERFACE_VERSION 20020609
+#define HURD_INTERFACE_VERSION 20100527
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]