77 char prompt[256] = { 0 };
79 snprintf(prompt,
sizeof(prompt),
_(
"Username at %s: "), cac->
host);
155 char prompt[512] = { 0 };
156 snprintf(prompt,
sizeof(prompt),
_(
"Password for %s@%s: "),
179 cac->
flags &= ~MUTT_ACCT_PASS;
180 memset(cac->
pass, 0,
sizeof(cac->
pass));
223 size_t token_size = 0;
232 if (!token || (*token ==
'\0'))
239 if ((!xoauth2 && (token_size > 512)) || (xoauth2 && (token_size > 4096)))
241 mutt_error(
_(
"OAUTH token is too big: %ld"), (
long) token_size);
248 char oauthbearer[4500] = { 0 };
252 oalen = snprintf(oauthbearer,
sizeof(oauthbearer),
253 "user=%s\001auth=Bearer %s\001\001", cac->
login, token);
257 oalen = snprintf(oauthbearer,
sizeof(oauthbearer),
258 "n,a=%s,\001host=%s\001port=%d\001auth=Bearer %s\001\001",
263 size_t encoded_len = oalen * 4 / 3 + 10;
264 ASSERT(encoded_len < 6010);
269 return encoded_token;
MuttAccountFlags mutt_account_call_external_cmd(struct ConnAccount *cac)
Retrieve account credentials via an external command.
Connection Credentials External Command.
size_t mutt_b64_encode(const char *in, size_t inlen, char *out, size_t outlen)
Convert raw bytes to null-terminated base64 string.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
int mutt_account_getpass(struct ConnAccount *cac)
Fetch password into ConnAccount, if necessary.
int mutt_account_getuser(struct ConnAccount *cac)
Retrieve username into ConnAccount, if necessary.
void mutt_account_unsetpass(struct ConnAccount *cac)
Unset ConnAccount's password.
char * mutt_account_getoauthbearer(struct ConnAccount *cac, bool xoauth2)
Get an OAUTHBEARER/XOAUTH2 token.
int mutt_account_getlogin(struct ConnAccount *cac)
Retrieve login info into ConnAccount, if necessary.
@ MUTT_CA_OAUTH_CMD
OAuth refresh command.
@ MUTT_CA_LOGIN
Login name.
#define MUTT_ACCT_NO_FLAGS
No flags are set.
#define MUTT_ACCT_PASS
Password field has been set.
#define MUTT_ACCT_USER
User field has been set.
#define MUTT_ACCT_LOGIN
Login field has been set.
void mutt_need_hard_redraw(void)
Force a hard refresh.
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, ReadLineFlags flags)
Read a line from a file.
#define mutt_file_fclose(FP)
#define MUTT_RL_NO_FLAGS
No flags are set.
bool OptNoCurses
(pseudo) when sending in batch mode
char * Username
User's login name.
char ** EnvList
Private copy of the environment variables.
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
#define mutt_debug(LEVEL,...)
Convenience wrapper for the gui headers.
Read/write command history from/to a file.
@ HC_OTHER
Miscellaneous strings.
@ LL_DEBUG1
Log at debug level 1.
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
pid_t filter_create(const char *cmd, FILE **fp_in, FILE **fp_out, FILE **fp_err, char **envlist)
Set up filter program.
Convenience wrapper for the library headers.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Many unsorted constants and some structs.
#define MUTT_COMP_PASS
Password mode (no echo)
#define MUTT_COMP_UNBUFFERED
Ignore macro buffer.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
String manipulation buffer.
Login details for a remote server.
char login[128]
Login name.
char host[128]
Server to login to.
const char *(* get_field)(enum ConnAccountField field, void *gf_data)
MuttAccountFlags flags
Which fields are initialised, e.g. MUTT_ACCT_USER.
void * gf_data
Private data to pass to get_field()
unsigned short port
Port to connect to.