Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / log / pagsh.c
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12
13 #include <roken.h>
14
15 #ifdef AFS_AIX32_ENV
16 # ifdef AFS_AIX51_ENV
17 # include <sys/cred.h>
18 # ifdef HAVE_SYS_PAG_H
19 # include <sys/pag.h>
20 # endif
21 # endif
22 #endif
23
24 #include <limits.h>
25 #include <rx/rx.h>
26 #include <afs/auth.h>
27 #include <afs/sys_prototypes.h>
28
29 #include "AFS_component_version_number.c"
30
31 int
32 main(int argc, char *argv[])
33 {
34 struct passwd *pwe;
35 int uid;
36 char *shell = "/bin/sh";
37
38 #ifdef AFS_AIX32_ENV
39 /*
40 * The following signal action for AIX is necessary so that in case of a
41 * crash (i.e. core is generated) we can include the user's data section
42 * in the core dump. Unfortunately, by default, only a partial core is
43 * generated which, in many cases, isn't too useful.
44 */
45 struct sigaction nsa;
46
47 sigemptyset(&nsa.sa_mask);
48 nsa.sa_handler = SIG_DFL;
49 nsa.sa_flags = SA_FULLDUMP;
50 sigaction(SIGSEGV, &nsa, NULL);
51 #endif
52 uid = getuid();
53 pwe = getpwuid(uid);
54 if (pwe == 0) {
55 fprintf(stderr, "Intruder alert.\n");
56 } else {
57 /* shell = pwe->pw_shell; */
58 }
59 if (setpag() == -1) {
60 perror("setpag");
61 }
62 #ifdef AFS_KERBEROS_ENV
63 ktc_newpag();
64 #endif
65 argv[0] = shell;
66 execvp(shell, argv);
67 perror(shell);
68 fprintf(stderr, "No shell\n");
69 exit(1);
70 }