2
* $Id: aklog_main.c,v 1.1.2.14 2006/08/29 19:19:05 shadow Exp $
2
* $Id: aklog_main.c,v 1.1.2.15 2007/02/10 13:56:54 jaltman Exp $
4
4
* Copyright 1990,1991 by the Massachusetts Institute of Technology
5
5
* For distribution and copying rights, see the file "mit-copyright.h"
8
8
#if !defined(lint) && !defined(SABER)
10
"$Id: aklog_main.c,v 1.1.2.14 2006/08/29 19:19:05 shadow Exp $";
10
"$Id: aklog_main.c,v 1.1.2.15 2007/02/10 13:56:54 jaltman Exp $";
11
11
#endif /* lint || SABER */
13
13
#include <afsconfig.h>
158
158
* Other prototypes
161
extern char *afs_realm_of_cell(krb5_context, struct afsconf_cell *);
161
extern char *afs_realm_of_cell(krb5_context, struct afsconf_cell *, int);
162
162
static int isdir(char *, unsigned char *);
163
163
static krb5_error_code get_credv5(krb5_context context, char *, char *,
164
164
char *, krb5_creds **);
499
char *realm = afs_realm_of_cell(context, &ak_cellconfig);
499
char *afs_realm = afs_realm_of_cell(context, &ak_cellconfig, FALSE);
503
503
"%s: Couldn't figure out realm for cell %s.\n",
504
504
progname, cell_to_use);
505
505
exit(AKLOG_MISC);
508
strcpy(realm_of_cell, realm);
508
strcpy(realm_of_cell, afs_realm);
511
printf("We've deduced that we need to authenticate to"
512
" realm %s.\n", realm_of_cell);
511
if (realm_of_cell[0])
512
printf("We've deduced that we need to authenticate to"
513
" realm %s.\n", realm_of_cell);
515
printf("We've deduced that we need to authenticate "
516
"using referrals.\n");
566
printf("Getting tickets: %s/%s@%s\n", name,
570
printf("Getting tickets: %s%s%s@%s\n", name,
571
primary_instance[0] ? "/" : "",
567
572
primary_instance, realm_of_cell);
570
575
status = get_credv5(context, name, primary_instance, realm_of_cell,
578
if ((status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) &&
580
char *afs_realm = afs_realm_of_cell(context, &ak_cellconfig, TRUE);
584
"%s: Couldn't figure out realm for cell %s.\n",
585
progname, cell_to_use);
589
strcpy(realm_of_cell, afs_realm);
591
if (strcasecmp(cell_to_use, realm_of_cell) == 0) {
593
secondary_instance[0] = '\0';
597
printf("We've deduced that we need to authenticate to"
598
" realm %s.\n", realm_of_cell);
599
printf("Getting tickets: %s%s%s@%s\n", name,
600
primary_instance[0] ? "/" : "",
601
primary_instance, realm_of_cell);
604
status = get_credv5(context, name, primary_instance, realm_of_cell,
573
608
if (status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) {
574
609
if (try_secondary) {
576
611
printf("Principal not found, trying alternate "
577
"service name: %s/%s@%s\n", name,
612
"service name: %s%s%s@%s\n", name,
613
secondary_instance[0] ? "/" : "",
578
614
secondary_instance, realm_of_cell);
580
616
status = get_credv5(context, name, secondary_instance,
779
815
error_message(status), username, cell_to_use,
782
printf("created cross-cell entry for %s at %s\n",
783
username, cell_to_use);
818
printf("created cross-cell entry for %s (Id %d) at %s\n",
819
username, id, cell_to_use);
784
820
sprintf(username, "AFS ID %d", (int) id);