emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master dcc7109: Make auth-source work with non-ASCII passw


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master dcc7109: Make auth-source work with non-ASCII passwords again
Date: Tue, 15 Oct 2019 02:44:22 -0400 (EDT)

branch: master
commit dcc710916e29777192630c8f225f4b17aa9cd3c2
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Make auth-source work with non-ASCII passwords again
    
    * lisp/auth-source.el (auth-source--obfuscate): Convert the string
    to bytes before obfuscating.
    (auth-source--deobfuscate): Convert back into a string (bug#37758).
---
 lisp/auth-source.el | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 9061d41..1d3d8db 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -1184,7 +1184,8 @@ FILE is the file from which we obtained this token."
           (auth-source--pad auth-source--session-nonce
                             (plist-get cdata :cipher-keysize))
           (list 'iv-auto (plist-get cdata :cipher-ivsize))
-          (auth-source--pad string (plist-get cdata :cipher-blocksize)))
+          (auth-source--pad (encode-coding-string string 'utf-8)
+                            (plist-get cdata :cipher-blocksize)))
          "-"))
     (mapcar #'1- string)))
 
@@ -1203,14 +1204,16 @@ FILE is the file from which we obtained this token."
            (gnutls-available-p))
       (let ((cdata (car (last (gnutls-ciphers))))
             (bits (split-string data "-")))
-        (auth-source--unpad
-         (car
-          (gnutls-symmetric-decrypt
-           (pop cdata)
-           (auth-source--pad auth-source--session-nonce
-                             (plist-get cdata :cipher-keysize))
-           (base64-decode-string (cadr bits))
-           (base64-decode-string (car bits))))))
+        (decode-coding-string
+         (auth-source--unpad
+          (car
+           (gnutls-symmetric-decrypt
+            (pop cdata)
+            (auth-source--pad auth-source--session-nonce
+                              (plist-get cdata :cipher-keysize))
+            (base64-decode-string (cadr bits))
+            (base64-decode-string (car bits)))))
+         'utf-8))
     (apply #'string (mapcar #'1+ data))))
 
 (cl-defun auth-source-netrc-search (&rest spec



reply via email to

[Prev in Thread] Current Thread [Next in Thread]