client-authenticate.c revision 41336a1443f9f6acfe4fd16499cd482f2ccec2ca
/* Copyright (c) 2013-2017 Dovecot authors, see the included COPYING file */
#include "login-common.h"
#include "base64.h"
#include "buffer.h"
#include "hex-binary.h"
#include "ioloop.h"
#include "istream.h"
#include "ostream.h"
#include "safe-memset.h"
#include "str.h"
#include "str-sanitize.h"
#include "auth-client.h"
#include "master-service-ssl-settings.h"
#include "client.h"
#include "client-authenticate.h"
#include "submission-proxy.h"
#include "submission-login-settings.h"
struct smtp_server_cmd_ctx *cmd,
struct smtp_server_cmd_helo *data)
{
struct smtp_server_reply *reply;
const struct auth_mech_desc *mechs;
unsigned int count, i;
&count);
for (i = 0; i < count; i++) {
if (i > 0)
}
}
"BURL", "imap");
"CHUNKING");
"ENHANCEDSTATUSCODES");
} else {
}
}
}
struct smtp_server_cmd_helo *data)
{
T_BEGIN {
} T_END;
return 1;
}
enum client_auth_result result,
const char *text)
{
struct submission_client *subm_client =
switch (result) {
/* nothing to be done for SMTP */
break;
/* RFC4954, Section 6:
454 4.7.0 Temporary authentication failure
This response to the AUTH command indicates that the
authentication failed due to a temporary server failure.
*/
break;
/* RFC4954, Section 4:
If the client wishes to cancel the authentication exchange,
it issues a line with a single "*". If the server receives
such a response, it MUST reject the AUTH command by sending
a 501 reply. */
break;
/* RFC4954, Section 4:
If the server cannot [BASE64] decode any client response, it
MUST reject the AUTH command with a 501 reply (and an
enhanced status code of 5.5.2). */
break;
/* RFC3207, Section 4:
A SMTP server that is not publicly referenced may choose to
require that the client perform a TLS negotiation before
accepting any commands. In this case, the server SHOULD
return the reply code:
530 Must issue a STARTTLS command first
to every command other than NOOP, EHLO, STARTTLS, or QUIT.
If the client and server are using the ENHANCEDSTATUSCODES
ESMTP extension [RFC2034], the status code to be returned
SHOULD be 5.7.0. */
break;
/* RFC5248, Section 2.4:
523 X.7.10 Encryption Needed
This indicates that an external strong privacy layer is
needed in order to use the requested authentication
mechanism. This is primarily intended for use with clear text
authentication mechanisms. A client that receives this may
activate a security layer such as TLS prior to
authenticating, or attempt to use a stronger mechanism. */
break;
/* RFC4954, Section 4:
If the requested authentication mechanism is invalid (e.g.,
is not supported or requires an encryption layer), the server
rejects the AUTH command with a 504 reply. If the server
supports the [ESMTP-CODES] extension, it SHOULD return a
5.5.4 enhanced response code. */
break;
/* RFC5248, Section 2.4:
525 X.7.13 User Account Disabled
Sometimes a system administrator will have to disable a
user's account (e.g., due to lack of payment, abuse, evidence
of a break-in attempt, etc.). This error code occurs after a
successful authentication to a disabled account. This informs
the client that the failure is permanent until the user
contacts their system administrator to get the account
re-enabled. */
break;
default:
/* FIXME: RFC4954, Section 4:
If the client uses an initial-response argument to the AUTH
command with a SASL mechanism in which the client does not
begin the authentication exchange, the server MUST reject the
AUTH command with a 501 reply. Servers using the enhanced
status codes extension [ESMTP-CODES] SHOULD return an
enhanced status code of 5.7.0 in this case.
>> Currently, this is checked at the server side, but only a
generic error is ever produced.
*/
/* NOTE: RFC4954, Section 4:
If, during an authentication exchange, the server receives a
line that is longer than the server's authentication buffer,
the server fails the AUTH command with the 500 reply. Servers
using the enhanced status codes extension [ESMTP-CODES]
SHOULD return an enhanced status code of 5.5.6 in this case.
>> Currently, client is disconnected from login-common.
*/
/* RFC4954, Section 4:
If the server is unable to authenticate the client, it SHOULD
reject the AUTH command with a 535 reply unless a more
specific error code is appropriate.
RFC4954, Section 6:
535 5.7.8 Authentication credentials invalid
This response to the AUTH command indicates that the
authentication failed due to invalid or insufficient
authentication credentials.
*/
break;
}
}
int cmd_auth_continue(void *conn_ctx,
const char *response)
{
return 0;
}
return 0;
}
const char *data)
{
struct submission_client *subm_client =
}
struct smtp_server_cmd_auth *data)
{
struct smtp_server_helo_data *helo;
char *prefix;
/* pass ehlo parameter to post-login service upon successful login */
return 0;
}