svn rev #24548: branches/krb5-1-9/src/plugins/kdb/db2/

tlyu@MIT.EDU tlyu at MIT.EDU
Wed Dec 1 15:49:06 EST 2010


http://src.mit.edu/fisheye/changelog/krb5/?cs=24548
Commit By: tlyu
Log Message:
ticket: 6815
version_fixed: 1.9

Apply ported patch.

 If kdb5_util load (without -update) fails--say, due to an invalid dump
 file--it calls krb5_db_destroy to destroy the temporary DB.
 Unfortunately, this results in the destruction of the real DB instead.

 Luckily, this bug only applies to krb5 1.9, which hasn't been released
 yet.  In krb5 1.8 the destroy operation fails before it does any damage.


Changed Files:
U   branches/krb5-1-9/src/plugins/kdb/db2/kdb_db2.c
Modified: branches/krb5-1-9/src/plugins/kdb/db2/kdb_db2.c
===================================================================
--- branches/krb5-1-9/src/plugins/kdb/db2/kdb_db2.c	2010-12-01 20:01:46 UTC (rev 24547)
+++ branches/krb5-1-9/src/plugins/kdb/db2/kdb_db2.c	2010-12-01 20:49:06 UTC (rev 24548)
@@ -1206,6 +1206,7 @@
 {
     krb5_error_code status = 0;
     krb5_db2_context *db_ctx;
+    char *db_name;
 
     if (k5db2_inited(context)) {
         status = krb5_db2_fini(context);
@@ -1223,7 +1224,12 @@
         return status;
 
     db_ctx = context->dal_handle->db_context;
-    return destroy_db(context, db_ctx->db_name);
+    db_name = gen_dbsuffix(db_ctx->db_name, db_ctx->tempdb ? "~" : "");
+    if (db_name == NULL)
+        return ENOMEM;
+    status = destroy_db(context, db_name);
+    free(db_name);
+    return status;
 }
 
 void   *




More information about the cvs-krb5 mailing list