Bug 114375

Summary: [patch] news/nn 6.7.3 From: header broken when posting via nntp
Product: Ports & Packages Reporter: G. Paul Ziemba <p-fbsd-bugs>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description G. Paul Ziemba 2007-07-07 09:20:03 UTC
The nn-6.7.3 port generates broken From: headers because of
patch-an to nntp.c. I'm not certain, but I think it's because
some ifdefs in earlier versions of the base code were removed
before 6.7.3 was released, and the patch was not updated to
take that into account.
 
Here's the result of patch-an as it stands today:
 
    static void
    gen_frompath(void)
    {
        struct passwd  *passwd;
        char           *domain;
        const char     *fromFormat = "From: <%s@%s>\r\n";
 
        passwd = getpwuid(getuid());
 
        fprintf(nntp_out, "From: ");
        fprintf(nntp_out, "%s ", full_name());
 
        domain = find_domain(DOMAIN_FILE);
        if (domain == NULL) {
            fprintf(nntp_out, fromFormat,
                    passwd->pw_name,
                    host_name);
        } else {
            fprintf(nntp_out, fromFormat,
                    passwd->pw_name,
                    domain);
        }
 
        [...]
 
    }
 
As you can see, this results in a From: line that looks like:
 
    From: Some User From: <someuser@example.com>
 
The find_domain() code (to obtain the domain name from a file)
seems to have been added as part of the FreeBSD port and is not
part of the base nn distribution. The use of "char *domain;" in
gen_frompath() obscures the global of the same name, which is
already set via set_domain().
 
set_domain() already has provisions for obtaining the local
domain name in various ways (local hostname, resolv.conf, etc.)
and respects HIDDENNET for those cases. (yes, I realize HIDDENNET
doesn't have a knob in the port Makefile, yet)

While I'm fixing the immediate problem (incorrect From: line format),
I'd like to modify the FreeBSD-specific implementation of find_domain()
and make it part of set_domain(), so that if a domain is not specified
in the domain file it can fall back to the assortment of mechanisms
in set_domain().

Proposed patch to the port's file/patch-an below.

Fix: Proposed patch (to patch-an 1.5) attached

Patch attached with submission follows:
How-To-Repeat: 0. Configure nn to use nntp
1. Ensure no From: header is set explicitly in user configuration (e.g., via news-header in ~/.nn/init)
2. nnpost
3. observe resulting From: header
Comment 1 dfilter service freebsd_committer freebsd_triage 2007-07-27 16:14:37 UTC
rafan       2007-07-27 15:14:31 UTC

  FreeBSD ports repository

  Modified files:
    news/nn              Makefile 
    news/nn/files        patch-an 
  Log:
  - Fix From: header
  
  PR:             ports/114375
  Submitted by:   G. Paul Ziemba <p-fbsd-bugs at treehouse.napa.ca.us>
  
  Revision  Changes    Path
  1.45      +1 -0      ports/news/nn/Makefile
  1.6       +23 -26    ports/news/nn/files/patch-an
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 2 Rong-En Fan freebsd_committer freebsd_triage 2007-07-27 16:14:41 UTC
State Changed
From-To: open->closed

Committed. Thanks!