If you still rely on UUCP, use nmh, not mmh.
#define AD_NHST 0 /* getm(): do not lookup official name */
#define AD_NAME AD_NHST /* AD_HOST is TOO slow */
-#define UUCPHOST (-1)
#define LOCALHOST 0
#define NETHOST 1
#define BADHOST 2
** from the former mts.h
*/
char *LocalName(void); /* hostname */
-char *SystemName(void);
char *getusername(void);
char *getfullname(void);
the Message Transfer Agent envelope information, if possible.
Under
.BR sendmail ,
-the sender will obtained from the UUCP
-\*(lqFrom:\*(rq line, if present. The user may override these
+the sender will obtained from the mbox
+\*(lqFrom \*(rq line, if present. The user may override these
values with command line arguments, or arguments to the
.B \-addr
and
was run
the address was thought to be deliverable by the transport service.
For local addresses, this is absolute; for network addresses, it means
-that the host is known; for uucp addresses, it (often) means that the
-.B UUCP
-network is available for use.
+that the host is known.
** to their "official" represenations.
**
** To summarize, when we're all done, here's what MH knows about the address:
-** type: local, uucp, or network
+** type: local or network
** host: not locally defaulted, not explicitly expanded
** everything else
*/
struct mailname *
getm(char *str, char *dfhost, int dftype, int wanthost, char *eresult)
{
- char *pp;
struct mailname *mp;
if (err[0]) {
mp->m_mbox = getcpy(mbox);
mp->m_host = getcpy(host);
} else {
- if ((pp = strchr(mbox, '!'))) {
- *pp++ = '\0';
- mp->m_mbox = getcpy(pp);
- mp->m_host = getcpy(mbox);
- mp->m_type = UUCPHOST;
+ mp->m_nohost = 1;
+ mp->m_mbox = getcpy(mbox);
+ if (route == NULL && dftype == LOCALHOST) {
+ mp->m_host = NULL;
+ mp->m_type = dftype;
} else {
- mp->m_nohost = 1;
- mp->m_mbox = getcpy(mbox);
- if (route == NULL && dftype == LOCALHOST) {
- mp->m_host = NULL;
- mp->m_type = dftype;
- } else {
- mp->m_host = route ? NULL : getcpy(dfhost);
- mp->m_type = route ? NETHOST : dftype;
- }
+ mp->m_host = route ? NULL : getcpy(dfhost);
+ mp->m_type = route ? NETHOST : dftype;
}
goto got_host;
}
if (mp->m_nohost)
strncpy(addr, mp->m_mbox ? mp->m_mbox : "", sizeof(addr));
- else if (mp->m_type != UUCPHOST)
+ else
snprintf(addr, sizeof(addr), mp->m_host ? "%s%s@%s" : "%s%s",
empty(mp->m_path), empty(mp->m_mbox), mp->m_host);
- else
- snprintf(addr, sizeof(addr), "%s!%s", mp->m_host, mp->m_mbox);
if (mp->m_pers || mp->m_path) {
if (mp->m_note)
break;
goto local_test;
- case UUCPHOST:
- if (mh_strcasecmp(np->m_host, SystemName()))
- break; /* fall */
case LOCALHOST:
local_test: ;
if (!mh_strcasecmp(np->m_mbox, mq.m_mbox))
case LOCALHOST:
str = mn->m_mbox;
break;
- case UUCPHOST:
- snprintf(buffer, sizeof(buffer), "%s!%s",
- mn->m_host, mn->m_mbox);
- str = buffer;
- break;
default:
if (mn->m_mbox) {
- snprintf(buffer, sizeof(buffer), "%s@%s",
- mn->m_mbox, mn->m_host);
+ snprintf(buffer, sizeof(buffer), "%s@%s", mn->m_mbox, mn->m_host);
str= buffer;
} else
str = mn->m_text;
** Return the Return-Path and Delivery-Date
** header information.
**
-** Currently, I'm assuming that the "From " line
-** takes one of the following forms.
-**
-** From sender date remote from host (for UUCP delivery)
-** From sender@host date (for sendmail delivery)
+** Currently, I'm assuming that the "From " line takes the following form:
+** "From" sender@host date (sendmail delivery)
*/
-
int
get_returnpath(char *rp, int rplen, char *dd, int ddlen)
{
- char *ap, *bp, *cp, *dp;
+ char *ap, *bp;
ap = unixbuf;
- if (!(bp = cp = strchr(ap, ' ')))
+ if (!(bp = strchr(ap, ' ')))
return 0;
- /*
- ** Check for "remote from" in envelope to see
- ** if this message uses UUCP style addressing
- */
- while ((cp = strchr(++cp, 'r'))) {
- if (strncmp(cp, "remote from", 11) == 0) {
- cp = strrchr(cp, ' ');
- break;
- }
- }
-
- /*
- ** Get the Return-Path information from
- ** the "From " envelope.
- */
- if (cp) {
- /* return path for UUCP style addressing */
- dp = strchr(++cp, '\n');
- snprintf(rp, rplen, "%.*s!%.*s\n", (int)(dp - cp), cp, (int)(bp - ap), ap);
- } else {
- /* return path for standard domain addressing */
- snprintf(rp, rplen, "%.*s\n", (int)(bp - ap), ap);
- }
+ /* Get the Return-Path information from the "From " envelope. */
+ snprintf(rp, rplen, "%.*s\n", (int)(bp - ap), ap);
/*
** advance over the spaces to get to
/* Now get delivery date from envelope */
snprintf(dd, ddlen, "%.*s\n", 24, bp);
- unixbuf[0] = 0;
+ *unixbuf = '\0';
return 1;
}
/*
-** This is only for UUCP mail. It gets the hostname
-** as part of the UUCP "domain".
-*/
-char *
-SystemName(void)
-{
- static char buffer[BUFSIZ] = "";
-
-#ifdef HAVE_UNAME
- struct utsname name;
-#endif
-
- /* check if we have cached the system name */
- if (buffer[0])
- return buffer;
-
-#ifdef HAVE_UNAME
- uname(&name);
- strncpy(buffer, name.nodename, sizeof(buffer));
-#else
- gethostname(buffer, sizeof(buffer));
-#endif
-
- return buffer;
-}
-
-
-/*
** Get the username of current user
*/
char *
ad = (struct adr *) mh_xmalloc(sizeof(*ad));
ad->ad_text = getcpy(pp);
- ad->ad_local = strchr(pp, '@') == NULL && strchr(pp, '!') == NULL;
+ ad->ad_local = strchr(pp, '@') == NULL;
ad->ad_next = NULL;
if (ak->ak_addr)
ld->ad_next = ad;
if (first) {
first = 0;
if (strncmp(buffer, "From ", i)==0) {
- char *fp, *cp, *hp, *ep;
+ char *fp, *cp;
/*
** get copy of envelope information
** ("From " line)
** Now create a "Return-Path:" line
** from the "From " line.
*/
- hp = cp = strchr(fp = envelope + i, ' ');
- while ((hp = strchr(++hp, 'r'))) {
- if (uprf(hp, "remote from")) {
- hp = strrchr(hp, ' ');
- break;
- }
- }
- if (hp) {
- /*
- ** return path for UUCP style
- ** addressing
- */
- ep = strchr(++hp, '\n');
- snprintf(buffer, sizeof(buffer), "Return-Path: %.*s!%.*s\n", (int)(ep - hp), hp, (int)(cp - fp), fp);
- } else {
- /*
- ** return path for standard domain
- ** addressing
- */
- snprintf(buffer, sizeof(buffer), "Return-Path: %.*s\n", (int)(cp - fp), fp);
- }
+ cp = strchr(fp = envelope + i, ' ');
+ snprintf(buffer, sizeof(buffer),
+ "Return-Path: %.*s\n",
+ (int)(cp - fp), fp);
/* Add Return-Path header to message */
fputs(buffer, ffp);