--- 1615,1621 ----
users are restricted in where they can send mail, and the other
table defines what destinations are local. It is left as an exercise
for the reader to change this into a scheme where only some users
! have permission to send mail to off-site destinations, and
where most users are restricted.
Execute the command postmap /etc/postfix/virtual whenever
! you edit the virtual table.
diff -cr /tmp/postfix-20010228-pl02/src/global/mail_conf_bool.c ./src/global/mail_conf_bool.c
*** /tmp/postfix-20010228-pl02/src/global/mail_conf_bool.c Sun Apr 25 18:05:41 1999
--- ./src/global/mail_conf_bool.c Tue May 1 11:08:07 2001
***************
*** 7,18 ****
/* #include
/*
/* int get_mail_conf_bool(name, defval)
- /* const char *path;
/* const char *name;
/* int defval;
/*
/* int get_mail_conf_bool_fn(name, defval)
- /* const char *path;
/* const char *name;
/* int (*defval)();
/*
--- 7,16 ----
diff -cr /tmp/postfix-20010228-pl02/src/lmtp/lmtp.c ./src/lmtp/lmtp.c
*** /tmp/postfix-20010228-pl02/src/lmtp/lmtp.c Wed Mar 28 20:14:25 2001
--- ./src/lmtp/lmtp.c Fri May 25 20:27:05 2001
***************
*** 420,425 ****
--- 420,432 ----
result = state->status;
lmtp_chat_reset(state);
+ /*
+ * XXX State persists until idle timeout, but these fields will be
+ * dangling pointers. Nuke them.
+ */
+ state->request = 0;
+ state->src = 0;
+
return (result);
}
diff -cr /tmp/postfix-20010228-pl02/src/lmtp/lmtp_proto.c ./src/lmtp/lmtp_proto.c
*** /tmp/postfix-20010228-pl02/src/lmtp/lmtp_proto.c Fri Apr 27 15:33:12 2001
--- ./src/lmtp/lmtp_proto.c Fri May 25 20:27:05 2001
***************
*** 139,144 ****
--- 139,147 ----
* same code that implements command pipelining, so that we can borrow from
* the existing code for exception handling and error reporting.
*
+ * Client states that are associated with sending mail (up to and including
+ * SMTP_STATE_DOT) must have smaller numerical values than the non-sending
+ * states (SMTP_STATE_ABORT .. SMTP_STATE_LAST).
*/
#define LMTP_STATE_MAIL 0
#define LMTP_STATE_RCPT 1
***************
*** 313,318 ****
--- 316,324 ----
#define SENDER_IN_WAIT_STATE \
(send_state == LMTP_STATE_DOT || send_state == LMTP_STATE_LAST)
+ #define SENDING_MAIL \
+ (recv_state <= LMTP_STATE_DOT)
+
/*
* Pipelining support requires two loops: one loop for sending and one
* for receiving. Each loop has its own independent state. Most of the
***************
*** 454,461 ****
smtp_timeout_setup(state->session->stream,
*xfer_timeouts[recv_state]);
if ((except = vstream_setjmp(state->session->stream)) != 0)
! RETURN(lmtp_stream_except(state, except,
! xfer_states[recv_state]));
resp = lmtp_chat_resp(state);
/*
--- 460,467 ----
smtp_timeout_setup(state->session->stream,
*xfer_timeouts[recv_state]);
if ((except = vstream_setjmp(state->session->stream)) != 0)
! RETURN(SENDING_MAIL ? lmtp_stream_except(state, except,
! xfer_states[recv_state]) : -1);
resp = lmtp_chat_resp(state);
/*
diff -cr /tmp/postfix-20010228-pl02/src/postsuper/postsuper.c ./src/postsuper/postsuper.c
*** /tmp/postfix-20010228-pl02/src/postsuper/postsuper.c Sun Jan 28 21:18:17 2001
--- ./src/postsuper/postsuper.c Sat May 26 18:57:06 2001
***************
*** 238,246 ****
}
/*
! * Skip temporary files that aren't old enough.
*/
if (mail_queue_id_ok(path) == 0)
continue;
/*
--- 238,254 ----
}
/*
! * Skip over files with illegal names. The library routines
! * refuse to operate on them.
*/
if (mail_queue_id_ok(path) == 0)
+ continue;
+
+ /*
+ * Skip temporary files that aren't old enough.
+ */
+ if (qp->perms == MAIL_QUEUE_STAT_READY
+ && (st.st_mode & S_IRWXU) != qp->perms)
continue;
/*
diff -cr /tmp/postfix-20010228-pl02/src/sendmail/sendmail.c ./src/sendmail/sendmail.c
*** /tmp/postfix-20010228-pl02/src/sendmail/sendmail.c Wed Jan 24 20:11:59 2001
--- ./src/sendmail/sendmail.c Sat May 26 11:58:00 2001
***************
*** 34,45 ****
/* the reason for failure is shown. This mode of operation is implemented
/* by connecting to the \fBshowq\fR(8) daemon.
/* .IP \fBnewaliases\fR
! /* Initialize the alias database. If no alias database type is
! /* specified, the program uses the type specified in the
! /* \fBdatabase_type\fR configuration parameter; if no input file
! /* is specified, the program processes the file(s) specified with the
! /* \fBalias_database\fR configuration parameter. This mode of operation
! /* is implemented by running the \fBpostalias\fR(1) command.
/* .sp
/* Note: it may take a minute or so before an alias database update
/* becomes visible. Use the \fBpostfix reload\fR command to eliminate
--- 34,46 ----
/* the reason for failure is shown. This mode of operation is implemented
/* by connecting to the \fBshowq\fR(8) daemon.
/* .IP \fBnewaliases\fR
! /* Initialize the alias database. If no input file is specified (with
! /* the \fB-oA\fR option, see below), the program processes the file(s)
! /* specified with the \fBalias_database\fR configuration parameter.
! /* If no alias database type is specified, the program uses the type
! /* specified with the \fBdatabase_type\fR configuration parameter.
! /* This mode of operation is implemented by running the \fBpostalias\fR(1)
! /* command.
/* .sp
/* Note: it may take a minute or so before an alias database update
/* becomes visible. Use the \fBpostfix reload\fR command to eliminate
***************
*** 517,528 ****
signal(SIGPIPE, SIG_DFL);
if ((showq = mail_connect(MAIL_CLASS_PUBLIC, MAIL_SERVICE_SHOWQ, BLOCKING)) != 0) {
while ((n = vstream_fread(showq, buf, sizeof(buf))) > 0)
! if (vstream_fwrite(VSTREAM_OUT, buf, n) != n)
msg_fatal("write error: %m");
- if (vstream_fflush(VSTREAM_OUT))
- msg_fatal("write error: %m");
-
if (vstream_fclose(showq))
msg_warn("close: %m");
}
--- 518,527 ----
signal(SIGPIPE, SIG_DFL);
if ((showq = mail_connect(MAIL_CLASS_PUBLIC, MAIL_SERVICE_SHOWQ, BLOCKING)) != 0) {
while ((n = vstream_fread(showq, buf, sizeof(buf))) > 0)
! if (vstream_fwrite(VSTREAM_OUT, buf, n) != n
! || vstream_fflush(VSTREAM_OUT) != 0)
msg_fatal("write error: %m");
if (vstream_fclose(showq))
msg_warn("close: %m");
}
***************
*** 949,954 ****
--- 948,955 ----
case SM_MODE_NEWALIAS:
if (argv[OPTIND])
msg_fatal("alias initialization mode requires no recipient");
+ if (*var_alias_db_map == 0)
+ return (0);
ext_argv = argv_alloc(2);
argv_add(ext_argv, "postalias", (char *) 0);
for (n = 0; n < msg_verbose; n++)
diff -cr /tmp/postfix-20010228-pl02/src/smtp/smtp_proto.c ./src/smtp/smtp_proto.c
*** /tmp/postfix-20010228-pl02/src/smtp/smtp_proto.c Sun Jan 21 13:18:40 2001
--- ./src/smtp/smtp_proto.c Fri May 25 20:26:53 2001
***************
*** 114,119 ****
--- 114,123 ----
* By default, the receiver skips the QUIT response. Some SMTP servers
* disconnect after responding to ".", and some SMTP servers wait before
* responding to QUIT.
+ *
+ * Client states that are associated with sending mail (up to and including
+ * SMTP_STATE_DOT) must have smaller numerical values than the non-sending
+ * states (SMTP_STATE_ABORT .. SMTP_STATE_LAST).
*/
#define SMTP_STATE_MAIL 0
#define SMTP_STATE_RCPT 1
***************
*** 294,299 ****
--- 298,306 ----
#define SENDER_IN_WAIT_STATE \
(send_state == SMTP_STATE_DOT || send_state == SMTP_STATE_LAST)
+ #define SENDING_MAIL \
+ (recv_state <= SMTP_STATE_DOT)
+
/*
* We use SMTP command pipelining if the server said it supported it.
* Since we use blocking I/O, RFC 2197 says that we should inspect the
***************
*** 451,458 ****
smtp_timeout_setup(state->session->stream,
*xfer_timeouts[recv_state]);
if ((except = vstream_setjmp(state->session->stream)) != 0)
! RETURN(smtp_stream_except(state, except,
! xfer_states[recv_state]));
resp = smtp_chat_resp(state);
/*
--- 458,465 ----
smtp_timeout_setup(state->session->stream,
*xfer_timeouts[recv_state]);
if ((except = vstream_setjmp(state->session->stream)) != 0)
! RETURN(SENDING_MAIL ? smtp_stream_except(state, except,
! xfer_states[recv_state]) : -1);
resp = smtp_chat_resp(state);
/*
diff -cr /tmp/postfix-20010228-pl02/src/smtpd/smtpd.c ./src/smtpd/smtpd.c
*** /tmp/postfix-20010228-pl02/src/smtpd/smtpd.c Fri Apr 27 13:27:29 2001
--- ./src/smtpd/smtpd.c Tue May 1 12:43:22 2001
***************
*** 834,840 ****
state->error_mask |= MAIL_ERROR_PROTOCOL;
smtpd_chat_reply(state, "503 Error: need RCPT command");
} else {
! smtpd_chat_reply(state, "550 Error: no valid recipients");
}
return (-1);
}
--- 834,840 ----
state->error_mask |= MAIL_ERROR_PROTOCOL;
smtpd_chat_reply(state, "503 Error: need RCPT command");
} else {
! smtpd_chat_reply(state, "554 Error: no valid recipients");
}
return (-1);
}
diff -cr /tmp/postfix-20010228-pl02/src/smtpd/smtpd_check.c ./src/smtpd/smtpd_check.c
*** /tmp/postfix-20010228-pl02/src/smtpd/smtpd_check.c Mon Apr 30 12:33:53 2001
--- ./src/smtpd/smtpd_check.c Mon May 7 18:27:58 2001
***************
*** 552,557 ****
--- 552,577 ----
printable(STR(error_text), ' ');
/*
+ * XXX The code below also appears in the SMTP server reply output
+ * routine. It is duplicated here in order to avoid discrepancies between
+ * the reply codes that are shown in "reject" logging and the reply codes
+ * that are actually sent to the SMTP client.
+ *
+ * Implementing the soft_bounce safety net in the SMTP server reply output
+ * routine has the advantage that it covers all 5xx replies, including
+ * SMTP protocol or syntax errors, which makes soft_bounce great for
+ * non-destructive tests (especially by people who are paranoid about
+ * losing mail).
+ *
+ * We could eliminate the code duplication and implement the soft_bounce
+ * safety net only in the code below. But then the safety net would cover
+ * the UCE restrictions only. This would be at odds with the documentation
+ * which says soft_bounce changes all 5xx replies into 4xx ones.
+ */
+ if (var_soft_bounce && STR(error_text)[0] == '5')
+ STR(error_text)[0] = '4';
+
+ /*
* Log what is happening. When the sysadmin discards policy violation
* postmaster notices, this may be the only trace left that service was
* rejected. Print the request, client name/address, and response.
diff -cr /tmp/postfix-20010228-pl02/src/util/dict_ldap.c ./src/util/dict_ldap.c
*** /tmp/postfix-20010228-pl02/src/util/dict_ldap.c Fri Apr 6 10:29:21 2001
--- ./src/util/dict_ldap.c Thu May 24 15:36:42 2001
***************
*** 584,589 ****
--- 584,591 ----
ldap_msgfree(res);
if (filter_buf != 0)
vstring_free(filter_buf);
+ if (escaped_name != 0)
+ vstring_free(escaped_name);
/*
* If we had an error, return nothing, Otherwise, return the result, if
diff -cr /tmp/postfix-20010228-pl02/src/util/sane_link.c ./src/util/sane_link.c
*** /tmp/postfix-20010228-pl02/src/util/sane_link.c Fri Jan 28 09:22:58 2000
--- ./src/util/sane_link.c Tue May 1 11:06:05 2001
***************
*** 6,12 ****
/* SYNOPSIS
/* #include
/*
! /* int sane_link(old, new)
/* const char *from;
/* const char *to;
/* DESCRIPTION
--- 6,12 ----
/* SYNOPSIS
/* #include
/*
! /* int sane_link(from, to)
/* const char *from;
/* const char *to;
/* DESCRIPTION
diff -cr /tmp/postfix-20010228-pl02/src/util/writable.c ./src/util/writable.c
*** /tmp/postfix-20010228-pl02/src/util/writable.c Sun Mar 21 12:53:06 1999
--- ./src/util/writable.c Tue May 1 11:04:30 2001
***************
*** 10,16 ****
/* int fd;
/* DESCRIPTION
/* writable() asks the kernel if the specified file descriptor
! /* is writable, i.e. a read operation would not block.
/*
/* Arguments:
/* .IP fd
--- 10,16 ----
/* int fd;
/* DESCRIPTION
/* writable() asks the kernel if the specified file descriptor
! /* is writable, i.e. a write operation would not block.
/*
/* Arguments:
/* .IP fd