--- 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)