- Fix From: header

PR:		ports/114375
Submitted by:	G. Paul Ziemba <p-fbsd-bugs at treehouse.napa.ca.us>
This commit is contained in:
Rong-En Fan 2007-07-27 15:14:31 +00:00
parent 18107c8853
commit 801b1826fb
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=196417
2 changed files with 24 additions and 26 deletions

View file

@ -7,6 +7,7 @@
PORTNAME= nn
PORTVERSION= 6.7.3
PORTREVISION= 1
CATEGORIES= news
MASTER_SITES= http://www.sourcefiles.org/Internet/News/Usenet_Clients/ \
http://www.wa.apana.org.au/~dean/sources/

View file

@ -1,5 +1,5 @@
--- nntp.c.orig Tue Apr 19 18:06:51 2005
+++ nntp.c Sat Sep 3 14:34:49 2005
--- nntp.c.orig Tue Apr 19 16:06:51 2005
+++ nntp.c Sat Jul 7 00:30:15 2007
@@ -76,6 +76,7 @@
static int connect_server(void);
static void debug_msg(char *prefix, char *str);
@ -59,31 +59,28 @@
/*
* get_server_line: get a line from the server.
*
@@ -1492,15 +1537,24 @@
gen_frompath(void)
{
struct passwd *passwd;
+ char *domain;
+ const char *fromFormat = "From: <%s@%s>\r\n";
@@ -848,6 +893,16 @@
passwd = getpwuid(getuid());
#else /* DOMAIN */
fprintf(nntp_out, "From: ");
fprintf(nntp_out, "%s ", full_name());
- fprintf(nntp_out, "<%s@%s>\r\n",
- passwd->pw_name,
- domain);
+ 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);
+ /*
+ * if domain is defined in DOMAIN_FILE, use it
+ */
+ cp = find_domain(DOMAIN_FILE);
+ if (cp) {
+ strncpy(domain, cp, MAXHOSTNAMELEN);
+ domain[MAXHOSTNAMELEN-1] = 0; /* ensure nul-terminated */
+ return;
+ }
+
domain[0] = '\0';
#ifdef HIDDENNET
/* Only the login name - nntp server will add uucp name */
cp = index(host_name, '.');
@@ -882,6 +937,7 @@
#endif
}
#endif /* DOMAIN */
+ domain[MAXHOSTNAMELEN-1] = 0; /* ensure nul-terminated */
}
/*