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>
17 #include <sys/types.h>
22 #include <netinet/in.h>
24 #include "cellconfig.h"
25 #include <afs/afsutil.h>
27 #include "AFS_component_version_number.c"
36 register afs_int32 code;
38 struct afsconf_dir *tdir;
39 struct ktc_principal tserver;
40 struct ktc_token token;
42 strcpy(whoami, argv[0]);
46 ("%s: copies a file system ticket from the local cell to another cell\n",
48 printf("%s: usage is 'setauth <new-cell>\n", whoami);
54 /* lookup the name of the local cell */
55 tdir = afsconf_Open(AFSDIR_CLIENT_ETC_DIRPATH);
57 printf("copyauth: can't open dir %s\n", AFSDIR_CLIENT_ETC_DIRPATH);
60 code = afsconf_GetLocalCell(tdir, localName, sizeof(localName));
62 printf("%s: can't determine local cell name\n", whoami);
65 /* done with configuration stuff now */
69 /* get ticket in local cell */
70 strcpy(tserver.cell, localName);
71 strcpy(tserver.name, "afs");
72 tserver.instance[0] = 0;
73 code = ktc_GetToken(&tserver, &token, sizeof(token), NULL);
76 ("%s: failed to get '%s' service ticket in cell '%s' (code %d)\n",
77 whoami, tserver.name, tserver.cell, code);
81 /* and now set the ticket in the new cell */
82 strcpy(tserver.cell, argv[1]);
83 code = ktc_SetToken(&tserver, &token, NULL, 0);
86 ("%s: failed to set ticket (code %d), are you sure you're authenticated?\n",
92 printf("Authentication established for cell %s.\n", cname);