2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-30 05:38:06 +00:00

postfix-19990601

This commit is contained in:
Wietse Venema 1999-06-01 00:00:00 -05:00
parent 8933229fb7
commit 2aaa35c476
29 changed files with 90 additions and 257 deletions

View File

@ -2740,7 +2740,7 @@ Apologies for any names omitted.
Feature: control over how address extensions are propagated
to other addresses. By default, propagation of unmatched
address extensions is now restricted to canonical and
virtual mappings. Specify "propagate_unmatched_extension
virtual mappings. Specify "propagate_unmatched_extensions
= canonical, virtual, alias, forward, include" to restore
previous behavior.
@ -2790,22 +2790,14 @@ Apologies for any names omitted.
discarded" warning when mail is dropped on the floor.
Requested by Michael Hasenstein, SuSE, Germany.
19990516
Feature: per-service peak and average process limit. When
the system is lightly loaded, use the per-service peak
process limit. When the system is under stress, use the
per-service average process limit. The per-service average
process count is computed once a minute.
19990517
Bugfix: reject_non_fqdn_sender/recipient would pass
user@[ip_address] regardless of destination. Eric Cholet
had the honor of suffering from this one.
19990527
1990601
More SMTP client logging for easier debugging: the smtp
client now logs hostname[ip.addr], and logs every failed
attempt to reach an MX host, not just the last one.
Bugfix: emit a blank line before a MIME boundary; the line
is part of the boundary. File: bounce/bounce_notify_service.c.
Wolfgang Segmuller, IBM Research.

View File

@ -19,8 +19,8 @@ from:
You will need to add -DHAS_PCRE and a -I for the PCRE header to CCARGS,
and add the path to the PCRE library to AUXLIBS, for example:
make -f Makefile.init makefiles 'CCARGS=-DHAS_PCRE -I../../pcre-2.04' \
'AUXLIBS=../../pcre-2.04/libpcre.a'
make -f Makefile.init makefiles 'CCARGS=-DHAS_PCRE -I../../pcre-2.05' \
'AUXLIBS=../../pcre-2.05/libpcre.a'
[note: earlier pcre versions have problems -- Wietse]

View File

@ -1,4 +1,4 @@
Incompatible changes with snapshot-19990513:
Incompatible changes with postfix-19990601:
===========================================
- The SMTP server now delays all UCE restrictions until the RCPT
@ -24,10 +24,10 @@ libexec subdirectory, command executables in the bin subdirectory.
The INSTALL instructions now recommend installing daemons and
commands into separate directories.
Major changes with snapshot-19990513:
Major changes with postfix-19990601:
=====================================
- New USER, EXTENSION, LOCAL, DOMAIN. and RECIPIENT environment
- New USER, EXTENSION, LOCAL, DOMAIN and RECIPIENT environment
variables for delivery to command (including mailbox_command) by
the local delivery agent. As you might expect, the information is
censored. The list of acceptable characters is specified with the

4
postfix/UUCP_README Normal file
View File

@ -0,0 +1,4 @@
In order to receive mail via UUCP, your system needs to have an
rmail command installed. A minimal rmail command can be found in
the "aux/rmail" directory. Install the command, mode 755, in a
place that can be found by the UUCP "uuxqt" command.

8
postfix/aux/rmail/rmail Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
# Dummy UUCP rmail command for postfix/qmail systems
SENDMAIL="/usr/sbin/sendmail"
IFS=" " read junk from junk
exec $SENDMAIL -f "$from" -- "$@"

View File

@ -130,11 +130,11 @@ static int bounce_header(VSTREAM *bounce, VSTRING *buf, const char *dest,
post_mail_fprintf(bounce, "\tboundary=\"%s\"", boundary);
post_mail_fputs(bounce, "");
post_mail_fputs(bounce, "This is a MIME-encapsulated message.");
post_mail_fputs(bounce, "");
/*
* More MIME header.
*/
post_mail_fputs(bounce, "");
post_mail_fprintf(bounce, "--%s", boundary);
post_mail_fprintf(bounce, "Content-Description: %s", "Notification");
post_mail_fprintf(bounce, "Content-Type: %s", "text/plain");
@ -217,6 +217,7 @@ static int bounce_diagnostics(char *service, VSTREAM *bounce, VSTRING *buf,
* MIME header.
*/
#ifdef DSN
post_mail_fputs(bounce, "");
post_mail_fprintf(bounce, "--%s", boundary);
post_mail_fprintf(bounce, "Content-Description: %s", "Delivery error report");
post_mail_fprintf(bounce, "Content-Type: %s", "message/delivery-status");
@ -275,6 +276,7 @@ static int bounce_original(char *service, VSTREAM *bounce, VSTRING *buf,
/*
* MIME headers.
*/
post_mail_fputs(bounce, "");
post_mail_fprintf(bounce, "--%s", boundary);
post_mail_fprintf(bounce, "Content-Description: %s", "Undelivered Message");
post_mail_fprintf(bounce, "Content-Type: %s", headers_only ?
@ -325,6 +327,7 @@ static int bounce_original(char *service, VSTREAM *bounce, VSTRING *buf,
status = (REC_PUT_BUF(bounce, rec_type, buf) != rec_type);
}
}
post_mail_fputs(bounce, "");
post_mail_fprintf(bounce, "--%s--", boundary);
if (headers_only == 0 && rec_type != REC_TYPE_XTRA)
status |= mark_corrupt(src);

View File

@ -78,8 +78,7 @@ void cleanup_envelope(void)
}
if (type == REC_TYPE_MESG) {
if (cleanup_sender == 0 || cleanup_time == 0) {
msg_warn("%s: missing sender or time envelope record",
cleanup_queue_id);
msg_warn("missing sender or time envelope record");
cleanup_errs |= CLEANUP_STAT_BAD;
} else {
if (warn_time == 0 && var_delay_warn_time > 0)
@ -91,8 +90,7 @@ void cleanup_envelope(void)
break;
}
if (strchr(REC_TYPE_ENVELOPE, type) == 0) {
msg_warn("%s: unexpected record type %d in envelope", type,
cleanup_queue_id);
msg_warn("unexpected record type %d in envelope", type);
cleanup_errs |= CLEANUP_STAT_BAD;
break;
}
@ -119,8 +117,7 @@ void cleanup_envelope(void)
cleanup_sender = mystrdup(STR(clean_addr));
} else if (type == REC_TYPE_RCPT) {
if (cleanup_sender == 0) { /* protect showq */
msg_warn("%s: envelope recipient precedes sender",
cleanup_queue_id);
msg_warn("envelope recipient precedes sender");
cleanup_errs |= CLEANUP_STAT_BAD;
break;
}

View File

@ -90,8 +90,7 @@ void cleanup_extracted(void)
} else if (type == REC_TYPE_END) {
break;
} else {
msg_warn("%s: unexpected record type %d in extracted segment",
cleanup_queue_id, type);
msg_warn("unexpected record type %d in extracted segment", type);
cleanup_errs |= CLEANUP_STAT_BAD;
if (type >= 0)
cleanup_skip();

View File

@ -103,8 +103,8 @@ void cleanup_map11_external(VSTRING *addr, MAPS *maps, int propagate)
for (count = 0; count < MAX_RECURSION; count++) {
if ((new_addr = mail_addr_map(maps, STR(addr), propagate)) != 0) {
if (new_addr->argc > 1)
msg_warn("%s: multi-valued %s entry for %s",
cleanup_queue_id, maps->title, STR(addr));
msg_warn("multi-valued %s entry for %s",
maps->title, STR(addr));
saved_addr = mystrdup(STR(addr));
vstring_strcpy(addr, new_addr->argv[0]);
expand_to_self = !strcasecmp(saved_addr, STR(addr));

View File

@ -391,8 +391,7 @@ void cleanup_message(void)
break;
}
if (strchr(REC_TYPE_CONTENT, type) == 0) {
msg_warn("%s: %s: unexpected record type %d",
cleanup_queue_id, myname, type);
msg_warn("%s: unexpected record type %d", myname, type);
cleanup_errs |= CLEANUP_STAT_BAD;
break;
}

View File

@ -84,8 +84,7 @@ void cleanup_out(int type, char *string, int len)
if (CLEANUP_OUT_OK()) {
if (rec_put(cleanup_dst, type, string, len) < 0) {
if (errno == EFBIG) {
msg_warn("%s: queue file size limit exceeded",
cleanup_queue_id);
msg_warn("queue file size limit exceeded");
cleanup_errs |= CLEANUP_STAT_SIZE;
} else {
msg_warn("%s: write queue file: %m", cleanup_queue_id);

View File

@ -46,7 +46,7 @@ void cleanup_skip(void)
{
int type;
msg_warn("%s: skipping further client input", cleanup_queue_id);
msg_warn("skipping further client input");
/*
* XXX Rely on the front-end programs to enforce record size limits.

View File

@ -62,7 +62,7 @@ luser_relay =
mail_name = Postfix
mail_owner = postfix
mail_spool_directory = /var/mail
mail_version = Snapshot-19990527
mail_version = Beta-19990601
mailbox_command =
mailbox_transport =
maps_rbl_domains = rbl.maps.vix.com

View File

@ -15,7 +15,7 @@
* Version of this program.
*/
#define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "Snapshot-19990527"
#define DEF_MAIL_VERSION "Beta-19990601"
extern char *var_mail_version;
/* LICENSE

View File

@ -283,7 +283,7 @@ delivery.</a>
Normally, Postfix attempts to deliver outbound mail at its convenience.
If your machine uses on-demand dialup IP, this causes your system
to place a telephone call whenever you submit mail, and whenever
to place a telephone call whenever you submit new mail, and whenever
Postfix retries to deliver delayed mail. To prevent such telephone
calls from being placed, disable spontaneous SMTP mail deliveries.
@ -323,6 +323,12 @@ that are disconnected most of the time)
<p>
<i> When you disable DNS lookups, you must specify a</i> <b>relayhost</b>
<i> as either a numeric IP address, or as a hostname that appears
in</i> <b>/etc/hosts</b>.
<p>
<li> Flush the mail queue whenever the Internet link is established.
<p>
@ -340,12 +346,12 @@ Put the following command into your PPP or SLIP dialup scripts:
<p>
The exact location of the <b>sendmail</b> command is system-specific.
With some UNIX versions, usr <b>/usr/lib/sendmail</b>.
With some UNIX versions, use <b>/usr/lib/sendmail</b>.
If you have disabled <a href="#spontaneous_smtp">spontaneous SMTP
mail delivery</a> you need to run this command occasionally while
the dialup link is up, so that newly-posted mail is flushed from
the queue.
mail delivery</a>, you also need to run the above command every
now and then while the dialup link is up, so that newly-posted mail
is flushed from the queue.
</ul>

View File

@ -2,10 +2,10 @@ SHELL = /bin/sh
SRCS = master.c master_conf.c master_ent.c master_sig.c master_avail.c \
master_spawn.c master_service.c master_status.o master_listen.c \
master_proto.c single_server.c multi_server.c master_vars.c \
master_wakeup.c master_sample.c
master_wakeup.c
OBJS = master.o master_conf.o master_ent.o master_sig.o master_avail.o \
master_spawn.o master_service.o master_status.o master_listen.o \
master_vars.o master_wakeup.o master_sample.o
master_vars.o master_wakeup.o
LIB_OBJ = single_server.o multi_server.o trigger_server.o master_proto.o
HDRS = mail_server.h master_proto.h
INT_HDR = master.h
@ -118,7 +118,6 @@ master_ent.o: ../include/argv.h
master_ent.o: ../include/stringops.h
master_ent.o: ../include/readlline.h
master_ent.o: ../include/inet_addr_list.h
master_ent.o: ../include/split_at.h
master_ent.o: ../include/mail_proto.h
master_ent.o: ../include/iostuff.h
master_ent.o: ../include/mail_params.h
@ -140,11 +139,6 @@ master_proto.o: master_proto.c
master_proto.o: ../include/sys_defs.h
master_proto.o: ../include/msg.h
master_proto.o: master_proto.h
master_sample.o: master_sample.c
master_sample.o: ../include/sys_defs.h
master_sample.o: ../include/events.h
master_sample.o: ../include/msg.h
master_sample.o: master.h
master_service.o: master_service.c
master_service.o: ../include/sys_defs.h
master_service.o: ../include/msg.h

View File

@ -331,7 +331,6 @@ int main(int argc, char **argv)
* that there are no concurrency conflicts within the master process.
*/
signal(SIGALRM, master_watchdog);
master_sample_start();
for (;;) {
#ifdef HAS_VOLATILE_LOCKS
if (myflock(vstream_fileno(lock_fp), MYFLOCK_EXCLUSIVE) < 0)

View File

@ -27,13 +27,10 @@ typedef struct MASTER_SERV {
struct INET_ADDR_LIST *inet;
} addr_list;
int max_proc; /* upper bound on # processes */
int max_proc_pk; /* peak upper bound */
int max_proc_avg; /* average upper bound */
char *path; /* command pathname */
struct ARGV *args; /* argument vector */
int avail_proc; /* idle processes */
int total_proc; /* number of processes */
float total_proc_avg; /* average number of processes */
int throttle_delay; /* failure recovery parameter */
int status_fd[2]; /* child status reports */
struct BINHASH *children; /* linkage */
@ -158,12 +155,6 @@ extern void master_spawn(MASTER_SERV *);
extern void master_reap_child(void);
extern void master_delete_children(MASTER_SERV *);
/*
* master_sample.c
*/
extern void master_sample_start(void);
extern void master_sample_stop(void);
/* DIAGNOSTICS
/* BUGS
/* SEE ALSO

View File

@ -102,10 +102,8 @@ void master_avail_listen(MASTER_SERV *serv)
* request.
*/
if (msg_verbose)
msg_info("%s: avail %d total/avg %d/%.1f max/pk/avg %d/%d/%d", myname,
serv->avail_proc, serv->total_proc, serv->total_proc_avg,
serv->max_proc, serv->max_proc, serv->max_proc_pk,
serv->max_proc_avg);
msg_info("%s: avail %d total %d max %d", myname,
serv->avail_proc, serv->total_proc, serv->max_proc);
if (serv->avail_proc < 1
&& MASTER_LIMIT_OK(serv->max_proc, serv->total_proc)
&& !MASTER_THROTTLED(serv)) {

View File

@ -124,8 +124,7 @@ void master_config(void)
else {
serv->flags &= ~MASTER_FLAG_MARK;
serv->wakeup_time = entry->wakeup_time;
serv->max_proc_pk = entry->max_proc_pk;
serv->max_proc_avg = entry->max_proc_avg;
serv->max_proc = entry->max_proc;
serv->throttle_delay = entry->throttle_delay;
SWAP(char *, serv->path, entry->path);
SWAP(ARGV *, serv->args, entry->args);

View File

@ -84,7 +84,6 @@
#include <stringops.h>
#include <readlline.h>
#include <inet_addr_list.h>
#include <split_at.h>
/* Global library. */
@ -184,10 +183,13 @@ static char *get_str_ent(char **bufp, char *name, char *def_val)
}
}
/* cvt_bool_ent - convert boolean field */
/* get_bool_ent - extract boolean field */
static int cvt_bool_ent(char *name, char *value)
static int get_bool_ent(char **bufp, char *name, char *def_val)
{
char *value;
value = get_str_ent(bufp, name, def_val);
if (strcmp("y", value) == 0) {
return (1);
} else if (strcmp("n", value) == 0) {
@ -198,35 +200,17 @@ static int cvt_bool_ent(char *name, char *value)
/* NOTREACHED */
}
/* get_bool_ent - extract boolean field */
static int get_bool_ent(char **bufp, char *name, char *def_val)
{
char *value;
value = get_str_ent(bufp, name, def_val);
return (cvt_bool_ent(name, value));
}
/* cvt_int_ent - convert integer field */
static int cvt_int_ent(char *name, char *value, int min_val)
{
int n;
if (!ISDIGIT(*value) || (n = atoi(value)) < min_val)
fatal_invalid_field(name, value);
return (n);
}
/* get_int_ent - extract integer field */
static int get_int_ent(char **bufp, char *name, char *def_val, int min_val)
{
char *value;
int n;
value = get_str_ent(bufp, name, def_val);
return (cvt_int_ent(name, value, min_val));
if (!ISDIGIT(*value) || (n = atoi(value)) < min_val)
fatal_invalid_field(name, value);
return (n);
}
/* get_master_ent - read entry from configuration file */
@ -245,7 +229,6 @@ MASTER_SERV *get_master_ent()
char *command;
int n;
char *bufp;
char *cp2;
if (master_fp == 0)
msg_panic("get_master_ent: config file not open");
@ -360,23 +343,7 @@ MASTER_SERV *get_master_ent()
* Concurrency limit. Zero means no limit.
*/
vstring_sprintf(junk, "%d", var_proc_limit);
cp = get_str_ent(&bufp, "max_proc", vstring_str(junk));
if ((cp2 = split_at(cp, '/')) != 0) {
serv->max_proc_pk = cvt_int_ent("max_proc", strcmp(cp, "-") != 0 ?
cp : vstring_str(junk), 0);
serv->max_proc_avg = cvt_int_ent("max_proc", strcmp(cp2, "-") != 0 ?
cp2 : vstring_str(junk), 0);
if (serv->max_proc_pk == 0 && serv->max_proc_avg != 0)
fatal_with_context("specify a non-zero peak process limit");
if (serv->max_proc_pk != 0 && serv->max_proc_avg == 0)
fatal_with_context("specify a non-zero average process limit");
if (serv->max_proc_pk < serv->max_proc_avg)
fatal_with_context("peak < average process limit");
} else {
serv->max_proc_pk = cvt_int_ent("max_proc", cp, 0);
serv->max_proc_avg = serv->max_proc;
}
serv->max_proc = serv->max_proc_pk;
serv->max_proc = get_int_ent(&bufp, "max_proc", vstring_str(junk), 0);
/*
* Path to command,
@ -389,7 +356,6 @@ MASTER_SERV *get_master_ent()
*/
serv->avail_proc = 0;
serv->total_proc = 0;
serv->total_proc_avg = 0;
/*
* Backoff time in case a service is broken.
@ -412,7 +378,7 @@ MASTER_SERV *get_master_ent()
*/
serv->args = argv_alloc(0);
argv_add(serv->args, command, (char *) 0);
if (serv->max_proc_pk == 1)
if (serv->max_proc == 1)
argv_add(serv->args, "-l", (char *) 0);
if (strcmp(basename(command), name) != 0)
argv_add(serv->args, "-n", name, (char *) 0);
@ -456,14 +422,11 @@ void print_master_ent(MASTER_SERV *serv)
msg_info("listen_fd_count: %d", serv->listen_fd_count);
msg_info("wakeup: %d", serv->wakeup_time);
msg_info("max_proc: %d", serv->max_proc);
msg_info("max_proc_pk: %d", serv->max_proc_pk);
msg_info("max_proc_avg: %d", serv->max_proc_avg);
msg_info("path: %s", serv->path);
for (cpp = serv->args->argv; *cpp; cpp++)
msg_info("arg[%d]: %s", (int) (cpp - serv->args->argv), *cpp);
msg_info("avail_proc: %d", serv->avail_proc);
msg_info("total_proc: %d", serv->total_proc);
msg_info("total_proc_avg: %f", serv->total_proc_avg);
msg_info("throttle_delay: %d", serv->throttle_delay);
msg_info("status_fd %d %d", serv->status_fd[0], serv->status_fd[1]);
msg_info("children: 0x%lx", (long) serv->children);

View File

@ -1,98 +0,0 @@
/*++
/* NAME
/* master_sample 3
/* SUMMARY
/* Postfix master - statistics sampling
/* SYNOPSIS
/* #include "master.h"
/*
/* void master_sample_start()
/*
/* void master_sample_stop(serv)
/* DESCRIPTION
/* This module samples statistics at one-minute intervals.
/* Currently, it maintains the average process counts.
/*
/* master_sample_start() resets the statistics and starts
/* the statistics sampling process.
/*
/* master_sample_start() stops the statistics sampling process.
/* DIAGNOSTICS
/* BUGS
/* SEE ALSO
/* 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
/*--*/
/* System libraries. */
#include <sys_defs.h>
/* Utility library. */
#include <events.h>
#include <msg.h>
/* Application-specific. */
#include "master.h"
/* master_sample_action - take sample */
static void master_sample_action(int unused_event, char *unused_context)
{
MASTER_SERV *serv;
#define TSAMPLE 60
#define NSAMPLE 5
/*
* Update the process limit for services that have different peak/average
* concurrency limits. Gradually change from idle mode (allowing peak
* concurrency) to stress mode (long-term average process limit).
*/
for (serv = master_head; serv != 0; serv = serv->next) {
if (serv->max_proc_pk == 0 || serv->max_proc_avg == 0
|| serv->max_proc_pk == serv->max_proc_avg)
continue;
serv->total_proc_avg +=
(serv->total_proc - serv->total_proc_avg) / NSAMPLE;
if (msg_verbose)
msg_info("%s total/avg %d/%.1f",
serv->name, serv->total_proc, serv->total_proc_avg);
if (serv->max_proc_pk < serv->max_proc_avg)
msg_panic("%s: process limit botch: %d < %d",
serv->name, serv->max_proc_pk, serv->max_proc_avg);
if (serv->total_proc_avg >= serv->max_proc_avg)
serv->max_proc = serv->max_proc_avg;
else
serv->max_proc = serv->max_proc_pk
- serv->total_proc_avg * (serv->max_proc_pk - serv->max_proc_avg) / (double) serv->max_proc_avg;
}
event_request_timer(master_sample_action, (char *) 0, TSAMPLE);
}
/* master_sample_start - start sampling */
void master_sample_start(void)
{
MASTER_SERV *serv;
for (serv = master_head; serv != 0; serv = serv->next)
serv->total_proc_avg = 0;
event_request_timer(master_sample_action, (char *) 0, TSAMPLE);
}
/* master_sample_stop - stop sampling */
void master_sample_stop(void)
{
event_cancel_timer(master_sample_action, (char *) 0);
}

View File

@ -54,7 +54,6 @@ typedef struct SMTP_SESSION {
VSTREAM *stream; /* network connection */
char *host; /* mail exchanger */
char *addr; /* mail exchanger */
char *namaddr; /* mail exchanger */
int best; /* most preferred host */
} SMTP_SESSION;

View File

@ -143,11 +143,9 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRI
*/
if (ISDIGIT(host[0]) && (inaddr.s_addr = inet_addr(host)) != INADDR_NONE) {
memset((char *) &fixed, 0, sizeof(fixed));
rr = dns_rr_create(host, &fixed, pref,
(char *) &inaddr, sizeof(inaddr));
if (msg_verbose)
smtp_print_addr(host, rr);
return (dns_rr_append(addr_list, rr));
return (dns_rr_append(addr_list,
dns_rr_create(host, &fixed, pref,
(char *) &inaddr, sizeof(inaddr))));
}
/*
@ -165,12 +163,10 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRI
smtp_errno = SMTP_FAIL;
} else {
while (hp->h_addr_list[0]) {
rr = dns_rr_create(host, &fixed, pref,
hp->h_addr_list[0],
sizeof(inaddr));
if (msg_verbose)
smtp_print_addr(host, rr);
addr_list = dns_rr_append(addr_list, rr);
addr_list = dns_rr_append(addr_list,
dns_rr_create(host, &fixed, pref,
hp->h_addr_list[0],
sizeof(inaddr)));
hp->h_addr_list++;
}
}
@ -184,8 +180,6 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRI
case DNS_OK:
for (rr = addr; rr; rr = rr->next)
rr->pref = pref;
if (msg_verbose)
smtp_print_addr(host, addr_list);
addr_list = dns_rr_append(addr_list, addr);
break;
default:

View File

@ -142,7 +142,7 @@ void smtp_chat_cmd(SMTP_STATE *state, char *fmt,...)
* program is trying to do.
*/
if (msg_verbose)
msg_info("> %s: %s", session->namaddr, STR(state->buffer));
msg_info("> %s: %s", session->host, STR(state->buffer));
/*
* Send the command to the SMTP server.
@ -177,9 +177,9 @@ SMTP_RESP *smtp_chat_resp(SMTP_STATE *state)
cp = printable(STR(state->buffer), '?');
if (last_char != '\n')
msg_warn("%s: response longer than %d: %.30s...",
session->namaddr, var_line_limit, cp);
session->host, var_line_limit, cp);
if (msg_verbose)
msg_info("< %s: %s", session->namaddr, cp);
msg_info("< %s: %s", session->host, cp);
while (ISDIGIT(*cp))
cp++;
rdata.code = (cp - STR(state->buffer) == 3 ?
@ -256,9 +256,9 @@ void smtp_chat_notify(SMTP_STATE *state)
mail_addr_mail_daemon());
post_mail_fprintf(notice, "To: %s (Postmaster)", var_error_rcpt);
post_mail_fprintf(notice, "Subject: %s SMTP client: errors from %s",
var_mail_name, session->namaddr);
var_mail_name, session->host);
post_mail_fputs(notice, "");
post_mail_fprintf(notice, "Unexpected response from %s.", session->namaddr);
post_mail_fprintf(notice, "Unexpected response from %s.", session->host);
post_mail_fputs(notice, "");
post_mail_fputs(notice, "Transcript of session follows.");
post_mail_fputs(notice, "");

View File

@ -256,7 +256,6 @@ SMTP_SESSION *smtp_connect_host(char *host, unsigned port, VSTRING *why)
SMTP_SESSION *smtp_connect_domain(char *name, unsigned port, VSTRING *why)
{
struct in_addr inaddr;
SMTP_SESSION *session = 0;
DNS_RR *addr_list;
DNS_RR *addr;
@ -275,11 +274,6 @@ SMTP_SESSION *smtp_connect_domain(char *name, unsigned port, VSTRING *why)
session->best = (addr->pref == addr_list->pref);
break;
}
if (addr->next) {
memcpy((char *) &inaddr, addr->data, sizeof(inaddr));
msg_info("%s: connect to %s port %d: %s",
name, inet_ntoa(inaddr), port, vstring_str(why));
}
}
dns_rr_free(addr_list);
return (session);

View File

@ -166,7 +166,7 @@ int smtp_helo(SMTP_STATE *state)
if (((resp = smtp_chat_resp(state))->code / 100) != 2)
return (smtp_site_fail(state, resp->code,
"host %s refused to talk to me: %s",
session->namaddr, translit(resp->str, "\n", " ")));
session->host, translit(resp->str, "\n", " ")));
/*
* See if we are talking to ourself. This should not be possible with the
@ -179,7 +179,7 @@ int smtp_helo(SMTP_STATE *state)
for (n = 0; (word = mystrtok(&words, " \t\n")) != 0; n++) {
if (n == 0 && strcasecmp(word, var_myhostname) == 0) {
msg_warn("host %s greeted me with my own hostname %s",
session->namaddr, var_myhostname);
session->host, var_myhostname);
return (smtp_site_fail(state, session->best ? 550 : 450,
"mail for %s loops back to myself",
request->nexthop));
@ -201,7 +201,7 @@ int smtp_helo(SMTP_STATE *state)
if ((resp = smtp_chat_resp(state))->code / 100 != 2)
return (smtp_site_fail(state, resp->code,
"host %s refused to talk to me: %s",
session->namaddr,
session->host,
translit(resp->str, "\n", " ")));
}
@ -441,7 +441,7 @@ int smtp_xfer(SMTP_STATE *state)
case SMTP_STATE_MAIL:
if (resp->code / 100 != 2) {
smtp_mesg_fail(state, resp->code,
"host %s said: %s", session->namaddr,
"host %s said: %s", session->host,
translit(resp->str, "\n", " "));
mail_from_rejected = 1;
}
@ -461,7 +461,7 @@ int smtp_xfer(SMTP_STATE *state)
} else {
rcpt = request->rcpt_list.info + recv_rcpt;
smtp_rcpt_fail(state, resp->code, rcpt,
"host %s said: %s", session->namaddr,
"host %s said: %s", session->host,
translit(resp->str, "\n", " "));
rcpt->offset = 0; /* in case deferred */
}
@ -479,7 +479,7 @@ int smtp_xfer(SMTP_STATE *state)
if (resp->code / 100 != 3) {
if (nrcpt > 0)
smtp_mesg_fail(state, resp->code,
"host %s said: %s", session->namaddr,
"host %s said: %s", session->host,
translit(resp->str, "\n", " "));
nrcpt = -1;
}
@ -500,15 +500,14 @@ int smtp_xfer(SMTP_STATE *state)
if (resp->code / 100 != 2) {
smtp_mesg_fail(state, resp->code,
"host %s said: %s",
session->namaddr,
session->host,
translit(resp->str, "\n", " "));
} else {
for (nrcpt = 0; nrcpt < recv_rcpt; nrcpt++) {
rcpt = request->rcpt_list.info + nrcpt;
if (rcpt->offset) {
sent(request->queue_id, rcpt->address,
session->namaddr,
request->arrival_time, "%s",
session->host, request->arrival_time, "%s",
resp->str);
deliver_completed(state->src, rcpt->offset);
rcpt->offset = 0;
@ -605,9 +604,6 @@ int smtp_xfer(SMTP_STATE *state)
msg_fatal("queue file read error");
if (rec_type != REC_TYPE_XTRA)
RETURN(mark_corrupt(state->src));
#if 0
vstream_fflush(session->stream);
#endif
}
/*

View File

@ -40,7 +40,6 @@
#include <mymalloc.h>
#include <vstream.h>
#include <stringops.h>
/* Application-specific. */
@ -56,7 +55,6 @@ SMTP_SESSION *smtp_session_alloc(VSTREAM *stream, char *host, char *addr)
session->stream = stream;
session->host = mystrdup(host);
session->addr = mystrdup(addr);
session->namaddr = concatenate(host, "[", addr, "]", (char *) 0);
session->best = 1;
return (session);
}
@ -68,7 +66,6 @@ void smtp_session_free(SMTP_SESSION *session)
vstream_fclose(session->stream);
myfree(session->host);
myfree(session->addr);
myfree(session->namaddr);
myfree((char *) session);
}

View File

@ -168,7 +168,7 @@ int smtp_site_fail(SMTP_STATE *state, int code, char *format,...)
continue;
status = (soft_error ? defer_append : bounce_append)
(KEEP, request->queue_id, rcpt->address,
session ? session->namaddr : "none",
session ? session->host : "none",
request->arrival_time, "%s", vstring_str(why));
if (status == 0) {
deliver_completed(state->src, rcpt->offset);
@ -215,7 +215,7 @@ int smtp_mesg_fail(SMTP_STATE *state, int code, char *format,...)
continue;
status = (SMTP_SOFT(code) ? defer_append : bounce_append)
(KEEP, request->queue_id, rcpt->address,
session->namaddr, request->arrival_time,
session->host, request->arrival_time,
"%s", vstring_str(why));
if (status == 0) {
deliver_completed(state->src, rcpt->offset);
@ -248,7 +248,7 @@ void smtp_rcpt_fail(SMTP_STATE *state, int code, RECIPIENT *rcpt,
*/
va_start(ap, format);
status = (SMTP_SOFT(code) ? vdefer_append : vbounce_append)
(KEEP, request->queue_id, rcpt->address, session->namaddr,
(KEEP, request->queue_id, rcpt->address, session->host,
request->arrival_time, format, ap);
va_end(ap);
if (status == 0) {
@ -277,11 +277,11 @@ int smtp_stream_except(SMTP_STATE *state, int code, char *description)
msg_panic("smtp_stream_except: unknown exception %d", code);
case SMTP_ERR_EOF:
vstring_sprintf(why, "lost connection with %s while %s",
session->namaddr, description);
session->host, description);
break;
case SMTP_ERR_TIME:
vstring_sprintf(why, "conversation with %s timed out while %s",
session->namaddr, description);
session->host, description);
break;
}
@ -294,7 +294,7 @@ int smtp_stream_except(SMTP_STATE *state, int code, char *description)
if (rcpt->offset == 0)
continue;
state->status |= defer_append(KEEP, request->queue_id,
rcpt->address, session->namaddr,
rcpt->address, session->host,
request->arrival_time,
"%s", vstring_str(why));
}