pop-os / cosmic-greeter

libcosmic greeter for greetd, which can be run inside cosmic-comp
GNU General Public License v3.0
53 stars 30 forks source link

fix: Invalid password message #49

Open joshuamegnauth54 opened 4 months ago

joshuamegnauth54 commented 4 months ago

Closes: #41

jackpot51 commented 4 months ago

An auth error does not have to be a password related error. I think the connection refused error is not coming from PAM. When we get an error from PAM we should display it as it was provided.

joshuamegnauth54 commented 4 months ago

You're right about the connection refused error. I've been messing around with this for a week but I can't figure out what's causing that error.

Through the magic of print debugging...:

[2024-05-30T04:56:14Z INFO  cosmic_greeter::greeter] focus surface Id(1)
[2024-05-30T04:56:39Z INFO  cosmic_greeter::greeter] Sending request over socket: PostAuthMessageResponse { response: Some("gaben") }
[2024-05-30T04:56:39Z INFO  cosmic_greeter::greeter] Request: PostAuthMessageResponse { response: Some("gaben") }
[2024-05-30T04:56:39Z INFO  cosmic_greeter::greeter] Waiting for a writable socket
[2024-05-30T04:56:39Z INFO  cosmic_greeter::greeter] Writing bytes
[2024-05-30T04:56:39Z INFO  cosmic_greeter::greeter] Reading response from socket
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Response: Error { error_type: AuthError, description: "pam_authenticate: AUTH_ERR" }
[2024-05-30T04:56:42Z ERROR cosmic_greeter::greeter] AuthError => pam_authenticate: AUTH_ERR
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Sending request over socket: CancelSession
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Request: CancelSession
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Waiting for a writable socket
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Writing bytes
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Reading response from socket
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Response: Error { error_type: Error, description: "unable to send message: Connection refused (os error 111)" }
[2024-05-30T04:56:42Z ERROR cosmic_greeter::greeter] Error => unable to send message: Connection refused (os error 111)
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Sending request over socket: CancelSession
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Request: CancelSession
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Waiting for a writable socket
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Writing bytes
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Reading response from socket
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Response: Success
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] CancelSession => Recreating session
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] updating wallpaper for "VGA-1"
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Sending request over socket: CreateSession { username: "josh" }
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Request: CreateSession { username: "josh" }
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Waiting for a writable socket
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Writing bytes
[2024-05-30T04:56:42Z INFO  cosmic_greeter::greeter] Reading response from socket

...I found out that the first CancelSession triggers the connection refused error, but then the second CancelSession + CreateSession succeeds.

I tried switching to greet_ipc's TokioCodec plus adding a lock on the socket. That fixed the spurious login failures I've experienced but didn't help with this issue.

So. I might be stumped.

jackpot51 commented 4 months ago

It's okay, I am confused by it as well. If TokioCodec helps with another problem might as well PR that piece separately.

joshuamegnauth54 commented 4 months ago

Sorry. I ended up really busy for these last few days. I just opened a PR fixing the deadlocks issue though.