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 103ecc312..eac0abd5f 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -1,4 +1,4 @@
1# $Id: Makefile.in,v 1.19 2001/09/20 02:07:51 mouring Exp $ 1# $Id: Makefile.in,v 1.20 2002/02/19 20:02:49 mouring Exp $
2 2
3sysconfdir=@sysconfdir@ 3sysconfdir=@sysconfdir@
4piddir=@piddir@ 4piddir=@piddir@
@@ -20,6 +20,8 @@ OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getop
20 20
21COMPAT=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 21COMPAT=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
22 22
23PORTS=port-irix.o
24
23.c.o: 25.c.o:
24 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< 26 $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
25 27
@@ -27,9 +29,10 @@ all: libopenbsd-compat.a
27 29
28$(COMPAT): ../config.h 30$(COMPAT): ../config.h
29$(OPENBSD): ../config.h 31$(OPENBSD): ../config.h
32$(PORTS): ../config.h
30 33
31libopenbsd-compat.a: $(COMPAT) $(OPENBSD) 34libopenbsd-compat.a: $(COMPAT) $(OPENBSD) $(PORTS)
32 $(AR) rv $@ $(COMPAT) $(OPENBSD) 35 $(AR) rv $@ $(COMPAT) $(OPENBSD) $(PORTS)
33 $(RANLIB) $@ 36 $(RANLIB) $@
34 37
35clean: 38clean:
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index efa204dc3..224055c25 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -1,4 +1,4 @@
1/* $Id: openbsd-compat.h,v 1.14 2001/09/20 02:07:51 mouring Exp $ */ 1/* $Id: openbsd-compat.h,v 1.15 2002/02/19 20:02:49 mouring Exp $ */
2 2
3#ifndef _OPENBSD_H 3#ifndef _OPENBSD_H
4#define _OPENBSD_H 4#define _OPENBSD_H
@@ -40,5 +40,6 @@
40 40
41/* Routines for a single OS platform */ 41/* Routines for a single OS platform */
42#include "bsd-cray.h" 42#include "bsd-cray.h"
43#include "port-irix.h"
43 44
44#endif /* _OPENBSD_H */ 45#endif /* _OPENBSD_H */
diff --git a/openbsd-compat/port-irix.c b/openbsd-compat/port-irix.c
new file mode 100644
index 000000000..a63ec429a
--- /dev/null
+++ b/openbsd-compat/port-irix.c
@@ -0,0 +1,61 @@
1#include "includes.h"
2
3#if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
4
5#ifdef WITH_IRIX_PROJECT
6#include <proj.h>
7#endif /* WITH_IRIX_PROJECT */
8#ifdef WITH_IRIX_JOBS
9#include <sys/resource.h>
10#endif
11#ifdef WITH_IRIX_AUDIT
12#include <sat.h>
13#endif /* WITH_IRIX_AUDIT */
14
15void
16irix_setusercontext(struct passwd *pw)
17{
18#ifdef WITH_IRIX_PROJECT
19 prid_t projid;
20#endif /* WITH_IRIX_PROJECT */
21#ifdef WITH_IRIX_JOBS
22 jid_t jid = 0;
23#else
24# ifdef WITH_IRIX_ARRAY
25 int jid = 0;
26# endif /* WITH_IRIX_ARRAY */
27#endif /* WITH_IRIX_JOBS */
28
29#ifdef WITH_IRIX_JOBS
30 jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive");
31 if (jid == -1)
32 fatal("Failed to create job container: %.100s",
33 strerror(errno));
34#endif /* WITH_IRIX_JOBS */
35#ifdef WITH_IRIX_ARRAY
36 /* initialize array session */
37 if (jid == 0 && newarraysess() != 0)
38 fatal("Failed to set up new array session: %.100s",
39 strerror(errno));
40#endif /* WITH_IRIX_ARRAY */
41#ifdef WITH_IRIX_PROJECT
42 /* initialize irix project info */
43 if ((projid = getdfltprojuser(pw->pw_name)) == -1) {
44 debug("Failed to get project id, using projid 0");
45 projid = 0;
46 }
47 if (setprid(projid))
48 fatal("Failed to initialize project %d for %s: %.100s",
49 (int)projid, pw->pw_name, strerror(errno));
50#endif /* WITH_IRIX_PROJECT */
51#ifdef WITH_IRIX_AUDIT
52 if (sysconf(_SC_AUDIT)) {
53 debug("Setting sat id to %d", (int) pw->pw_uid);
54 if (satsetid(pw->pw_uid))
55 debug("error setting satid: %.100s", strerror(errno));
56 }
57#endif /* WITH_IRIX_AUDIT */
58}
59
60
61#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 000000000..2dd3c2e25
--- /dev/null
+++ b/openbsd-compat/port-irix.h
@@ -0,0 +1,5 @@
1#if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
2
3void irix_setusercontext(struct passwd *pw);
4
5#endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */