diff options
| author | Lars Ingebrigtsen | 2019-10-15 08:42:28 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-10-15 08:42:28 +0200 |
| commit | dcc710916e29777192630c8f225f4b17aa9cd3c2 (patch) | |
| tree | 72387e4a1f2277e9acaaf1047052743ca84f25e4 | |
| parent | ddc9837bf48c99c31df397438175afc2f9d3819c (diff) | |
| download | emacs-dcc710916e29777192630c8f225f4b17aa9cd3c2.tar.gz emacs-dcc710916e29777192630c8f225f4b17aa9cd3c2.zip | |
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).
| -rw-r--r-- | lisp/auth-source.el | 21 |
1 files changed, 12 insertions, 9 deletions
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." | |||
| 1184 | (auth-source--pad auth-source--session-nonce | 1184 | (auth-source--pad auth-source--session-nonce |
| 1185 | (plist-get cdata :cipher-keysize)) | 1185 | (plist-get cdata :cipher-keysize)) |
| 1186 | (list 'iv-auto (plist-get cdata :cipher-ivsize)) | 1186 | (list 'iv-auto (plist-get cdata :cipher-ivsize)) |
| 1187 | (auth-source--pad string (plist-get cdata :cipher-blocksize))) | 1187 | (auth-source--pad (encode-coding-string string 'utf-8) |
| 1188 | (plist-get cdata :cipher-blocksize))) | ||
| 1188 | "-")) | 1189 | "-")) |
| 1189 | (mapcar #'1- string))) | 1190 | (mapcar #'1- string))) |
| 1190 | 1191 | ||
| @@ -1203,14 +1204,16 @@ FILE is the file from which we obtained this token." | |||
| 1203 | (gnutls-available-p)) | 1204 | (gnutls-available-p)) |
| 1204 | (let ((cdata (car (last (gnutls-ciphers)))) | 1205 | (let ((cdata (car (last (gnutls-ciphers)))) |
| 1205 | (bits (split-string data "-"))) | 1206 | (bits (split-string data "-"))) |
| 1206 | (auth-source--unpad | 1207 | (decode-coding-string |
| 1207 | (car | 1208 | (auth-source--unpad |
| 1208 | (gnutls-symmetric-decrypt | 1209 | (car |
| 1209 | (pop cdata) | 1210 | (gnutls-symmetric-decrypt |
| 1210 | (auth-source--pad auth-source--session-nonce | 1211 | (pop cdata) |
| 1211 | (plist-get cdata :cipher-keysize)) | 1212 | (auth-source--pad auth-source--session-nonce |
| 1212 | (base64-decode-string (cadr bits)) | 1213 | (plist-get cdata :cipher-keysize)) |
| 1213 | (base64-decode-string (car bits)))))) | 1214 | (base64-decode-string (cadr bits)) |
| 1215 | (base64-decode-string (car bits))))) | ||
| 1216 | 'utf-8)) | ||
| 1214 | (apply #'string (mapcar #'1+ data)))) | 1217 | (apply #'string (mapcar #'1+ data)))) |
| 1215 | 1218 | ||
| 1216 | (cl-defun auth-source-netrc-search (&rest spec | 1219 | (cl-defun auth-source-netrc-search (&rest spec |