From a7855be17da5d0075b8eb44837eb9b54fe26c96d Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 6 Sep 2006 20:31:54 +0000 Subject: [PATCH] Make database plugin responsible for releasing the error-message string, so that we can use the krb5_get_error_message interface internally. * kdb5.h: Add release_errcode_string field to the interface. * db2_exp.c, ldap_exp.c: Initialize it. * ldap_misc.c: Use krb5_get/free_error_message for error message strings. * kdb_ldap.h: Declare krb5_ldap_release_errcode_string. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18565 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kdb/kdb5.h | 1 + src/plugins/kdb/db2/db2_exp.c | 1 + src/plugins/kdb/ldap/ldap_exp.c | 1 + src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h | 3 +++ src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c | 7 ++++++- 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/kdb/kdb5.h b/src/lib/kdb/kdb5.h index 43c681db3..f19b077e4 100644 --- a/src/lib/kdb/kdb5.h +++ b/src/lib/kdb/kdb5.h @@ -114,6 +114,7 @@ typedef struct _kdb_vftabl{ const char * (*errcode_2_string) (krb5_context kcontext, long err_code); + void (*release_errcode_string) (krb5_context kcontext, const char *msg); void * (*db_alloc) (krb5_context kcontext, void *ptr, size_t size); void (*db_free) (krb5_context kcontext, void *ptr); diff --git a/src/plugins/kdb/db2/db2_exp.c b/src/plugins/kdb/db2/db2_exp.c index c922eafd0..9b6a58abd 100644 --- a/src/plugins/kdb/db2/db2_exp.c +++ b/src/plugins/kdb/db2/db2_exp.c @@ -246,6 +246,7 @@ kdb_vftabl kdb_function_table = { /* db_supported_realms */ NULL, /* db_free_supported_realms */ NULL, /* errcode_2_string */ NULL, + /* release_errcode_string */ NULL, /* db_alloc */ wrap_krb5_db2_alloc, /* db_free */ wrap_krb5_db2_free, /* set_master_key */ wrap_krb5_db2_set_master_key_ext, diff --git a/src/plugins/kdb/ldap/ldap_exp.c b/src/plugins/kdb/ldap/ldap_exp.c index 6c5a37077..d0eec64d8 100644 --- a/src/plugins/kdb/ldap/ldap_exp.c +++ b/src/plugins/kdb/ldap/ldap_exp.c @@ -72,6 +72,7 @@ kdb_vftabl kdb_function_table = { /* db_supported_realms */ krb5_ldap_supported_realms, /* db_free_supported_realms */ krb5_ldap_free_supported_realms, /* errcode_2_string */ krb5_ldap_errcode_2_string, + /* release_errcode_string */ krb5_ldap_release_errcode_string, /* db_alloc */ krb5_ldap_alloc, /* db_free */ krb5_ldap_free, /* optional functions */ diff --git a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h index 81fc6f636..df6d4e819 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h +++ b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h @@ -292,4 +292,7 @@ krb5_ldap_free_supported_realms( krb5_context, char ** ); const char * krb5_ldap_errcode_2_string( krb5_context, long ); +void +krb5_ldap_release_errcode_string (krb5_context, const char *); + #endif diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c index cfa1a5ff4..76b53820f 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c @@ -1547,6 +1547,11 @@ krb5_ldap_free_supported_realms(krb5_context kcontext, char **realms) const char * krb5_ldap_errcode_2_string(krb5_context kcontext, long err_code) { - return error_message(err_code); + return krb5_get_error_message(kcontext, err_code); } +void +krb5_ldap_release_errcode_string(krb5_context kcontext, const char *msg) +{ + krb5_free_error_message(kcontext, msg); +} -- 2.26.2