bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch/* VRFY command */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Boschvoid smtp_server_cmd_vrfy(struct smtp_server_cmd_ctx *cmd,
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch struct smtp_server_connection *conn = cmd->conn;
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch struct smtp_server_command *command = cmd->cmd;
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch const struct smtp_server_callbacks *callbacks = conn->callbacks;
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch /* vrfy = "VRFY" SP String CRLF */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch if ((ret=smtp_string_parse(params, ¶m, &error)) <= 0) {
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch if (callbacks != NULL && callbacks->conn_cmd_vrfy != NULL) {
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch /* specific implementation of VRFY command */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch if ((ret=callbacks->conn_cmd_vrfy(conn->context,
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch /* command is waiting for external event or it failed */
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch /* RFC 5321, Section 3.5.3:
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch A server MUST NOT return a 250 code in response to a VRFY or EXPN
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch command unless it has actually verified the address. In particular,
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch a server MUST NOT return 250 if all it has done is to verify that the
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch syntax given is valid. In that case, 502 (Command not implemented)
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch or 500 (Syntax error, command unrecognized) SHOULD be returned. As
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch stated elsewhere, implementation (in the sense of actually validating
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch addresses and returning information) of VRFY and EXPN are strongly
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch recommended. Hence, implementations that return 500 or 502 for VRFY
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch are not in full compliance with this specification.
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch There may be circumstances where an address appears to be valid but
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch cannot reasonably be verified in real time, particularly when a
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch server is acting as a mail exchanger for another server or domain.
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch "Apparent validity", in this case, would normally involve at least
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch syntax checking and might involve verification that any domains
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch specified were ones to which the host expected to be able to relay
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch mail. In these situations, reply code 252 SHOULD be returned.
56dd928c164ec5c0d1158a1760154b58c5f1f6e7Stephan Bosch smtp_server_reply(cmd, 252, "2.3.3", "Try RCPT instead");