source: freewrt/package/ssmtp/patches/500-debian-subset-2.61-2.patch

freewrt_2_0
Last change on this file was 475ad56, checked in by Waldemar Brodkorb <wbx@…>, 20 years ago

add OpenWrt trunk revision 3830.

git-svn-id: svn://www.freewrt.org/trunk/freewrt@1 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 5.9 KB
  • ssmtp.conf

    old new  
    3636
    3737# Use this RSA certificate.
    3838#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  
    9393static char hextab[]="0123456789abcdef";
    9494#endif
    9595
     96ssize_t outbytes;
    9697
    9798/*
    9899log_event() -- Write event to syslog (or log file if defined)
     
    129130#endif
    130131}
    131132
    132 void smtp_write(int fd, char *format, ...);
     133ssize_t smtp_write(int fd, char *format, ...);
    133134int smtp_read(int fd, char *response);
    134135int smtp_read_all(int fd, char *response);
    135136int smtp_okay(int fd, char *response);
     
    150151        if(isatty(fileno(stdin))) {
    151152                if(log_level > 0) {
    152153                        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);
    154155                }
    155156                return;
    156157        }
     
    964965                                        log_event(LOG_INFO, "Set AuthMethod=\"%s\"\n", auth_method);
    965966                                }
    966967                        }
     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                        }
    967979                        else {
    968980                                log_event(LOG_INFO, "Unable to set %s=\"%s\"\n", p, q);
    969981                        }
     
    12321244/*
    12331245smtp_write() -- A printf to an fd and append <CR/LF>
    12341246*/
    1235 void smtp_write(int fd, char *format, ...)
     1247ssize_t smtp_write(int fd, char *format, ...)
    12361248{
    12371249        char buf[(BUF_SZ + 1)];
    12381250        va_list ap;
     1251        ssize_t outbytes = 0;
    12391252
    12401253        va_start(ap, format);
    12411254        if(vsnprintf(buf, (BUF_SZ - 2), format, ap) == -1) {
     
    12521265        }
    12531266        (void)strcat(buf, "\r\n");
    12541267
    1255         (void)fd_puts(fd, buf, strlen(buf));
     1268        outbytes = fd_puts(fd, buf, strlen(buf));
     1269       
     1270        return (outbytes >= 0) ? outbytes : 0;
    12561271}
    12571272
    12581273/*
     
    12821297        int i, sock;
    12831298        uid_t uid;
    12841299
     1300        outbytes = 0;
     1301
    12851302        uid = getuid();
    12861303        if((pw = getpwuid(uid)) == (struct passwd *)NULL) {
    12871304                die("Could not find password entry for UID %d", uid);
     
    13351352
    13361353        /* If user supplied username and password, then try ELHO */
    13371354        if(auth_user) {
    1338                 smtp_write(sock, "EHLO %s", hostname);
     1355                outbytes += smtp_write(sock, "EHLO %s", hostname);
    13391356        }
    13401357        else {
    1341                 smtp_write(sock, "HELO %s", hostname);
     1358                outbytes += smtp_write(sock, "HELO %s", hostname);
    13421359        }
    13431360        (void)alarm((unsigned) MEDWAIT);
    13441361
     
    13541371                }
    13551372
    13561373                if(strcasecmp(auth_method, "cram-md5") == 0) {
    1357                         smtp_write(sock, "AUTH CRAM-MD5");
     1374                        outbytes += smtp_write(sock, "AUTH CRAM-MD5");
    13581375                        (void)alarm((unsigned) MEDWAIT);
    13591376
    13601377                        if(smtp_read(sock, buf) != 3) {
     
    13691386#endif
    13701387                memset(buf, 0, sizeof(buf));
    13711388                to64frombits(buf, auth_user, strlen(auth_user));
    1372                 smtp_write(sock, "AUTH LOGIN %s", buf);
     1389                outbytes += smtp_write(sock, "AUTH LOGIN %s", buf);
    13731390
    13741391                (void)alarm((unsigned) MEDWAIT);
    13751392                if(smtp_read(sock, buf) != 3) {
     
    13811398#ifdef MD5AUTH
    13821399                }
    13831400#endif
    1384                 smtp_write(sock, "%s", buf);
     1401                outbytes += smtp_write(sock, "%s", buf);
    13851402                (void)alarm((unsigned) MEDWAIT);
    13861403
    13871404                if(smtp_okay(sock, buf) == False) {
     
    13901407        }
    13911408
    13921409        /* Send "MAIL FROM:" line */
    1393         smtp_write(sock, "MAIL FROM:<%s>", uad);
     1410        outbytes += smtp_write(sock, "MAIL FROM:<%s>", uad);
    13941411
    13951412        (void)alarm((unsigned) MEDWAIT);
    13961413
     
    14081425
    14091426                while(rt->next) {
    14101427                        p = rcpt_remap(rt->string);
    1411                         smtp_write(sock, "RCPT TO:<%s>", p);
     1428                        outbytes += smtp_write(sock, "RCPT TO:<%s>", p);
    14121429
    14131430                        (void)alarm((unsigned)MEDWAIT);
    14141431
     
    14251442                        while(p) {
    14261443                                /* RFC822 Address -> "foo@bar" */
    14271444                                q = rcpt_remap(addr_parse(p));
    1428                                 smtp_write(sock, "RCPT TO:<%s>", q);
     1445                                outbytes += smtp_write(sock, "RCPT TO:<%s>", q);
    14291446
    14301447                                (void)alarm((unsigned) MEDWAIT);
    14311448
     
    14391456        }
    14401457
    14411458        /* Send DATA */
    1442         smtp_write(sock, "DATA");
     1459        outbytes += smtp_write(sock, "DATA");
    14431460        (void)alarm((unsigned) MEDWAIT);
    14441461
    14451462        if(smtp_read(sock, buf) != 3) {
     
    14471464                die("%s", buf);
    14481465        }
    14491466
    1450         smtp_write(sock,
     1467        outbytes += smtp_write(sock,
    14511468                "Received: by %s (sSMTP sendmail emulation); %s", hostname, arpadate);
    14521469
    14531470        if(have_from == False) {
    1454                 smtp_write(sock, "From: %s", from);
     1471                outbytes += smtp_write(sock, "From: %s", from);
    14551472        }
    14561473
    14571474        if(have_date == False) {
    1458                 smtp_write(sock, "Date: %s", arpadate);
     1475                outbytes += smtp_write(sock, "Date: %s", arpadate);
    14591476        }
    14601477
    14611478#ifdef HASTO_OPTION
    14621479        if(have_to == False) {
    1463                 smtp_write(sock, "To: postmaster");
     1480                outbytes += smtp_write(sock, "To: postmaster");
    14641481        }
    14651482#endif
    14661483
    14671484        ht = &headers;
    14681485        while(ht->next) {
    1469                 smtp_write(sock, "%s", ht->string);
     1486                outbytes += smtp_write(sock, "%s", ht->string);
    14701487                ht = ht->next;
    14711488        }
    14721489
    14731490        (void)alarm((unsigned) MEDWAIT);
    14741491
    14751492        /* End of headers, start body */
    1476         smtp_write(sock, "");
     1493        outbytes += smtp_write(sock, "");
    14771494
    14781495        while(fgets(buf, sizeof(buf), stdin)) {
    14791496                /* Trim off \n, double leading .'s */
    14801497                standardise(buf);
    14811498
    1482                 smtp_write(sock, "%s", buf);
     1499                outbytes += smtp_write(sock, "%s", buf);
    14831500
    14841501                (void)alarm((unsigned) MEDWAIT);
    14851502        }
    14861503        /* End of body */
    14871504
    1488         smtp_write(sock, ".");
     1505        outbytes += smtp_write(sock, ".");
    14891506        (void)alarm((unsigned) MAXWAIT);
    14901507
    14911508        if(smtp_okay(sock, buf) == 0) {
     
    14951512        /* Close conection */
    14961513        (void)signal(SIGALRM, SIG_IGN);
    14971514
    1498         smtp_write(sock, "QUIT");
     1515        outbytes += smtp_write(sock, "QUIT");
    14991516        (void)smtp_okay(sock, buf);
    15001517        (void)close(sock);
    15011518
    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);
    15031521
    15041522        return(0);
    15051523}
  • configure.in

    old new  
    2424AC_STRUCT_TM
    2525
    2626dnl Checks for libraries.
    27 AC_CHECK_LIB(nsl, gethostname)
    28 AC_CHECK_LIB(socket, socket)
     27AC_SEARCH_LIBS(gethostname, nsl)
     28AC_SEARCH_LIBS(socket, socket)
    2929
    3030dnl Checks for library functions.
    3131AC_TYPE_SIGNAL
Note: See TracBrowser for help on using the repository browser.