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