/*++ /* NAME /* smtp_chat 3 /* SUMMARY /* SMTP client request/response support /* SYNOPSIS /* #include "smtp.h" /* /* typedef struct { /* .in +4
/* int code; /* SMTP code, not sanitized */ /* char *dsn; /* enhanced status, sanitized */ /* char *str; /* unmodified SMTP reply */ /* VSTRING *dsn_buf; /* VSTRING *str_buf; /* .in -4 /* } SMTP_RESP; /* /* void smtp_chat_cmd(session, format, ...) /* SMTP_SESSION *session; /* const char *format; /* /* DICT *smtp_chat_resp_filter; /* /* SMTP_RESP *smtp_chat_resp(session) /* SMTP_SESSION *session; /* /* void smtp_chat_notify(session) /* SMTP_SESSION *session; /* /* void smtp_chat_init(session) /* SMTP_SESSION *session; /* /* void smtp_chat_reset(session) /* SMTP_SESSION *session; /* DESCRIPTION /* This module implements SMTP client support for request/reply /* conversations, and maintains a limited SMTP transaction log. /* /* smtp_chat_cmd() formats a command and sends it to an SMTP server. /* Optionally, the command is logged. /* /* smtp_chat_resp() reads one SMTP server response. It extracts /* the SMTP reply code and enhanced status code from the text, /* and concatenates multi-line responses to one string, using /* a newline as separator. Optionally, the server response /* is logged. /* .IP \(bu /* Postfix never sanitizes the extracted SMTP reply code except /* to ensure that it is a three-digit code. A malformed reply /* results in a null extracted SMTP reply code value. /* .IP \(bu /* Postfix always sanitizes the extracted enhanced status code. /* When the server's SMTP status code is 2xx, 4xx or 5xx, /* Postfix requires that the first digit of the server's /* enhanced status code matches the first digit of the server's /* SMTP status code. In case of a mis-match, or when the /* server specified no status code, the extracted enhanced /* status code is set to 2.0.0, 4.0.0 or 5.0.0 instead. With /* SMTP reply codes other than 2xx, 4xx or 5xx, the extracted /* enhanced status code is set to a default value of 5.5.0 /* (protocol error) for reasons outlined under the next bullet. /* .IP \(bu /* Since the SMTP reply code may violate the protocol even /* when it is correctly formatted, Postfix uses the sanitized /* extracted enhanced status code to decide whether an error /* condition is permanent or transient. This means that the /* caller may have to update the enhanced status code when it /* discovers that a server reply violates the SMTP protocol, /* even though it was correctly formatted. This happens when /* the client and server get out of step due to a broken proxy /* agent. /* .PP /* smtp_chat_resp_filter specifies an optional filter to /* transform one server reply line before it is parsed. The /* filter is invoked once for each line of a multi-line reply. /* /* smtp_chat_notify() sends a copy of the SMTP transaction log /* to the postmaster for review. The postmaster notice is sent only /* when delivery is possible immediately. It is an error to call /* smtp_chat_notify() when no SMTP transaction log exists. /* /* smtp_chat_init() initializes the per-session transaction log. /* This must be done at the beginning of a new SMTP session. /* /* smtp_chat_reset() resets the transaction log. This is /* typically done at the beginning or end of an SMTP session, /* or within a session to discard non-error information. /* DIAGNOSTICS /* Fatal errors: memory allocation problem, server response exceeds /* configurable limit. /* All other exceptions are handled by long jumps (see smtp_stream(3)). /* SEE ALSO /* smtp_stream(3) SMTP session I/O support /* msg(3) generic logging interface /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA /* /* Wietse Venema /* Google, Inc. /* 111 8th Avenue /* New York, NY 10011, USA
/*--*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.