Skip to content

Commit

Permalink
Merge branch 'bruceg:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ionum authored Oct 17, 2023
2 parents 1c62711 + 7ed88a0 commit f7d3da2
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
8 changes: 8 additions & 0 deletions doc/nullmailer-queue.8
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ The directory in which messages are formed temporarily.
A pipe used to trigger
.BR nullmailer-send
to immediately start sending the message from the queue.
.PP
Note that due to
.B nullmailer-queue
using hard links to manage emails both
.I /var/spool/nullmailer/queue
and
.I /var/spool/nullmailer/tmp
MUST reside on the same filesystem.
.SH SEE ALSO
nullmailer-inject(1),
nullmailer-send(8)
Expand Down
3 changes: 3 additions & 0 deletions doc/nullmailer-send.8
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ Set the source address for connections to the remote host.
.B auth-login
Force SMTP "AUTH LOGIN" mode instead of auto-detecting.
.TP
.B auth-external
Use SMTP "AUTH EXTERNAL" for TLS client certificate authentication.
.TP
.B tls
Connect using TLS.
This will automatically switch the default port to
Expand Down
2 changes: 2 additions & 0 deletions protocols/protocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ cli_option cli_options[] = {
{ 0, "source", cli_option::string, 0, &source,
"Source address for connections", 0 },
#ifdef HAVE_TLS
{ 0, "auth-external", cli_option::flag, AUTH_EXTERNAL, &auth_method,
"Use AUTH EXTERNAL for certificate based authentication", 0 },
{ 0, "tls", cli_option::flag, 1, &use_tls,
"Connect using TLS (on an alternate port by default)", 0 },
{ 0, "ssl", cli_option::flag, 1, &use_tls,
Expand Down
1 change: 1 addition & 0 deletions protocols/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extern void protocol_succ(const char* msg);
#define AUTH_DETECT 0
#define AUTH_LOGIN 1
#define AUTH_PLAIN 2
#define AUTH_EXTERNAL 3
extern const char* user;
extern const char* pass;
extern int auth_method;
Expand Down
9 changes: 8 additions & 1 deletion protocols/smtp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,14 @@ void protocol_send(fdibuf& in, fdibuf& netin, fdobuf& netout)
if (!did_starttls)
conn.docmd("", 200);

if (user != 0 && pass != 0) {
if (auth_method == AUTH_EXTERNAL) {
conn.dohelo(true);
if (conn.hascap("AUTH", "EXTERNAL"))
conn.docmd("AUTH EXTERNAL =", 200, ERR_AUTH_FAILED);
else
protocol_fail(ERR_MSG_TEMPFAIL, "Server does not advertise certificate authentication");
}
else if (user != 0 && pass != 0) {
conn.dohelo(true);
if (auth_method == AUTH_LOGIN)
conn.auth_login();
Expand Down
6 changes: 6 additions & 0 deletions test/accept-smtp.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
echo 250-domain.com
echo 250-8BITMIME
echo 250-ENHANCEDSTATUSCODES
echo 250-SIZE 36700160
echo 250-DSN
echo 250-AUTH PLAIN LOGIN
echo 250 OK
echo 250 OK
echo 250 OK
Expand Down

0 comments on commit f7d3da2

Please sign in to comment.