From jos@catnook.com  Fri Apr 19 20:21:35 2002
Return-Path: <jos@catnook.com>
Received: from w250.z064001178.sjc-ca.dsl.cnc.net (w250.z064001178.sjc-ca.dsl.cnc.net [64.1.178.250])
	by hub.freebsd.org (Postfix) with SMTP id D8B0F37B405
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 19 Apr 2002 20:21:34 -0700 (PDT)
Received: (qmail 17209 invoked by uid 1000); 20 Apr 2002 03:21:55 -0000
Message-Id: <20020420032155.17208.qmail@lizzy.catnook.com>
Date: 20 Apr 2002 03:21:55 -0000
From: Jos Backus <jos@catnook.com>
Reply-To: Jos Backus <jos@catnook.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: send-pr does not add domain to the username
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         37267
>Category:       gnu
>Synopsis:       send-pr does not add domain to the username
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 19 20:30:01 PDT 2002
>Closed-Date:    Sat Apr 20 12:32:29 PDT 2002
>Last-Modified:  Sat Apr 20 12:32:29 PDT 2002
>Originator:     Jos Backus
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
CatNook
>Environment:
System: FreeBSD lizzy.catnook.com 5.0-CURRENT FreeBSD 5.0-CURRENT #18: Mon Apr 15 23:20:45 PDT 2002 jos@lizzy.catnook.com:/disk0/usr/obj/disk0/usr/src/sys/LIZZY i386


>Description:
	
	send-pr does not attempt to determine the domain of the system when
	creating the From: and Reply-To: form fields, forcing the user to add
	the domain manually.

>How-To-Repeat:
	
	Run send-pr and observe that the e-mail address in the  From: and
	Reply-To: does not have a domain appended.
>Fix:

	The patch below adds the first domain found in /etc/resolv.conf, when
	present.

--- send-pr.sh.orig	Fri Apr 19 20:16:12 2002
+++ send-pr.sh	Fri Apr 19 20:16:59 2002
@@ -99,8 +99,9 @@
   rm -f $PTEMP
 fi
 
-FROM="$ORIGINATOR <$LOGNAME>"
-REPLY_TO="$ORIGINATOR <${REPLY_TO:-${REPLYTO:-$LOGNAME}}>"
+DOMAIN=`test -r /etc/resolv.conf && awk '$1 ~ /(search|domain)/ {print "@"$2; exit}' /etc/resolv.conf`
+FROM="$ORIGINATOR <$LOGNAME$DOMAIN>"
+REPLY_TO="$ORIGINATOR <${REPLY_TO:-${REPLYTO:-$LOGNAME$DOMAIN}}>"
 
 if [ -n "$ORGANIZATION" ]; then
   if [ -f "$ORGANIZATION" ]; then
>Release-Note:
>Audit-Trail:

From: Garrett Wollman <wollman@lcs.mit.edu>
To: Jos Backus <jos@catnook.com>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: gnu/37267: send-pr does not add domain to the username
Date: Fri, 19 Apr 2002 23:33:09 -0400 (EDT)

 <<On 20 Apr 2002 03:21:55 -0000, Jos Backus <jos@catnook.com> said:
 
 > 	send-pr does not attempt to determine the domain of the system when
 > 	creating the From: and Reply-To: form fields, forcing the user to add
 > 	the domain manually.
 
 It's the job of the MUA/MSA to do that.
 
 -GAWollman
 

From: Jos Backus <jos@catnook.com>
To: Garrett Wollman <wollman@lcs.mit.edu>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: gnu/37267: send-pr does not add domain to the username
Date: Fri, 19 Apr 2002 20:41:11 -0700

 On Fri, Apr 19, 2002 at 11:33:09PM -0400, Garrett Wollman wrote:
 > It's the job of the MUA/MSA to do that.
 
 You mean by rewriting those fields? I guess that makes sense.
 
 Jos

From: Giorgos Keramidas <keramida@FreeBSD.ORG>
To: Jos Backus <jos@catnook.com>
Cc: bug-followup@FreeBSD.ORG
Subject: Re: gnu/37267: send-pr does not add domain to the username
Date: Sat, 20 Apr 2002 17:12:45 +0300

 On 2002-04-20 03:21, Jos Backus wrote:
 > 	Run send-pr and observe that the e-mail address in the  From:
 > 	and Reply-To: does not have a domain appended.
 
 One might argue that this is easy to fix in the MTA.
 
 > +DOMAIN=`test -r /etc/resolv.conf && awk '$1 ~ /(search|domain)/ {print "@"$2; exit}' /etc/resolv.conf`
 
 Hmm, so what about places where the first domain is not the correct
 domain?  You could always add `hostname` there, since that's where the
 message comes from, and most domains have their MTA set up to
 correctly recognize and masquerade this :-)
 
 Just an idea,
 
 - Giorgos

From: Jos Backus <jos@catnook.com>
To: Giorgos Keramidas <keramida@FreeBSD.ORG>
Cc: bug-followup@FreeBSD.ORG
Subject: Re: gnu/37267: send-pr does not add domain to the username
Date: Sat, 20 Apr 2002 08:33:45 -0701

 On Sat, Apr 20, 2002 at 05:12:45PM +0300, Giorgos Keramidas wrote:
 > One might argue that this is easy to fix in the MTA.
  
 Indeed, that's what I did.
 
 > Hmm, so what about places where the first domain is not the correct
 > domain?  You could always add `hostname` there, since that's where the
 > message comes from, and most domains have their MTA set up to
 > correctly recognize and masquerade this :-)
 > 
 > Just an idea,
 
 You are right, I wasn't thinking this through properly. Thanks, and please
 close the PR.
 
 Jos
State-Changed-From-To: open->closed 
State-Changed-By: keramida 
State-Changed-When: Sat Apr 20 12:30:26 PDT 2002 
State-Changed-Why:  
Submitter says this is not a problem since the local MTA can be used 
to properly expand/masquerade the <username> address in From: headers. 

Nevertheless, thank you for submitting this, Jos :) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37267 
>Unformatted:
