I've fixed some existing bugs in mgmt. I'm posting the patches in
sequence. Could anyone pls help to review and import them into upstream?
Thanks!

Patch1:
If we start hb_gui in the foreground of a terminal, and press Ctrl-C in
the login window, the saved login information will be corrupted. 

Attached the patch. 

Signed-off-by: Yan Gao <[EMAIL PROTECTED]>

This fixes the bug #1724 :
http://developerbugs.linux-foundation.org//show_bug.cgi?id=1724

And unless we login successfully, the inputted login information won't
be saved.

-- 
Yan Gao
China R&D Software Engineer
[EMAIL PROTECTED]

Novell, Inc.
SUSEĀ® Linux Enterprise 10
Your Linux is ready
http://www.novell.com/linux
# HG changeset patch
# User Yan Gao <[EMAIL PROTECTED]>
# Date 1197449562 -28800
# Node ID b8484c65c8bc31794680be743317758f6cef2777
# Parent  0d824123f5efa83c466ca3aebf6dbcc9c864041f
mgmt: Prevent saved login information from being corrupted. (Resolve LF bug #1724)

diff -r 0d824123f5ef -r b8484c65c8bc mgmt/client/haclient.py.in
--- a/mgmt/client/haclient.py.in	Tue Dec 11 22:18:38 2007 -0700
+++ b/mgmt/client/haclient.py.in	Wed Dec 12 16:52:42 2007 +0800
@@ -1795,13 +1795,14 @@ class MainWindow :
 		server = glade.get_widget("server").get_text()
 		user = glade.get_widget("username").get_text()
 		password = glade.get_widget("password").get_text()
-		manager.save_login_info(server,user)
 		
 		dialog.destroy()
 
 		if ret == gtk.RESPONSE_OK:
 			if not manager.login(server, user, password):
 				msgbox(manager.failed_reason)
+			else:
+				manager.save_login_info(server,user)
 	
 		self.update_ui()
 
@@ -2160,11 +2161,16 @@ class Manager :
 		save_path = os.environ["HOME"]+"/.haclient"
 		if not os.path.exists(save_path) :
 			return ("127.0.0.1","hacluster")
-		return pickle.load(file(save_path,"r"))
-		
+		try:
+			return pickle.load(file(save_path,"r"))
+		except:
+			return ("127.0.0.1", "hacluster")	
 	def save_login_info(self, server, user) :
 		save_path = os.environ["HOME"]+"/.haclient"
-		pickle.dump((server,user), file(save_path,"w"))
+		try:
+			pickle.dump((server,user), file(save_path,"w"))
+		except:
+			os.remove(save_path)
 		return
 		
 	def login(self, server, username, password) :
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to