rpcd: iwinfo plugin fixes
[openwrt/svn-archive/archive.git] / patches / 500-debian-subset-2.61-2.patch
1 Index: ssmtp-2.61/ssmtp.conf
2 ===================================================================
3 --- ssmtp-2.61.orig/ssmtp.conf 2007-08-30 20:56:56.000000000 +0200
4 +++ ssmtp-2.61/ssmtp.conf 2007-08-30 20:56:56.000000000 +0200
5 @@ -36,3 +36,8 @@
6
7 # Use this RSA certificate.
8 #TLSCert=/etc/ssl/certs/ssmtp.pem
9 +
10 +# Get enhanced (*really* enhanced) debugging information in the logs
11 +# If you want to have debugging of the config file parsing, move this option
12 +# to the top of the config file and uncomment
13 +#Debug=YES
14 Index: ssmtp-2.61/ssmtp.c
15 ===================================================================
16 --- ssmtp-2.61.orig/ssmtp.c 2007-08-30 20:56:56.000000000 +0200
17 +++ ssmtp-2.61/ssmtp.c 2007-08-30 20:56:56.000000000 +0200
18 @@ -93,6 +93,7 @@
19 static char hextab[]="0123456789abcdef";
20 #endif
21
22 +ssize_t outbytes;
23
24 /*
25 log_event() -- Write event to syslog (or log file if defined)
26 @@ -129,7 +130,7 @@
27 #endif
28 }
29
30 -void smtp_write(int fd, char *format, ...);
31 +ssize_t smtp_write(int fd, char *format, ...);
32 int smtp_read(int fd, char *response);
33 int smtp_read_all(int fd, char *response);
34 int smtp_okay(int fd, char *response);
35 @@ -150,7 +151,7 @@
36 if(isatty(fileno(stdin))) {
37 if(log_level > 0) {
38 log_event(LOG_ERR,
39 - "stdin is a TTY - not saving to %s/dead.letter, pw->pw_dir");
40 + "stdin is a TTY - not saving to %s/dead.letter", pw->pw_dir);
41 }
42 return;
43 }
44 @@ -964,6 +965,17 @@
45 log_event(LOG_INFO, "Set AuthMethod=\"%s\"\n", auth_method);
46 }
47 }
48 + else if (strcasecmp(p, "Debug") == 0)
49 + {
50 + if (strcasecmp(q, "YES") == 0)
51 + {
52 + log_level = 1;
53 + }
54 + else
55 + {
56 + log_level = 0;
57 + }
58 + }
59 else {
60 log_event(LOG_INFO, "Unable to set %s=\"%s\"\n", p, q);
61 }
62 @@ -1232,10 +1244,11 @@
63 /*
64 smtp_write() -- A printf to an fd and append <CR/LF>
65 */
66 -void smtp_write(int fd, char *format, ...)
67 +ssize_t smtp_write(int fd, char *format, ...)
68 {
69 char buf[(BUF_SZ + 1)];
70 va_list ap;
71 + ssize_t outbytes = 0;
72
73 va_start(ap, format);
74 if(vsnprintf(buf, (BUF_SZ - 2), format, ap) == -1) {
75 @@ -1252,7 +1265,9 @@
76 }
77 (void)strcat(buf, "\r\n");
78
79 - (void)fd_puts(fd, buf, strlen(buf));
80 + outbytes = fd_puts(fd, buf, strlen(buf));
81 +
82 + return (outbytes >= 0) ? outbytes : 0;
83 }
84
85 /*
86 @@ -1282,6 +1297,8 @@
87 int i, sock;
88 uid_t uid;
89
90 + outbytes = 0;
91 +
92 uid = getuid();
93 if((pw = getpwuid(uid)) == (struct passwd *)NULL) {
94 die("Could not find password entry for UID %d", uid);
95 @@ -1335,10 +1352,10 @@
96
97 /* If user supplied username and password, then try ELHO */
98 if(auth_user) {
99 - smtp_write(sock, "EHLO %s", hostname);
100 + outbytes += smtp_write(sock, "EHLO %s", hostname);
101 }
102 else {
103 - smtp_write(sock, "HELO %s", hostname);
104 + outbytes += smtp_write(sock, "HELO %s", hostname);
105 }
106 (void)alarm((unsigned) MEDWAIT);
107
108 @@ -1354,7 +1371,7 @@
109 }
110
111 if(strcasecmp(auth_method, "cram-md5") == 0) {
112 - smtp_write(sock, "AUTH CRAM-MD5");
113 + outbytes += smtp_write(sock, "AUTH CRAM-MD5");
114 (void)alarm((unsigned) MEDWAIT);
115
116 if(smtp_read(sock, buf) != 3) {
117 @@ -1369,7 +1386,7 @@
118 #endif
119 memset(buf, 0, sizeof(buf));
120 to64frombits(buf, auth_user, strlen(auth_user));
121 - smtp_write(sock, "AUTH LOGIN %s", buf);
122 + outbytes += smtp_write(sock, "AUTH LOGIN %s", buf);
123
124 (void)alarm((unsigned) MEDWAIT);
125 if(smtp_read(sock, buf) != 3) {
126 @@ -1381,7 +1398,7 @@
127 #ifdef MD5AUTH
128 }
129 #endif
130 - smtp_write(sock, "%s", buf);
131 + outbytes += smtp_write(sock, "%s", buf);
132 (void)alarm((unsigned) MEDWAIT);
133
134 if(smtp_okay(sock, buf) == False) {
135 @@ -1390,7 +1407,7 @@
136 }
137
138 /* Send "MAIL FROM:" line */
139 - smtp_write(sock, "MAIL FROM:<%s>", uad);
140 + outbytes += smtp_write(sock, "MAIL FROM:<%s>", uad);
141
142 (void)alarm((unsigned) MEDWAIT);
143
144 @@ -1408,7 +1425,7 @@
145
146 while(rt->next) {
147 p = rcpt_remap(rt->string);
148 - smtp_write(sock, "RCPT TO:<%s>", p);
149 + outbytes += smtp_write(sock, "RCPT TO:<%s>", p);
150
151 (void)alarm((unsigned)MEDWAIT);
152
153 @@ -1425,7 +1442,7 @@
154 while(p) {
155 /* RFC822 Address -> "foo@bar" */
156 q = rcpt_remap(addr_parse(p));
157 - smtp_write(sock, "RCPT TO:<%s>", q);
158 + outbytes += smtp_write(sock, "RCPT TO:<%s>", q);
159
160 (void)alarm((unsigned) MEDWAIT);
161
162 @@ -1439,7 +1456,7 @@
163 }
164
165 /* Send DATA */
166 - smtp_write(sock, "DATA");
167 + outbytes += smtp_write(sock, "DATA");
168 (void)alarm((unsigned) MEDWAIT);
169
170 if(smtp_read(sock, buf) != 3) {
171 @@ -1447,45 +1464,45 @@
172 die("%s", buf);
173 }
174
175 - smtp_write(sock,
176 + outbytes += smtp_write(sock,
177 "Received: by %s (sSMTP sendmail emulation); %s", hostname, arpadate);
178
179 if(have_from == False) {
180 - smtp_write(sock, "From: %s", from);
181 + outbytes += smtp_write(sock, "From: %s", from);
182 }
183
184 if(have_date == False) {
185 - smtp_write(sock, "Date: %s", arpadate);
186 + outbytes += smtp_write(sock, "Date: %s", arpadate);
187 }
188
189 #ifdef HASTO_OPTION
190 if(have_to == False) {
191 - smtp_write(sock, "To: postmaster");
192 + outbytes += smtp_write(sock, "To: postmaster");
193 }
194 #endif
195
196 ht = &headers;
197 while(ht->next) {
198 - smtp_write(sock, "%s", ht->string);
199 + outbytes += smtp_write(sock, "%s", ht->string);
200 ht = ht->next;
201 }
202
203 (void)alarm((unsigned) MEDWAIT);
204
205 /* End of headers, start body */
206 - smtp_write(sock, "");
207 + outbytes += smtp_write(sock, "");
208
209 while(fgets(buf, sizeof(buf), stdin)) {
210 /* Trim off \n, double leading .'s */
211 standardise(buf);
212
213 - smtp_write(sock, "%s", buf);
214 + outbytes += smtp_write(sock, "%s", buf);
215
216 (void)alarm((unsigned) MEDWAIT);
217 }
218 /* End of body */
219
220 - smtp_write(sock, ".");
221 + outbytes += smtp_write(sock, ".");
222 (void)alarm((unsigned) MAXWAIT);
223
224 if(smtp_okay(sock, buf) == 0) {
225 @@ -1495,11 +1512,12 @@
226 /* Close conection */
227 (void)signal(SIGALRM, SIG_IGN);
228
229 - smtp_write(sock, "QUIT");
230 + outbytes += smtp_write(sock, "QUIT");
231 (void)smtp_okay(sock, buf);
232 (void)close(sock);
233
234 - log_event(LOG_INFO, "Sent mail for %s (%s)", from_strip(uad), buf);
235 + log_event(LOG_INFO, "Sent mail for %s (%s) uid=%d username=%s outbytes=%d",
236 + from_strip(uad), buf, uid, pw->pw_name, outbytes);
237
238 return(0);
239 }
240 Index: ssmtp-2.61/configure.in
241 ===================================================================
242 --- ssmtp-2.61.orig/configure.in 2007-08-30 20:56:56.000000000 +0200
243 +++ ssmtp-2.61/configure.in 2007-08-30 20:56:56.000000000 +0200
244 @@ -24,8 +24,8 @@
245 AC_STRUCT_TM
246
247 dnl Checks for libraries.
248 -AC_CHECK_LIB(nsl, gethostname)
249 -AC_CHECK_LIB(socket, socket)
250 +AC_SEARCH_LIBS(gethostname, nsl)
251 +AC_SEARCH_LIBS(socket, socket)
252
253 dnl Checks for library functions.
254 AC_TYPE_SIGNAL