bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch/* The command handling of the submission proxy service aims to follow the
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch following rules:
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch - Attempt to keep pipelined commands pipelined when proxying them to the
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch actual relay service.
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch - Don't forward commands if they're known to fail at the relay server. Errors
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch can still occur if pipelined commands fail. Abort subsequent pending
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch commands if such failures affect those commands.
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch - Keep predictable errors consistent as much as possible; send our own reply
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch if the error condition is clear (e.g. missing MAIL, RCPT).
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Boschbool client_command_handle_proxy_reply(struct client *client,
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch const struct smtp_reply *reply, struct smtp_reply *reply_r)
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch case SMTP_CLIENT_COMMAND_ERROR_HOST_LOOKUP_FAILED:
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch case SMTP_CLIENT_COMMAND_ERROR_CONNECT_FAILED:
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch case SMTP_CLIENT_COMMAND_ERROR_CONNECTION_CLOSED:
2cbbe9b4829adb184c83dbf780316f4144559054Stephan Bosch case SMTP_CLIENT_COMMAND_ERROR_CONNECTION_LOST:
b5d61c3f6ead1284cb54b6f30e3e907f9c8a7ffeStephan Bosch /* RFC 4954, Section 6: 530 5.7.0 Authentication required
b5d61c3f6ead1284cb54b6f30e3e907f9c8a7ffeStephan Bosch This response SHOULD be returned by any command other than AUTH,
b5d61c3f6ead1284cb54b6f30e3e907f9c8a7ffeStephan Bosch EHLO, HELO, NOOP, RSET, or QUIT when server policy requires
b5d61c3f6ead1284cb54b6f30e3e907f9c8a7ffeStephan Bosch authentication in order to perform the requested action and
b5d61c3f6ead1284cb54b6f30e3e907f9c8a7ffeStephan Bosch authentication is not currently in force. */
b5d61c3f6ead1284cb54b6f30e3e907f9c8a7ffeStephan Bosch i_error("Relay server requires authentication: %s",
b5d61c3f6ead1284cb54b6f30e3e907f9c8a7ffeStephan Bosch "Internal error occurred. "
b5d61c3f6ead1284cb54b6f30e3e907f9c8a7ffeStephan Bosch "Refer to server log for more information.");