Escape IMAP passwords properly #125

Closed
opened 1 month ago by geri1701 Β· 9 comments
geri1701 commented 1 month ago

Meli doesn't start when I try
to start it with this command that I wrote in an executable shell script:

#!/usr/bin/env bash
rooster export json | jq -r '.passwords[] | select(.name == "gmx") | .password'

config.toml

server_password_command = "rooster_get_mail_pass.sh"

I get the following error:

offline:  Could not connect. Server replied with 'BAD expected end of data instead of ******

Do I have to do something different at Meli? With other email clients such as himalaya, this works in this way.

Meli doesn't start when I try to start it with this command that I wrote in an executable shell script: ``` #!/usr/bin/env bash rooster export json | jq -r '.passwords[] | select(.name == "gmx") | .password' ``` config.toml ``` server_password_command = "rooster_get_mail_pass.sh" ``` I get the following error: ``` offline: Could not connect. Server replied with 'BAD expected end of data instead of ****** ``` Do I have to do something different at Meli? With other email clients such as himalaya, this works in this way.
Owner

I'm wondering if it's a character escaping problem. Are there any quotes or any kind of whitespace in your password? (I asssume the asterisks in your error is the password by the way)

I'm wondering if it's a character escaping problem. Are there any quotes or any kind of whitespace in your password? (I asssume the asterisks in your error is the password by the way)
epilys added the
bug
label 1 month ago
Poster

Yes, the asterisks should represent the password and all possible special characters are included in the password. If I write the password directly into the configuration file, then it works.
With other email clients such as himalaya or aerc, the above command works. Something is different here.

Yes, the asterisks should represent the password and all possible special characters are included in the password. If I write the password directly into the configuration file, then it works. With other email clients such as himalaya or aerc, the above command works. Something is different here.
Poster

I played around a little with different passwords, in any case, it doesn't work with meli and the server_password_command if quotes or \ are included in the string. If a backslash is included I get:

 Could not connect. Server replied with 'BAD expected DQUOTE or \ instead of X'
I played around a little with different passwords, in any case, it doesn't work with meli and the `server_password_command` if quotes or \ are included in the string. If a backslash is included I get: ``` Could not connect. Server replied with 'BAD expected DQUOTE or \ instead of X' ```
Owner

Thanks so much for testing this! I will try to push a fix asap :)

Thanks so much for testing this! I will try to push a fix asap :)
epilys changed title from password command to Escape IMAP passwords properly 1 month ago
epilys closed this issue 1 month ago
Owner

@geri1701 could you confirm it works?

@geri1701 could you confirm it works?
Poster

Unfortunately, it doesn't work as soon as special characters are included:

Could not connect. Server replied with 'BAD expected DQUOTE or \ instead of "{"'
Unfortunately, it doesn't work as soon as special characters are included: ``` Could not connect. Server replied with 'BAD expected DQUOTE or \ instead of "{"' ```
Owner

Weird, the code escapes {. I will take a look at it again.

Weird, the code escapes `{`. I will take a look at it again.
epilys reopened this issue 1 month ago
Owner

@geri1701 I changed the code to send the password as a byte literal according to IMAP spec.

@geri1701 I changed the code to send the password as a byte literal according to IMAP spec.
Poster

Top! That looks great now. Thanks so much!

Top! That looks great now. Thanks so much!
geri1701 closed this issue 1 week ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.