fence-agents: master - fence_ilo2: Unable to login when password contains "

Marek GrĂ¡c marx at fedoraproject.org
Wed Jul 31 12:16:43 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=3a185569e825ee8e948a6cbef8bf847f6a7632dc
Commit:        3a185569e825ee8e948a6cbef8bf847f6a7632dc
Parent:        7117a54a55aafb9f6ea97fe7b3a7b56355f609e4
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Wed Jul 31 14:15:58 2013 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Wed Jul 31 14:15:58 2013 +0200

fence_ilo2: Unable to login when password contains "

Resolves: rhbz#990537
---
 fence/agents/ilo/fence_ilo.py |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 15e273f..ab6e342 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -12,6 +12,7 @@
 #####
 
 import sys, re, pexpect
+from xml.sax.saxutils import quoteattr
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
@@ -22,8 +23,8 @@ BUILD_DATE="March, 2008"
 #END_VERSION_GENERATION
 
 def get_power_status(conn, options):
-	conn.send("<LOGIN USER_LOGIN = \"" + options["--username"] + "\"" + \
-		" PASSWORD = \"" + options["--password"] + "\">\r\n")
+	conn.send("<LOGIN USER_LOGIN = " + quoteattr(options["--username"]) + \
+		" PASSWORD = " + quoteattr(options["--password"]) + ">\r\n")
 	conn.send("<SERVER_INFO MODE = \"read\"><GET_HOST_POWER_STATUS/>\r\n")
 	conn.send("</SERVER_INFO></LOGIN>\r\n")
 	conn.log_expect(options, "HOST_POWER=\"(.*?)\"", int(options["--power-timeout"]))
@@ -32,8 +33,8 @@ def get_power_status(conn, options):
 	return status.lower().strip()
 
 def set_power_status(conn, options):
-	conn.send("<LOGIN USER_LOGIN = \"" + options["--username"] + "\"" + \
-		" PASSWORD = \"" + options["--password"] + "\">\r\n")
+	conn.send("<LOGIN USER_LOGIN = " + quoteattr(options["--username"]) + \
+		" PASSWORD = " + quoteattr(options["--password"]) + ">\r\n")
 	conn.send("<SERVER_INFO MODE = \"write\">")
 
 	if options.has_key("fw_processor") and options["fw_processor"] == "iLO2":
@@ -101,8 +102,8 @@ the iLO card through an XML stream."
 		else:
 			conn.send("<RIBCL VERSION=\"1.2\">\r\n")
 
-		conn.send("<LOGIN USER_LOGIN = \"" + options["--username"] + "\"" + \
-			" PASSWORD = \"" + options["--password"] + "\">\r\n")
+		conn.send("<LOGIN USER_LOGIN = " + quoteattr(options["--username"]) + \
+			" PASSWORD = " + quoteattr(options["--password"]) + ">\r\n")
 		if options["--ribcl-version"] >= 2:
 			conn.send("<RIB_INFO MODE=\"read\"><GET_FW_VERSION />\r\n")
 			conn.send("</RIB_INFO>\r\n")


More information about the cluster-commits mailing list