2 * Copyright 2000, International Business Machines Corporation and others.
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
10 #include <afsconfig.h>
11 #include <afs/param.h>
32 #ifdef AFS_KERBEROS_ENV
33 #include <sys/types.h>
37 #include "AFS_component_version_number.c"
39 extern afs_int32 setpag();
42 main(int argc, char *argv[])
46 char *shell = "/bin/sh";
50 * The following signal action for AIX is necessary so that in case of a
51 * crash (i.e. core is generated) we can include the user's data section
52 * in the core dump. Unfortunately, by default, only a partial core is
53 * generated which, in many cases, isn't too useful.
57 sigemptyset(&nsa.sa_mask);
58 nsa.sa_handler = SIG_DFL;
59 nsa.sa_flags = SA_FULLDUMP;
60 sigaction(SIGSEGV, &nsa, NULL);
66 fprintf(stderr, "Intruder alert.\n");
68 /* shell = pwe->pw_shell; */
73 #ifdef AFS_KERBEROS_ENV
81 fprintf(stderr, "No shell\n");
86 #ifdef AFS_KERBEROS_ENV
87 /* stolen from auth/ktc.c */
92 #if defined(AFS_AIX51_ENV)
95 if (get_pag(PAG_AFS, &pag) < 0 || pag == 0)
99 afs_uint32 groups[NGROUPS_MAX];
101 afs_uint32 h, l, ret;
103 if (getgroups(sizeof groups / sizeof groups[0], groups) < 2)
106 g0 = groups[0] & 0xffff;
107 g1 = groups[1] & 0xffff;
110 if ((g0 < 0xc000) && (g1 < 0xc000)) {
111 l = ((g0 & 0x3fff) << 14) | (g1 & 0x3fff);
113 h = (g1 >> 14) + h + h + h;
114 ret = ((h << 28) | l);
115 /* Additional testing */
116 if (((ret >> 24) & 0xff) == 'A')
128 extern char **environ;
132 char fname[256], *prefix = "/ticket/";
134 char **newenv, **senv, **denv;
136 if (stat("/ticket", &sbuf) == -1) {
140 pag = curpag() & 0xffffffff;
142 sprintf(fname, "%s%d", prefix, getuid());
144 sprintf(fname, "%sp%ld", prefix, pag);
146 /* ktc_set_tkt_string(fname); */
148 for (senv = environ, numenv = 0; *senv; senv++)
150 newenv = (char **)malloc((numenv + 2) * sizeof(char *));
152 for (senv = environ, denv = newenv; *senv; *senv++) {
153 if (strncmp(*senv, "KRBTKFILE=", 10) != 0)
157 *denv = malloc(10 + strlen(fname) + 1);
158 strcpy(*denv, "KRBTKFILE=");
159 strcat(*denv, fname);