Index: man/man5/smail.an Prereq: 1.37 *** orig/man/man5/smail.an Sun Sep 20 23:58:50 1992 --- test/man/man5/smail.an Tue Jun 1 16:46:14 1993 *************** *** 348,353 **** --- 348,360 ---- likely by set to \fBsendmail\fP or \fBsmail\fP, depending upon the program that typically is invoked for receiving mail. .TP .8i + .B tap_ident_sender + The identification code of the user that sent the mail over its + last hop as determined by the TAP protocol. This will generally + only be set for mail received by SMTP. It is most useful for putting + into the \fBReceived:\fP header. Only available if \fBHAVE_TAP\fP + was defined when building. + .TP .8i .B uucp_name the UUCP-network name for the local host. .TP .8i *************** *** 1131,1136 **** --- 1138,1149 ---- attribute for more information. .DD spool_mode number 0440 This defines the file creation mode for spool files. + .DD tap_query_timeout number -1 + This defines the timeout for TAP identity queries on + incoming SMTP connections. Values of zero or less + mean that no tap query is made (so queries are initially + disabled). This is only available if TAP support is + compiled into your copy of smail. .DD transport_file string "``transports''" names the file containing the transport configuration information. If this does not begin with ``/'', it will be referenced Index: man/man8/smail.an Prereq: 1.8 *** orig/man/man8/smail.an Sun Aug 2 11:27:21 1992 --- test/man/man8/smail.an Tue Jun 1 16:46:15 1993 *************** *** 534,539 **** --- 534,546 ---- Specify the protocol that was used by the sending host to deliver the mail message. This value can be included in expansion strings through the variable \fB$sender_proto\fP. + .TP + \fB\-oMu\fP \fItap_ident_sender\fP + Specify the user that intitiated the message transfer on the previous + host to get to this host. This value is set by the SMTP receiver when + a message is received from a host supporting the \fBTAP\fP protocol. + This value can be included in expansion strings through + the variable \fB$tap_ident_sender\fP. .SH NORMAL USAGE Under normal usage, one smail daemon exists which receives requests from Index: src/config.c Prereq: 1.15 *** orig/src/config.c Wed Sep 16 17:10:21 1992 --- test/src/config.c Wed Jun 2 12:43:05 1993 *************** *** 103,105 **** --- 103,106 ---- int tzoffset = 0; /* glotznet host timezone offset */ int tznodst = 0; /* glotznet does not have DST */ #endif /* GLOTZNET */ + int tap_query_timeout = -1; /* Timeout on TAP queries - initially disabled */ Index: src/expand.c Prereq: 1.10 *** orig/src/expand.c Sun Sep 20 20:54:50 1992 --- test/src/expand.c Wed Jun 2 12:43:03 1993 *************** *** 1104,1109 **** --- 1104,1112 ---- if (MATCH("sender_proto")) { return sender_proto; } + if (MATCH("tap_ident_sender")) { + return tap_ident_sender; + } if (MATCH("program")) { return program; } Index: src/extern.h Prereq: 1.34 *** orig/src/extern.h Mon Sep 21 02:44:04 1992 --- test/src/extern.h Wed Jun 2 12:43:00 1993 *************** *** 97,102 **** --- 97,103 ---- extern int tzoffset; /* timezone offset for glotznet host */ extern int tznodst; /* true if no DST for glotznet host */ #endif /* GLOTZNET */ + extern int tap_query_timeout; /* Timeout on TAP queries */ /* external variables defined in default.c */ extern struct director *directors; /* configured directors */ *************** *** 219,224 **** --- 220,228 ---- /* external variables defined in route.c */ extern int cached_routers; /* TRUE if cache_routers() called */ + + /* external variables defined in smtprecv.c */ + extern char * tap_ident_sender; /* The calculated identity of the sender */ /* Index: src/main.c Prereq: 1.24 *** orig/src/main.c Sun Sep 20 20:54:55 1992 --- test/src/main.c Wed Jun 2 12:42:57 1993 *************** *** 1085,1090 **** --- 1085,1098 ---- sender_proto = arg; break; + case 'u': + if (*arg == '\0') { + arg = *args++; + panic_if_null(arg, "oMu"); + } + tap_ident_sender = arg; + break; + case 'P': if (*arg == '\0') { arg = *args++; Index: src/queue.c Prereq: 1.22 *** orig/src/queue.c Sun Sep 20 20:55:05 1992 --- test/src/queue.c Wed Jun 2 12:42:54 1993 *************** *** 283,288 **** --- 283,299 ---- } /* + * write the ident of the sending person if known + */ + if (tap_ident_sender) { + if (put_line("-oMu") == FAIL || + put_line(tap_ident_sender) == FAIL) + { + return FAIL; + } + } + + /* * write out the invoked program, too */ if (put_line("-oMP") == FAIL || *************** *** 1157,1163 **** *p = '\0'; } ! write_log(LOG_SYS, "received%s%s%s%s%s%s%s%s%s%s%s%ld%s", "\n|\t from: ", sender, host_string? "\n|\t host: ": "", host_string? host_string: "", --- 1168,1174 ---- *p = '\0'; } ! write_log(LOG_SYS, "received%s%s%s%s%s%s%s%s%s%s%s%ld%s%s%s", "\n|\t from: ", sender, host_string? "\n|\t host: ": "", host_string? host_string: "", *************** *** 1166,1172 **** "\n|\t program: ", program, trim_old_id? "\n|\t orig-id: ": "", trim_old_id? trim_old_id: "", ! "\n|\t size: ", msg_size, " bytes"); if (host_string) { xfree(host_string); --- 1177,1185 ---- "\n|\t program: ", program, trim_old_id? "\n|\t orig-id: ": "", trim_old_id? trim_old_id: "", ! "\n|\t size: ", msg_size, " bytes", ! tap_ident_sender? ! "\n|\t tap_id: ": "", tap_ident_sender? tap_ident_sender: ""); if (host_string) { xfree(host_string); Index: src/smailconf.c Prereq: 1.15 *** orig/src/smailconf.c Wed Sep 16 17:10:37 1992 --- test/src/smailconf.c Wed Jun 2 12:42:51 1993 *************** *** 135,140 **** --- 135,141 ---- { "spool_mode", t_int, NULL, (tup *)&spool_mode, 0 }, { "switch_percent_and_bang", t_boolean, NULL, (tup *)&switch_percent_and_bang, 0 }, + { "tap_query_timeout", t_int, NULL, (tup *)&tap_query_timeout, 0 }, { "transport_file", t_string, NULL, (tup *)&transport_file, 0 }, { "trusted", t_string, NULL, (tup *)&trusted, 0 }, { "trusted_users", t_string, NULL, (tup *)&trusted, 0 }, Index: src/smtprecv.c Prereq: 1.16 *** orig/src/smtprecv.c Sun Sep 6 09:33:49 1992 --- test/src/smtprecv.c Wed Jun 2 12:42:47 1993 *************** *** 28,36 **** --- 28,47 ---- # include "exitcodes.h" #endif + #ifdef HAVE_TAP + /* Include the declarations for TAP lookups */ + #include + #endif /* HAVE_TAP */ + /* library functions */ extern long time(); + /* Declare the TAP variables - even if HAVE_TAP is not defined, so that configs + * can be kept consistant + */ + char * tap_ident_sender = NULL; /* The calculated identity of the sender */ + + /* types local to this file */ enum e_smtp_commands { HELO_CMD, /* HELO domain */ *************** *** 159,164 **** --- 170,200 ---- putc('\n', out); fflush(out); } + + #ifdef HAVE_TAP + /* + * This code does a TAP/Ident/RFC1413 lookup on the connecting user (if possible) + * Its here because this may cause a delay and it seems better to have the + * delay once the connection is established rather than at the start + */ + if (tap_query_timeout > 0) { /* switch off TAP by setting timeout <= 0 */ + unsigned long inlocal; + unsigned long inremote; + unsigned short local; + unsigned short remote; + + if (auth_fd2(fileno(in), &inlocal, &inremote, &local, &remote) == EOF) { + /* + * You may want some error reporting here - however that + * may not be appropriate + */ + tap_ident_sender = NULL; /* Make sure ident is not set */ + } else { + tap_ident_sender = auth_tcpuser3(inlocal, inremote, local, + remote, tap_query_timeout); + } + } + #endif /* HAVE_TAP */ while (! term_signal || out == NULL) { if (out) {