Menu

#1530 Not work Copy&paste between Keepass2 and Remmina

KeePass_2.x
closed
nobody
None
5
2016-12-24
2016-06-10
kvaps
No

This bug is crossposted on
Remmina bug tracker: https://github.com/FreeRDP/Remmina/issues/900
Keepass bug tracker:

Can not copy&paste from Keepass a field to RDP session, and back it from RDP session. (namely from the field, select and copy, not press Ctrl+C for copy password from entry list)

Example try to copy text from URL: or Notes: field to RDP session, and backeward copy text from Remmina's RDP session to Keepass2.

The problem covers only RDP connections and Keepass.
Copy&paste work fine with others programs written in mono or with freerdp runned with +clipboard option from terminal.

Details:
Client OS: Arch Linux with last updates (also Manjaro 15.12 and Ubuntu 15.10 tested)
Remmina version: 1.2.0-rcgit.11 (git n/a)
Keepass version: 2.33 (Dev)
Mono version: 4.4.0 (Stable 4.4.0.40/f8474c4 Mon Mar 28 12:22:29 UTC 2016)
Desktop environment: naked X11 with awesome (also XFCE and Unity tested)
Connecting to: Windows Server 2008 R2 and Windows 7 (may others)
Connecting via: RDP (vnc work fine)
Freerdp version: 2.0.0-dev (git c3ce0c3)

Discussion

  • kvaps

    kvaps - 2016-06-10

    I'm not allowed to edit my ticket. Why?
    Please move it to KeePass_2.x milestone.
    And add link to this thread.

     
  • Dominik Reichl

    Dominik Reichl - 2016-06-10
    • Group: KeePass_1.x --> KeePass_2.x
     
  • kvaps

    kvaps - 2016-07-01

    Through trial and error, it turned out that this is still Keepass bug.
    Recent tests with the spice only confirmed this.

    Thus we have the following situation:

    RDP

    • Copy from Keepass to Remmina: not work
    • Copy from Remmina to Keepass: not work
    • Copy from Keepass to xfreerdp: not work
    • Copy from xfreerdp to Keepass: work

    SPICE

    • Copy from Keepass to remote-viewer: not work
    • Copy from remote-viewer to Keepass: work

    Also I tested for vnc:

    VNC

    • Copy from Keepass to Remmina: work
    • Copy from Remmina to Keepass: work
     
  • Antenore Gatta

    Antenore Gatta - 2016-07-01

    I confirm. I can reproduce this on Fedora 23, FreeBSD 10.3 and Ubuntu 16.04.

    I've tried other password managers and they work fine with Remmina.

    I'm not a regular keepas user, I've tested it just because we received some reports about keepass not working as expected with the Remmina, but I cannot see anything wrong with our code (that doesn't mean we don't have any issues :-p )

    Let me know if you need support from us (Remmina project).

    Thanks in advance!

     
  • Dominik Reichl

    Dominik Reichl - 2016-07-01

    Antenore, your code is probably perfectly fine.

    The issue lies somewhere in Mono; various related problems have been reported previously. This is the reason why I've added code to KeePass (in 2012) that makes it use 'xsel' (if installed) for the most common clipboard commands (like Ctrl+C in the main entry list, which according to the original post works fine) as a workaround. Unfortunately, implementing this workaround for each and every command involving the clipboard would be a huge task (for each and every UI control, KeePass would need to override the clipboard commands)... Let's hope the Mono developers fix their clipboard methods one day.

    Best regards,
    Dominik

     
  • Antenore Gatta

    Antenore Gatta - 2016-07-01

    THanks a lot Dominik. If I can do anything just let me know.

    @kvaps sorry :-\ it's really not feasable

     
  • kvaps

    kvaps - 2016-07-03

    Dominik, OK, I understand.
    But it is strange that other mono applications (like Pinta, and some more from this list) do not have this bug.

    Antenore, thanks for your assistance!

     
  • Dominik Reichl

    Dominik Reichl - 2016-07-03

    Pinta uses GTK/GDK for its user interface; KeePass uses Windows Forms. So, Pinta uses the GTK clipboard, which doesn't have the issue.

    Best regards,
    Dominik

     
  • kvaps

    kvaps - 2016-07-03

    It explains everything.
    I try to use a dotnet for keepass. I'll write on results.

     
  • kvaps

    kvaps - 2016-07-04

    Hi, i installed Keepass via wine with dotnet2.0 instead mono.
    Copy and paste works fine!
    I followed these instruction. Thanks!

     
  • kvaps

    kvaps - 2016-09-15

    The issue lies somewhere in Mono; various related problems have been reported previously. This is the reason why I've added code to KeePass (in 2012) that makes it use 'xsel' (if installed) for the most common clipboard commands

    As I understand this problem will not be solved in the near future by mono developers, so may be to extend the xsel using to all other flieds in keepass?

     
  • Dominik Reichl

    Dominik Reichl - 2016-09-15
    • status: open --> closed
     
  • Dominik Reichl

    Dominik Reichl - 2016-09-15

    No, sorry. Like I wrote previously, implementing this workaround for each and every command involving the clipboard would be a huge task (for each and every UI control, KeePass would need to override the clipboard commands); I'm not planning to do this.

    As you successfully tested KeePass with Wine, my suggestion would be to use this, if you really need clipboard commands for all controls.

    Best regards,
    Dominik

     
  • kvaps

    kvaps - 2016-11-08

    Hi! Keepass in wine did not meet my expectations. I came up with another more simplest solution:
    This is simple function that automatically calling xsel -o -b | xsel -i -b when clipboard is changed.

    More information:
    https://github.com/kvaps/keepass-clipboard-fix

     
  • Dominik Reichl

    Dominik Reichl - 2016-11-12

    Interesting, thanks! That is an acceptable workaround; I've added this to KeePass now (a background thread that basically does the same as your script does).

    Here's the latest development snapshot for testing:
    http://keepass.info/filepool/KeePass_161112.zip

    Best regards,
    Dominik

     
  • kvaps

    kvaps - 2016-11-12

    Hi Dominik, I tested this version with RDP and spice:

    RDP

    • Copy from Keepass to Remmina: work
    • Copy from Remmina to Keepass: work
    • Copy from Keepass to xfreerdp: work
    • Copy from xfreerdp to Keepass: work

    SPICE

    • Copy from Keepass to remote-viewer: work
    • Copy from remote-viewer to Keepass: work

    Thanks and you!
    I am pleased to contribute to this project.

     

    Last edit: kvaps 2016-11-12
  • Dominik Reichl

    Dominik Reichl - 2016-11-13

    Great, thanks for testing it! :-)

     
  • kvaps

    kvaps - 2016-12-19

    Dominik, hi!
    Is it possible to call this hack only when keepass window is active?
    Because It is breakes formatting text when copy&pasting in other applications.

     

    Last edit: kvaps 2016-12-19
  • Dominik Reichl

    Dominik Reichl - 2016-12-19

    Good idea; I've implemented this now. Note that 'xdotool' is required for the window detection to work.

    Here's the latest development snapshot for testing:
    http://keepass.info/filepool/KeePass_161219e.zip

    Thanks and best regards,
    Dominik

     
  • kvaps

    kvaps - 2016-12-19

    Hi, I installed your build, and xdotool:

    Formatting now isn't breaks. But something with copying from Remmina, although freerdp works perfectly.

    RDP

    • Copy from Keepass to Remmina: work
    • Copy from Remmina to Keepass: not work
    • Copy from Keepass to xfreerdp: work
    • Copy from xfreerdp to Keepass: work

    SPICE

    • Copy from Keepass to remote-viewer: work
    • Copy from remote-viewer to Keepass: work

    If I run xsel -o -b | xsel -i -b in my terminal before pasting from Remmina, then pasting is works.
    Also if I remove xdotool package from my system, then results remain the same, but the text formatting in other apps is broken.

     

    Last edit: kvaps 2016-12-19
  • Dominik Reichl

    Dominik Reichl - 2016-12-22

    Ok, so Remmina copies data to the clipboard in a way that Mono doesn't understand.

    Maybe a Remmina-specific workaround can be implemented. Can you please let me know the full path of the Remmina executable that is displaying the window in which you're copying data to the clipboard?

    Best regards,
    Dominik

     
  • kvaps

    kvaps - 2016-12-22

    Hi, I have the /usr/bin/remmina executable on archlinux. As I know the ubuntu has same.
    But I think that no sense to hook the path. May be use wm classes instead?

    Example:

    #!/bin/bash
    WINDOW=`xdotool getactivewindow`
    WM_CLASS=`xprop -id ${WINDOW} WM_CLASS`
    if [[ "$WM_CLASS" == *'"KeePass2"'* ]] || [[ "$WM_CLASS" == *'"Remmina"'* ]]; then
        xsel -o -b | xsel -i -b
    fi 
    

    Output of xprop of remmina connection window in attach.

     
  • Dominik Reichl

    Dominik Reichl - 2016-12-23

    Good idea (I didn't expect Remmina to set WM_CLASS; Mono for instance doesn't, thus KeePass must do it itself). I've implemented that now.

    Here's the latest development snapshot for testing:
    http://keepass.info/filepool/KeePass_161223b.zip

    Thanks and best regards,
    Dominik

     
  • kvaps

    kvaps - 2016-12-23

    Ok, now it's work with remmina too, but it breaks formating when copy&paste inside remmina window. :(
    From MS Word to MS Word for example.

    I do not understand why the previous your solution does not work with remmina?
    As I understand you just call xsel -o -b | xsel -i -b everytime if Keepass window in focus?

    I think that we do not need to track the remmina's window for that.
    We need to track only Keepass2 window, and execute xsel -o -b | xsel -i -b everytime if Keepass2 window in focus.
    I think that should be enough.

    Thanks!

     
  • Dominik Reichl

    Dominik Reichl - 2016-12-24

    No, because that would break formatting when you copy something in a different application, switch to KeePass, and try to paste in a different application. In order to avoid this, KeePass basically waits until the clipboard text changes, checks whether KeePass or Remmina has the focus (by comparing the WM_CLASS value) and if so, it executes the xsel workaround.

    If you want to have a look, here's the latest MonoWorkarounds.cs source code file that implements the workaround:
    http://keepass.info/filepool/KeePass_161224_MW.zip

    Best regards,
    Dominik

     

Log in to post a comment.