Skip Menu |
 

Subject: Failed kdb5_util load removes real database
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.

The trunk kdb_db2 code has already drifted substantially and does not
have this bug. Please apply the attached patch for 1.9.
Download patch.txt
text/plain 760B
Index: src/plugins/kdb/db2/kdb_db2.c
===================================================================
--- src/plugins/kdb/db2/kdb_db2.c (revision 24510)
+++ src/plugins/kdb/db2/kdb_db2.c (working copy)
@@ -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 *
From: tlyu@mit.edu
Subject: SVN Commit

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.

https://github.com/krb5/krb5/commit/7bd614f7b3a11e67a21e01049116354c29853de6
Commit By: tlyu
Revision: 24548
Changed Files:
U branches/krb5-1-9/src/plugins/kdb/db2/kdb_db2.c