1*7c478bd9Sstevel@tonic-gate #include "includes.h"
2*7c478bd9Sstevel@tonic-gate
3*7c478bd9Sstevel@tonic-gate #if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
4*7c478bd9Sstevel@tonic-gate
5*7c478bd9Sstevel@tonic-gate #ifdef WITH_IRIX_PROJECT
6*7c478bd9Sstevel@tonic-gate #include <proj.h>
7*7c478bd9Sstevel@tonic-gate #endif /* WITH_IRIX_PROJECT */
8*7c478bd9Sstevel@tonic-gate #ifdef WITH_IRIX_JOBS
9*7c478bd9Sstevel@tonic-gate #include <sys/resource.h>
10*7c478bd9Sstevel@tonic-gate #endif
11*7c478bd9Sstevel@tonic-gate #ifdef WITH_IRIX_AUDIT
12*7c478bd9Sstevel@tonic-gate #include <sat.h>
13*7c478bd9Sstevel@tonic-gate #endif /* WITH_IRIX_AUDIT */
14*7c478bd9Sstevel@tonic-gate
15*7c478bd9Sstevel@tonic-gate void
irix_setusercontext(struct passwd * pw)16*7c478bd9Sstevel@tonic-gate irix_setusercontext(struct passwd *pw)
17*7c478bd9Sstevel@tonic-gate {
18*7c478bd9Sstevel@tonic-gate #ifdef WITH_IRIX_PROJECT
19*7c478bd9Sstevel@tonic-gate prid_t projid;
20*7c478bd9Sstevel@tonic-gate #endif /* WITH_IRIX_PROJECT */
21*7c478bd9Sstevel@tonic-gate #ifdef WITH_IRIX_JOBS
22*7c478bd9Sstevel@tonic-gate jid_t jid = 0;
23*7c478bd9Sstevel@tonic-gate #else
24*7c478bd9Sstevel@tonic-gate # ifdef WITH_IRIX_ARRAY
25*7c478bd9Sstevel@tonic-gate int jid = 0;
26*7c478bd9Sstevel@tonic-gate # endif /* WITH_IRIX_ARRAY */
27*7c478bd9Sstevel@tonic-gate #endif /* WITH_IRIX_JOBS */
28*7c478bd9Sstevel@tonic-gate
29*7c478bd9Sstevel@tonic-gate #ifdef WITH_IRIX_JOBS
30*7c478bd9Sstevel@tonic-gate jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive");
31*7c478bd9Sstevel@tonic-gate if (jid == -1)
32*7c478bd9Sstevel@tonic-gate fatal("Failed to create job container: %.100s",
33*7c478bd9Sstevel@tonic-gate strerror(errno));
34*7c478bd9Sstevel@tonic-gate #endif /* WITH_IRIX_JOBS */
35*7c478bd9Sstevel@tonic-gate #ifdef WITH_IRIX_ARRAY
36*7c478bd9Sstevel@tonic-gate /* initialize array session */
37*7c478bd9Sstevel@tonic-gate if (jid == 0 && newarraysess() != 0)
38*7c478bd9Sstevel@tonic-gate fatal("Failed to set up new array session: %.100s",
39*7c478bd9Sstevel@tonic-gate strerror(errno));
40*7c478bd9Sstevel@tonic-gate #endif /* WITH_IRIX_ARRAY */
41*7c478bd9Sstevel@tonic-gate #ifdef WITH_IRIX_PROJECT
42*7c478bd9Sstevel@tonic-gate /* initialize irix project info */
43*7c478bd9Sstevel@tonic-gate if ((projid = getdfltprojuser(pw->pw_name)) == -1) {
44*7c478bd9Sstevel@tonic-gate debug("Failed to get project id, using projid 0");
45*7c478bd9Sstevel@tonic-gate projid = 0;
46*7c478bd9Sstevel@tonic-gate }
47*7c478bd9Sstevel@tonic-gate if (setprid(projid))
48*7c478bd9Sstevel@tonic-gate fatal("Failed to initialize project %d for %s: %.100s",
49*7c478bd9Sstevel@tonic-gate (int)projid, pw->pw_name, strerror(errno));
50*7c478bd9Sstevel@tonic-gate #endif /* WITH_IRIX_PROJECT */
51*7c478bd9Sstevel@tonic-gate #ifdef WITH_IRIX_AUDIT
52*7c478bd9Sstevel@tonic-gate if (sysconf(_SC_AUDIT)) {
53*7c478bd9Sstevel@tonic-gate debug("Setting sat id to %d", (int) pw->pw_uid);
54*7c478bd9Sstevel@tonic-gate if (satsetid(pw->pw_uid))
55*7c478bd9Sstevel@tonic-gate debug("error setting satid: %.100s", strerror(errno));
56*7c478bd9Sstevel@tonic-gate }
57*7c478bd9Sstevel@tonic-gate #endif /* WITH_IRIX_AUDIT */
58*7c478bd9Sstevel@tonic-gate }
59*7c478bd9Sstevel@tonic-gate
60*7c478bd9Sstevel@tonic-gate
61*7c478bd9Sstevel@tonic-gate #endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */
62*7c478bd9Sstevel@tonic-gate
63*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
64