source:
freewrt/package/ssmtp/patches/500-debian-subset-2.61-2.patch
| Last change on this file was 475ad56, checked in by , 20 years ago | |
|---|---|
|
|
| File size: 5.9 KB | |
-
ssmtp.conf
old new 36 36 37 37 # Use this RSA certificate. 38 38 #TLSCert=/etc/ssl/certs/ssmtp.pem 39 40 # Get enhanced (*really* enhanced) debugging information in the logs 41 # If you want to have debugging of the config file parsing, move this option 42 # to the top of the config file and uncomment 43 #Debug=YES -
ssmtp-2.61
old new 93 93 static char hextab[]="0123456789abcdef"; 94 94 #endif 95 95 96 ssize_t outbytes; 96 97 97 98 /* 98 99 log_event() -- Write event to syslog (or log file if defined) … … 129 130 #endif 130 131 } 131 132 132 voidsmtp_write(int fd, char *format, ...);133 ssize_t smtp_write(int fd, char *format, ...); 133 134 int smtp_read(int fd, char *response); 134 135 int smtp_read_all(int fd, char *response); 135 136 int smtp_okay(int fd, char *response); … … 150 151 if(isatty(fileno(stdin))) { 151 152 if(log_level > 0) { 152 153 log_event(LOG_ERR, 153 "stdin is a TTY - not saving to %s/dead.letter , pw->pw_dir");154 "stdin is a TTY - not saving to %s/dead.letter", pw->pw_dir); 154 155 } 155 156 return; 156 157 } … … 964 965 log_event(LOG_INFO, "Set AuthMethod=\"%s\"\n", auth_method); 965 966 } 966 967 } 968 else if (strcasecmp(p, "Debug") == 0) 969 { 970 if (strcasecmp(q, "YES") == 0) 971 { 972 log_level = 1; 973 } 974 else 975 { 976 log_level = 0; 977 } 978 } 967 979 else { 968 980 log_event(LOG_INFO, "Unable to set %s=\"%s\"\n", p, q); 969 981 } … … 1232 1244 /* 1233 1245 smtp_write() -- A printf to an fd and append <CR/LF> 1234 1246 */ 1235 voidsmtp_write(int fd, char *format, ...)1247 ssize_t smtp_write(int fd, char *format, ...) 1236 1248 { 1237 1249 char buf[(BUF_SZ + 1)]; 1238 1250 va_list ap; 1251 ssize_t outbytes = 0; 1239 1252 1240 1253 va_start(ap, format); 1241 1254 if(vsnprintf(buf, (BUF_SZ - 2), format, ap) == -1) { … … 1252 1265 } 1253 1266 (void)strcat(buf, "\r\n"); 1254 1267 1255 (void)fd_puts(fd, buf, strlen(buf)); 1268 outbytes = fd_puts(fd, buf, strlen(buf)); 1269 1270 return (outbytes >= 0) ? outbytes : 0; 1256 1271 } 1257 1272 1258 1273 /* … … 1282 1297 int i, sock; 1283 1298 uid_t uid; 1284 1299 1300 outbytes = 0; 1301 1285 1302 uid = getuid(); 1286 1303 if((pw = getpwuid(uid)) == (struct passwd *)NULL) { 1287 1304 die("Could not find password entry for UID %d", uid); … … 1335 1352 1336 1353 /* If user supplied username and password, then try ELHO */ 1337 1354 if(auth_user) { 1338 smtp_write(sock, "EHLO %s", hostname);1355 outbytes += smtp_write(sock, "EHLO %s", hostname); 1339 1356 } 1340 1357 else { 1341 smtp_write(sock, "HELO %s", hostname);1358 outbytes += smtp_write(sock, "HELO %s", hostname); 1342 1359 } 1343 1360 (void)alarm((unsigned) MEDWAIT); 1344 1361 … … 1354 1371 } 1355 1372 1356 1373 if(strcasecmp(auth_method, "cram-md5") == 0) { 1357 smtp_write(sock, "AUTH CRAM-MD5");1374 outbytes += smtp_write(sock, "AUTH CRAM-MD5"); 1358 1375 (void)alarm((unsigned) MEDWAIT); 1359 1376 1360 1377 if(smtp_read(sock, buf) != 3) { … … 1369 1386 #endif 1370 1387 memset(buf, 0, sizeof(buf)); 1371 1388 to64frombits(buf, auth_user, strlen(auth_user)); 1372 smtp_write(sock, "AUTH LOGIN %s", buf);1389 outbytes += smtp_write(sock, "AUTH LOGIN %s", buf); 1373 1390 1374 1391 (void)alarm((unsigned) MEDWAIT); 1375 1392 if(smtp_read(sock, buf) != 3) { … … 1381 1398 #ifdef MD5AUTH 1382 1399 } 1383 1400 #endif 1384 smtp_write(sock, "%s", buf);1401 outbytes += smtp_write(sock, "%s", buf); 1385 1402 (void)alarm((unsigned) MEDWAIT); 1386 1403 1387 1404 if(smtp_okay(sock, buf) == False) { … … 1390 1407 } 1391 1408 1392 1409 /* Send "MAIL FROM:" line */ 1393 smtp_write(sock, "MAIL FROM:<%s>", uad);1410 outbytes += smtp_write(sock, "MAIL FROM:<%s>", uad); 1394 1411 1395 1412 (void)alarm((unsigned) MEDWAIT); 1396 1413 … … 1408 1425 1409 1426 while(rt->next) { 1410 1427 p = rcpt_remap(rt->string); 1411 smtp_write(sock, "RCPT TO:<%s>", p);1428 outbytes += smtp_write(sock, "RCPT TO:<%s>", p); 1412 1429 1413 1430 (void)alarm((unsigned)MEDWAIT); 1414 1431 … … 1425 1442 while(p) { 1426 1443 /* RFC822 Address -> "foo@bar" */ 1427 1444 q = rcpt_remap(addr_parse(p)); 1428 smtp_write(sock, "RCPT TO:<%s>", q);1445 outbytes += smtp_write(sock, "RCPT TO:<%s>", q); 1429 1446 1430 1447 (void)alarm((unsigned) MEDWAIT); 1431 1448 … … 1439 1456 } 1440 1457 1441 1458 /* Send DATA */ 1442 smtp_write(sock, "DATA");1459 outbytes += smtp_write(sock, "DATA"); 1443 1460 (void)alarm((unsigned) MEDWAIT); 1444 1461 1445 1462 if(smtp_read(sock, buf) != 3) { … … 1447 1464 die("%s", buf); 1448 1465 } 1449 1466 1450 smtp_write(sock,1467 outbytes += smtp_write(sock, 1451 1468 "Received: by %s (sSMTP sendmail emulation); %s", hostname, arpadate); 1452 1469 1453 1470 if(have_from == False) { 1454 smtp_write(sock, "From: %s", from);1471 outbytes += smtp_write(sock, "From: %s", from); 1455 1472 } 1456 1473 1457 1474 if(have_date == False) { 1458 smtp_write(sock, "Date: %s", arpadate);1475 outbytes += smtp_write(sock, "Date: %s", arpadate); 1459 1476 } 1460 1477 1461 1478 #ifdef HASTO_OPTION 1462 1479 if(have_to == False) { 1463 smtp_write(sock, "To: postmaster");1480 outbytes += smtp_write(sock, "To: postmaster"); 1464 1481 } 1465 1482 #endif 1466 1483 1467 1484 ht = &headers; 1468 1485 while(ht->next) { 1469 smtp_write(sock, "%s", ht->string);1486 outbytes += smtp_write(sock, "%s", ht->string); 1470 1487 ht = ht->next; 1471 1488 } 1472 1489 1473 1490 (void)alarm((unsigned) MEDWAIT); 1474 1491 1475 1492 /* End of headers, start body */ 1476 smtp_write(sock, "");1493 outbytes += smtp_write(sock, ""); 1477 1494 1478 1495 while(fgets(buf, sizeof(buf), stdin)) { 1479 1496 /* Trim off \n, double leading .'s */ 1480 1497 standardise(buf); 1481 1498 1482 smtp_write(sock, "%s", buf);1499 outbytes += smtp_write(sock, "%s", buf); 1483 1500 1484 1501 (void)alarm((unsigned) MEDWAIT); 1485 1502 } 1486 1503 /* End of body */ 1487 1504 1488 smtp_write(sock, ".");1505 outbytes += smtp_write(sock, "."); 1489 1506 (void)alarm((unsigned) MAXWAIT); 1490 1507 1491 1508 if(smtp_okay(sock, buf) == 0) { … … 1495 1512 /* Close conection */ 1496 1513 (void)signal(SIGALRM, SIG_IGN); 1497 1514 1498 smtp_write(sock, "QUIT");1515 outbytes += smtp_write(sock, "QUIT"); 1499 1516 (void)smtp_okay(sock, buf); 1500 1517 (void)close(sock); 1501 1518 1502 log_event(LOG_INFO, "Sent mail for %s (%s)", from_strip(uad), buf); 1519 log_event(LOG_INFO, "Sent mail for %s (%s) uid=%d username=%s outbytes=%d", 1520 from_strip(uad), buf, uid, pw->pw_name, outbytes); 1503 1521 1504 1522 return(0); 1505 1523 } -
configure.in
old new 24 24 AC_STRUCT_TM 25 25 26 26 dnl Checks for libraries. 27 AC_ CHECK_LIB(nsl, gethostname)28 AC_ CHECK_LIB(socket, socket)27 AC_SEARCH_LIBS(gethostname, nsl) 28 AC_SEARCH_LIBS(socket, socket) 29 29 30 30 dnl Checks for library functions. 31 31 AC_TYPE_SIGNAL
Note:
See TracBrowser
for help on using the repository browser.
