diff -cr /var/tmp/postfix-2.5.2/src/global/mail_proto.h ./src/global/mail_proto.h *** /var/tmp/postfix-2.5.2/src/global/mail_proto.h 2007-12-12 15:28:28.000000000 -0500 --- ./src/global/mail_proto.h 2008-07-04 07:38:21.000000000 -0400 *************** *** 203,208 **** --- 203,209 ---- #define XCLIENT_PORT "PORT" /* client port */ #define XCLIENT_PROTO "PROTO" /* client protocol */ #define XCLIENT_HELO "HELO" /* client helo */ + #define XCLIENT_LOGIN "LOGIN" /* client login */ #define XCLIENT_UNAVAILABLE "[UNAVAILABLE]" /* permanently unavailable */ #define XCLIENT_TEMPORARY "[TEMPUNAVAIL]" /* temporarily unavailable */ diff -cr /var/tmp/postfix-2.5.2/src/smtpd/smtpd.c ./src/smtpd/smtpd.c *** /var/tmp/postfix-2.5.2/src/smtpd/smtpd.c 2008-05-08 20:12:00.000000000 -0400 --- ./src/smtpd/smtpd.c 2008-07-09 08:33:35.000000000 -0400 *************** *** 1557,1563 **** ENQUEUE_FIX_REPLY(state, reply_buf, XCLIENT_CMD " " XCLIENT_NAME " " XCLIENT_ADDR " " XCLIENT_PROTO " " XCLIENT_HELO ! " " XCLIENT_REVERSE_NAME " " XCLIENT_PORT); if ((discard_mask & EHLO_MASK_XFORWARD) == 0) if (xforward_allowed) ENQUEUE_FIX_REPLY(state, reply_buf, XFORWARD_CMD --- 1557,1564 ---- ENQUEUE_FIX_REPLY(state, reply_buf, XCLIENT_CMD " " XCLIENT_NAME " " XCLIENT_ADDR " " XCLIENT_PROTO " " XCLIENT_HELO ! " " XCLIENT_REVERSE_NAME " " XCLIENT_PORT ! " " XCLIENT_LOGIN); if ((discard_mask & EHLO_MASK_XFORWARD) == 0) if (xforward_allowed) ENQUEUE_FIX_REPLY(state, reply_buf, XFORWARD_CMD *************** *** 3195,3200 **** --- 3196,3202 ---- }; int got_helo = 0; int got_proto = 0; + int got_login =0; /* * Sanity checks. *************** *** 3386,3391 **** --- 3388,3406 ---- UPDATE_STR(state->protocol, uppercase(attr_value)); got_proto = 1; } + + /* + * LOGIN=substitute SMTP client username has been authenticated. + */ + else if (STREQ(attr_name, XCLIENT_LOGIN)) { + if (STREQ(attr_value, XCLIENT_UNAVAILABLE)) { + attr_value = CLIENT_LOGIN_UNKNOWN; + } + UPDATE_STR(state->sasl_username, attr_value); + printable(state->sasl_username, '?'); + UPDATE_STR(state->sasl_method, "xclient"); + got_login = 1; + } /* * Unknown attribute name. Complain. *************** *** 3436,3442 **** } #ifdef USE_SASL_AUTH if (var_smtpd_sasl_enable) ! smtpd_sasl_auth_reset(state); #endif chat_reset(state, 0); mail_reset(state); --- 3451,3458 ---- } #ifdef USE_SASL_AUTH if (var_smtpd_sasl_enable) ! if (got_proto == 0) ! smtpd_sasl_auth_reset(state); #endif chat_reset(state, 0); mail_reset(state); diff -cr /var/tmp/postfix-2.5.2/src/smtpd/smtpd.h ./src/smtpd/smtpd.h *** /var/tmp/postfix-2.5.2/src/smtpd/smtpd.h 2008-04-29 20:49:01.000000000 -0400 --- ./src/smtpd/smtpd.h 2008-07-07 13:35:06.000000000 -0400 *************** *** 242,247 **** --- 242,248 ---- #define CLIENT_PROTO_UNKNOWN CLIENT_ATTR_UNKNOWN #define CLIENT_IDENT_UNKNOWN 0 #define CLIENT_DOMAIN_UNKNOWN 0 + #define CLIENT_LOGIN_UNKNOWN 0 #define IS_AVAIL_CLIENT_ATTR(v) ((v) && strcmp((v), CLIENT_ATTR_UNKNOWN))