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>
16 #include <sys/types.h>
17 #include <netinet/in.h>
30 #include <afs/cellconfig.h>
31 #include <afs/afsutil.h>
38 #include "AFS_component_version_number.c"
41 main(int argc, char **argv)
43 struct ktc_token token;
44 struct ktc_principal sname;
45 register afs_int32 code;
46 struct afsconf_dir *dir;
49 char cellName[MAXKTCNAMELEN];
54 * The following signal action for AIX is necessary so that in case of a
55 * crash (i.e. core is generated) we can include the user's data section
56 * in the core dump. Unfortunately, by default, only a partial core is
57 * generated which, in many cases, isn't too useful.
61 sigemptyset(&nsa.sa_mask);
62 nsa.sa_handler = SIG_DFL;
63 nsa.sa_flags = SA_FULLDUMP;
64 sigaction(SIGSEGV, &nsa, NULL);
67 printf("kseal: usage is 'kseal <username> <server key>\n");
71 /* lookup configuration info */
72 dir = afsconf_Open(AFSDIR_CLIENT_ETC_DIRPATH);
74 printf("kseal: can't open config dir (%s)\n",
75 AFSDIR_CLIENT_ETC_DIRPATH);
78 code = afsconf_GetLocalCell(dir, cellName, sizeof(cellName));
80 printf("kseal: failed to get local cell name, code %d\n", code);
84 /* setup key for sealing */
85 string_to_key(argv[2], skey);
88 memcpy(session, &now, 4); /* but this is only a test pgm */
89 memcpy(session + 4, &now, 4);
91 tkt_MakeTicket(token.ticket, &token.ticketLen, skey, argv[1], "",
92 cellName, now - 300, now + 25 * 3600, session,
93 /* host */ 0, "afs", "");
95 printf("kseal: could not seal ticket, code %d!\n", code);
99 /* now send the ticket to the ticket cache */
100 strcpy(sname.name, "afs");
101 strcpy(sname.instance, "");
102 strcpy(sname.cell, cellName);
104 token.endTime = 0x7fffffff;
105 memcpy(&token.sessionKey, session, 8);
107 code = ktc_SetToken(&sname, &token, NULL, 0);
109 printf("kseal: could not install newly-sealed ticket, code %d\n",