diff --git a/include/email.h b/include/email.h index 5800265..a8ec3e2 100644 --- a/include/email.h +++ b/include/email.h @@ -60,9 +60,9 @@ struct addr { typedef enum { GPG_SIG=0x01, GPG_ENC=0x02 } GpgCallType; -/* Globally defined vars */ -dhash table; -char *conf_file; +/* Globally defined vars (defined in email.c) */ +extern dhash table; +extern char *conf_file; struct mailer_options { bool verbose; @@ -78,7 +78,9 @@ struct mailer_options { dlist to; dlist cc; dlist bcc; -} Mopts; +}; + +extern struct mailer_options Mopts; void usage(void); diff --git a/src/email.c b/src/email.c index 524e9be..d62f65d 100644 --- a/src/email.c +++ b/src/email.c @@ -40,6 +40,11 @@ #include "error.h" #include "mimeutils.h" +/* Global variables declared in email.h */ +dhash table; +char *conf_file; +struct mailer_options Mopts; + static void defaultDestr(void *ptr) { diff --git a/src/processmail.c b/src/processmail.c index 88f708d..e4e8b9c 100644 --- a/src/processmail.c +++ b/src/processmail.c @@ -173,7 +173,12 @@ processRemote(const char *smtp_serv, int smtp_port, dstrbuf *msg) #endif if (use_tls && strcasecmp(use_tls, "true") == 0) { if (smtpStartTls(sd) != ERROR) { - dnetUseTls(sd); + if (dnetUseTls(sd) == ERROR) { + fatal("Could not establish TLS connection: %s\n", + dnetGetErr(sd)); + retval = ERROR; + goto end; + } dnetVerifyCert(sd); if (smtpInitAfterTLS(sd, nodename) == ERROR) { printSmtpError();