krb5-auth-dialog r89 - in branches/pkinit: . src



Author: guidog
Date: Sun Jan  4 16:04:02 2009
New Revision: 89
URL: http://svn.gnome.org/viewvc/krb5-auth-dialog?rev=89&view=rev

Log:
use get_error_message() when possible

since it gives clearer error messages

Modified:
   branches/pkinit/ChangeLog
   branches/pkinit/configure.ac
   branches/pkinit/src/krb5-auth-dialog.c

Modified: branches/pkinit/configure.ac
==============================================================================
--- branches/pkinit/configure.ac	(original)
+++ branches/pkinit/configure.ac	Sun Jan  4 16:04:02 2009
@@ -59,6 +59,7 @@
 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])
 AC_CHECK_FUNCS([krb5_get_renewed_creds])
 AC_MSG_CHECKING(if a krb5_principal->realm is a char*)
 AC_COMPILE_IFELSE([

Modified: branches/pkinit/src/krb5-auth-dialog.c
==============================================================================
--- branches/pkinit/src/krb5-auth-dialog.c	(original)
+++ branches/pkinit/src/krb5-auth-dialog.c	Sun Jan  4 16:04:02 2009
@@ -125,6 +125,23 @@
 	return p->realm.data;
 #endif
 }
+
+static const char*
+get_error_message(krb5_context context, krb5_error_code err)
+{
+	const char *msg = NULL;
+
+#if defined(HAVE_KRB5_GET_ERROR_MESSAGE)
+	msg = krb5_get_error_message(context, err);
+#else
+	msg = error_message(err);
+#endif
+	if (msg == NULL)
+		return "unknown error";
+	else
+		return msg;
+}
+
 /* ***************************************************************** */
 /* ***************************************************************** */
 
@@ -501,6 +518,7 @@
 				invalid_password = TRUE;
 				goto out;
 			default:
+				g_warning("Auth failed with %d: %s", retval, get_error_message(kcontext, retval));
 				break;
 		}
 		goto out;
@@ -656,7 +674,7 @@
 static void
 ka_error_dialog(int err)
 {
-	const char* msg = error_message(err);
+	const char* msg = get_error_message(kcontext, err);
 	GtkWidget *dialog = gtk_message_dialog_new (NULL,
 				GTK_DIALOG_DESTROY_WITH_PARENT,
 				GTK_MESSAGE_ERROR,
@@ -683,7 +701,8 @@
 			    retry = TRUE;
 			    break;
 		    case 0: /* success */
-		    case KRB5_LIBOS_CANTREADPWD: /* canceled */
+		    case KRB5_LIBOS_PWDINTR:     /* canceled (heimdal) */
+		    case KRB5_LIBOS_CANTREADPWD: /* canceled (mit) */
 			    retry = FALSE;
 			    break;
 		    case KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]