summaryrefslogtreecommitdiffstats
path: root/tcpd/starttls.c
diff options
context:
space:
mode:
authorSam Varshavchik2018-06-28 07:13:10 -0400
committerSam Varshavchik2018-06-28 07:13:10 -0400
commit7be5e389cf0b2f94e80f06a6deddec7c612075f3 (patch)
tree0746eb946f24b64cf7f1b0e12dfe0ec4e764f7a9 /tcpd/starttls.c
parent4c78ff960c041b02f47f029aa39eed0c2750ac05 (diff)
downloadcourier-libs-7be5e389cf0b2f94e80f06a6deddec7c612075f3.tar.bz2
couriertls: add -user option
Diffstat (limited to 'tcpd/starttls.c')
-rw-r--r--tcpd/starttls.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/tcpd/starttls.c b/tcpd/starttls.c
index 23c4a69..cb3bd2c 100644
--- a/tcpd/starttls.c
+++ b/tcpd/starttls.c
@@ -10,6 +10,8 @@
#include "tlscache.h"
#include "rfc1035/rfc1035.h"
#include "soxwrap/soxwrap.h"
+#include "numlib/numlib.h"
+
#ifdef getc
#undef getc
#endif
@@ -74,6 +76,7 @@ const char *statusfd=0;
const char *tcpd=0;
const char *peer_verify_domain=0;
const char *fdprotocol=0;
+const char *username=0;
static FILE *errfp;
static FILE *statusfp;
@@ -536,6 +539,14 @@ static int dossl(int fd, int argn, int argc, char **argv)
info.connect_callback= &verify_connection;
info.app_data=NULL;
+ stdin_fd=0;
+ stdout_fd=1;
+
+ startclient(argn, argc, argv, fd, &stdin_fd, &stdout_fd);
+
+ if (username)
+ libmail_changeusername(username, 0);
+
ctx=tls_create(server ? 1:0, &info);
if (ctx == 0) return (1);
@@ -555,11 +566,6 @@ static int dossl(int fd, int argn, int argc, char **argv)
return 1;
}
- stdin_fd=0;
- stdout_fd=1;
-
- startclient(argn, argc, argv, fd, &stdin_fd, &stdout_fd);
-
docopy(ssl, fd, stdin_fd, stdout_fd);
tls_disconnect(ssl, fd);
@@ -778,6 +784,7 @@ static struct args arginfo[] = {
{ "verify", &peer_verify_domain},
{ "statusfd", &statusfd},
{ "protocol", &fdprotocol},
+ { "user", &username},
{0}};
void (*protocol_func)(int)=0;