GNU bug report logs - #70301
30.0.50; secrets-create-item mangles cyrillic passwords

Previous Next

Package: emacs;

Reported by: k.ninev <at> cdots.bg

Date: Tue, 9 Apr 2024 08:20:04 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Fixed in version 30.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: k.ninev <at> cdots.bg
To: Eli Zaretskii <eliz <at> gnu.org>, Michael Albinus <michael.albinus <at> gmx.de>
Cc: 70301 <at> debbugs.gnu.org
Subject: bug#70301: 30.0.50; secrets-create-item mangles cyrillic passwords
Date: Tue, 09 Apr 2024 10:09:19 +0000
Yes, the patch works for me. Thank you.

On Tuesday, April 9, 2024 12:48 PM (+03:00), Eli Zaretskii wrote:

> > 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 <at> 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))
> 

-- 
KN




This bug report was last modified 1 year and 94 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.