summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-02-19 20:02:48 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-02-19 20:02:48 +0000
commitf095a8588237010852a3a85f971197a3a5b1d9ae (patch)
tree2af4cbb275dbe4ebeaa8a0471a437b2bf395e83c /openbsd-compat
parent95ca7e9f1f004a8b57183660d744d1433bf508eb (diff)
- (bal) Migrate IRIX jobs/projects/audit/etc code to
openbsd-compat/port-irix.[ch] to improve readiblity of do_child()
Diffstat (limited to 'openbsd-compat')
-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
4 files changed, 74 insertions, 4 deletions
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) */