Lines 1-6
Link Here
|
1 |
--- nntp.c.orig Tue Oct 9 11:39:11 2001 |
1 |
--- nntp.c.orig Sat Jan 25 00:10:39 2003 |
2 |
+++ nntp.c Mon Jun 10 10:15:02 2002 |
2 |
+++ nntp.c Wed Apr 28 17:47:59 2004 |
3 |
@@ -37,6 +37,7 @@ |
3 |
@@ -39,6 +39,7 @@ |
4 |
#include <errno.h> |
4 |
#include <errno.h> |
5 |
#include <pwd.h> |
5 |
#include <pwd.h> |
6 |
#include <ctype.h> |
6 |
#include <ctype.h> |
Lines 8-25
Link Here
|
8 |
|
8 |
|
9 |
#ifdef NOV |
9 |
#ifdef NOV |
10 |
#include "hash.h" |
10 |
#include "hash.h" |
11 |
@@ -88,6 +89,7 @@ |
11 |
@@ -63,6 +64,7 @@ |
|
|
12 |
static int connect_server(void); |
12 |
static void debug_msg __APROTO((char *prefix, char *str)); |
13 |
static void debug_msg __APROTO((char *prefix, char *str)); |
13 |
static void io_error __APROTO((void)); |
|
|
14 |
static void find_server __APROTO((void)); |
14 |
static void find_server __APROTO((void)); |
15 |
+char * find_domain(char *domainFile); |
15 |
+char *find_domain __APROTO((char *domainFile)); |
16 |
static int get_server_line __APROTO((char *string, int size)); |
16 |
static int get_server_line __APROTO((char *string, int size)); |
17 |
static int get_server __APROTO((char *string, int size)); |
17 |
static int get_server __APROTO((char *string, int size)); |
18 |
static int get_socket __APROTO((void)); |
18 |
static int get_socket __APROTO((void)); |
19 |
@@ -319,6 +321,49 @@ |
19 |
@@ -212,6 +214,50 @@ |
|
|
20 |
sys_error("Failed to find name of NNTP server!"); |
20 |
} |
21 |
} |
21 |
|
22 |
|
22 |
/* |
23 |
+ |
|
|
24 |
+/* |
23 |
+ * find_domain Get the domain name for posting from a named file. |
25 |
+ * find_domain Get the domain name for posting from a named file. |
24 |
+ * Handle blank lines and comments. |
26 |
+ * Handle blank lines and comments. |
25 |
+ * |
27 |
+ * |
Lines 33-40
Link Here
|
33 |
+ */ |
35 |
+ */ |
34 |
+ |
36 |
+ |
35 |
+char * |
37 |
+char * |
36 |
+find_domain(domainFile) |
38 |
+find_domain(char *domainFile) |
37 |
+char *domainFile; |
|
|
38 |
+{ |
39 |
+{ |
39 |
+ register FILE *fp; |
40 |
+ register FILE *fp; |
40 |
+ register char *cp; |
41 |
+ register char *cp; |
Lines 62-113
Link Here
|
62 |
+ return (NULL); |
63 |
+ return (NULL); |
63 |
+} |
64 |
+} |
64 |
+ |
65 |
+ |
65 |
+/* |
66 |
+ |
|
|
67 |
/* |
66 |
* get_server_line: get a line from the server. |
68 |
* get_server_line: get a line from the server. |
67 |
* |
69 |
* |
68 |
* Expects to be connected to the server. |
70 |
@@ -1415,15 +1461,24 @@ |
69 |
@@ -634,7 +679,7 @@ |
71 |
gen_frompath() |
70 |
can_post = 0; |
72 |
{ |
71 |
break; |
73 |
struct passwd *passwd; |
72 |
default: |
|
|
73 |
- nn_exitmsg(1, line); |
74 |
+ nn_exitmsg(1, "%s", line); |
75 |
/* NOTREACHED */ |
76 |
} |
77 |
} |
78 |
@@ -1726,7 +1771,7 @@ |
79 |
* Phil Lapsley <phil@ucbvax.berkeley.edu> |
80 |
*/ |
81 |
|
82 |
-static char host_name[256]; |
83 |
+static char host_name[MAXHOSTNAMELEN]; |
84 |
|
85 |
/* |
86 |
* gen_frompath -- generate From: and Path: lines, in the form |
87 |
@@ -1745,6 +1790,7 @@ |
88 |
#ifndef HIDDENNET |
89 |
char *cp; |
90 |
#endif |
91 |
+ char *domain; |
74 |
+ char *domain; |
|
|
75 |
+ char *fromFormat = "From: <%s@%s>\r\n"; |
92 |
|
76 |
|
93 |
fprintf(nntp_out, "From: "); |
|
|
94 |
passwd = getpwuid(getuid()); |
77 |
passwd = getpwuid(getuid()); |
95 |
@@ -1772,9 +1818,15 @@ |
78 |
|
96 |
DOMAIN); |
79 |
fprintf(nntp_out, "From: "); |
97 |
#endif /* HIDDENNET */ |
80 |
fprintf(nntp_out, "%s ", full_name()); |
98 |
#else |
81 |
|
99 |
- fprintf(nntp_out, "<%s@%s>\r\n", |
82 |
- fprintf(nntp_out, "<%s@%s>\r\n", |
100 |
- passwd->pw_name, |
83 |
- passwd->pw_name, |
101 |
- host_name); |
84 |
- domain); |
102 |
+ domain = find_domain(DOMAIN_FILE); |
85 |
+ domain = find_domain(DOMAIN_FILE); |
103 |
+ if (domain == NULL) |
86 |
+ if (domain == NULL) { |
104 |
+ fprintf(nntp_out, "From: <%s@%s>\r\n", |
87 |
+ fprintf(nntp_out, fromFormat, |
105 |
+ passwd->pw_name, |
88 |
+ passwd->pw_name, |
106 |
+ host_name); |
89 |
+ host_name); |
107 |
+ else |
90 |
+ } else { |
108 |
+ fprintf(nntp_out, "From: <%s@%s>\r\n", |
91 |
+ fprintf(nntp_out, fromFormat, |
109 |
+ passwd->pw_name, |
92 |
+ passwd->pw_name, |
110 |
+ domain); |
93 |
+ domain); |
111 |
#endif |
94 |
+ } |
112 |
|
95 |
|
113 |
#ifdef HIDDENNET |
96 |
#ifdef HIDDENNET |
|
|
97 |
/* Only the login name - nntp server will add uucp name */ |