summaryrefslogtreecommitdiff
path: root/src/tls/s6-tlsserver.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-05-28 01:05:56 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2021-05-28 01:05:56 +0000
commit02afa553cc33400ead38ac85f8f7f2f3fe79f49d (patch)
treed0d22ad521d9d3b8e28af128bae0ec796b35ff74 /src/tls/s6-tlsserver.c
parentd5ce828c97505e429e0cc87b5e87da4f7d291ad4 (diff)
downloads6-networking-02afa553cc33400ead38ac85f8f7f2f3fe79f49d.tar.xz
Server-side SNI, libtls version
Implementation for bearssl coming soon.
Diffstat (limited to 'src/tls/s6-tlsserver.c')
-rw-r--r--src/tls/s6-tlsserver.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/tls/s6-tlsserver.c b/src/tls/s6-tlsserver.c
index 0a6ae78..623bbfa 100644
--- a/src/tls/s6-tlsserver.c
+++ b/src/tls/s6-tlsserver.c
@@ -15,7 +15,7 @@
#define USAGE "s6-tlsserver [ -e ] [ options ] ip port prog...\n" \
"s6-tcpserver options: [ -q | -Q | -v ] [ -4 | -6 ] [ -1 ] [ -c maxconn ] [ -C localmaxconn ] [ -b backlog ] [ -G gidlist ] [ -g gid ] [ -u uid ] [ -U ]\n" \
"s6-tcpserver-access options: [ -W | -w ] [ -D | -d ] [ -H | -h ] [ -R | -r ] [ -P | -p ] [ -l localname ] [ -B banner ] [ -t timeout ] [ -i rulesdir | -x rulesfile ]\n" \
-"s6-tlsd options: [ -S | -s ] [ -Y | -y ] [ -K timeout ] [ -Z | -z ]"
+"s6-tlsd options: [ -S | -s ] [ -Y | -y ] [ -K timeout ] [ -Z | -z ] [ -k snilevel ]"
#define dieusage() strerr_dieusage(100, USAGE)
@@ -34,6 +34,7 @@ struct options_s
unsigned int backlog ;
unsigned int timeout ;
unsigned int kimeout ;
+ unsigned int snilevel ;
unsigned int verbosity : 2 ;
unsigned int flag46 : 2 ;
unsigned int flag1 : 1 ;
@@ -66,6 +67,7 @@ struct options_s
.timeout = 0, \
.kimeout = 0, \
.verbosity = 1, \
+ .snilevel = 0, \
.flag46 = 0, \
.flag1 = 0, \
.flagU = 0, \
@@ -91,7 +93,7 @@ int main (int argc, char const *const *argv)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "qQv461c:C:b:G:g:u:UWwDdHhRrPpleB:t:i:x:SsYyK:Zz", &l) ;
+ int opt = subgetopt_r(argc, argv, "qQv461c:C:b:G:g:u:UWwDdHhRrPpleB:t:i:x:SsYyK:Zzk:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -131,6 +133,7 @@ int main (int argc, char const *const *argv)
case 'K' : if (!uint0_scan(l.arg, &o.kimeout)) dieusage() ; break ;
case 'Z' : o.flagZ = 1 ; break ;
case 'z' : o.flagZ = 0 ; break ;
+ case 'k' : if (!uint0_scan(l.arg, &o.snilevel)) dieusage() ; break ;
default : dieusage() ;
}
}
@@ -142,7 +145,7 @@ int main (int argc, char const *const *argv)
size_t pos = 0 ;
unsigned int m = 0 ;
char fmt[UINT_FMT * 5 + UID_FMT + GID_FMT * (NGROUPS_MAX + 1)] ;
- char const *newargv[45 + argc] ;
+ char const *newargv[46 + argc] ;
newargv[m++] = S6_NETWORKING_BINPREFIX "s6-tcpserver" ;
if (o.verbosity != 1) newargv[m++] = o.verbosity ? "-v" : "-q" ;
if (o.flag46) newargv[m++] = o.flag46 == 1 ? "-4" : "-6" ;
@@ -223,6 +226,8 @@ int main (int argc, char const *const *argv)
fmt[pos++] = 0 ;
}
if (o.flagZ) newargv[m++] = "-Z" ;
+ if (o.snilevel >= 2) newargv[m++] = "-k2" ;
+ else if (o.snilevel) newargv[m++] = "-k1" ;
newargv[m++] = "--" ;
if (o.doapply)
{