|
Lines 1-5
Link Here
|
| 1 |
--- ssmtp.c.orig 2009-11-23 11:55:11.000000000 +0200 |
1 |
--- ssmtp.c.orig 2009-11-23 11:55:11.000000000 +0200 |
| 2 |
+++ ssmtp.c 2011-02-21 02:56:10.000000000 +0200 |
2 |
+++ ssmtp.c 2011-02-21 02:56:10.000000000 +0200 |
| 3 |
@@ -25,6 +25,7 @@ |
3 |
@@ -25,6 +25,7 @@ |
| 4 |
#include <string.h> |
4 |
#include <string.h> |
| 5 |
#include <ctype.h> |
5 |
#include <ctype.h> |
|
Lines 120-126
Link Here
|
| 120 |
} |
120 |
} |
| 121 |
|
121 |
|
| 122 |
/* Ignore malformed lines and comments */ |
122 |
/* Ignore malformed lines and comments */ |
| 123 |
@@ -519,11 +543,11 @@ |
123 |
@@ -519,11 +538,11 @@ |
| 124 |
#endif |
124 |
#endif |
| 125 |
|
125 |
|
| 126 |
/* Ignore missing usernames */ |
126 |
/* Ignore missing usernames */ |
|
Lines 134-140
Link Here
|
| 134 |
die("rcpt_save() -- strdup() failed"); |
134 |
die("rcpt_save() -- strdup() failed"); |
| 135 |
} |
135 |
} |
| 136 |
|
136 |
|
| 137 |
@@ -548,7 +572,7 @@ |
137 |
@@ -548,7 +567,7 @@ |
| 138 |
(void)fprintf(stderr, "*** rcpt_parse(): str = [%s]\n", str); |
138 |
(void)fprintf(stderr, "*** rcpt_parse(): str = [%s]\n", str); |
| 139 |
#endif |
139 |
#endif |
| 140 |
|
140 |
|
|
Lines 143-149
Link Here
|
| 143 |
die("rcpt_parse(): strdup() failed"); |
143 |
die("rcpt_parse(): strdup() failed"); |
| 144 |
} |
144 |
} |
| 145 |
q = p; |
145 |
q = p; |
| 146 |
@@ -576,7 +600,7 @@ |
146 |
@@ -576,7 +595,7 @@ |
| 147 |
} |
147 |
} |
| 148 |
|
148 |
|
| 149 |
/* End of string? */ |
149 |
/* End of string? */ |
|
Lines 152-158
Link Here
|
| 152 |
got_addr = True; |
152 |
got_addr = True; |
| 153 |
} |
153 |
} |
| 154 |
|
154 |
|
| 155 |
@@ -584,7 +608,7 @@ |
155 |
@@ -584,7 +603,7 @@ |
| 156 |
if((*q == ',') && (in_quotes == False)) { |
156 |
if((*q == ',') && (in_quotes == False)) { |
| 157 |
got_addr = True; |
157 |
got_addr = True; |
| 158 |
|
158 |
|
|
Lines 161-167
Link Here
|
| 161 |
} |
161 |
} |
| 162 |
|
162 |
|
| 163 |
if(got_addr) { |
163 |
if(got_addr) { |
| 164 |
@@ -668,7 +692,7 @@ |
164 |
@@ -668,7 +687,7 @@ |
| 165 |
(void)fprintf(stderr, "header_save(): str = [%s]\n", str); |
165 |
(void)fprintf(stderr, "header_save(): str = [%s]\n", str); |
| 166 |
#endif |
166 |
#endif |
| 167 |
|
167 |
|
|
Lines 170-176
Link Here
|
| 170 |
die("header_save() -- strdup() failed"); |
170 |
die("header_save() -- strdup() failed"); |
| 171 |
} |
171 |
} |
| 172 |
ht->string = p; |
172 |
ht->string = p; |
| 173 |
@@ -676,7 +700,7 @@ |
173 |
@@ -676,7 +695,7 @@ |
| 174 |
if(strncasecmp(ht->string, "From:", 5) == 0) { |
174 |
if(strncasecmp(ht->string, "From:", 5) == 0) { |
| 175 |
#if 1 |
175 |
#if 1 |
| 176 |
/* Hack check for NULL From: line */ |
176 |
/* Hack check for NULL From: line */ |
|
Lines 179-185
Link Here
|
| 179 |
return; |
179 |
return; |
| 180 |
} |
180 |
} |
| 181 |
#endif |
181 |
#endif |
| 182 |
@@ -739,19 +763,19 @@ |
182 |
@@ -739,19 +758,19 @@ |
| 183 |
void header_parse(FILE *stream) |
183 |
void header_parse(FILE *stream) |
| 184 |
{ |
184 |
{ |
| 185 |
size_t size = BUF_SZ, len = 0; |
185 |
size_t size = BUF_SZ, len = 0; |
|
Lines 203-209
Link Here
|
| 203 |
die("header_parse() -- realloc() failed"); |
203 |
die("header_parse() -- realloc() failed"); |
| 204 |
} |
204 |
} |
| 205 |
q = (p + len); |
205 |
q = (p + len); |
| 206 |
@@ -776,9 +800,9 @@ |
206 |
@@ -776,9 +795,9 @@ |
| 207 |
in_header = False; |
207 |
in_header = False; |
| 208 |
|
208 |
|
| 209 |
default: |
209 |
default: |
|
Lines 215-221
Link Here
|
| 215 |
} |
215 |
} |
| 216 |
header_save(p); |
216 |
header_save(p); |
| 217 |
|
217 |
|
| 218 |
@@ -809,9 +833,9 @@ |
218 |
@@ -809,9 +828,9 @@ |
| 219 |
in_header = False; |
219 |
in_header = False; |
| 220 |
|
220 |
|
| 221 |
default: |
221 |
default: |
|
Lines 227-238
Link Here
|
| 227 |
} |
227 |
} |
| 228 |
header_save(p); |
228 |
header_save(p); |
| 229 |
|
229 |
|
| 230 |
@@ -876,11 +900,11 @@ |
230 |
@@ -876,21 +895,27 @@ |
| 231 |
char *rightside; |
231 |
char *rightside; |
| 232 |
/* Make comments invisible */ |
232 |
/* Make comments invisible */ |
| 233 |
if((p = strchr(buf, '#'))) { |
233 |
if((p = strchr(buf, '#'))) { |
| 234 |
- *p = (char)NULL; |
234 |
- *p = (char)NULL; |
| 235 |
+ *p = '\0'; |
235 |
+ /* check if # is a part of a param */ |
|
|
236 |
+ if((q = strchr(buf, '='))) { |
| 237 |
+ if ((int)(p-buf) < (int)(q-buf)) |
| 238 |
+ *p = '\0'; |
| 239 |
+ } |
| 240 |
+ else |
| 241 |
+ *p = '\0'; |
| 236 |
} |
242 |
} |
| 237 |
|
243 |
|
| 238 |
/* Ignore malformed lines and comments */ |
244 |
/* Ignore malformed lines and comments */ |
|
Lines 241-247
Link Here
|
| 241 |
|
247 |
|
| 242 |
/* Parse out keywords */ |
248 |
/* Parse out keywords */ |
| 243 |
p=firsttok(&begin, "= \t\n"); |
249 |
p=firsttok(&begin, "= \t\n"); |
| 244 |
@@ -890,7 +914,7 @@ |
250 |
if(p){ |
|
|
251 |
rightside=begin; |
| 252 |
- q = firsttok(&begin, "= \t\n"); |
| 253 |
+ q = firsttok(&begin, " \t\n"); |
| 245 |
} |
254 |
} |
| 246 |
if(p && q) { |
255 |
if(p && q) { |
| 247 |
if(strcasecmp(p, "Root") == 0) { |
256 |
if(strcasecmp(p, "Root") == 0) { |
|
Lines 250-256
Link Here
|
| 250 |
die("parse_config() -- strdup() failed"); |
259 |
die("parse_config() -- strdup() failed"); |
| 251 |
} |
260 |
} |
| 252 |
|
261 |
|
| 253 |
@@ -904,7 +928,7 @@ |
262 |
@@ -904,7 +929,7 @@ |
| 254 |
port = atoi(r); |
263 |
port = atoi(r); |
| 255 |
} |
264 |
} |
| 256 |
|
265 |
|
|
Lines 259-265
Link Here
|
| 259 |
die("parse_config() -- strdup() failed"); |
268 |
die("parse_config() -- strdup() failed"); |
| 260 |
} |
269 |
} |
| 261 |
|
270 |
|
| 262 |
@@ -949,7 +973,7 @@ |
271 |
@@ -949,7 +974,7 @@ |
| 263 |
mail_domain = strdup(q); |
272 |
mail_domain = strdup(q); |
| 264 |
} |
273 |
} |
| 265 |
|
274 |
|
|
Lines 268-274
Link Here
|
| 268 |
die("parse_config() -- strdup() failed"); |
277 |
die("parse_config() -- strdup() failed"); |
| 269 |
} |
278 |
} |
| 270 |
rewrite_domain = True; |
279 |
rewrite_domain = True; |
| 271 |
@@ -1025,7 +1049,7 @@ |
280 |
@@ -1025,7 +1050,7 @@ |
| 272 |
} |
281 |
} |
| 273 |
} |
282 |
} |
| 274 |
else if(strcasecmp(p, "TLSCert") == 0) { |
283 |
else if(strcasecmp(p, "TLSCert") == 0) { |
|
Lines 277-283
Link Here
|
| 277 |
die("parse_config() -- strdup() failed"); |
286 |
die("parse_config() -- strdup() failed"); |
| 278 |
} |
287 |
} |
| 279 |
|
288 |
|
| 280 |
@@ -1036,7 +1060,7 @@ |
289 |
@@ -1036,7 +1061,7 @@ |
| 281 |
#endif |
290 |
#endif |
| 282 |
/* Command-line overrides these */ |
291 |
/* Command-line overrides these */ |
| 283 |
else if(strcasecmp(p, "AuthUser") == 0 && !auth_user) { |
292 |
else if(strcasecmp(p, "AuthUser") == 0 && !auth_user) { |
|
Lines 286-292
Link Here
|
| 286 |
die("parse_config() -- strdup() failed"); |
295 |
die("parse_config() -- strdup() failed"); |
| 287 |
} |
296 |
} |
| 288 |
|
297 |
|
| 289 |
@@ -1045,7 +1069,7 @@ |
298 |
@@ -1045,7 +1070,7 @@ |
| 290 |
} |
299 |
} |
| 291 |
} |
300 |
} |
| 292 |
else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) { |
301 |
else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) { |
|
Lines 295-301
Link Here
|
| 295 |
die("parse_config() -- strdup() failed"); |
304 |
die("parse_config() -- strdup() failed"); |
| 296 |
} |
305 |
} |
| 297 |
|
306 |
|
| 298 |
@@ -1054,7 +1078,7 @@ |
307 |
@@ -1054,7 +1079,7 @@ |
| 299 |
} |
308 |
} |
| 300 |
} |
309 |
} |
| 301 |
else if(strcasecmp(p, "AuthMethod") == 0 && !auth_method) { |
310 |
else if(strcasecmp(p, "AuthMethod") == 0 && !auth_method) { |
|
Lines 304-310
Link Here
|
| 304 |
die("parse_config() -- strdup() failed"); |
313 |
die("parse_config() -- strdup() failed"); |
| 305 |
} |
314 |
} |
| 306 |
|
315 |
|
| 307 |
@@ -1107,11 +1131,11 @@ |
316 |
@@ -1107,11 +1132,11 @@ |
| 308 |
#ifdef INET6 |
317 |
#ifdef INET6 |
| 309 |
struct addrinfo hints, *ai0, *ai; |
318 |
struct addrinfo hints, *ai0, *ai; |
| 310 |
char servname[NI_MAXSERV]; |
319 |
char servname[NI_MAXSERV]; |
|
Lines 318-324
Link Here
|
| 318 |
#endif |
327 |
#endif |
| 319 |
|
328 |
|
| 320 |
#ifdef HAVE_SSL |
329 |
#ifdef HAVE_SSL |
| 321 |
@@ -1310,7 +1334,7 @@ |
330 |
@@ -1310,7 +1335,7 @@ |
| 322 |
buf[i++] = c; |
331 |
buf[i++] = c; |
| 323 |
} |
332 |
} |
| 324 |
} |
333 |
} |
|
Lines 327-333
Link Here
|
| 327 |
|
336 |
|
| 328 |
return(buf); |
337 |
return(buf); |
| 329 |
} |
338 |
} |
| 330 |
@@ -1434,14 +1458,14 @@ |
339 |
@@ -1435,14 +1460,14 @@ |
| 331 |
} |
340 |
} |
| 332 |
|
341 |
|
| 333 |
if((p = strtok(pw->pw_gecos, ";,"))) { |
342 |
if((p = strtok(pw->pw_gecos, ";,"))) { |
|
Lines 344-350
Link Here
|
| 344 |
uad = append_domain(pw->pw_name); |
353 |
uad = append_domain(pw->pw_name); |
| 345 |
} |
354 |
} |
| 346 |
|
355 |
|
| 347 |
@@ -1489,7 +1513,7 @@ |
356 |
@@ -1490,7 +1515,7 @@ |
| 348 |
/* Try to log in if username was supplied */ |
357 |
/* Try to log in if username was supplied */ |
| 349 |
if(auth_user) { |
358 |
if(auth_user) { |
| 350 |
#ifdef MD5AUTH |
359 |
#ifdef MD5AUTH |
|
Lines 353-359
Link Here
|
| 353 |
auth_pass = strdup(""); |
362 |
auth_pass = strdup(""); |
| 354 |
} |
363 |
} |
| 355 |
|
364 |
|
| 356 |
@@ -1737,7 +1761,7 @@ |
365 |
@@ -1742,7 +1767,7 @@ |
| 357 |
j = 0; |
366 |
j = 0; |
| 358 |
|
367 |
|
| 359 |
add = 1; |
368 |
add = 1; |
|
Lines 362-368
Link Here
|
| 362 |
switch(argv[i][j]) { |
371 |
switch(argv[i][j]) { |
| 363 |
#ifdef INET6 |
372 |
#ifdef INET6 |
| 364 |
case '6': |
373 |
case '6': |
| 365 |
@@ -1755,14 +1779,14 @@ |
374 |
@@ -1760,14 +1785,14 @@ |
| 366 |
if((!argv[i][(j + 1)]) |
375 |
if((!argv[i][(j + 1)]) |
| 367 |
&& argv[(i + 1)]) { |
376 |
&& argv[(i + 1)]) { |
| 368 |
auth_user = strdup(argv[i+1]); |
377 |
auth_user = strdup(argv[i+1]); |
|
Lines 379-385
Link Here
|
| 379 |
die("parse_options() -- strdup() failed"); |
388 |
die("parse_options() -- strdup() failed"); |
| 380 |
} |
389 |
} |
| 381 |
} |
390 |
} |
| 382 |
@@ -1772,14 +1796,14 @@ |
391 |
@@ -1777,14 +1802,14 @@ |
| 383 |
if((!argv[i][(j + 1)]) |
392 |
if((!argv[i][(j + 1)]) |
| 384 |
&& argv[(i + 1)]) { |
393 |
&& argv[(i + 1)]) { |
| 385 |
auth_pass = strdup(argv[i+1]); |
394 |
auth_pass = strdup(argv[i+1]); |
|
Lines 396-402
Link Here
|
| 396 |
die("parse_options() -- strdup() failed"); |
405 |
die("parse_options() -- strdup() failed"); |
| 397 |
} |
406 |
} |
| 398 |
} |
407 |
} |
| 399 |
@@ -1870,14 +1894,14 @@ |
408 |
@@ -1875,14 +1900,14 @@ |
| 400 |
case 'F': |
409 |
case 'F': |
| 401 |
if((!argv[i][(j + 1)]) && argv[(i + 1)]) { |
410 |
if((!argv[i][(j + 1)]) && argv[(i + 1)]) { |
| 402 |
minus_F = strdup(argv[(i + 1)]); |
411 |
minus_F = strdup(argv[(i + 1)]); |
|
Lines 413-419
Link Here
|
| 413 |
die("parse_options() -- strdup() failed"); |
422 |
die("parse_options() -- strdup() failed"); |
| 414 |
} |
423 |
} |
| 415 |
} |
424 |
} |
| 416 |
@@ -1889,14 +1913,14 @@ |
425 |
@@ -1894,14 +1919,14 @@ |
| 417 |
case 'r': |
426 |
case 'r': |
| 418 |
if((!argv[i][(j + 1)]) && argv[(i + 1)]) { |
427 |
if((!argv[i][(j + 1)]) && argv[(i + 1)]) { |
| 419 |
minus_f = strdup(argv[(i + 1)]); |
428 |
minus_f = strdup(argv[(i + 1)]); |