summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2012-09-06 15:31:59 -0500
committerGreg Hudson <ghudson@mit.edu>2012-10-05 15:18:22 -0400
commita298ab2ab8b9eb384fdbf5f3625172ded61ece9f (patch)
tree1e8ec6bc538b62e9adb589e95dc393d137071bf7
parente65a16d898f3a686525e83661f4fd86c76e27bbf (diff)
downloadkrb5-a298ab2ab8b9eb384fdbf5f3625172ded61ece9f.tar.gz
krb5-a298ab2ab8b9eb384fdbf5f3625172ded61ece9f.tar.xz
krb5-a298ab2ab8b9eb384fdbf5f3625172ded61ece9f.zip
Add -R option to kproplog to force full resyncs
ticket: 7375
-rw-r--r--doc/rst_source/krb_admins/admin_commands/kpropd.rst3
-rw-r--r--doc/rst_source/krb_admins/admin_commands/kproplog.rst6
-rw-r--r--src/slave/kproplog.c29
3 files changed, 34 insertions, 4 deletions
diff --git a/doc/rst_source/krb_admins/admin_commands/kpropd.rst b/doc/rst_source/krb_admins/admin_commands/kpropd.rst
index d881a6283..b5cebcc47 100644
--- a/doc/rst_source/krb_admins/admin_commands/kpropd.rst
+++ b/doc/rst_source/krb_admins/admin_commands/kpropd.rst
@@ -55,6 +55,9 @@ enabled, the principal ``kiprop/slavehostname@REALM`` (where
name of the Kerberos realm) must be present in the slave's keytab
file.
+:ref:`kproplog(8)` can be used to force full replication when iprop is
+enabled.
+
OPTIONS
--------
diff --git a/doc/rst_source/krb_admins/admin_commands/kproplog.rst b/doc/rst_source/krb_admins/admin_commands/kproplog.rst
index 5d71575a5..c7a0ea417 100644
--- a/doc/rst_source/krb_admins/admin_commands/kproplog.rst
+++ b/doc/rst_source/krb_admins/admin_commands/kproplog.rst
@@ -7,6 +7,7 @@ SYNOPSIS
--------
**kproplog** [**-h**] [**-e** *num*] [-v]
+**kproplog** [-R]
DESCRIPTION
@@ -35,6 +36,11 @@ last update received and the associated time stamp of the last update.
OPTIONS
-------
+**-R**
+ Reset the update log. This forces full resynchronization. If used
+ on a slave then that slave will request a full resync. If used on
+ the master then all slaves will request full resyncs.
+
**-h**
Display a summary of the update log. This information includes
the database version number, state of the database, the number of
diff --git a/src/slave/kproplog.c b/src/slave/kproplog.c
index e58ca2078..c6f244bbb 100644
--- a/src/slave/kproplog.c
+++ b/src/slave/kproplog.c
@@ -30,8 +30,8 @@ static char *progname;
static void
usage()
{
- (void) fprintf(stderr, _("\nUsage: %s [-h] [-v] [-v] [-e num]\n\n"),
- progname);
+ fprintf(stderr, _("\nUsage: %s [-h] [-v] [-v] [-e num]\n\t%s -R\n\n"),
+ progname, progname);
exit(1);
}
@@ -489,6 +489,7 @@ main(int argc, char **argv)
int c;
unsigned int verbose = 0;
bool_t headeronly = FALSE;
+ bool_t reset = FALSE;
uint32_t entry = 0;
krb5_context context;
kadm5_config_params params;
@@ -506,7 +507,7 @@ main(int argc, char **argv)
progname = argv[0];
- while ((c = getopt(argc, argv, "vhe:")) != -1) {
+ while ((c = getopt(argc, argv, "Rvhe:")) != -1) {
switch (c) {
case 'h':
headeronly = TRUE;
@@ -514,6 +515,9 @@ main(int argc, char **argv)
case 'e':
entry = atoi(optarg);
break;
+ case 'R':
+ reset = TRUE;
+ break;
case 'v':
verbose++;
break;
@@ -539,7 +543,8 @@ main(int argc, char **argv)
(void) printf(_("\nKerberos update log (%s)\n"),
params.iprop_logfile);
- if (ulog_map(context, params.iprop_logfile, 0, FKPROPLOG, db_args)) {
+ if (ulog_map(context, params.iprop_logfile, 0,
+ reset ? FKADMIND : FKPROPLOG, db_args)) {
(void) fprintf(stderr, _("Unable to map log file %s\n\n"),
params.iprop_logfile);
exit(1);
@@ -560,6 +565,22 @@ main(int argc, char **argv)
exit(1);
}
+ if (reset) {
+ ulog->kdb_hmagic = KDB_ULOG_HDR_MAGIC;
+ ulog->db_version_num = KDB_VERSION;
+ ulog->kdb_state = KDB_STABLE;
+ ulog->kdb_block = ULOG_BLOCK;
+ ulog->kdb_first_sno = 0;
+ ulog->kdb_first_time.seconds = 0;
+ ulog->kdb_first_time.useconds = 0;
+ ulog->kdb_last_sno = 0;
+ ulog->kdb_last_time.seconds = 0;
+ ulog->kdb_last_time.useconds = 0;
+ ulog_sync_header(ulog);
+ printf(_("Reinitialized the ulog.\n"));
+ exit(0);
+ }
+
(void) printf(_("Update log dump :\n"));
(void) printf(_("\tLog version # : %u\n"), ulog->db_version_num);
(void) printf(_("\tLog state : "));