--- nntp.c.orig Sat Jan 25 00:10:39 2003 +++ nntp.c Wed Apr 28 17:47:59 2004 @@ -39,6 +39,7 @@ #include #include #include +#include #ifdef NOV #include "hash.h" @@ -63,6 +64,7 @@ static int connect_server(void); static void debug_msg __APROTO((char *prefix, char *str)); static void find_server __APROTO((void)); +char *find_domain __APROTO((char *domainFile)); static int get_server_line __APROTO((char *string, int size)); static int get_server __APROTO((char *string, int size)); static int get_socket __APROTO((void)); @@ -212,6 +214,50 @@ sys_error("Failed to find name of NNTP server!"); } + +/* + * find_domain Get the domain name for posting from a named file. + * Handle blank lines and comments. + * + * Parameters: "file" is the name of the file to read. + * + * Returns: Pointer to static data area containing the + * first non-blank/comment line in the file. + * NULL on error (or lack of entry in file). + * + * Side effects: None. + */ + +char * +find_domain(char *domainFile) +{ + register FILE *fp; + register char *cp; + static char buf[MAXHOSTNAMELEN]; + char *index(); + + if (domainFile == NULL) + return (NULL); + + fp = fopen(domainFile, "r"); + if (fp == NULL) + return (NULL); + + while (fgets(buf, sizeof (buf), fp) != NULL) { + if (*buf == '\n' || *buf == '#') + continue; + cp = index(buf, '\n'); + if (cp) + *cp = '\0'; + (void) fclose(fp); + return (buf); + } + + (void) fclose(fp); + return (NULL); +} + + /* * get_server_line: get a line from the server. * @@ -1415,15 +1461,24 @@ gen_frompath() { struct passwd *passwd; + char *domain; + char *fromFormat = "From: <%s@%s>\r\n"; passwd = getpwuid(getuid()); 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); + } #ifdef HIDDENNET /* Only the login name - nntp server will add uucp name */ evel/electron4/files/lodash-4.17.19 FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* Use PLIST_FILES.trevor2004-02-061-0/+2
* Per distfile survey, remove mastersite that disappeared in December 2001.linimon2003-10-281-1/+2
* Drop maintainershipkris2003-07-121-1/+1