diff options
Diffstat (limited to 'openbsd-compat/port-irix.c')
-rw-r--r-- | openbsd-compat/port-irix.c | 61 |
1 files changed, 61 insertions, 0 deletions
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) */ | ||