Skip to content
Newer
Older
100644 71 lines (57 sloc) 2.14 KB
14c2920 Imported Upstream version 1.5.18
Antonio Radici authored May 24, 2009
1 /*
19304f7 Imported Upstream version 1.5.19
Antonio Radici authored May 24, 2009
2 * Copyright (C) 1999-2001,2005 Brendan Cully <brendan@kublai.com>
14c2920 Imported Upstream version 1.5.18
Antonio Radici authored May 24, 2009
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 /* plain LOGIN support */
20
21 #if HAVE_CONFIG_H
22 # include "config.h"
23 #endif
24
25 #include "mutt.h"
26 #include "imap_private.h"
27 #include "auth.h"
28
29 /* imap_auth_login: Plain LOGIN support */
30 imap_auth_res_t imap_auth_login (IMAP_DATA* idata, const char* method)
31 {
32 char q_user[SHORT_STRING], q_pass[SHORT_STRING];
33 char buf[STRING];
34 int rc;
35
36 if (mutt_bit_isset (idata->capabilities, LOGINDISABLED))
37 {
38 mutt_message _("LOGIN disabled on this server.");
39 return IMAP_AUTH_UNAVAIL;
40 }
41
594a6a4 Imported Upstream version 1.5.21
Antonio Radici authored Oct 3, 2010
42 if (mutt_account_getuser (&idata->conn->account))
14c2920 Imported Upstream version 1.5.18
Antonio Radici authored May 24, 2009
43 return IMAP_AUTH_FAILURE;
44 if (mutt_account_getpass (&idata->conn->account))
45 return IMAP_AUTH_FAILURE;
46
47 mutt_message _("Logging in...");
48
49 imap_quote_string (q_user, sizeof (q_user), idata->conn->account.user);
50 imap_quote_string (q_pass, sizeof (q_pass), idata->conn->account.pass);
51
52 #ifdef DEBUG
53 /* don't print the password unless we're at the ungodly debugging level
54 * of 5 or higher */
55
56 if (debuglevel < IMAP_LOG_PASS)
57 dprint (2, (debugfile, "Sending LOGIN command for %s...\n",
58 idata->conn->account.user));
59 #endif
60
61 snprintf (buf, sizeof (buf), "LOGIN %s %s", q_user, q_pass);
62 rc = imap_exec (idata, buf, IMAP_CMD_FAIL_OK | IMAP_CMD_PASS);
63
64 if (!rc)
65 return IMAP_AUTH_SUCCESS;
66
67 mutt_error _("Login failed.");
68 mutt_sleep (2);
69 return IMAP_AUTH_FAILURE;
70 }
Something went wrong with that request. Please try again.