18900 The python RadAuth.pam_login() method is broken osol_175
authorStephen Talley <stephen.talley@oracle.com>
Thu, 08 Sep 2011 11:44:40 -0400
changeset 771 d8e492629de3
parent 770 47e98605bb9d
child 772 71694a1770d1
18900 The python RadAuth.pam_login() method is broken
usr/src/lib/pyrad/util.py
--- a/usr/src/lib/pyrad/util.py	Tue Sep 06 19:00:35 2011 -0400
+++ b/usr/src/lib/pyrad/util.py	Thu Sep 08 11:44:40 2011 -0400
@@ -150,22 +150,25 @@
 		if not user:
 			user = raw_input("Username: ")
 		blk = self._auth.login("C", user);
+		types = self._auth._object.types
+		BlockType = types.BlockType
+		MsgType = types.MsgType
 		while True:
 			resp = []
-			if blk.type == "success":
+			if blk.type == BlockType.success:
 				break
-			if blk.type == "error":
+			if blk.type == BlockType.error:
 				raise Exception("Authentication Failed")
 			for m in blk.messages:
-				if m.style == "prompt_echo_off":
+				if m.style == MsgType.prompt_echo_off:
 					r = getpass.getpass(m.message)
 					resp.append(r)
-				elif m.style == "prompt_echo_on":
+				elif m.style == MsgType.prompt_echo_on:
 					r = raw_input(m.message)
 					resp.append(r)
-				elif m.style == "text_info":
+				elif m.style == MsgType.text_info:
 					print m.message
-				elif m.style == "error_msg":
+				elif m.style == MsgType.error_msg:
 					print "ERROR: %s" % m.message
 			blk = self._auth.submit(resp)