Bug 114375 - [patch] news/nn 6.7.3 From: header broken when posting via nntp
Summary: [patch] news/nn 6.7.3 From: header broken when posting via nntp
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
Depends on:
Reported: 2007-07-07 09:20 UTC by G. Paul Ziemba
Modified: 2007-07-27 16:20 UTC (History)
0 users

See Also:

file.diff (1.58 KB, patch)
2007-07-07 09:20 UTC, G. Paul Ziemba
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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
        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,
        } else {
            fprintf(nntp_out, fromFormat,
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 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 
  - 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
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 2 Rong-En Fan freebsd_committer 2007-07-27 16:14:41 UTC
State Changed
From-To: open->closed

Committed. Thanks!