[krb5-auth-dialog] check for krb5_free_error_message
- From: Guido Günther <guidog src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog] check for krb5_free_error_message
- Date: Mon, 28 Sep 2009 16:21:20 +0000 (UTC)
commit 126657ebfddb23aa3e3aa18f25f4afae00ecc24d
Author: Guido Günther <agx sigxcpu org>
Date: Thu Sep 17 00:33:57 2009 +0200
check for krb5_free_error_message
and make krb5_get_error_message mandatory. Fixes build with MIT
Kerberos.
configure.ac | 5 ++++-
src/krb5-auth-dialog.c | 20 ++++++++++++++++----
2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index dd9115b..cf601d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,7 +87,10 @@ AC_CHECK_MEMBERS(krb5_creds.flags.b.forwardable,,,[#include <krb5.h>])
AC_CHECK_MEMBERS(krb5_creds.flags.b.renewable,,,[#include <krb5.h>])
AC_CHECK_MEMBERS(krb5_creds.flags.b.proxiable,,,[#include <krb5.h>])
AC_CHECK_MEMBERS(krb5_creds.flags,,,[#include <krb5.h>])
-AC_CHECK_FUNCS([krb5_get_error_message krb5_get_renewed_creds \
+AC_CHECK_FUNCS([krb5_get_error_message \
+ krb5_free_error_message \
+ krb5_free_error_string \
+ krb5_get_renewed_creds \
krb5_get_init_creds_opt_set_default_flags \
krb5_cc_clear_mcred])
AC_CHECK_FUNCS([krb5_get_init_creds_opt_set_pkinit],
diff --git a/src/krb5-auth-dialog.c b/src/krb5-auth-dialog.c
index 46e2317..b8f95c2 100644
--- a/src/krb5-auth-dialog.c
+++ b/src/krb5-auth-dialog.c
@@ -139,22 +139,34 @@ get_principal_realm_data(krb5_principal p)
#endif
}
+static void
+ka_krb5_free_error_message(krb5_context context, const char* msg)
+{
+#if defined(HAVE_KRB5_FREE_ERROR_MESSAGE)
+ krb5_free_error_message(context, msg);
+#elif defined(HAVE_KRB5_FREE_ERROR_STRING)
+ krb5_free_error_string(context, (char *) msg);
+#else
+# error No way to free error string.
+#endif
+}
+
/*
* Returns a descriptive error message or kerberos related error
- * pointer must be freed using g_free()
+ * returned pointer must be freed using g_free().
*/
static char*
ka_get_error_message(krb5_context context, krb5_error_code err)
{
char *msg = NULL;
#if defined(HAVE_KRB5_GET_ERROR_MESSAGE)
- char *krberr;
+ const char *krberr;
krberr = krb5_get_error_message(context, err);
msg = g_strdup(krberr);
- krb5_free_error_string(context, krberr);
+ ka_krb5_free_error_message(context, krberr);
#else
- msg = g_strdup(error_message(err));
+# error No detailed error message information
#endif
if (msg == NULL)
msg = g_strdup(_("unknown error"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]