From: Ken Hornstein Date: Thu, 15 Mar 2012 19:54:02 +0000 (-0400) Subject: Remove all masquerade support (draft_from is now the default, and the other X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=ccd3685b42cb198b11d2d4daabb58849d239df40;p=mmh Remove all masquerade support (draft_from is now the default, and the other two can be accomplished via the components file). --- diff --git a/INSTALL b/INSTALL index 1da728e..e946242 100644 --- a/INSTALL +++ b/INSTALL @@ -96,9 +96,7 @@ need an ANSI C compiler such as gcc. rather than hardcoding pophost in `mts.conf'. Check the `mh-tailor' man page for a list of all the available options - for this file ("masquerade" may be of particular interest, though its - default value allows the most flexibility. See the discussion of the - --enable-masquerade configure option below). + for this file. 7) Edit the file `mhn.defaults' (installed in the nmh `etc' directory). This file contains the default profile entries for the nmh command @@ -196,19 +194,6 @@ Options for configure --enable-debug Enable debugging support. ---enable-masquerade[='draft_from mmailid username_extension'] - By default, all three masquerade options are enabled. - - If this option is disabled, the mts.conf file will contain the - line "masquerade: " (with no value), which may be manually edited - later. You may find it convenient to specify a value at - configure-time, however, so that each time nmh is reinstalled, - the right value will be there. - - See the mh-tailor(5) man page for full documentation of "masquerade:". - - This option will likely be removed in a future version of nmh. - --enable-pop Enable client-side support for pop. diff --git a/Makefile.am b/Makefile.am index 8abe7ed..eea18db 100644 --- a/Makefile.am +++ b/Makefile.am @@ -387,7 +387,6 @@ etc/mts.conf: $(srcdir)/etc/mts.conf.in Makefile $(SED) -e 's,%mts%,$(MTS),' \ -e 's,%mailspool%,$(mailspool),' \ -e 's,%etcdir%,$(sysconfdir),' \ - -e 's,%masquerade%,$(masquerade),' \ -e 's,%smtpservers%,$(smtpservers),' \ < $(srcdir)/etc/mts.conf.in > $@ diff --git a/configure.ac b/configure.ac index aeed66c..fd9b98e 100644 --- a/configure.ac +++ b/configure.ac @@ -30,16 +30,6 @@ AC_ARG_ENABLE([debug], dnl The old redundant --enable-nmh-debug is deprecated and undocumented. AS_IF([test x"$enable_nmh_debug" = x"yes"], [enable_debug=yes]) -dnl Allow users to send email from addresses other than their default? -AC_ARG_ENABLE(masquerade, - AS_HELP_STRING([--enable-masquerade='draft_from mmailid username_extension'], - [enable up to 3 types of address masquerading]), - [AS_IF([test x"$enable_masquerade" = x"yes"], - [masquerade="draft_from mmailid username_extension"], - [masquerade="$enable_masquerade"])], - [masquerade="draft_from mmailid username_extension"]) -AC_SUBST(masquerade)dnl - dnl Do you want to disable use of locale functions AH_TEMPLATE([LOCALE], [Undefine if you don't want locale features. By default this is defined.]) @@ -758,7 +748,6 @@ file locking type : ${LOCKTYPE} default smtp servers : ${smtpservers} default editor : ${editorpath} default pager : ${pagerpath} -email address masquerading : ${masquerade} SASL support : ${sasl_support} TLS support : ${tls_support} ])])dnl diff --git a/etc/mts.conf.in b/etc/mts.conf.in index c3c946d..1ba5f8f 100644 --- a/etc/mts.conf.in +++ b/etc/mts.conf.in @@ -19,10 +19,6 @@ hostable: %etcdir%/hosts # query the system for this value (gethostname, etc...). #localname: foo.bar.com -# The following directive allows email address masquerading. The string -# "draft_from mmailid username_extension" will allow all three types. -masquerade: %masquerade% - # Default location of mail drops. If this option is # set, but empty, the user's home directory is used. mmdfldir: %mailspool% diff --git a/man/mh-tailor.man b/man/mh-tailor.man index a8d400a..3963e4b 100644 --- a/man/mh-tailor.man +++ b/man/mh-tailor.man @@ -164,79 +164,6 @@ The beginning-of-message delimiter for maildrops. The end-of-message delimiter for maildrops. .RE .PP -.BR masquerade: -.RS 5 -This directive controls three different types of email address masquerading. -The three possible values, which may be specified in any combination on the -line, separated by spaces, are \*(lqdraft_from\*(rq, \*(lqmmailid\*(rq, and -\*(lqusername_extension\*(rq. -.PP -\*(lqmmailid\*(rq was the only type of masquerading in the original MH package, and -apparently stands for \*(lqmasquerade mail identification\*(rq. This type of -masquerading keys off of the GECOS field of the passwd file. When enabled, -.B nmh -will check if the user's pw_gecos field in the passwd file is of the -form: -.PP -.RS 5 -Full Name -.RE -.PP -If it is, the internal -.B nmh -routines that find the username and full name -of that user will return \*(lqfakeusername\*(rq and \*(lqFull Name\*(rq respectively. This is -useful if you want the messages you send to always appear to come from the name -of an MTA alias rather than your actual account name. For instance, many -organizations set up \*(lqFirst.Last\*(rq sendmail aliases for all users. If this is -the case, the GECOS field for each user should look like: -.PP -.RS 5 -First [Middle] Last -.RE -.PP -\*(lqusername_extension\*(rq, when specified on the \*(lqmasquerade:\*(rq line, allows a second -type of username masquerading. If the user sets the -.B $USERNAME_EXTENSION -environment variable, its value will be appended to the actual login name. For -instance, if I am \*(lqdan@example.com\*(rq, and I set -.B $USERNAME_EXTENSION -to \*(lq\-www\*(rq, my mail will appear to come from \*(lqdan\-www@example.com\*(rq. This is meant -to interact with qmail's \*(lquser\-extension\*(rq feature, where mail sent to -.IR user \- string -will be delivered to -.IR user . -Likewise, those using -versions of sendmail for which \*(lqplussed user\*(rq processing is active can set -.B $USERNAME_EXTENSION -to \*(lq+\fIstring\fR\*(rq. These MTA features are useful -because they allow one to use different email addresses in different situations -(to aid in automatic mail filtering or in determining where spammers got one's -address) while only actually having a single account. Note that -.B $USERNAME_EXTENSION -is only appended to the username when \fIpost\fR is -generating \*(lq[Resent\-]From:\*(rq lines and the SMTP envelope -\*(lqFrom:\*(rq. -.BR inc , -for instance, will not try to read from a maildrop file called \*(lqdan\-www\*(rq (to -recall the earlier example). -.PP -\*(lqdraft_from\*(rq controls the most powerful type of address masquerading. Normally, -when a user explicitly specifies a \*(lqFrom:\*(rq header in a draft, -.B nmh -uses it -rather than constructing its own. However, to discourage email forgery, the -SMTP envelope \*(lqFrom:\*(rq and a \*(lqSender:\*(rq header are set to the user's real address. -When \*(lqdraft_from\*(rq is turned on, though, the envelope \*(lqFrom:\*(rq will use the -address specified in the draft, and there will be no \*(lqSender:\*(rq header. This is -useful when a user wants to pretend to be sending mail \*(lqdirectly\*(rq from a remote -POP3 account, or when remote mail robots incorrectly use the envelope \*(lqFrom:\*(rq in -preference to the body \*(lqFrom:\*(rq (or refuse to take action when the two don't -match). Note that the MTA may still reveal the user's real identity (e.g. -.BR sendmail 's -\*(lqX\-Authentication\-Warning:\*(rq header). -.RE -.PP .BR maildelivery : %libdir%/maildelivery .RS 5 diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c index 9edb139..fc026fb 100644 --- a/sbr/addrsbr.c +++ b/sbr/addrsbr.c @@ -77,9 +77,6 @@ static char err[BUFSIZ]; static char adr[BUFSIZ]; -extern boolean username_extension_masquerading; /* defined in mts.c */ - - char * getname (char *addrs) { @@ -291,47 +288,11 @@ auxformat (struct mailname *mp, int extras) char * getlocaladdr(void) { - int snprintf_return; - char *username, *domain; - static char addr[BUFSIZ]; + char *username; username = getusername(); - if (username_extension_masquerading) { - /* mts.conf contains "masquerade:[...]username_extension[...]", so tack - on the value of the $USERNAME_EXTENSION environment variable, if set, - to username. */ - char* extension = getenv("USERNAME_EXTENSION"); - static char username_with_extension[BUFSIZ]; - - if (extension != NULL && *extension != '\0') { - snprintf_return = snprintf(username_with_extension, - sizeof(username_with_extension), - "%s%s", username, extension); - - if (snprintf_return < 0 || - snprintf_return >= (int) sizeof(username_with_extension)) - adios(NULL, "snprintf() error writing username (%d chars) and" - " $USERNAME_EXTENSION (%d chars) to array of BUFSIZ (%d)" - " chars", - strlen(username), strlen(extension), BUFSIZ); - - username = username_with_extension; - } - } - return username; - - domain = LocalName(0); - - snprintf_return = snprintf (addr, sizeof(addr), "%s@%s", username, domain); - - if (snprintf_return < 0 || snprintf_return >= (int) sizeof(addr)) - adios(NULL, "snprintf() error writing username (%d chars), domain (%d" - " chars), and 1 separator char to array of BUFSIZ (%d) chars", - strlen(username), strlen(domain), BUFSIZ); - - return addr; } diff --git a/sbr/mts.c b/sbr/mts.c index ba7ff07..c529156 100644 --- a/sbr/mts.c +++ b/sbr/mts.c @@ -59,12 +59,6 @@ static char username[BUFSIZ]; static char fullname[BUFSIZ]; static char localmbox[BUFSIZ]; -/* Variables for username masquerading: */ - boolean draft_from_masquerading = FALSE; /* also used from post.c */ -static boolean mmailid_masquerading = FALSE; - boolean username_extension_masquerading = FALSE; /* " from addrsbr.c */ -static char* masquerade = ""; - /* * MTS specific variables */ @@ -113,7 +107,6 @@ static struct bind binds[] = { { "uucplfil", &uucplfil }, { "mmdelim1", &mmdlm1 }, { "mmdelim2", &mmdlm2 }, - { "masquerade", &masquerade }, { "mts", &sm_method }, { "hostable", &hostable }, { "sendmail", &sendmail }, @@ -156,15 +149,6 @@ mts_init (char *name) Everyone = atoi (everyone); - if (strstr(masquerade, "draft_from") != NULL) - draft_from_masquerading = TRUE; - - if (strstr(masquerade, "mmailid") != NULL) - mmailid_masquerading = TRUE; - - if (strstr(masquerade, "username_extension") != NULL) - username_extension_masquerading = TRUE; - if (strcmp(sm_method, "smtp") == 0) sm_mts = MTS_SMTP; else if (strcmp(sm_method, "sendmail") == 0) @@ -374,8 +358,6 @@ getlocalmbox (void) /* * Find the user's username and full name, and cache them. - * Also, handle "mmailid" username masquerading controlled from the GECOS field - * of the passwd file. */ static void @@ -398,39 +380,12 @@ getuserinfo (void) /* Get the user's real name from the GECOS field. Stop once we hit a ',', which some OSes use to separate other 'finger' information in the GECOS - field, like phone number. Also, if mmailid masquerading is turned on due - to "mmailid" appearing on the "masquerade:" line of mts.conf, stop if we - hit a '<' (which should precede any ','s). */ - if (mmailid_masquerading) - /* Stop at ',' or '<'. */ - for (cp = fullname; *np != '\0' && *np != ',' && *np != '<'; - *cp++ = *np++) - continue; - else - /* Allow '<' as a legal character of the user's name. This code is - basically a duplicate of the code above the "else" -- we don't - collapse it down to one copy and put the mmailid_masquerading check - inside the loop with "(x ? y : z)" because that's inefficient and the - value'll never change while it's in there. */ - for (cp = fullname; *np != '\0' && *np != ','; - *cp++ = *np++) - continue; + field, like phone number. */ + for (cp = fullname; *np != '\0' && *np != ','; *cp++ = *np++) + continue; *cp = '\0'; - if (mmailid_masquerading) { - /* Do mmailid processing. The GECOS field should have the form - "Full Name ". For instance, - "Dan Harkless ". Naturally, you'll want your MTA to - have an alias (e.g. in /etc/aliases) from "fakeusername" to your - account name. */ - if (*np) - np++; - for (cp = username; *np && *np != '>'; *cp++ = *np++) - continue; - *cp = '\0'; - } - if (!mmailid_masquerading || *np == '\0') - strncpy (username, pw->pw_name, sizeof(username)); + strncpy (username, pw->pw_name, sizeof(username)); /* The $SIGNATURE environment variable overrides the GECOS field's idea of your real name. If SIGNATURE isn't set, use the Signature profile diff --git a/uip/spost.c b/uip/spost.c index 7454c89..4133f86 100644 --- a/uip/spost.c +++ b/uip/spost.c @@ -172,8 +172,6 @@ extern char *sendmail; extern char *getfullname (void); extern char *getusername (void); -extern boolean draft_from_masquerading; /* defined in mts.c */ - /* * static prototypes */ @@ -565,16 +563,7 @@ finish_headers (FILE *out) if (!(msgflags & MDAT)) fprintf (out, "Date: %s\n", dtimenow (0)); - if (msgflags & MFRM) { - /* There was already a From: in the draft. Don't add one. */ - if (!draft_from_masquerading) - /* mts.conf didn't contain "masquerade:[...]draft_from[...]" - so we'll reveal the user's actual account@thismachine - address in a Sender: header (and use it as the envelope - From: later). */ - fprintf (out, "Sender: %s\n", from); - } - else + if (!(msgflags & MFRM)) fprintf (out, "From: %s\n", signature); #ifdef notdef @@ -586,16 +575,7 @@ finish_headers (FILE *out) case resent: if (!(msgflags & MRDT)) fprintf (out, "Resent-Date: %s\n", dtimenow(0)); - if (msgflags & MRFM) { - /* There was already a Resent-From: in draft. Don't add one. */ - if (!draft_from_masquerading) - /* mts.conf didn't contain "masquerade:[...]draft_from[...]" - so we'll reveal the user's actual account@thismachine - address in a Sender: header (and use it as the envelope - From: later). */ - fprintf (out, "Resent-Sender: %s\n", from); - } - else + if (!(msgflags & MRFM)) /* Construct a Resent-From: header. */ fprintf (out, "Resent-From: %s\n", signature); #ifdef notdef @@ -740,16 +720,7 @@ make_bcc_file (void) chmod (bccfil, 0600); fprintf (out, "Date: %s\n", dtimenow (0)); - if (msgflags & MFRM) { - /* There was already a From: in the draft. Don't add one. */ - if (!draft_from_masquerading) - /* mts.conf didn't contain "masquerade:[...]draft_from[...]" - so we'll reveal the user's actual account@thismachine - address in a Sender: header (and use it as the envelope - From: later). */ - fprintf (out, "Sender: %s\n", from); - } - else + if (!(msgflags & MFRM)) /* Construct a From: header. */ fprintf (out, "From: %s\n", signature); if (subject)