[krb5-auth-dialog] handle length zero KA_GCONF_KEY_PRINCIPAL



commit 3874e60b6172421f8ffdd822fedcc8479cc83b26
Author: Guido Günther <agx sigxcpu org>
Date:   Sat Apr 18 00:15:37 2009 +0200

    handle length zero KA_GCONF_KEY_PRINCIPAL
---
 ChangeLog             |    5 +++++
 src/krb5-auth-gconf.c |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f85ee72..3a03eae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Apr 18 00:19:02 CEST 2009 Guido Günther <agx sigxcpu org>
+
+	* src/krb5-auth-gconf.c (ka_gconf_set_principal): handle length zero
+	  KA_GCONF_KEY_PRINCIPAL
+
 Fri Apr 17 13:36:00 CEST 2009 Guido Günther <agx sigxcpu org>
 
 	* preferences/krb5-auth-dialog-preferences.glade: mark GtkEntrys
diff --git a/src/krb5-auth-gconf.c b/src/krb5-auth-gconf.c
index b63d833..497b1a7 100644
--- a/src/krb5-auth-gconf.c
+++ b/src/krb5-auth-gconf.c
@@ -20,6 +20,7 @@
 #include "config.h"
 
 #include <gconf/gconf-client.h>
+#include <string.h>
 
 #include "krb5-auth-applet.h"
 #include "krb5-auth-gconf-tools.h"
@@ -30,7 +31,9 @@ ka_gconf_set_principal (GConfClient* client, KaApplet* applet)
 {
 	gchar* principal = NULL;
 
-	if(!ka_gconf_get_string (client, KA_GCONF_KEY_PRINCIPAL, &principal)) {
+	if(!ka_gconf_get_string (client, KA_GCONF_KEY_PRINCIPAL, &principal)
+	   || !strlen(principal)) {
+		g_free (principal);
 		principal = g_strdup (g_get_user_name());
 	}
 	g_object_set(applet, "principal", principal, NULL);



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