From 7bd614f7b3a11e67a21e01049116354c29853de6 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Wed, 1 Dec 2010 20:49:06 +0000 Subject: [PATCH] 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. ticket: 6815 version_fixed: 1.9 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-9@24548 dc483132-0cff-0310-8789-dd5450dbe970 --- src/plugins/kdb/db2/kdb_db2.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/kdb/db2/kdb_db2.c b/src/plugins/kdb/db2/kdb_db2.c index 0a35e3a71..334e5a3a8 100644 --- a/src/plugins/kdb/db2/kdb_db2.c +++ b/src/plugins/kdb/db2/kdb_db2.c @@ -1206,6 +1206,7 @@ krb5_db2_destroy(krb5_context context, char *conf_section, char **db_args) { 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 @@ krb5_db2_destroy(krb5_context context, char *conf_section, char **db_args) 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 * -- 2.26.2