bilelmoussaoui / oo7

James Bond went on a new mission as a Secret Service provider
https://bilelmoussaoui.github.io/oo7/oo7/
MIT License
63 stars 12 forks source link

Support `plain` secret transport #33

Closed nullobsi closed 1 year ago

nullobsi commented 1 year ago

Hi,

I created pass-secrets, an alternative implementation of a DBus Secret-Service. Most applications work with it, but since this library forces the use of the Encrypted method that I have not implemented yet here: https://github.com/bilelmoussaoui/oo7/blob/5e89053ed75ba4bc117c6ab9698aad595e297d72/src/keyring.rs#L55

https://github.com/nullobsi/pass-secrets/issues/10 someone is having some issues.

I plan on implementing this auth method sometime. But it seems a bit complicated and I want to make sure I get it right. As a stopgap and to prevent issues with other potential implmentations, it's reccomended to catch the error if it is an org.freedesktop.DBus.Error.NotSupported, and in that case attempt to use plain algorithm.

Thank you :)

freswa commented 1 year ago

I recompiled fractal with oo7 0.1.1, but I still get Failed to restore previous sessions: DBus error zbus error org.freedesktop.DBus.Error.NotSupported: Only plain is supported

bilelmoussaoui commented 1 year ago

I recompiled fractal with oo7 0.1.1, but I still get Failed to restore previous sessions: DBus error zbus error org.freedesktop.DBus.Error.NotSupported: Only plain is supported

Can you try to build fractal with this branch of oo7 https://github.com/bilelmoussaoui/oo7/pull/36? it should be fixed with those changes

freswa commented 1 year ago

Unfortunately that doesn't work. I'm still getting 2023-04-16T15:58:30.165169Z WARN fractal::window: Failed to restore previous sessions: DBus error zbus error org.freedesktop.DBus.Error.NotSupported: Only plain is supported, although the Cargo.lock included source = "git+https://github.com/bilelmoussaoui/oo7?branch=bilelmoussaoui/fallback-fix#5e8f77500f3eed26fd7dacb22f06fd49e6bfd6d0"

bilelmoussaoui commented 1 year ago

Let us reopen this. But I don't think I would be able to do much, someone with this specific issue would have to dig into the code and see what is not working

freswa commented 1 year ago

So I started by adding a debug print, which gives me:


Error: Zbus(MethodError(OwnedErrorName(ErrorName(Str(Owned("org.freedesktop.DBus.Error.NotSupported")))), Some("Only plain is supported"), Msg { type: Error, sender: UniqueName(Str(Borrowed(":1.57"))), reply-serial: 2, body: Signature("s") }))
nullobsi commented 1 year ago

2023/04/16 9:46:41 Frederik Schwan @.***>:

So I started by adding a debug print, which gives me:

— Reply to this email directly, view it on GitHub[https://github.com/bilelmoussaoui/oo7/issues/33#issuecomment-1510429317], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AFKALLP3IBH73JGVO6C2LGLXBQO7BANCNFSM6AAAAAAUKLYUEE]. You are receiving this because you authored the thread.[トラッキング画像][https://github.com/notifications/beacon/AFKALLK4KT33EX3W2IURHKDXBQO7BA5CNFSM6AAAAAAUKLYUEGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS2A5JIK.gif]

yes, you need to use MethodError and zbus::fdo::error

bilelmoussaoui commented 1 year ago

Thanks @freswa

freswa commented 1 year ago

@bilelmoussaoui This snippet works:


        let service = match dbus::Service::new(Algorithm::Encrypted).await {
            Ok(service) => Ok(service),
            Err(dbus::Error::Zbus(zbus::Error::MethodError(../* fields */))) => {
                dbus::Service::new(Algorithm::Plain).await
            }
            Err(e) => {
                println!("Error: {:?}", e);
                Err(e) }
        }?;
bilelmoussaoui commented 1 year ago

that is what I did in #36

freswa commented 1 year ago

Yep. so lgtm to merge :)

bilelmoussaoui commented 1 year ago

@freswa Did a new minor release with the fix, enjoy :)