summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--openbsd-compat/Makefile.in9
-rw-r--r--openbsd-compat/openbsd-compat.h3
-rw-r--r--openbsd-compat/port-irix.c61
-rw-r--r--openbsd-compat/port-irix.h5
-rw-r--r--session.c56
6 files changed, 80 insertions, 58 deletions
diff --git a/ChangeLog b/ChangeLog
index d8df46c0..5944e0ad 100644
--- 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
@@ -7640,4 +7642,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.1865 2002/02/19 04:29:02 djm Exp $
+$Id: ChangeLog,v 1.1866 2002/02/19 20:02:48 mouring Exp $
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index 103ecc31..eac0abd5 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.19 2001/09/20 02:07:51 mouring Exp $
+# $Id: Makefile.in,v 1.20 2002/02/19 20:02:49 mouring Exp $
sysconfdir=@sysconfdir@
piddir=@piddir@
@@ -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:
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index efa204dc..224055c2 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -1,4 +1,4 @@
-/* $Id: openbsd-compat.h,v 1.14 2001/09/20 02:07:51 mouring Exp $ */
+/* $Id: openbsd-compat.h,v 1.15 2002/02/19 20:02:49 mouring Exp $ */
#ifndef _OPENBSD_H
#define _OPENBSD_H
@@ -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
index 00000000..a63ec429
--- /dev/null
+++ b/openbsd-compat/port-irix.c
@@ -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
index 00000000..2dd3c2e2
--- /dev/null
+++ b/openbsd-compat/port-irix.h
@@ -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) */
diff --git a/session.c b/session.c
index f9f5da80..e48c3c0b 100644
--- 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