~ubuntu-branches/ubuntu/trusty/krb5/trusty

« back to all changes in this revision

Viewing changes to src/slave/kproplog.c

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-11-10 02:20:12 UTC
  • mfrom: (53.1.3 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131110022012-b8ojkqhcxos55kln
Tags: 1.11.3+dfsg-3ubuntu2
Add alternate dependency on libverto-libevent1 as that's the package
ABI name in ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 * This module will parse the update logs on the master or slave servers.
11
11
 */
12
12
 
 
13
#include <locale.h>
13
14
#include <stdio.h>
14
15
#include <sys/types.h>
15
16
#include <time.h>
29
30
static void
30
31
usage()
31
32
{
32
 
    (void) fprintf(stderr, _("\nUsage: %s [-h] [-v] [-v] [-e num]\n\n"),
33
 
                   progname);
 
33
    fprintf(stderr, _("\nUsage: %s [-h] [-v] [-v] [-e num]\n\t%s -R\n\n"),
 
34
            progname, progname);
34
35
    exit(1);
35
36
}
36
37
 
488
489
    int                 c;
489
490
    unsigned int        verbose = 0;
490
491
    bool_t              headeronly = FALSE;
 
492
    bool_t              reset = FALSE;
491
493
    uint32_t            entry = 0;
492
494
    krb5_context        context;
493
495
    kadm5_config_params params;
495
497
    kdb_hlog_t          *ulog = NULL;
496
498
    char                **db_args = NULL; /* XXX */
497
499
 
498
 
    setlocale(LC_MESSAGES, "");
 
500
    setlocale(LC_ALL, "");
499
501
 
500
502
#if !defined(TEXT_DOMAIN)
501
503
#define TEXT_DOMAIN "SYS_TEST"
505
507
 
506
508
    progname = argv[0];
507
509
 
508
 
    while ((c = getopt(argc, argv, "vhe:")) != -1) {
 
510
    while ((c = getopt(argc, argv, "Rvhe:")) != -1) {
509
511
        switch (c) {
510
512
        case 'h':
511
513
            headeronly = TRUE;
513
515
        case 'e':
514
516
            entry = atoi(optarg);
515
517
            break;
 
518
        case 'R':
 
519
            reset = TRUE;
 
520
            break;
516
521
        case 'v':
517
522
            verbose++;
518
523
            break;
538
543
    (void) printf(_("\nKerberos update log (%s)\n"),
539
544
                  params.iprop_logfile);
540
545
 
541
 
    if (ulog_map(context, params.iprop_logfile, 0, FKPROPLOG, db_args)) {
 
546
    if (ulog_map(context, params.iprop_logfile, 0,
 
547
                 reset ? FKADMIND : FKPROPLOG, db_args)) {
542
548
        (void) fprintf(stderr, _("Unable to map log file %s\n\n"),
543
549
                       params.iprop_logfile);
544
550
        exit(1);
559
565
        exit(1);
560
566
    }
561
567
 
 
568
    if (reset) {
 
569
        ulog->kdb_hmagic = KDB_ULOG_HDR_MAGIC;
 
570
        ulog->db_version_num = KDB_VERSION;
 
571
        ulog->kdb_state = KDB_STABLE;
 
572
        ulog->kdb_block = ULOG_BLOCK;
 
573
        ulog->kdb_first_sno = 0;
 
574
        ulog->kdb_first_time.seconds = 0;
 
575
        ulog->kdb_first_time.useconds = 0;
 
576
        ulog->kdb_last_sno = 0;
 
577
        ulog->kdb_last_time.seconds = 0;
 
578
        ulog->kdb_last_time.useconds = 0;
 
579
        ulog_sync_header(ulog);
 
580
        printf(_("Reinitialized the ulog.\n"));
 
581
        exit(0);
 
582
    }
 
583
 
562
584
    (void) printf(_("Update log dump :\n"));
563
585
    (void) printf(_("\tLog version # : %u\n"), ulog->db_version_num);
564
586
    (void) printf(_("\tLog state : "));