bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#70301: 30.0.50; secrets-create-item mangles cyrillic passwords


From: Eli Zaretskii
Subject: bug#70301: 30.0.50; secrets-create-item mangles cyrillic passwords
Date: Tue, 09 Apr 2024 12:48:37 +0300

> Date: Tue, 09 Apr 2024 08:18:37 +0000
> From: k.ninev--- via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> 
> using this Secret Service API code in 'emacs -Q'
> 
> (require 'secrets)
> (secrets-create-item "session" "my item" "парола" :method "sudo" :user
> "joe" :host "remote-host")
> 
> Successfully creates an entry but the password "парола" is mangled to
> "?0@>;0" and cannot be viewed both with M-x secrets-show-secrets 
> and secret-tool cli tool , this does not occur with latin passwords

Does the patch below give good results?

Michael, I think we have a similar problem in
dbus-byte-array-to-string: when MULTIBYTE is non-nil, the function
should call decode-coding-string on the unibyte string it produces
instead of converting each byte to multibyte.  Because the bytes in
the argument BYTE-ARRAY are not characters, they are raw bytes of the
UTF-8 sequence, so calling 'string' on them is not TRT.

diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el
index c1a670f..63fc874 100644
--- a/lisp/net/secrets.el
+++ b/lisp/net/secrets.el
@@ -665,7 +665,8 @@ secrets-create-item
             ;; Secret.
             `(:struct :object-path ,secrets-session-path
                       (:array :signature "y") ;; No parameters.
-                      ,(dbus-string-to-byte-array password)
+                      ,(dbus-string-to-byte-array
+                         (encode-coding-string password 'utf-8))
                        ,secrets-struct-secret-content-type)
             ;; Do not replace. Replace does not seem to work.
             nil))





reply via email to

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