]> andersk Git - openssh.git/blob - openbsd-compat/port-irix.c
- (djm) Big KNF on openbsd-compat/
[openssh.git] / openbsd-compat / port-irix.c
1 /* XXX - BSD license here */
2
3 #include "includes.h"
4
5 #if defined(WITH_IRIX_PROJECT) || \
6     defined(WITH_IRIX_JOBS) || \
7     defined(WITH_IRIX_ARRAY)
8
9 #ifdef WITH_IRIX_PROJECT
10 # include <proj.h>
11 #endif /* WITH_IRIX_PROJECT */
12 #ifdef WITH_IRIX_JOBS
13 # include <sys/resource.h>
14 #endif
15 #ifdef WITH_IRIX_AUDIT
16 # include <sat.h>
17 #endif /* WITH_IRIX_AUDIT */
18
19 void
20 irix_setusercontext(struct passwd *pw)
21 {
22 #ifdef WITH_IRIX_PROJECT
23         prid_t projid;
24 #endif
25 #ifdef WITH_IRIX_JOBS
26         jid_t jid = 0;
27 #elif defined(WITH_IRIX_ARRAY)
28         int jid = 0;
29 #endif
30
31 #ifdef WITH_IRIX_JOBS
32         jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive");
33         if (jid == -1)
34                 fatal("Failed to create job container: %.100s",
35                     strerror(errno));
36 #endif /* WITH_IRIX_JOBS */
37 #ifdef WITH_IRIX_ARRAY
38         /* initialize array session */
39         if (jid == 0  && newarraysess() != 0)
40                 fatal("Failed to set up new array session: %.100s",
41                     strerror(errno));
42 #endif /* WITH_IRIX_ARRAY */
43 #ifdef WITH_IRIX_PROJECT
44         /* initialize irix project info */
45         if ((projid = getdfltprojuser(pw->pw_name)) == -1) {
46                 debug("Failed to get project id, using projid 0");
47                 projid = 0;
48         }
49         if (setprid(projid))
50                 fatal("Failed to initialize project %d for %s: %.100s",
51                     (int)projid, pw->pw_name, strerror(errno));
52 #endif /* WITH_IRIX_PROJECT */
53 #ifdef WITH_IRIX_AUDIT
54         if (sysconf(_SC_AUDIT)) {
55                 debug("Setting sat id to %d", (int) pw->pw_uid);
56                 if (satsetid(pw->pw_uid))
57                         debug("error setting satid: %.100s", strerror(errno));
58         }
59 #endif /* WITH_IRIX_AUDIT */
60 }
61
62
63 #endif /* defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) */
This page took 0.053157 seconds and 5 git commands to generate.