unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: k.ninev@cdots.bg, Michael Albinus <michael.albinus@gmx.de>
Cc: 70301@debbugs.gnu.org
Subject: bug#70301: 30.0.50; secrets-create-item mangles cyrillic passwords
Date: Tue, 09 Apr 2024 12:48:37 +0300	[thread overview]
Message-ID: <86o7aix3wq.fsf@gnu.org> (raw)
In-Reply-To: <1712650236526.1662743497.3911072838@cdots.bg> (bug-gnu-emacs@gnu.org)

> 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	other threads:[~2024-04-09  9:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09  8:18 bug#70301: 30.0.50; secrets-create-item mangles cyrillic passwords k.ninev--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-09  9:48 ` Eli Zaretskii [this message]
2024-04-09 10:09   ` k.ninev
2024-04-09 10:23     ` Eli Zaretskii
2024-04-10 15:32   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-10 15:44     ` Eli Zaretskii
2024-04-10 16:10       ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-12  8:14         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-12  8:51           ` k.ninev
2024-04-12  8:59             ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-12 11:37               ` Eli Zaretskii
2024-04-12 13:53                 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86o7aix3wq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=70301@debbugs.gnu.org \
    --cc=k.ninev@cdots.bg \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).