hgext/factotum.py
changeset 23393 c834c0194dbb
parent 21228 be561a622100
child 25078 e8348f1cc228
--- a/hgext/factotum.py	Tue Nov 25 02:27:31 2014 -0600
+++ b/hgext/factotum.py	Tue Nov 25 02:31:52 2014 -0600
@@ -72,9 +72,14 @@
                 l = os.read(fd, ERRMAX).split()
                 if l[0] == 'ok':
                     os.write(fd, 'read')
-                    l = os.read(fd, ERRMAX).split()
-                    if l[0] == 'ok':
-                        return l[1:]
+                    status, user, passwd = os.read(fd, ERRMAX).split(None, 2)
+                    if status == 'ok':
+                        if passwd.startswith("'"):
+                            if passwd.endswith("'"):
+                                passwd = passwd[1:-1].replace("''", "'")
+                            else:
+                                raise util.Abort(_('malformed password string'))
+                        return (user, passwd)
             except (OSError, IOError):
                 raise util.Abort(_('factotum not responding'))
         finally: