|
@@ -68,7 +68,15 @@
|
68
|
68
|
}
|
69
|
69
|
(void)strip_post_ws(p);
|
70
|
70
|
|
71
|
|
-@@ -363,7 +363,7 @@ bool_t standardise(char *str, bool_t *li
|
|
71
|
+@@ -349,7 +349,6 @@ standardise() -- Trim off '\n's and doub
|
|
72
|
+ */
|
|
73
|
+ bool_t standardise(char *str, bool_t *linestart)
|
|
74
|
+ {
|
|
75
|
+- size_t sl;
|
|
76
|
+ char *p;
|
|
77
|
+ bool_t leadingdot = False;
|
|
78
|
+
|
|
79
|
+@@ -363,7 +362,7 @@ bool_t standardise(char *str, bool_t *li
|
72
|
80
|
*linestart = False;
|
73
|
81
|
|
74
|
82
|
if((p = strchr(str, '\n'))) {
|
|
@@ -77,7 +85,7 @@
|
77
|
85
|
*linestart = True;
|
78
|
86
|
}
|
79
|
87
|
return(leadingdot);
|
80
|
|
-@@ -384,7 +384,7 @@ void revaliases(struct passwd *pw)
|
|
88
|
+@@ -384,7 +383,7 @@ void revaliases(struct passwd *pw)
|
81
|
89
|
while(fgets(buf, sizeof(buf), fp)) {
|
82
|
90
|
/* Make comments invisible */
|
83
|
91
|
if((p = strchr(buf, '#'))) {
|
|
@@ -86,7 +94,7 @@
|
86
|
94
|
}
|
87
|
95
|
|
88
|
96
|
/* Ignore malformed lines and comments */
|
89
|
|
-@@ -519,11 +519,11 @@ void rcpt_save(char *str)
|
|
97
|
+@@ -519,11 +518,11 @@ void rcpt_save(char *str)
|
90
|
98
|
#endif
|
91
|
99
|
|
92
|
100
|
/* Ignore missing usernames */
|
|
@@ -100,7 +108,7 @@
|
100
|
108
|
die("rcpt_save() -- strdup() failed");
|
101
|
109
|
}
|
102
|
110
|
|
103
|
|
-@@ -548,7 +548,7 @@ void rcpt_parse(char *str)
|
|
111
|
+@@ -548,7 +547,7 @@ void rcpt_parse(char *str)
|
104
|
112
|
(void)fprintf(stderr, "*** rcpt_parse(): str = [%s]\n", str);
|
105
|
113
|
#endif
|
106
|
114
|
|
|
@@ -109,7 +117,7 @@
|
109
|
117
|
die("rcpt_parse(): strdup() failed");
|
110
|
118
|
}
|
111
|
119
|
q = p;
|
112
|
|
-@@ -576,7 +576,7 @@ void rcpt_parse(char *str)
|
|
120
|
+@@ -576,7 +575,7 @@ void rcpt_parse(char *str)
|
113
|
121
|
}
|
114
|
122
|
|
115
|
123
|
/* End of string? */
|
|
@@ -118,7 +126,7 @@
|
118
|
126
|
got_addr = True;
|
119
|
127
|
}
|
120
|
128
|
|
121
|
|
-@@ -584,7 +584,7 @@ void rcpt_parse(char *str)
|
|
129
|
+@@ -584,7 +583,7 @@ void rcpt_parse(char *str)
|
122
|
130
|
if((*q == ',') && (in_quotes == False)) {
|
123
|
131
|
got_addr = True;
|
124
|
132
|
|
|
@@ -127,7 +135,7 @@
|
127
|
135
|
}
|
128
|
136
|
|
129
|
137
|
if(got_addr) {
|
130
|
|
-@@ -668,7 +668,7 @@ void header_save(char *str)
|
|
138
|
+@@ -668,7 +667,7 @@ void header_save(char *str)
|
131
|
139
|
(void)fprintf(stderr, "header_save(): str = [%s]\n", str);
|
132
|
140
|
#endif
|
133
|
141
|
|
|
@@ -136,7 +144,7 @@
|
136
|
144
|
die("header_save() -- strdup() failed");
|
137
|
145
|
}
|
138
|
146
|
ht->string = p;
|
139
|
|
-@@ -676,7 +676,7 @@ void header_save(char *str)
|
|
147
|
+@@ -676,7 +675,7 @@ void header_save(char *str)
|
140
|
148
|
if(strncasecmp(ht->string, "From:", 5) == 0) {
|
141
|
149
|
#if 1
|
142
|
150
|
/* Hack check for NULL From: line */
|
|
@@ -145,7 +153,7 @@
|
145
|
153
|
return;
|
146
|
154
|
}
|
147
|
155
|
#endif
|
148
|
|
-@@ -739,19 +739,19 @@ header_parse() -- Break headers into sep
|
|
156
|
+@@ -739,19 +738,19 @@ header_parse() -- Break headers into sep
|
149
|
157
|
void header_parse(FILE *stream)
|
150
|
158
|
{
|
151
|
159
|
size_t size = BUF_SZ, len = 0;
|
|
@@ -169,7 +177,7 @@
|
169
|
177
|
die("header_parse() -- realloc() failed");
|
170
|
178
|
}
|
171
|
179
|
q = (p + len);
|
172
|
|
-@@ -776,9 +776,9 @@ void header_parse(FILE *stream)
|
|
180
|
+@@ -776,9 +775,9 @@ void header_parse(FILE *stream)
|
173
|
181
|
in_header = False;
|
174
|
182
|
|
175
|
183
|
default:
|
|
@@ -181,7 +189,7 @@
|
181
|
189
|
}
|
182
|
190
|
header_save(p);
|
183
|
191
|
|
184
|
|
-@@ -809,9 +809,9 @@ void header_parse(FILE *stream)
|
|
192
|
+@@ -809,9 +808,9 @@ void header_parse(FILE *stream)
|
185
|
193
|
in_header = False;
|
186
|
194
|
|
187
|
195
|
default:
|
|
@@ -193,7 +201,7 @@
|
193
|
201
|
}
|
194
|
202
|
header_save(p);
|
195
|
203
|
|
196
|
|
-@@ -876,11 +876,11 @@ bool_t read_config()
|
|
204
|
+@@ -876,11 +875,11 @@ bool_t read_config()
|
197
|
205
|
char *rightside;
|
198
|
206
|
/* Make comments invisible */
|
199
|
207
|
if((p = strchr(buf, '#'))) {
|
|
@@ -207,7 +215,7 @@
|
207
|
215
|
|
208
|
216
|
/* Parse out keywords */
|
209
|
217
|
p=firsttok(&begin, "= \t\n");
|
210
|
|
-@@ -890,7 +890,7 @@ bool_t read_config()
|
|
218
|
+@@ -890,7 +889,7 @@ bool_t read_config()
|
211
|
219
|
}
|
212
|
220
|
if(p && q) {
|
213
|
221
|
if(strcasecmp(p, "Root") == 0) {
|
|
@@ -216,7 +224,7 @@
|
216
|
224
|
die("parse_config() -- strdup() failed");
|
217
|
225
|
}
|
218
|
226
|
|
219
|
|
-@@ -904,7 +904,7 @@ bool_t read_config()
|
|
227
|
+@@ -904,7 +903,7 @@ bool_t read_config()
|
220
|
228
|
port = atoi(r);
|
221
|
229
|
}
|
222
|
230
|
|
|
@@ -225,7 +233,7 @@
|
225
|
233
|
die("parse_config() -- strdup() failed");
|
226
|
234
|
}
|
227
|
235
|
|
228
|
|
-@@ -949,7 +949,7 @@ bool_t read_config()
|
|
236
|
+@@ -949,7 +948,7 @@ bool_t read_config()
|
229
|
237
|
mail_domain = strdup(q);
|
230
|
238
|
}
|
231
|
239
|
|
|
@@ -234,7 +242,7 @@
|
234
|
242
|
die("parse_config() -- strdup() failed");
|
235
|
243
|
}
|
236
|
244
|
rewrite_domain = True;
|
237
|
|
-@@ -1025,7 +1025,7 @@ bool_t read_config()
|
|
245
|
+@@ -1025,7 +1024,7 @@ bool_t read_config()
|
238
|
246
|
}
|
239
|
247
|
}
|
240
|
248
|
else if(strcasecmp(p, "TLSCert") == 0) {
|
|
@@ -243,7 +251,7 @@
|
243
|
251
|
die("parse_config() -- strdup() failed");
|
244
|
252
|
}
|
245
|
253
|
|
246
|
|
-@@ -1036,7 +1036,7 @@ bool_t read_config()
|
|
254
|
+@@ -1036,7 +1035,7 @@ bool_t read_config()
|
247
|
255
|
#endif
|
248
|
256
|
/* Command-line overrides these */
|
249
|
257
|
else if(strcasecmp(p, "AuthUser") == 0 && !auth_user) {
|
|
@@ -252,7 +260,7 @@
|
252
|
260
|
die("parse_config() -- strdup() failed");
|
253
|
261
|
}
|
254
|
262
|
|
255
|
|
-@@ -1045,7 +1045,7 @@ bool_t read_config()
|
|
263
|
+@@ -1045,7 +1044,7 @@ bool_t read_config()
|
256
|
264
|
}
|
257
|
265
|
}
|
258
|
266
|
else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) {
|
|
@@ -261,7 +269,7 @@
|
261
|
269
|
die("parse_config() -- strdup() failed");
|
262
|
270
|
}
|
263
|
271
|
|
264
|
|
-@@ -1054,7 +1054,7 @@ bool_t read_config()
|
|
272
|
+@@ -1054,7 +1053,7 @@ bool_t read_config()
|
265
|
273
|
}
|
266
|
274
|
}
|
267
|
275
|
else if(strcasecmp(p, "AuthMethod") == 0 && !auth_method) {
|
|
@@ -270,7 +278,7 @@
|
270
|
278
|
die("parse_config() -- strdup() failed");
|
271
|
279
|
}
|
272
|
280
|
|
273
|
|
-@@ -1119,14 +1119,11 @@ int smtp_open(char *host, int port)
|
|
281
|
+@@ -1119,14 +1118,11 @@ int smtp_open(char *host, int port)
|
274
|
282
|
char buf[(BUF_SZ + 1)];
|
275
|
283
|
|
276
|
284
|
/* Init SSL stuff */
|
|
@@ -287,7 +295,7 @@
|
287
|
295
|
if(!ctx) {
|
288
|
296
|
log_event(LOG_ERR, "No SSL support initiated\n");
|
289
|
297
|
return(-1);
|
290
|
|
-@@ -1310,7 +1307,7 @@ char *fd_gets(char *buf, int size, int f
|
|
298
|
+@@ -1310,7 +1306,7 @@ char *fd_gets(char *buf, int size, int f
|
291
|
299
|
buf[i++] = c;
|
292
|
300
|
}
|
293
|
301
|
}
|
|
@@ -296,7 +304,7 @@
|
296
|
304
|
|
297
|
305
|
return(buf);
|
298
|
306
|
}
|
299
|
|
-@@ -1434,14 +1431,14 @@ int ssmtp(char *argv[])
|
|
307
|
+@@ -1434,14 +1430,14 @@ int ssmtp(char *argv[])
|
300
|
308
|
}
|
301
|
309
|
|
302
|
310
|
if((p = strtok(pw->pw_gecos, ";,"))) {
|
|
@@ -313,7 +321,7 @@
|
313
|
321
|
uad = append_domain(pw->pw_name);
|
314
|
322
|
}
|
315
|
323
|
|
316
|
|
-@@ -1489,7 +1486,7 @@ int ssmtp(char *argv[])
|
|
324
|
+@@ -1489,7 +1485,7 @@ int ssmtp(char *argv[])
|
317
|
325
|
/* Try to log in if username was supplied */
|
318
|
326
|
if(auth_user) {
|
319
|
327
|
#ifdef MD5AUTH
|
|
@@ -322,7 +330,34 @@
|
322
|
330
|
auth_pass = strdup("");
|
323
|
331
|
}
|
324
|
332
|
|
325
|
|
-@@ -1737,7 +1734,7 @@ char **parse_options(int argc, char *arg
|
|
333
|
+@@ -1508,7 +1504,7 @@ int ssmtp(char *argv[])
|
|
334
|
+ else {
|
|
335
|
+ #endif
|
|
336
|
+ memset(buf, 0, bufsize);
|
|
337
|
+- to64frombits(buf, auth_user, strlen(auth_user));
|
|
338
|
++ to64frombits(buf, (unsigned char *)auth_user, strlen(auth_user));
|
|
339
|
+ if (use_oldauth) {
|
|
340
|
+ outbytes += smtp_write(sock, "AUTH LOGIN %s", buf);
|
|
341
|
+ }
|
|
342
|
+@@ -1520,7 +1516,7 @@ int ssmtp(char *argv[])
|
|
343
|
+ }
|
|
344
|
+ /* we assume server asked us for Username */
|
|
345
|
+ memset(buf, 0, bufsize);
|
|
346
|
+- to64frombits(buf, auth_user, strlen(auth_user));
|
|
347
|
++ to64frombits(buf, (unsigned char *)auth_user, strlen(auth_user));
|
|
348
|
+ outbytes += smtp_write(sock, buf);
|
|
349
|
+ }
|
|
350
|
+
|
|
351
|
+@@ -1530,7 +1526,7 @@ int ssmtp(char *argv[])
|
|
352
|
+ }
|
|
353
|
+ memset(buf, 0, bufsize);
|
|
354
|
+
|
|
355
|
+- to64frombits(buf, auth_pass, strlen(auth_pass));
|
|
356
|
++ to64frombits(buf, (unsigned char *)auth_pass, strlen(auth_pass));
|
|
357
|
+ #ifdef MD5AUTH
|
|
358
|
+ }
|
|
359
|
+ #endif
|
|
360
|
+@@ -1737,7 +1733,7 @@ char **parse_options(int argc, char *arg
|
326
|
361
|
j = 0;
|
327
|
362
|
|
328
|
363
|
add = 1;
|
|
@@ -331,7 +366,7 @@
|
331
|
366
|
switch(argv[i][j]) {
|
332
|
367
|
#ifdef INET6
|
333
|
368
|
case '6':
|
334
|
|
-@@ -1755,14 +1752,14 @@ char **parse_options(int argc, char *arg
|
|
369
|
+@@ -1755,14 +1751,14 @@ char **parse_options(int argc, char *arg
|
335
|
370
|
if((!argv[i][(j + 1)])
|
336
|
371
|
&& argv[(i + 1)]) {
|
337
|
372
|
auth_user = strdup(argv[i+1]);
|
|
@@ -348,7 +383,7 @@
|
348
|
383
|
die("parse_options() -- strdup() failed");
|
349
|
384
|
}
|
350
|
385
|
}
|
351
|
|
-@@ -1772,14 +1769,14 @@ char **parse_options(int argc, char *arg
|
|
386
|
+@@ -1772,14 +1768,14 @@ char **parse_options(int argc, char *arg
|
352
|
387
|
if((!argv[i][(j + 1)])
|
353
|
388
|
&& argv[(i + 1)]) {
|
354
|
389
|
auth_pass = strdup(argv[i+1]);
|
|
@@ -365,7 +400,7 @@
|
365
|
400
|
die("parse_options() -- strdup() failed");
|
366
|
401
|
}
|
367
|
402
|
}
|
368
|
|
-@@ -1870,14 +1867,14 @@ char **parse_options(int argc, char *arg
|
|
403
|
+@@ -1870,14 +1866,14 @@ char **parse_options(int argc, char *arg
|
369
|
404
|
case 'F':
|
370
|
405
|
if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
|
371
|
406
|
minus_F = strdup(argv[(i + 1)]);
|
|
@@ -382,7 +417,7 @@
|
382
|
417
|
die("parse_options() -- strdup() failed");
|
383
|
418
|
}
|
384
|
419
|
}
|
385
|
|
-@@ -1889,14 +1886,14 @@ char **parse_options(int argc, char *arg
|
|
420
|
+@@ -1889,14 +1885,14 @@ char **parse_options(int argc, char *arg
|
386
|
421
|
case 'r':
|
387
|
422
|
if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
|
388
|
423
|
minus_f = strdup(argv[(i + 1)]);
|
|
@@ -399,3 +434,33 @@
|
399
|
434
|
die("parse_options() -- strdup() failed");
|
400
|
435
|
}
|
401
|
436
|
}
|
|
437
|
+--- a/base64.c
|
|
438
|
++++ b/base64.c
|
|
439
|
+@@ -31,7 +31,7 @@ static const char base64val[] = {
|
|
440
|
+ };
|
|
441
|
+ #define DECODE64(c) (isascii(c) ? base64val[c] : BAD)
|
|
442
|
+
|
|
443
|
+-void to64frombits(unsigned char *out, const unsigned char *in, int inlen)
|
|
444
|
++void to64frombits(char *out, const unsigned char *in, int inlen)
|
|
445
|
+ /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
|
|
446
|
+ {
|
|
447
|
+ for (; inlen >= 3; inlen -= 3)
|
|
448
|
+@@ -57,7 +57,7 @@ void to64frombits(unsigned char *out, co
|
|
449
|
+ *out = '\0';
|
|
450
|
+ }
|
|
451
|
+
|
|
452
|
+-int from64tobits(char *out, const char *in)
|
|
453
|
++int from64tobits(unsigned char *out, const char *in)
|
|
454
|
+ /* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */
|
|
455
|
+ {
|
|
456
|
+ int len = 0;
|
|
457
|
+--- a/ssmtp.h
|
|
458
|
++++ b/ssmtp.h
|
|
459
|
+@@ -41,5 +41,5 @@ typedef struct string_list rcpt_t;
|
|
460
|
+ void get_arpadate(char *);
|
|
461
|
+
|
|
462
|
+ /* base64.c */
|
|
463
|
+-void to64frombits(unsigned char *, const unsigned char *, int);
|
|
464
|
+-int from64tobits(char *, const char *);
|
|
465
|
++void to64frombits(char *, const unsigned char *, int);
|
|
466
|
++int from64tobits(unsigned char *, const char *);
|