diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | openbsd-compat/Makefile.in | 9 | ||||
-rw-r--r-- | openbsd-compat/openbsd-compat.h | 3 | ||||
-rw-r--r-- | openbsd-compat/port-irix.c | 61 | ||||
-rw-r--r-- | openbsd-compat/port-irix.h | 5 | ||||
-rw-r--r-- | session.c | 56 |
6 files changed, 80 insertions, 58 deletions
@@ -43,6 +43,8 @@ | |||
43 | - deraadt@cvs.openbsd.org 2002/02/19 02:50:59 | 43 | - deraadt@cvs.openbsd.org 2002/02/19 02:50:59 |
44 | [sshd_config] | 44 | [sshd_config] |
45 | stategy is not an english word | 45 | stategy is not an english word |
46 | - (bal) Migrate IRIX jobs/projects/audit/etc code to | ||
47 | openbsd-compat/port-irix.[ch] to improve readiblity of do_child() | ||
46 | 48 | ||
47 | 20020218 | 49 | 20020218 |
48 | - (tim) newer config.guess from ftp://ftp.gnu.org/gnu/config/config.guess | 50 | - (tim) newer config.guess from ftp://ftp.gnu.org/gnu/config/config.guess |
@@ -7640,4 +7642,4 @@ | |||
7640 | - Wrote replacements for strlcpy and mkdtemp | 7642 | - Wrote replacements for strlcpy and mkdtemp |
7641 | - Released 1.0pre1 | 7643 | - Released 1.0pre1 |
7642 | 7644 | ||
7643 | $Id: ChangeLog,v 1.1865 2002/02/19 04:29:02 djm Exp $ | 7645 | $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 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 | ||
3 | sysconfdir=@sysconfdir@ | 3 | sysconfdir=@sysconfdir@ |
4 | piddir=@piddir@ | 4 | piddir=@piddir@ |
@@ -20,6 +20,8 @@ OPENBSD=base64.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getop | |||
20 | 20 | ||
21 | 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 | 21 | 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 |
22 | 22 | ||
23 | PORTS=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 | ||
31 | libopenbsd-compat.a: $(COMPAT) $(OPENBSD) | 34 | libopenbsd-compat.a: $(COMPAT) $(OPENBSD) $(PORTS) |
32 | $(AR) rv $@ $(COMPAT) $(OPENBSD) | 35 | $(AR) rv $@ $(COMPAT) $(OPENBSD) $(PORTS) |
33 | $(RANLIB) $@ | 36 | $(RANLIB) $@ |
34 | 37 | ||
35 | clean: | 38 | clean: |
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 | |||
15 | void | ||
16 | irix_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 | |||
3 | void irix_setusercontext(struct passwd *pw); | ||
4 | |||
5 | #endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */ | ||
@@ -57,16 +57,6 @@ RCSID("$OpenBSD: session.c,v 1.126 2002/02/14 23:28:00 markus Exp $"); | |||
57 | #include "canohost.h" | 57 | #include "canohost.h" |
58 | #include "session.h" | 58 | #include "session.h" |
59 | 59 | ||
60 | #ifdef WITH_IRIX_PROJECT | ||
61 | #include <proj.h> | ||
62 | #endif /* WITH_IRIX_PROJECT */ | ||
63 | #ifdef WITH_IRIX_JOBS | ||
64 | #include <sys/resource.h> | ||
65 | #endif | ||
66 | #ifdef WITH_IRIX_AUDIT | ||
67 | #include <sat.h> | ||
68 | #endif /* WITH_IRIX_AUDIT */ | ||
69 | |||
70 | #if defined(HAVE_USERSEC_H) | 60 | #if defined(HAVE_USERSEC_H) |
71 | #include <usersec.h> | 61 | #include <usersec.h> |
72 | #endif | 62 | #endif |
@@ -1006,16 +996,6 @@ do_child(Session *s, const char *command) | |||
1006 | struct stat st; | 996 | struct stat st; |
1007 | char *argv[10]; | 997 | char *argv[10]; |
1008 | int do_xauth; | 998 | int do_xauth; |
1009 | #ifdef WITH_IRIX_PROJECT | ||
1010 | prid_t projid; | ||
1011 | #endif /* WITH_IRIX_PROJECT */ | ||
1012 | #ifdef WITH_IRIX_JOBS | ||
1013 | jid_t jid = 0; | ||
1014 | #else | ||
1015 | #ifdef WITH_IRIX_ARRAY | ||
1016 | int jid = 0; | ||
1017 | #endif /* WITH_IRIX_ARRAY */ | ||
1018 | #endif /* WITH_IRIX_JOBS */ | ||
1019 | 999 | ||
1020 | do_xauth = | 1000 | do_xauth = |
1021 | s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL; | 1001 | s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL; |
@@ -1098,39 +1078,9 @@ do_child(Session *s, const char *command) | |||
1098 | */ | 1078 | */ |
1099 | do_pam_setcred(0); | 1079 | do_pam_setcred(0); |
1100 | # endif /* USE_PAM */ | 1080 | # endif /* USE_PAM */ |
1101 | # ifdef WITH_IRIX_JOBS | 1081 | # if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) |
1102 | jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive"); | 1082 | irix_setusercontext(pw); |
1103 | if (jid == -1) { | 1083 | # endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */ |
1104 | fatal("Failed to create job container: %.100s", | ||
1105 | strerror(errno)); | ||
1106 | } | ||
1107 | # endif /* WITH_IRIX_JOBS */ | ||
1108 | # ifdef WITH_IRIX_ARRAY | ||
1109 | /* initialize array session */ | ||
1110 | if (jid == 0) { | ||
1111 | if (newarraysess() != 0) | ||
1112 | fatal("Failed to set up new array session: %.100s", | ||
1113 | strerror(errno)); | ||
1114 | } | ||
1115 | # endif /* WITH_IRIX_ARRAY */ | ||
1116 | # ifdef WITH_IRIX_PROJECT | ||
1117 | /* initialize irix project info */ | ||
1118 | if ((projid = getdfltprojuser(pw->pw_name)) == -1) { | ||
1119 | debug("Failed to get project id, using projid 0"); | ||
1120 | projid = 0; | ||
1121 | } | ||
1122 | if (setprid(projid)) | ||
1123 | fatal("Failed to initialize project %d for %s: %.100s", | ||
1124 | (int)projid, pw->pw_name, strerror(errno)); | ||
1125 | # endif /* WITH_IRIX_PROJECT */ | ||
1126 | #ifdef WITH_IRIX_AUDIT | ||
1127 | if (sysconf(_SC_AUDIT)) { | ||
1128 | debug("Setting sat id to %d", (int) pw->pw_uid); | ||
1129 | if (satsetid(pw->pw_uid)) | ||
1130 | debug("error setting satid: %.100s", strerror(errno)); | ||
1131 | } | ||
1132 | #endif /* WITH_IRIX_AUDIT */ | ||
1133 | |||
1134 | #ifdef _AIX | 1084 | #ifdef _AIX |
1135 | /* | 1085 | /* |
1136 | * AIX has a "usrinfo" area where logname and | 1086 | * AIX has a "usrinfo" area where logname and |