krb5 commit: Fix policy refcount corruption race in dump

Greg Hudson ghudson at MIT.EDU
Fri Oct 5 15:32:28 EDT 2012


https://github.com/krb5/krb5/commit/e65a16d898f3a686525e83661f4fd86c76e27bbf
commit e65a16d898f3a686525e83661f4fd86c76e27bbf
Author: Nicolas Williams <nico at cryptonector.com>
Date:   Thu Sep 27 17:10:41 2012 -0500

    Fix policy refcount corruption race in dump
    
    ticket: 7384

 src/kadmin/dbutil/dump.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/kadmin/dbutil/dump.c b/src/kadmin/dbutil/dump.c
index 1009679..63f48f3 100644
--- a/src/kadmin/dbutil/dump.c
+++ b/src/kadmin/dbutil/dump.c
@@ -1476,17 +1476,17 @@ dump_db(argc, argv)
         arglist.kcontext = util_context;
         fprintf(arglist.ofile, "%s", dump->header);
 
-        if (dump_sno) {
-            /*
-             * We grab the lock twice (once again in the iterator call),
-             * but that's ok since the lock func handles incr locks held.
-             */
-            if (krb5_db_lock(util_context, KRB5_LOCKMODE_SHARED)) {
-                fprintf(stderr,
-                        _("%s: Couldn't grab lock\n"), progname);
-                goto error;
-            }
+        /*
+         * We grab the lock twice (once again in the iterator call),
+         * but that's ok since the lock func handles incr locks held.
+         */
+        if (krb5_db_lock(util_context, KRB5_LOCKMODE_SHARED)) {
+            fprintf(stderr,
+                    _("%s: Couldn't grab lock\n"), progname);
+            goto error;
+        }
 
+        if (dump_sno) {
             if (ipropx_version)
                 fprintf(f, " %u", IPROPX_VERSION);
             fprintf(f, " %u", log_ctx->ulog->kdb_last_sno);


More information about the cvs-krb5 mailing list