]> andersk Git - openssh.git/commitdiff
- (bal) Migrate IRIX jobs/projects/audit/etc code to
authormouring <mouring>
Tue, 19 Feb 2002 20:02:48 +0000 (20:02 +0000)
committermouring <mouring>
Tue, 19 Feb 2002 20:02:48 +0000 (20:02 +0000)
   openbsd-compat/port-irix.[ch] to improve readiblity of do_child()

ChangeLog
openbsd-compat/Makefile.in
openbsd-compat/openbsd-compat.h
openbsd-compat/port-irix.c [new file with mode: 0644]
openbsd-compat/port-irix.h [new file with mode: 0644]
session.c

index e258175b82de4a8b5d13efdf9d9711d979764d9c..f75e6346c4130c466bcfd27c489656983fe74361 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,8 @@
    - deraadt@cvs.openbsd.org 2002/02/19 02:50:59
      [sshd_config]
      stategy is not an english word
+ - (bal) Migrate IRIX jobs/projects/audit/etc code to 
+   openbsd-compat/port-irix.[ch] to improve readiblity of do_child()
 
 20020218
  - (tim) newer config.guess from ftp://ftp.gnu.org/gnu/config/config.guess
index 31f9ea9e44dabd470bf695173661efaf196f3f7c..8697593a7395e914888b50f821d1e333a877f041 100644 (file)
@@ -20,6 +20,8 @@ OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getop
 
 COMPAT=bsd-arc4random.o bsd-cray.o bsd-cygwin_util.o bsd-misc.o bsd-nextstep.o bsd-snprintf.o bsd-waitpid.o fake-getaddrinfo.o fake-getnameinfo.o
 
+PORTS=port-irix.o
+
 .c.o:
        $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
 
@@ -27,9 +29,10 @@ all: libopenbsd-compat.a
 
 $(COMPAT): ../config.h
 $(OPENBSD): ../config.h
+$(PORTS): ../config.h
 
-libopenbsd-compat.a:  $(COMPAT) $(OPENBSD)
-       $(AR) rv $@ $(COMPAT) $(OPENBSD)
+libopenbsd-compat.a:  $(COMPAT) $(OPENBSD) $(PORTS)
+       $(AR) rv $@ $(COMPAT) $(OPENBSD) $(PORTS)
        $(RANLIB) $@
 
 clean:
index 845d98fb9414afe7687f6d2e22c82c7cd63e31c9..e5c74cf594c86f4cf67f645318b0cf0278d249f1 100644 (file)
@@ -40,5 +40,6 @@
 
 /* Routines for a single OS platform */
 #include "bsd-cray.h"
+#include "port-irix.h"
 
 #endif /* _OPENBSD_H */
diff --git a/openbsd-compat/port-irix.c b/openbsd-compat/port-irix.c
new file mode 100644 (file)
index 0000000..a63ec42
--- /dev/null
@@ -0,0 +1,61 @@
+#include "includes.h"
+
+#if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
+
+#ifdef WITH_IRIX_PROJECT
+#include <proj.h>
+#endif /* WITH_IRIX_PROJECT */
+#ifdef WITH_IRIX_JOBS
+#include <sys/resource.h>
+#endif
+#ifdef WITH_IRIX_AUDIT
+#include <sat.h>
+#endif /* WITH_IRIX_AUDIT */
+
+void
+irix_setusercontext(struct passwd *pw)
+{
+#ifdef WITH_IRIX_PROJECT
+        prid_t projid;
+#endif /* WITH_IRIX_PROJECT */
+#ifdef WITH_IRIX_JOBS
+        jid_t jid = 0;
+#else
+# ifdef WITH_IRIX_ARRAY
+        int jid = 0;
+# endif /* WITH_IRIX_ARRAY */
+#endif /* WITH_IRIX_JOBS */
+
+#ifdef WITH_IRIX_JOBS
+        jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive");
+        if (jid == -1)
+                fatal("Failed to create job container: %.100s",
+                    strerror(errno));
+#endif /* WITH_IRIX_JOBS */
+#ifdef WITH_IRIX_ARRAY
+        /* initialize array session */
+        if (jid == 0  && newarraysess() != 0)
+                fatal("Failed to set up new array session: %.100s",
+                    strerror(errno));
+#endif /* WITH_IRIX_ARRAY */
+#ifdef WITH_IRIX_PROJECT
+        /* initialize irix project info */
+        if ((projid = getdfltprojuser(pw->pw_name)) == -1) {
+                debug("Failed to get project id, using projid 0");
+                projid = 0;
+        }
+        if (setprid(projid))
+                fatal("Failed to initialize project %d for %s: %.100s",
+                    (int)projid, pw->pw_name, strerror(errno));
+#endif /* WITH_IRIX_PROJECT */
+#ifdef WITH_IRIX_AUDIT
+        if (sysconf(_SC_AUDIT)) {
+                debug("Setting sat id to %d", (int) pw->pw_uid);
+                if (satsetid(pw->pw_uid))
+                        debug("error setting satid: %.100s", strerror(errno));
+        }
+#endif /* WITH_IRIX_AUDIT */
+}
+
+
+#endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */
diff --git a/openbsd-compat/port-irix.h b/openbsd-compat/port-irix.h
new file mode 100644 (file)
index 0000000..2dd3c2e
--- /dev/null
@@ -0,0 +1,5 @@
+#if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
+
+void irix_setusercontext(struct passwd *pw);
+
+#endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */
index f9f5da80e3ab4aaf300271859b585825269eb529..e48c3c0b4412b1fae22b76c0e51b05bf088c3154 100644 (file)
--- a/session.c
+++ b/session.c
@@ -57,16 +57,6 @@ RCSID("$OpenBSD: session.c,v 1.126 2002/02/14 23:28:00 markus Exp $");
 #include "canohost.h"
 #include "session.h"
 
-#ifdef WITH_IRIX_PROJECT
-#include <proj.h>
-#endif /* WITH_IRIX_PROJECT */
-#ifdef WITH_IRIX_JOBS
-#include <sys/resource.h>
-#endif
-#ifdef WITH_IRIX_AUDIT
-#include <sat.h>
-#endif /* WITH_IRIX_AUDIT */
-
 #if defined(HAVE_USERSEC_H)
 #include <usersec.h>
 #endif
@@ -1006,16 +996,6 @@ do_child(Session *s, const char *command)
        struct stat st;
        char *argv[10];
        int do_xauth;
-#ifdef WITH_IRIX_PROJECT
-       prid_t projid;
-#endif /* WITH_IRIX_PROJECT */
-#ifdef WITH_IRIX_JOBS
-       jid_t jid = 0;
-#else
-#ifdef WITH_IRIX_ARRAY
-       int jid = 0;
-#endif /* WITH_IRIX_ARRAY */
-#endif /* WITH_IRIX_JOBS */
 
        do_xauth =
            s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL;
@@ -1098,39 +1078,9 @@ do_child(Session *s, const char *command)
                         */
                        do_pam_setcred(0);
 #  endif /* USE_PAM */
-#  ifdef WITH_IRIX_JOBS
-                       jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive");
-                       if (jid == -1) {
-                               fatal("Failed to create job container: %.100s",
-                                     strerror(errno));
-                       }
-#  endif /* WITH_IRIX_JOBS */
-#  ifdef WITH_IRIX_ARRAY
-                       /* initialize array session */
-                       if (jid == 0) {
-                               if (newarraysess() != 0)
-                                       fatal("Failed to set up new array session: %.100s",
-                                             strerror(errno));
-                       }
-#  endif /* WITH_IRIX_ARRAY */
-#  ifdef WITH_IRIX_PROJECT
-                       /* initialize irix project info */
-                       if ((projid = getdfltprojuser(pw->pw_name)) == -1) {
-                         debug("Failed to get project id, using projid 0");
-                         projid = 0;
-                       }
-                       if (setprid(projid))
-                         fatal("Failed to initialize project %d for %s: %.100s",
-                               (int)projid, pw->pw_name, strerror(errno));
-#  endif /* WITH_IRIX_PROJECT */
-#ifdef WITH_IRIX_AUDIT
-                       if (sysconf(_SC_AUDIT)) {
-                               debug("Setting sat id to %d", (int) pw->pw_uid);
-                               if (satsetid(pw->pw_uid))
-                                       debug("error setting satid: %.100s", strerror(errno));
-                       }
-#endif /* WITH_IRIX_AUDIT */
-
+#  if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
+                       irix_setusercontext(pw);
+#  endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */
 #ifdef _AIX
                        /*
                         * AIX has a "usrinfo" area where logname and
This page took 4.427624 seconds and 5 git commands to generate.