Make database plugin responsible for releasing the error-message string, so
authorKen Raeburn <raeburn@mit.edu>
Wed, 6 Sep 2006 20:31:54 +0000 (20:31 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 6 Sep 2006 20:31:54 +0000 (20:31 +0000)
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
src/plugins/kdb/db2/db2_exp.c
src/plugins/kdb/ldap/ldap_exp.c
src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h
src/plugins/kdb/ldap/libkdb_ldap/ldap_misc.c

index 43c681db3637b1c32e82751422db48189d963803..f19b077e4db90d784887a90da14afc58200cec44 100644 (file)
@@ -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);
index c922eafd06406db60841551a2f1fd7145d86cb99..9b6a58abd55c4e743cbd5dd2a3f1f140fb0f8a6f 100644 (file)
@@ -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,
index 6c5a370779129864049c33516c8b852eeef0002c..d0eec64d8022a9c4f60ae7351c1bcd9203e1d620 100644 (file)
@@ -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 */
index 81fc6f63697101edc38c985a1cb48bf6e80272ed..df6d4e819f01a00136c479108a21178dcf8b1389 100644 (file)
@@ -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
index cfa1a5ff4dc72cb22fba2502b20b808d0e4bd89a..76b53820f20dd63f4c896b0bdfc2527656b4c8c3 100644 (file)
@@ -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);
+}