Skip to contentSkip to conversation

Correct pygrub return value

PATCH New Michal Novotny 1 participant 1 message Sep 14, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Correct pygrub return value

Hi,
this is the patch to correct pygrub return value for checkPassword() function. It didn't return False at the end of the function. It returned None so it was working fine and it's most likely just a cosmetic issue.

Also, the missing () were added to checkPassword() function when calling hasPassword and the unnecessary comment was removed.

Michal

tools/pygrub/src/GrubConf.py +3 -2
diff -r d2a32e24fe50 tools/pygrub/src/GrubConf.py
@@ -220,10 +220,9 @@ class GrubConfigFile(object):
 
     def checkPassword(self, password):
         # Always allow if no password defined in grub.conf
-        if not self.hasPassword:
+        if not self.hasPassword():
             return True
 
-        # If we're here, we're having 'password' attribute set
         pwd = getattr(self, 'password').split()
 
         # We check whether password is in MD5 hash for comparison
@@ -239,6 +238,8 @@ class GrubConfigFile(object):
         # ... and if not, we compare it as a plain text
         if pwd[0] == password:
             return True
+
+        return False
 
     def set(self, line):
         (com, arg) = grub_exact_split(line, 2)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel