From: Nicolas Thill Date: Mon, 20 Jun 2005 06:42:28 +0000 (+0000) Subject: Add ssmtp package X-Git-Tag: reboot~32462 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1b965aebd357520e0b4cbb8d309e8afc28ba8e4c;p=openwrt%2Fstaging%2Fnoltari.git Add ssmtp package SVN-Revision: 1275 --- diff --git a/openwrt/package/Config.in b/openwrt/package/Config.in index 1ea07647e5..5d98370a59 100644 --- a/openwrt/package/Config.in +++ b/openwrt/package/Config.in @@ -75,6 +75,7 @@ source "package/shat/Config.in" source "package/siproxd/Config.in" source "package/sipsak/Config.in" source "package/snort/Config.in" +source "package/ssmtp/Config.in" source "package/tcpdump/Config.in" source "package/tinc/Config.in" source "package/tor/Config.in" diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile index 01a157cd32..6819b0719c 100644 --- a/openwrt/package/Makefile +++ b/openwrt/package/Makefile @@ -109,6 +109,7 @@ package-$(BR2_PACKAGE_SIPSAK) += sipsak package-$(BR2_PACKAGE_SNORT) += snort package-$(BR2_PACKAGE_SPEEX) += speex package-$(BR2_PACKAGE_SQLITE) += sqlite +package-$(BR2_PACKAGE_SSMTP) += ssmtp package-$(BR2_PACKAGE_STRACE) += strace package-$(BR2_PACKAGE_TCPDUMP) += tcpdump package-$(BR2_PACKAGE_TINC) += tinc diff --git a/openwrt/package/ssmtp/Config.in b/openwrt/package/ssmtp/Config.in new file mode 100644 index 0000000000..94a50bf161 --- /dev/null +++ b/openwrt/package/ssmtp/Config.in @@ -0,0 +1,12 @@ +config BR2_PACKAGE_SSMTP + tristate "ssmtp - A minimal and secure mail sender" + default m if CONFIG_DEVEL + help + A secure, effective and simple way of getting mail off a system to your + mail hub. It contains no suid-binaries or other dangerous things - no + mail spool to poke around in, and no daemons running in the background. + Mail is simply forwarded to the configured mailhost. Extremely easy + configuration. + + http://packages.debian.org/stable/mail/ssmtp + diff --git a/openwrt/package/ssmtp/Makefile b/openwrt/package/ssmtp/Makefile new file mode 100644 index 0000000000..0db7149d6e --- /dev/null +++ b/openwrt/package/ssmtp/Makefile @@ -0,0 +1,66 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ssmtp +PKG_VERSION:=2.61 +PKG_RELEASE:=1 +PKG_MD5SUM:=957e6fff08625fe34f4fc33d0925bbc9 + +PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/s/ssmtp/ +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(TOPDIR)/package/rules.mk + +BR2_PACKAGE_SSMTP=m + +$(eval $(call PKG_template,SSMTP,ssmtp,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) + +$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared + (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + CPPFLAGS="-I$(STAGING_DIR)/usr/include" \ + LDFLAGS="-L$(STAGING_DIR)/usr/lib" \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --program-prefix="" \ + --program-suffix="" \ + --prefix=/usr \ + --exec-prefix=/usr \ + --bindir=/usr/bin \ + --datadir=/usr/share \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + $(DISABLE_NLS) \ + $(DISABLE_LARGEFILE) \ + ); + touch $@ + +$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured + $(MAKE) -C $(PKG_BUILD_DIR) \ + all + touch $@ + +$(IPKG_SSMTP): + install -m0755 -d $(IDIR_SSMTP)/etc/ssmtp + install -m0644 $(PKG_BUILD_DIR)/ssmtp.conf $(IDIR_SSMTP)/etc/ssmtp/ + install -m0644 $(PKG_BUILD_DIR)/revaliases $(IDIR_SSMTP)/etc/ssmtp/ + install -m0755 -d $(IDIR_SSMTP)/usr/sbin + cp -fpR $(PKG_BUILD_DIR)/ssmtp $(IDIR_SSMTP)/usr/sbin/ + ln -sf ssmtp $(IDIR_SSMTP)/usr/sbin/sendmail + $(RSTRIP) $(IDIR_SSMTP) + $(IPKG_BUILD) $(IDIR_SSMTP) $(PACKAGE_DIR) + diff --git a/openwrt/package/ssmtp/ipkg/ssmtp.conffiles b/openwrt/package/ssmtp/ipkg/ssmtp.conffiles new file mode 100644 index 0000000000..d1da3e1792 --- /dev/null +++ b/openwrt/package/ssmtp/ipkg/ssmtp.conffiles @@ -0,0 +1,2 @@ +/etc/ssmtp/ssmtp.conf +/etc/ssmtp/revaliases diff --git a/openwrt/package/ssmtp/ipkg/ssmtp.control b/openwrt/package/ssmtp/ipkg/ssmtp.control new file mode 100644 index 0000000000..afa9a1d069 --- /dev/null +++ b/openwrt/package/ssmtp/ipkg/ssmtp.control @@ -0,0 +1,8 @@ +Package: ssmtp +Priority: optional +Section: net +Version: [TBDL] +Architecture: [TBDL] +Maintainer: OpenWrt Developers Team +Source: http://openwrt.org/cgi-bin/viewcvs.cgi/openwrt/package/ssmtp/ +Description: A minimal and secure mail sender diff --git a/openwrt/package/ssmtp/patches/500-debian-subset-2.61-2.patch b/openwrt/package/ssmtp/patches/500-debian-subset-2.61-2.patch new file mode 100644 index 0000000000..f682c97a13 --- /dev/null +++ b/openwrt/package/ssmtp/patches/500-debian-subset-2.61-2.patch @@ -0,0 +1,248 @@ +--- ssmtp-2.61.orig/ssmtp.conf ++++ ssmtp-2.61/ssmtp.conf +@@ -36,3 +36,8 @@ + + # Use this RSA certificate. + #TLSCert=/etc/ssl/certs/ssmtp.pem ++ ++# Get enhanced (*really* enhanced) debugging information in the logs ++# If you want to have debugging of the config file parsing, move this option ++# to the top of the config file and uncomment ++#Debug=YES +--- ssmtp-2.61.orig/ssmtp.c ++++ ssmtp-2.61/ssmtp.c +@@ -93,6 +93,7 @@ + static char hextab[]="0123456789abcdef"; + #endif + ++ssize_t outbytes; + + /* + log_event() -- Write event to syslog (or log file if defined) +@@ -129,7 +130,7 @@ + #endif + } + +-void smtp_write(int fd, char *format, ...); ++ssize_t smtp_write(int fd, char *format, ...); + int smtp_read(int fd, char *response); + int smtp_read_all(int fd, char *response); + int smtp_okay(int fd, char *response); +@@ -150,7 +151,7 @@ + if(isatty(fileno(stdin))) { + if(log_level > 0) { + log_event(LOG_ERR, +- "stdin is a TTY - not saving to %s/dead.letter, pw->pw_dir"); ++ "stdin is a TTY - not saving to %s/dead.letter", pw->pw_dir); + } + return; + } +@@ -964,6 +965,17 @@ + log_event(LOG_INFO, "Set AuthMethod=\"%s\"\n", auth_method); + } + } ++ else if (strcasecmp(p, "Debug") == 0) ++ { ++ if (strcasecmp(q, "YES") == 0) ++ { ++ log_level = 1; ++ } ++ else ++ { ++ log_level = 0; ++ } ++ } + else { + log_event(LOG_INFO, "Unable to set %s=\"%s\"\n", p, q); + } +@@ -1232,10 +1244,11 @@ + /* + smtp_write() -- A printf to an fd and append + */ +-void smtp_write(int fd, char *format, ...) ++ssize_t smtp_write(int fd, char *format, ...) + { + char buf[(BUF_SZ + 1)]; + va_list ap; ++ ssize_t outbytes = 0; + + va_start(ap, format); + if(vsnprintf(buf, (BUF_SZ - 2), format, ap) == -1) { +@@ -1252,7 +1265,9 @@ + } + (void)strcat(buf, "\r\n"); + +- (void)fd_puts(fd, buf, strlen(buf)); ++ outbytes = fd_puts(fd, buf, strlen(buf)); ++ ++ return (outbytes >= 0) ? outbytes : 0; + } + + /* +@@ -1282,6 +1297,8 @@ + int i, sock; + uid_t uid; + ++ outbytes = 0; ++ + uid = getuid(); + if((pw = getpwuid(uid)) == (struct passwd *)NULL) { + die("Could not find password entry for UID %d", uid); +@@ -1335,10 +1352,10 @@ + + /* If user supplied username and password, then try ELHO */ + if(auth_user) { +- smtp_write(sock, "EHLO %s", hostname); ++ outbytes += smtp_write(sock, "EHLO %s", hostname); + } + else { +- smtp_write(sock, "HELO %s", hostname); ++ outbytes += smtp_write(sock, "HELO %s", hostname); + } + (void)alarm((unsigned) MEDWAIT); + +@@ -1354,7 +1371,7 @@ + } + + if(strcasecmp(auth_method, "cram-md5") == 0) { +- smtp_write(sock, "AUTH CRAM-MD5"); ++ outbytes += smtp_write(sock, "AUTH CRAM-MD5"); + (void)alarm((unsigned) MEDWAIT); + + if(smtp_read(sock, buf) != 3) { +@@ -1369,7 +1386,7 @@ + #endif + memset(buf, 0, sizeof(buf)); + to64frombits(buf, auth_user, strlen(auth_user)); +- smtp_write(sock, "AUTH LOGIN %s", buf); ++ outbytes += smtp_write(sock, "AUTH LOGIN %s", buf); + + (void)alarm((unsigned) MEDWAIT); + if(smtp_read(sock, buf) != 3) { +@@ -1381,7 +1398,7 @@ + #ifdef MD5AUTH + } + #endif +- smtp_write(sock, "%s", buf); ++ outbytes += smtp_write(sock, "%s", buf); + (void)alarm((unsigned) MEDWAIT); + + if(smtp_okay(sock, buf) == False) { +@@ -1390,7 +1407,7 @@ + } + + /* Send "MAIL FROM:" line */ +- smtp_write(sock, "MAIL FROM:<%s>", uad); ++ outbytes += smtp_write(sock, "MAIL FROM:<%s>", uad); + + (void)alarm((unsigned) MEDWAIT); + +@@ -1408,7 +1425,7 @@ + + while(rt->next) { + p = rcpt_remap(rt->string); +- smtp_write(sock, "RCPT TO:<%s>", p); ++ outbytes += smtp_write(sock, "RCPT TO:<%s>", p); + + (void)alarm((unsigned)MEDWAIT); + +@@ -1425,7 +1442,7 @@ + while(p) { + /* RFC822 Address -> "foo@bar" */ + q = rcpt_remap(addr_parse(p)); +- smtp_write(sock, "RCPT TO:<%s>", q); ++ outbytes += smtp_write(sock, "RCPT TO:<%s>", q); + + (void)alarm((unsigned) MEDWAIT); + +@@ -1439,7 +1456,7 @@ + } + + /* Send DATA */ +- smtp_write(sock, "DATA"); ++ outbytes += smtp_write(sock, "DATA"); + (void)alarm((unsigned) MEDWAIT); + + if(smtp_read(sock, buf) != 3) { +@@ -1447,45 +1464,45 @@ + die("%s", buf); + } + +- smtp_write(sock, ++ outbytes += smtp_write(sock, + "Received: by %s (sSMTP sendmail emulation); %s", hostname, arpadate); + + if(have_from == False) { +- smtp_write(sock, "From: %s", from); ++ outbytes += smtp_write(sock, "From: %s", from); + } + + if(have_date == False) { +- smtp_write(sock, "Date: %s", arpadate); ++ outbytes += smtp_write(sock, "Date: %s", arpadate); + } + + #ifdef HASTO_OPTION + if(have_to == False) { +- smtp_write(sock, "To: postmaster"); ++ outbytes += smtp_write(sock, "To: postmaster"); + } + #endif + + ht = &headers; + while(ht->next) { +- smtp_write(sock, "%s", ht->string); ++ outbytes += smtp_write(sock, "%s", ht->string); + ht = ht->next; + } + + (void)alarm((unsigned) MEDWAIT); + + /* End of headers, start body */ +- smtp_write(sock, ""); ++ outbytes += smtp_write(sock, ""); + + while(fgets(buf, sizeof(buf), stdin)) { + /* Trim off \n, double leading .'s */ + standardise(buf); + +- smtp_write(sock, "%s", buf); ++ outbytes += smtp_write(sock, "%s", buf); + + (void)alarm((unsigned) MEDWAIT); + } + /* End of body */ + +- smtp_write(sock, "."); ++ outbytes += smtp_write(sock, "."); + (void)alarm((unsigned) MAXWAIT); + + if(smtp_okay(sock, buf) == 0) { +@@ -1495,11 +1512,12 @@ + /* Close conection */ + (void)signal(SIGALRM, SIG_IGN); + +- smtp_write(sock, "QUIT"); ++ outbytes += smtp_write(sock, "QUIT"); + (void)smtp_okay(sock, buf); + (void)close(sock); + +- log_event(LOG_INFO, "Sent mail for %s (%s)", from_strip(uad), buf); ++ log_event(LOG_INFO, "Sent mail for %s (%s) uid=%d username=%s outbytes=%d", ++ from_strip(uad), buf, uid, pw->pw_name, outbytes); + + return(0); + } +--- ssmtp-2.61.orig/configure.in ++++ ssmtp-2.61/configure.in +@@ -24,8 +24,8 @@ + AC_STRUCT_TM + + dnl Checks for libraries. +-AC_CHECK_LIB(nsl, gethostname) +-AC_CHECK_LIB(socket, socket) ++AC_SEARCH_LIBS(gethostname, nsl) ++AC_SEARCH_LIBS(socket, socket) + + dnl Checks for library functions. + AC_TYPE_SIGNAL