ssmtp: package removal
* remove orphaned ssmtp package Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
f48625cbf9
commit
104936a2f7
7 changed files with 0 additions and 764 deletions
|
@ -1,60 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2007-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ssmtp
|
||||
PKG_VERSION:=2.64
|
||||
PKG_RELEASE:=7
|
||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
PKG_CPE_ID:=cpe:/a:ssmtp:ssmtp
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.bz2
|
||||
PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/s/ssmtp
|
||||
PKG_HASH:=22c37dc90c871e8e052b2cab0ad219d010fa938608cd66b21c8f3c759046fa36
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_CFLAGS += $(TARGET_CPPFLAGS)
|
||||
|
||||
define Package/ssmtp
|
||||
SECTION:=mail
|
||||
CATEGORY:=Mail
|
||||
DEPENDS:=+libopenssl
|
||||
TITLE:=A minimal and secure mail sender with ssl support
|
||||
URL:=http://packages.debian.org/ssmtp
|
||||
endef
|
||||
|
||||
define Package/ssmtp/description
|
||||
A secure, effective and simple way of getting mail off a system to your mail hub.
|
||||
Mail is simply forwarded to the configured mailhost, no daemons running in the background.
|
||||
Extremely easy configuration.
|
||||
|
||||
endef
|
||||
|
||||
define Package/ssmtp/conffiles
|
||||
/etc/ssmtp/ssmtp.conf
|
||||
/etc/ssmtp/revaliases
|
||||
endef
|
||||
|
||||
CONFIGURE_VARS += \
|
||||
LIBS="$(TARGET_LDFLAGS) -lcrypto -lssl"
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-ssl
|
||||
|
||||
define Package/ssmtp/install
|
||||
$(INSTALL_DIR) $(1)/etc/ssmtp
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/ssmtp.conf $(1)/etc/ssmtp/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/revaliases $(1)/etc/ssmtp/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ssmtp $(1)/usr/sbin/
|
||||
ln -s /usr/sbin/ssmtp $(1)/usr/sbin/sendmail
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ssmtp))
|
|
@ -1,466 +0,0 @@
|
|||
--- a/ssmtp.c
|
||||
+++ b/ssmtp.c
|
||||
@@ -55,21 +55,21 @@ bool_t use_oldauth = False; /* use old
|
||||
|
||||
#define ARPADATE_LENGTH 32 /* Current date in RFC format */
|
||||
char arpadate[ARPADATE_LENGTH];
|
||||
-char *auth_user = (char)NULL;
|
||||
-char *auth_pass = (char)NULL;
|
||||
-char *auth_method = (char)NULL; /* Mechanism for SMTP authentication */
|
||||
-char *mail_domain = (char)NULL;
|
||||
-char *from = (char)NULL; /* Use this as the From: address */
|
||||
+char *auth_user = NULL;
|
||||
+char *auth_pass = NULL;
|
||||
+char *auth_method = NULL; /* Mechanism for SMTP authentication */
|
||||
+char *mail_domain = NULL;
|
||||
+char *from = NULL; /* Use this as the From: address */
|
||||
char *hostname;
|
||||
char *mailhost = "mailhub";
|
||||
-char *minus_f = (char)NULL;
|
||||
-char *minus_F = (char)NULL;
|
||||
+char *minus_f = NULL;
|
||||
+char *minus_F = NULL;
|
||||
char *gecos;
|
||||
-char *prog = (char)NULL;
|
||||
+char *prog = NULL;
|
||||
char *root = NULL;
|
||||
char *tls_cert = "/etc/ssl/certs/ssmtp.pem"; /* Default Certificate */
|
||||
-char *uad = (char)NULL;
|
||||
-char *config_file = (char)NULL; /* alternate configuration file */
|
||||
+char *uad = NULL;
|
||||
+char *config_file = NULL; /* alternate configuration file */
|
||||
|
||||
headers_t headers, *ht;
|
||||
|
||||
@@ -261,7 +261,7 @@ char *strip_post_ws(char *str)
|
||||
|
||||
p = (str + strlen(str));
|
||||
while(isspace(*--p)) {
|
||||
- *p = (char)NULL;
|
||||
+ *p = '\0';
|
||||
}
|
||||
|
||||
return(p);
|
||||
@@ -279,7 +279,7 @@ char *addr_parse(char *str)
|
||||
#endif
|
||||
|
||||
/* Simple case with email address enclosed in <> */
|
||||
- if((p = strdup(str)) == (char *)NULL) {
|
||||
+ if((p = strdup(str)) == NULL) {
|
||||
die("addr_parse(): strdup()");
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ char *addr_parse(char *str)
|
||||
q++;
|
||||
|
||||
if((p = strchr(q, '>'))) {
|
||||
- *p = (char)NULL;
|
||||
+ *p = '\0';
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -310,7 +310,7 @@ char *addr_parse(char *str)
|
||||
q = strip_post_ws(p);
|
||||
if(*q == ')') {
|
||||
while((*--q != '('));
|
||||
- *q = (char)NULL;
|
||||
+ *q = '\0';
|
||||
}
|
||||
(void)strip_post_ws(p);
|
||||
|
||||
@@ -349,7 +349,6 @@ standardise() -- Trim off '\n's and doub
|
||||
*/
|
||||
bool_t standardise(char *str, bool_t *linestart)
|
||||
{
|
||||
- size_t sl;
|
||||
char *p;
|
||||
bool_t leadingdot = False;
|
||||
|
||||
@@ -363,7 +362,7 @@ bool_t standardise(char *str, bool_t *li
|
||||
*linestart = False;
|
||||
|
||||
if((p = strchr(str, '\n'))) {
|
||||
- *p = (char)NULL;
|
||||
+ *p = '\0';
|
||||
*linestart = True;
|
||||
}
|
||||
return(leadingdot);
|
||||
@@ -384,7 +383,7 @@ void revaliases(struct passwd *pw)
|
||||
while(fgets(buf, sizeof(buf), fp)) {
|
||||
/* Make comments invisible */
|
||||
if((p = strchr(buf, '#'))) {
|
||||
- *p = (char)NULL;
|
||||
+ *p = '\0';
|
||||
}
|
||||
|
||||
/* Ignore malformed lines and comments */
|
||||
@@ -519,11 +518,11 @@ void rcpt_save(char *str)
|
||||
#endif
|
||||
|
||||
/* Ignore missing usernames */
|
||||
- if(*str == (char)NULL) {
|
||||
+ if(*str == '\0') {
|
||||
return;
|
||||
}
|
||||
|
||||
- if((rt->string = strdup(str)) == (char *)NULL) {
|
||||
+ if((rt->string = strdup(str)) == NULL) {
|
||||
die("rcpt_save() -- strdup() failed");
|
||||
}
|
||||
|
||||
@@ -548,7 +547,7 @@ void rcpt_parse(char *str)
|
||||
(void)fprintf(stderr, "*** rcpt_parse(): str = [%s]\n", str);
|
||||
#endif
|
||||
|
||||
- if((p = strdup(str)) == (char *)NULL) {
|
||||
+ if((p = strdup(str)) == NULL) {
|
||||
die("rcpt_parse(): strdup() failed");
|
||||
}
|
||||
q = p;
|
||||
@@ -576,7 +575,7 @@ void rcpt_parse(char *str)
|
||||
}
|
||||
|
||||
/* End of string? */
|
||||
- if(*(q + 1) == (char)NULL) {
|
||||
+ if(*(q + 1) == '\0') {
|
||||
got_addr = True;
|
||||
}
|
||||
|
||||
@@ -584,7 +583,7 @@ void rcpt_parse(char *str)
|
||||
if((*q == ',') && (in_quotes == False)) {
|
||||
got_addr = True;
|
||||
|
||||
- *q = (char)NULL;
|
||||
+ *q = '\0';
|
||||
}
|
||||
|
||||
if(got_addr) {
|
||||
@@ -668,7 +667,7 @@ void header_save(char *str)
|
||||
(void)fprintf(stderr, "header_save(): str = [%s]\n", str);
|
||||
#endif
|
||||
|
||||
- if((p = strdup(str)) == (char *)NULL) {
|
||||
+ if((p = strdup(str)) == NULL) {
|
||||
die("header_save() -- strdup() failed");
|
||||
}
|
||||
ht->string = p;
|
||||
@@ -676,7 +675,7 @@ void header_save(char *str)
|
||||
if(strncasecmp(ht->string, "From:", 5) == 0) {
|
||||
#if 1
|
||||
/* Hack check for NULL From: line */
|
||||
- if(*(p + 6) == (char)NULL) {
|
||||
+ if(*(p + 6) == '\0') {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -739,19 +738,19 @@ header_parse() -- Break headers into sep
|
||||
void header_parse(FILE *stream)
|
||||
{
|
||||
size_t size = BUF_SZ, len = 0;
|
||||
- char *p = (char *)NULL, *q;
|
||||
+ char *p = NULL, *q;
|
||||
bool_t in_header = True;
|
||||
- char l = (char)NULL;
|
||||
+ char l = '\0';
|
||||
int c;
|
||||
|
||||
while(in_header && ((c = fgetc(stream)) != EOF)) {
|
||||
/* Must have space for up to two more characters, since we
|
||||
may need to insert a '\r' */
|
||||
- if((p == (char *)NULL) || (len >= (size - 1))) {
|
||||
+ if((p == NULL) || (len >= (size - 1))) {
|
||||
size += BUF_SZ;
|
||||
|
||||
p = (char *)realloc(p, (size * sizeof(char)));
|
||||
- if(p == (char *)NULL) {
|
||||
+ if(p == NULL) {
|
||||
die("header_parse() -- realloc() failed");
|
||||
}
|
||||
q = (p + len);
|
||||
@@ -776,9 +775,9 @@ void header_parse(FILE *stream)
|
||||
in_header = False;
|
||||
|
||||
default:
|
||||
- *q = (char)NULL;
|
||||
+ *q = '\0';
|
||||
if((q = strrchr(p, '\n'))) {
|
||||
- *q = (char)NULL;
|
||||
+ *q = '\0';
|
||||
}
|
||||
header_save(p);
|
||||
|
||||
@@ -809,9 +808,9 @@ void header_parse(FILE *stream)
|
||||
in_header = False;
|
||||
|
||||
default:
|
||||
- *q = (char)NULL;
|
||||
+ *q = '\0';
|
||||
if((q = strrchr(p, '\n'))) {
|
||||
- *q = (char)NULL;
|
||||
+ *q = '\0';
|
||||
}
|
||||
header_save(p);
|
||||
|
||||
@@ -876,11 +875,11 @@ bool_t read_config()
|
||||
char *rightside;
|
||||
/* Make comments invisible */
|
||||
if((p = strchr(buf, '#'))) {
|
||||
- *p = (char)NULL;
|
||||
+ *p = '\0';
|
||||
}
|
||||
|
||||
/* Ignore malformed lines and comments */
|
||||
- if(strchr(buf, '=') == (char *)NULL) continue;
|
||||
+ if(strchr(buf, '=') == NULL) continue;
|
||||
|
||||
/* Parse out keywords */
|
||||
p=firsttok(&begin, "= \t\n");
|
||||
@@ -890,7 +889,7 @@ bool_t read_config()
|
||||
}
|
||||
if(p && q) {
|
||||
if(strcasecmp(p, "Root") == 0) {
|
||||
- if((root = strdup(q)) == (char *)NULL) {
|
||||
+ if((root = strdup(q)) == NULL) {
|
||||
die("parse_config() -- strdup() failed");
|
||||
}
|
||||
|
||||
@@ -904,7 +903,7 @@ bool_t read_config()
|
||||
port = atoi(r);
|
||||
}
|
||||
|
||||
- if((mailhost = strdup(q)) == (char *)NULL) {
|
||||
+ if((mailhost = strdup(q)) == NULL) {
|
||||
die("parse_config() -- strdup() failed");
|
||||
}
|
||||
|
||||
@@ -949,7 +948,7 @@ bool_t read_config()
|
||||
mail_domain = strdup(q);
|
||||
}
|
||||
|
||||
- if(mail_domain == (char *)NULL) {
|
||||
+ if(mail_domain == NULL) {
|
||||
die("parse_config() -- strdup() failed");
|
||||
}
|
||||
rewrite_domain = True;
|
||||
@@ -1025,7 +1024,7 @@ bool_t read_config()
|
||||
}
|
||||
}
|
||||
else if(strcasecmp(p, "TLSCert") == 0) {
|
||||
- if((tls_cert = strdup(q)) == (char *)NULL) {
|
||||
+ if((tls_cert = strdup(q)) == NULL) {
|
||||
die("parse_config() -- strdup() failed");
|
||||
}
|
||||
|
||||
@@ -1036,7 +1035,7 @@ bool_t read_config()
|
||||
#endif
|
||||
/* Command-line overrides these */
|
||||
else if(strcasecmp(p, "AuthUser") == 0 && !auth_user) {
|
||||
- if((auth_user = strdup(q)) == (char *)NULL) {
|
||||
+ if((auth_user = strdup(q)) == NULL) {
|
||||
die("parse_config() -- strdup() failed");
|
||||
}
|
||||
|
||||
@@ -1045,7 +1044,7 @@ bool_t read_config()
|
||||
}
|
||||
}
|
||||
else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) {
|
||||
- if((auth_pass = strdup(q)) == (char *)NULL) {
|
||||
+ if((auth_pass = strdup(q)) == NULL) {
|
||||
die("parse_config() -- strdup() failed");
|
||||
}
|
||||
|
||||
@@ -1054,7 +1053,7 @@ bool_t read_config()
|
||||
}
|
||||
}
|
||||
else if(strcasecmp(p, "AuthMethod") == 0 && !auth_method) {
|
||||
- if((auth_method = strdup(q)) == (char *)NULL) {
|
||||
+ if((auth_method = strdup(q)) == NULL) {
|
||||
die("parse_config() -- strdup() failed");
|
||||
}
|
||||
|
||||
@@ -1119,14 +1118,11 @@ int smtp_open(char *host, int port)
|
||||
char buf[(BUF_SZ + 1)];
|
||||
|
||||
/* Init SSL stuff */
|
||||
- SSL_CTX *ctx;
|
||||
- SSL_METHOD *meth;
|
||||
+ SSL_CTX *ctx = NULL;
|
||||
X509 *server_cert;
|
||||
-
|
||||
SSL_load_error_strings();
|
||||
SSLeay_add_ssl_algorithms();
|
||||
- meth=SSLv23_client_method();
|
||||
- ctx = SSL_CTX_new(meth);
|
||||
+ ctx = SSL_CTX_new(SSLv23_client_method());
|
||||
if(!ctx) {
|
||||
log_event(LOG_ERR, "No SSL support initiated\n");
|
||||
return(-1);
|
||||
@@ -1310,7 +1306,7 @@ char *fd_gets(char *buf, int size, int f
|
||||
buf[i++] = c;
|
||||
}
|
||||
}
|
||||
- buf[i] = (char)NULL;
|
||||
+ buf[i] = '\0';
|
||||
|
||||
return(buf);
|
||||
}
|
||||
@@ -1434,14 +1430,14 @@ int ssmtp(char *argv[])
|
||||
}
|
||||
|
||||
if((p = strtok(pw->pw_gecos, ";,"))) {
|
||||
- if((gecos = strdup(p)) == (char *)NULL) {
|
||||
+ if((gecos = strdup(p)) == NULL) {
|
||||
die("ssmtp() -- strdup() failed");
|
||||
}
|
||||
}
|
||||
revaliases(pw);
|
||||
|
||||
/* revaliases() may have defined this */
|
||||
- if(uad == (char *)NULL) {
|
||||
+ if(uad == NULL) {
|
||||
uad = append_domain(pw->pw_name);
|
||||
}
|
||||
|
||||
@@ -1489,7 +1485,7 @@ int ssmtp(char *argv[])
|
||||
/* Try to log in if username was supplied */
|
||||
if(auth_user) {
|
||||
#ifdef MD5AUTH
|
||||
- if(auth_pass == (char *)NULL) {
|
||||
+ if(auth_pass == NULL) {
|
||||
auth_pass = strdup("");
|
||||
}
|
||||
|
||||
@@ -1508,7 +1504,7 @@ int ssmtp(char *argv[])
|
||||
else {
|
||||
#endif
|
||||
memset(buf, 0, bufsize);
|
||||
- to64frombits(buf, auth_user, strlen(auth_user));
|
||||
+ to64frombits(buf, (unsigned char *)auth_user, strlen(auth_user));
|
||||
if (use_oldauth) {
|
||||
outbytes += smtp_write(sock, "AUTH LOGIN %s", buf);
|
||||
}
|
||||
@@ -1520,7 +1516,7 @@ int ssmtp(char *argv[])
|
||||
}
|
||||
/* we assume server asked us for Username */
|
||||
memset(buf, 0, bufsize);
|
||||
- to64frombits(buf, auth_user, strlen(auth_user));
|
||||
+ to64frombits(buf, (unsigned char *)auth_user, strlen(auth_user));
|
||||
outbytes += smtp_write(sock, buf);
|
||||
}
|
||||
|
||||
@@ -1530,7 +1526,7 @@ int ssmtp(char *argv[])
|
||||
}
|
||||
memset(buf, 0, bufsize);
|
||||
|
||||
- to64frombits(buf, auth_pass, strlen(auth_pass));
|
||||
+ to64frombits(buf, (unsigned char *)auth_pass, strlen(auth_pass));
|
||||
#ifdef MD5AUTH
|
||||
}
|
||||
#endif
|
||||
@@ -1737,7 +1733,7 @@ char **parse_options(int argc, char *arg
|
||||
j = 0;
|
||||
|
||||
add = 1;
|
||||
- while(argv[i][++j] != (char)NULL) {
|
||||
+ while(argv[i][++j] != '\0') {
|
||||
switch(argv[i][j]) {
|
||||
#ifdef INET6
|
||||
case '6':
|
||||
@@ -1755,14 +1751,14 @@ char **parse_options(int argc, char *arg
|
||||
if((!argv[i][(j + 1)])
|
||||
&& argv[(i + 1)]) {
|
||||
auth_user = strdup(argv[i+1]);
|
||||
- if(auth_user == (char *)NULL) {
|
||||
+ if(auth_user == NULL) {
|
||||
die("parse_options() -- strdup() failed");
|
||||
}
|
||||
add++;
|
||||
}
|
||||
else {
|
||||
auth_user = strdup(argv[i]+j+1);
|
||||
- if(auth_user == (char *)NULL) {
|
||||
+ if(auth_user == NULL) {
|
||||
die("parse_options() -- strdup() failed");
|
||||
}
|
||||
}
|
||||
@@ -1772,14 +1768,14 @@ char **parse_options(int argc, char *arg
|
||||
if((!argv[i][(j + 1)])
|
||||
&& argv[(i + 1)]) {
|
||||
auth_pass = strdup(argv[i+1]);
|
||||
- if(auth_pass == (char *)NULL) {
|
||||
+ if(auth_pass == NULL) {
|
||||
die("parse_options() -- strdup() failed");
|
||||
}
|
||||
add++;
|
||||
}
|
||||
else {
|
||||
auth_pass = strdup(argv[i]+j+1);
|
||||
- if(auth_pass == (char *)NULL) {
|
||||
+ if(auth_pass == NULL) {
|
||||
die("parse_options() -- strdup() failed");
|
||||
}
|
||||
}
|
||||
@@ -1870,14 +1866,14 @@ char **parse_options(int argc, char *arg
|
||||
case 'F':
|
||||
if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
|
||||
minus_F = strdup(argv[(i + 1)]);
|
||||
- if(minus_F == (char *)NULL) {
|
||||
+ if(minus_F == NULL) {
|
||||
die("parse_options() -- strdup() failed");
|
||||
}
|
||||
add++;
|
||||
}
|
||||
else {
|
||||
minus_F = strdup(argv[i]+j+1);
|
||||
- if(minus_F == (char *)NULL) {
|
||||
+ if(minus_F == NULL) {
|
||||
die("parse_options() -- strdup() failed");
|
||||
}
|
||||
}
|
||||
@@ -1889,14 +1885,14 @@ char **parse_options(int argc, char *arg
|
||||
case 'r':
|
||||
if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
|
||||
minus_f = strdup(argv[(i + 1)]);
|
||||
- if(minus_f == (char *)NULL) {
|
||||
+ if(minus_f == NULL) {
|
||||
die("parse_options() -- strdup() failed");
|
||||
}
|
||||
add++;
|
||||
}
|
||||
else {
|
||||
minus_f = strdup(argv[i]+j+1);
|
||||
- if(minus_f == (char *)NULL) {
|
||||
+ if(minus_f == NULL) {
|
||||
die("parse_options() -- strdup() failed");
|
||||
}
|
||||
}
|
||||
--- a/base64.c
|
||||
+++ b/base64.c
|
||||
@@ -31,7 +31,7 @@ static const char base64val[] = {
|
||||
};
|
||||
#define DECODE64(c) (isascii(c) ? base64val[c] : BAD)
|
||||
|
||||
-void to64frombits(unsigned char *out, const unsigned char *in, int inlen)
|
||||
+void to64frombits(char *out, const unsigned char *in, int inlen)
|
||||
/* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
|
||||
{
|
||||
for (; inlen >= 3; inlen -= 3)
|
||||
@@ -57,7 +57,7 @@ void to64frombits(unsigned char *out, co
|
||||
*out = '\0';
|
||||
}
|
||||
|
||||
-int from64tobits(char *out, const char *in)
|
||||
+int from64tobits(unsigned char *out, const char *in)
|
||||
/* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */
|
||||
{
|
||||
int len = 0;
|
||||
--- a/ssmtp.h
|
||||
+++ b/ssmtp.h
|
||||
@@ -41,5 +41,5 @@ typedef struct string_list rcpt_t;
|
||||
void get_arpadate(char *);
|
||||
|
||||
/* base64.c */
|
||||
-void to64frombits(unsigned char *, const unsigned char *, int);
|
||||
-int from64tobits(char *, const char *);
|
||||
+void to64frombits(char *, const unsigned char *, int);
|
||||
+int from64tobits(unsigned char *, const char *);
|
|
@ -1,94 +0,0 @@
|
|||
--- a/ssmtp.c
|
||||
+++ b/ssmtp.c
|
||||
@@ -138,71 +138,7 @@ int smtp_read_all(int fd, char *response
|
||||
int smtp_okay(int fd, char *response);
|
||||
|
||||
/*
|
||||
-dead_letter() -- Save stdin to ~/dead.letter if possible
|
||||
-*/
|
||||
-void dead_letter(void)
|
||||
-{
|
||||
- char *path;
|
||||
- char buf[(BUF_SZ + 1)];
|
||||
- struct passwd *pw;
|
||||
- uid_t uid;
|
||||
- FILE *fp;
|
||||
-
|
||||
- uid = getuid();
|
||||
- pw = getpwuid(uid);
|
||||
-
|
||||
- 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);
|
||||
- }
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if(pw == (struct passwd *)NULL) {
|
||||
- /* Far to early to save things */
|
||||
- if(log_level > 0) {
|
||||
- log_event(LOG_ERR, "No sender failing horribly!");
|
||||
- }
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
-#define DEAD_LETTER "/dead.letter"
|
||||
- path = malloc (strlen (pw->pw_dir) + sizeof (DEAD_LETTER));
|
||||
- if (!path) {
|
||||
- /* Can't use die() here since dead_letter() is called from die() */
|
||||
- exit(1);
|
||||
- }
|
||||
- memcpy (path, pw->pw_dir, strlen (pw->pw_dir));
|
||||
- memcpy (path + strlen (pw->pw_dir), DEAD_LETTER, sizeof (DEAD_LETTER));
|
||||
-
|
||||
- if((fp = fopen(path, "a")) == (FILE *)NULL) {
|
||||
- /* Perhaps the person doesn't have a homedir... */
|
||||
- if(log_level > 0) {
|
||||
- log_event(LOG_ERR, "Can't open %s failing horribly!", path);
|
||||
- }
|
||||
- free(path);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- /* We start on a new line with a blank line separating messages */
|
||||
- (void)fprintf(fp, "\n\n");
|
||||
-
|
||||
- while(fgets(buf, sizeof(buf), stdin)) {
|
||||
- (void)fputs(buf, fp);
|
||||
- }
|
||||
-
|
||||
- if(fclose(fp) == -1) {
|
||||
- if(log_level > 0) {
|
||||
- log_event(LOG_ERR,
|
||||
- "Can't close %s/dead.letter, possibly truncated", pw->pw_dir);
|
||||
- }
|
||||
- }
|
||||
- free(path);
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
-die() -- Write error message, dead.letter and exit
|
||||
+die() -- Write error message and exit
|
||||
*/
|
||||
void die(char *format, ...)
|
||||
{
|
||||
@@ -216,9 +152,6 @@ void die(char *format, ...)
|
||||
(void)fprintf(stderr, "%s: %s\n", prog, buf);
|
||||
log_event(LOG_ERR, "%s", buf);
|
||||
|
||||
- /* Send message to dead.letter */
|
||||
- (void)dead_letter();
|
||||
-
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1640,7 +1573,7 @@ int ssmtp(char *argv[])
|
||||
sleep(1);
|
||||
/* don't hang forever when reading from stdin */
|
||||
if (++timeout >= MEDWAIT) {
|
||||
- log_event(LOG_ERR, "killed: timeout on stdin while reading body -- message saved to dead.letter.");
|
||||
+ log_event(LOG_ERR, "killed: timeout on stdin while reading body.");
|
||||
die("Timeout on stdin while reading body");
|
||||
}
|
||||
continue;
|
|
@ -1,21 +0,0 @@
|
|||
--- a/ssmtp.c
|
||||
+++ b/ssmtp.c
|
||||
@@ -1338,6 +1338,7 @@ ssmtp() -- send the message (exactly one
|
||||
int ssmtp(char *argv[])
|
||||
{
|
||||
char b[(BUF_SZ + 2)], *buf = b+1, *p, *q;
|
||||
+ char *remote_addr;
|
||||
#ifdef MD5AUTH
|
||||
char challenge[(BUF_SZ + 1)];
|
||||
#endif
|
||||
@@ -1541,6 +1542,10 @@ int ssmtp(char *argv[])
|
||||
outbytes += smtp_write(sock, "From: %s", from);
|
||||
}
|
||||
|
||||
+ if(remote_addr=getenv("REMOTE_ADDR")) {
|
||||
+ outbytes += smtp_write(sock, "X-Originating-IP: %s", remote_addr);
|
||||
+ }
|
||||
+
|
||||
if(have_date == False) {
|
||||
outbytes += smtp_write(sock, "Date: %s", arpadate);
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
--- a/ssmtp.c
|
||||
+++ b/ssmtp.c
|
||||
@@ -1591,12 +1591,12 @@ int ssmtp(char *argv[])
|
||||
outbytes += smtp_write(sock, "%s", leadingdot ? b : buf);
|
||||
} else {
|
||||
if (log_level > 0) {
|
||||
- log_event(LOG_INFO, "Sent a very long line in chunks");
|
||||
+ log_event(LOG_INFO, "Sending a partial line");
|
||||
}
|
||||
if (leadingdot) {
|
||||
- outbytes += fd_puts(sock, b, sizeof(b));
|
||||
+ outbytes += fd_puts(sock, b, strlen(b));
|
||||
} else {
|
||||
- outbytes += fd_puts(sock, buf, bufsize);
|
||||
+ outbytes += fd_puts(sock, buf, strlen(buf));
|
||||
}
|
||||
}
|
||||
(void)alarm((unsigned) MEDWAIT);
|
|
@ -1,92 +0,0 @@
|
|||
--- a/ssmtp.c
|
||||
+++ b/ssmtp.c
|
||||
@@ -282,6 +282,7 @@ standardise() -- Trim off '\n's and doub
|
||||
*/
|
||||
bool_t standardise(char *str, bool_t *linestart)
|
||||
{
|
||||
+ size_t sl;
|
||||
char *p;
|
||||
bool_t leadingdot = False;
|
||||
|
||||
@@ -297,6 +298,12 @@ bool_t standardise(char *str, bool_t *li
|
||||
if((p = strchr(str, '\n'))) {
|
||||
*p = '\0';
|
||||
*linestart = True;
|
||||
+
|
||||
+ /* If the line ended in "\r\n", then drop the '\r' too */
|
||||
+ sl = strlen(str);
|
||||
+ if(sl >= 1 && str[sl - 1] == '\r') {
|
||||
+ str[sl - 1] = '\0';
|
||||
+ }
|
||||
}
|
||||
return(leadingdot);
|
||||
}
|
||||
@@ -690,6 +697,14 @@ void header_parse(FILE *stream)
|
||||
}
|
||||
len++;
|
||||
|
||||
+ if(l == '\r' && c == '\n') {
|
||||
+ /* Properly handle input that already has "\r\n"
|
||||
+ line endings; see https://bugs.debian.org/584162 */
|
||||
+ l = (len >= 2 ? *(q - 2) : '\n');
|
||||
+ q--;
|
||||
+ len--;
|
||||
+ }
|
||||
+
|
||||
if(l == '\n') {
|
||||
switch(c) {
|
||||
case ' ':
|
||||
@@ -712,8 +727,9 @@ void header_parse(FILE *stream)
|
||||
if((q = strrchr(p, '\n'))) {
|
||||
*q = '\0';
|
||||
}
|
||||
- header_save(p);
|
||||
-
|
||||
+ if(len > 0) {
|
||||
+ header_save(p);
|
||||
+ }
|
||||
q = p;
|
||||
len = 0;
|
||||
}
|
||||
@@ -722,35 +738,12 @@ void header_parse(FILE *stream)
|
||||
|
||||
l = c;
|
||||
}
|
||||
- if(in_header) {
|
||||
- if(l == '\n') {
|
||||
- switch(c) {
|
||||
- case ' ':
|
||||
- case '\t':
|
||||
- /* Must insert '\r' before '\n's embedded in header
|
||||
- fields otherwise qmail won't accept our mail
|
||||
- because a bare '\n' violates some RFC */
|
||||
-
|
||||
- *(q - 1) = '\r'; /* Replace previous \n with \r */
|
||||
- *q++ = '\n'; /* Insert \n */
|
||||
- len++;
|
||||
-
|
||||
- break;
|
||||
-
|
||||
- case '\n':
|
||||
- in_header = False;
|
||||
-
|
||||
- default:
|
||||
- *q = '\0';
|
||||
- if((q = strrchr(p, '\n'))) {
|
||||
- *q = '\0';
|
||||
- }
|
||||
- header_save(p);
|
||||
-
|
||||
- q = p;
|
||||
- len = 0;
|
||||
- }
|
||||
- }
|
||||
+ if(in_header && l == '\n') {
|
||||
+ /* Got EOF while reading the header */
|
||||
+ if((q = strrchr(p, '\n'))) {
|
||||
+ *q = '\0';
|
||||
+ }
|
||||
+ header_save(p);
|
||||
}
|
||||
(void)free(p);
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
--- a/ssmtp.c
|
||||
+++ b/ssmtp.c
|
||||
@@ -1046,8 +1046,10 @@ int smtp_open(char *host, int port)
|
||||
/* Init SSL stuff */
|
||||
SSL_CTX *ctx = NULL;
|
||||
X509 *server_cert;
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
SSL_load_error_strings();
|
||||
SSLeay_add_ssl_algorithms();
|
||||
+#endif
|
||||
ctx = SSL_CTX_new(SSLv23_client_method());
|
||||
if(!ctx) {
|
||||
log_event(LOG_ERR, "No SSL support initiated\n");
|
Loading…
Reference in a new issue