~ubuntu-branches/ubuntu/feisty/openafs/feisty

« back to all changes in this revision

Viewing changes to src/aklog/aklog_main.c

  • Committer: Package Import Robot
  • Author(s): Russ Allbery
  • Date: 2007-03-26 18:56:55 UTC
  • Revision ID: package-import@ubuntu.com-20070326185655-osce8n0y0dptgurh
* New upstream release.  (Closes: #415699)
  - Support newer Linux kernels.  (Closes: #409797, #410120)
  - Add aklog fallbacks for null realms to support the referral
    capability in MIT Kerberos 1.6 and later.  (Closes: #410314)
* Apply patch from Thomas Sesselmann to support setting options to pass
  to bosserver in /etc/default/openafs-fileserver.  (Closes: #409357)
* Remove the rx_Init calls in the PAM module.  The internal counters
  that had to be initialized that way have been removed.
* Now that we're running regen.sh as part of the build process, only
  patch the Autoconf source files and not the generated output to make
  the diff easier to audit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* 
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 $
3
3
 *
4
4
 * Copyright 1990,1991 by the Massachusetts Institute of Technology
5
5
 * For distribution and copying rights, see the file "mit-copyright.h"
7
7
 
8
8
#if !defined(lint) && !defined(SABER)
9
9
static char *rcsid =
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 */
12
12
 
13
13
#include <afsconfig.h>
158
158
 * Other prototypes
159
159
 */
160
160
 
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 **);
496
496
            }
497
497
        }
498
498
        else {
499
 
            char *realm = afs_realm_of_cell(context, &ak_cellconfig);
 
499
            char *afs_realm = afs_realm_of_cell(context, &ak_cellconfig, FALSE);
500
500
 
501
 
            if (!realm) {
 
501
            if (!afs_realm) {
502
502
                fprintf(stderr, 
503
503
                        "%s: Couldn't figure out realm for cell %s.\n",
504
504
                        progname, cell_to_use);
505
505
                exit(AKLOG_MISC);
506
506
            }
507
507
 
508
 
            strcpy(realm_of_cell, realm);
 
508
            strcpy(realm_of_cell, afs_realm);
509
509
 
510
510
            if (dflag) {
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);
 
514
                else
 
515
                    printf("We've deduced that we need to authenticate "
 
516
                           "using referrals.\n");
513
517
            }
514
518
        }
515
519
 
563
567
         */
564
568
 
565
569
        if (dflag) {
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);
568
573
        }
569
574
 
570
575
        status = get_credv5(context, name, primary_instance, realm_of_cell,
571
576
                            &v5cred);
572
577
 
 
578
        if ((status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) &&
 
579
            !realm_of_cell[0]) {
 
580
            char *afs_realm = afs_realm_of_cell(context, &ak_cellconfig, TRUE);
 
581
 
 
582
            if (!afs_realm) {
 
583
                fprintf(stderr, 
 
584
                        "%s: Couldn't figure out realm for cell %s.\n",
 
585
                        progname, cell_to_use);
 
586
                exit(AKLOG_MISC);
 
587
            }
 
588
 
 
589
            strcpy(realm_of_cell, afs_realm);
 
590
 
 
591
            if (strcasecmp(cell_to_use, realm_of_cell) == 0) {
 
592
                try_secondary = 1;
 
593
                secondary_instance[0] = '\0';
 
594
            }
 
595
 
 
596
            if (dflag) {
 
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);
 
602
            }
 
603
 
 
604
            status = get_credv5(context, name, primary_instance, realm_of_cell,
 
605
                                 &v5cred);
 
606
 
 
607
        }
573
608
        if (status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) {
574
609
            if (try_secondary) {
575
610
                if (dflag) {
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);
579
615
                }
580
616
                status = get_credv5(context, name, secondary_instance,
779
815
                            error_message(status), username, cell_to_use,
780
816
                            status);
781
817
                } else {
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);
785
821
                }
786
822
            }