示例#1
0
文件: account.c 项目: 0xAX/muttx
/* mutt_account_getpass: fetch password into ACCOUNT, if necessary */
int mutt_account_getpass(ACCOUNT* account)
{
	char prompt[SHORT_STRING];

	if (account->flags & M_ACCT_PASS)
		return 0;
#if USE_IMAP
	else if ((account->type == M_ACCT_TYPE_IMAP) && ImapPass)
		strfcpy(account->pass, ImapPass, sizeof(account->pass));
#endif
#if USE_SMTP
	else if ((account->type == M_ACCT_TYPE_SMTP) && SmtpPass)
		strfcpy(account->pass, SmtpPass, sizeof(account->pass));
#endif
	else if (bit_val(options, OPTNOCURSES))
		return -1;
	else
	{
		snprintf(prompt, sizeof(prompt), ("Password for %s@%s: "),
			 account->flags & M_ACCT_LOGIN ? account->login : account->user,
			 account->host);
		account->pass[0] = '\0';
		if (mutt_get_password(prompt, account->pass, sizeof account->pass))
			return -1;
	}
	account->flags |= M_ACCT_PASS;
	return 0;
}
示例#2
0
/* mutt_account_getpass: fetch password into ACCOUNT, if necessary */
int mutt_account_getpass(ACCOUNT *account)
{
    char prompt[SHORT_STRING];

    if (account->flags & M_ACCT_PASS)
        return 0;

#ifdef USE_POP
    else if ((account->type == M_ACCT_TYPE_POP) && PopPass)
        strfcpy(account->pass, PopPass, sizeof(account->pass));
#endif /* ifdef USE_POP */
#ifdef USE_SMTP
    else if ((account->type == M_ACCT_TYPE_SMTP) && SmtpPass)
        strfcpy(account->pass, SmtpPass, sizeof(account->pass));
#endif /* ifdef USE_SMTP */
    else if (globals.has_option(OPTNOCURSES))
        return -1;
    else {
        snprintf(prompt, sizeof(prompt), _("Password for %s@%s: "),
                 account->flags & M_ACCT_LOGIN ? account->login : account->user,
                 account->host);
        account->pass[0] = '\0';

        if (mutt_get_password(prompt, account->pass, sizeof(account->pass)))
            return -1;
    }

    account->flags |= M_ACCT_PASS;

    return 0;
}
示例#3
0
static int getPass (void)
{
  if (!PopPass)
  {
    char tmp[SHORT_STRING];
    tmp[0] = '\0';
    if (mutt_get_password (_("POP Password: "), tmp, sizeof (tmp)) != 0
	|| *tmp == '\0')
      return 0;
    PopPass = safe_strdup (tmp);
  }
  return 1;
}
示例#4
0
文件: smime.c 项目: 0xAX/muttx
int smime_valid_passphrase(void)
{
	time_t now = time(NULL);

	if (now < SmimeExptime)
		/* Use cached copy.  */
		return 1;

	smime_void_passphrase();

	if (mutt_get_password(("Enter S/MIME passphrase:"), SmimePass, sizeof(SmimePass)) == 0)
	{
		SmimeExptime = time(NULL) + SmimeTimeout;
		return(1);
	}
	else
		SmimeExptime = 0;

	return 0;
}