From: Lars Ingebrigtsen Date: Tue, 15 Oct 2019 06:42:28 +0000 (+0200) Subject: Make auth-source work with non-ASCII passwords again X-Git-Tag: emacs-27.0.90~1058 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dcc710916e29777192630c8f225f4b17aa9cd3c2;p=emacs.git 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). --- diff --git a/lisp/auth-source.el b/lisp/auth-source.el index 9061d41556f..1d3d8dba405 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