summaryrefslogtreecommitdiffstats
path: root/tcpd/starttls.c
diff options
context:
space:
mode:
authorFlorianMickler2020-02-26 00:59:12 +0100
committerGitHub2020-02-26 00:59:12 +0100
commitd553cb68f8c4b37a2251b57f662006c87be5131c (patch)
treecf15fa1c36842eb4625b19c765e3391122981042 /tcpd/starttls.c
parent3beecc4b3822b86a7abd11c8ba2dba545ff94dd8 (diff)
downloadcourier-libs-d553cb68f8c4b37a2251b57f662006c87be5131c.tar.bz2
fix ssl client cert authentication (EXTERNAL)
The connect_callback verify_connection does setenv(TLS_SUBJECT_*) by calling dump_to_fp. These Environment variables are needed to do "AUTHENTICATE EXTERNAL" by doing a user lookup with one of the TLS_SUBJECT_* Variables (specified in the config file via TLS_EXTERNAL). If we call startclient() after the ssl connection has established, we actually do the fork()/exec with the updated environment and thus imapdlogin can do authentication. This error was not producing any error messages besides LOGIN FAILED. :( With this change, i was able to connect with openssl s_client, run "AUTHENTICATE EXTERNAL" and have a successfull login. No further testing was done.
Diffstat (limited to 'tcpd/starttls.c')
-rw-r--r--tcpd/starttls.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tcpd/starttls.c b/tcpd/starttls.c
index cb3bd2c..94cb3ac 100644
--- a/tcpd/starttls.c
+++ b/tcpd/starttls.c
@@ -542,8 +542,6 @@ static int dossl(int fd, int argn, int argc, char **argv)
stdin_fd=0;
stdout_fd=1;
- startclient(argn, argc, argv, fd, &stdin_fd, &stdout_fd);
-
if (username)
libmail_changeusername(username, 0);
@@ -566,6 +564,8 @@ static int dossl(int fd, int argn, int argc, char **argv)
return 1;
}
+ startclient(argn, argc, argv, fd, &stdin_fd, &stdout_fd);
+
docopy(ssl, fd, stdin_fd, stdout_fd);
tls_disconnect(ssl, fd);