]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Make kproplog handle underfull iprop logs
authorGreg Hudson <ghudson@mit.edu>
Fri, 25 Jan 2013 23:59:09 +0000 (18:59 -0500)
committerGreg Hudson <ghudson@mit.edu>
Sat, 26 Jan 2013 01:06:50 +0000 (20:06 -0500)
kproplog currently assumes that an iprop log is full once it has
circled--which is true right now but will need to change for
hierarchical slaves.  Avoid this assumption by using the correct
index modulus in print_update whether or not the log is full.

Based on a patch from Richard Basch <basch@alum.mit.edu>.

src/slave/kproplog.c

index fc4c559e4750ac183f25eafe6341d5aed5c90798..67ff1543389704d713b28d846657b92c638ec0aa 100644 (file)
@@ -400,7 +400,8 @@ print_attr(kdbe_val_t *val, int vverbose)
  * Print the update entry information
  */
 static void
-print_update(kdb_hlog_t *ulog, uint32_t entry, unsigned int verbose)
+print_update(kdb_hlog_t *ulog, uint32_t entry, uint32_t ulogentries,
+             unsigned int verbose)
 {
     XDR                 xdrs;
     uint32_t            start_sno, i, j, indx;
@@ -414,7 +415,7 @@ print_update(kdb_hlog_t *ulog, uint32_t entry, unsigned int verbose)
         start_sno = ulog->kdb_first_sno - 1;
 
     for (i = start_sno; i < ulog->kdb_last_sno; i++) {
-        indx = i % ulog->kdb_num;
+        indx = i % ulogentries;
 
         indx_log = (kdb_ent_header_t *)INDEX(ulog, indx);
 
@@ -621,7 +622,7 @@ main(int argc, char **argv)
     }
 
     if ((!headeronly) && ulog->kdb_num) {
-        print_update(ulog, entry, verbose);
+        print_update(ulog, entry, params.iprop_ulogsize, verbose);
     }
 
     (void) printf("\n");