diff options
author | Kevin McCarthy <kevin@8t8.us> | 2021-09-07 12:55:23 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2021-09-16 14:24:18 -0700 |
commit | 960afab461d1f72f64f322fe42738a91a066cc38 (patch) | |
tree | 14af33486aaf49d5380515df9b8d2e72ece78418 /account.c | |
parent | 8bb11afe4094d7f87267d7823b399c2f828034e4 (diff) |
Generate URLs with user/password as parsed.
This helps ensure they match for browser sticky-cursor, sidebar, and a
few other places where a path is compared against
something (e.g. $trash).
Add two flags that track if the user/password came from the parsed
URL. If they were instead added to the account via $imap_user or
$imap_pass, don't include those when generating a URL string as
output.
Change LSUB to also include the password, if present in the original
connection URL.
Diffstat (limited to 'account.c')
-rw-r--r-- | account.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -75,11 +75,13 @@ int mutt_account_fromurl (ACCOUNT* account, ciss_url_t* url) { strfcpy (account->user, url->user, sizeof (account->user)); account->flags |= MUTT_ACCT_USER; + account->flags |= MUTT_ACCT_USER_FROM_URL; } if (url->pass) { strfcpy (account->pass, url->pass, sizeof (account->pass)); account->flags |= MUTT_ACCT_PASS; + account->flags |= MUTT_ACCT_PASS_FROM_URL; } if (url->port) { @@ -134,10 +136,16 @@ void mutt_account_tourl (ACCOUNT* account, ciss_url_t* url) url->host = account->host; if (account->flags & MUTT_ACCT_PORT) url->port = account->port; - if (account->flags & MUTT_ACCT_USER) + if ((account->flags & MUTT_ACCT_USER) && + (account->flags & MUTT_ACCT_USER_FROM_URL)) + { url->user = account->user; - if (account->flags & MUTT_ACCT_PASS) + } + if ((account->flags & MUTT_ACCT_PASS) && + (account->flags & MUTT_ACCT_PASS_FROM_URL)) + { url->pass = account->pass; + } } /* mutt_account_getuser: retrieve username into ACCOUNT, if necessary */ @@ -253,6 +261,7 @@ int mutt_account_getpass (ACCOUNT *account) void mutt_account_unsetpass (ACCOUNT* account) { account->flags &= ~MUTT_ACCT_PASS; + account->flags &= ~MUTT_ACCT_PASS_FROM_URL; } /* mutt_account_getoauthbearer: call external command to generate the |