summaryrefslogtreecommitdiff
path: root/src/tls
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-11-17 03:04:59 +0000
committerLaurent Bercot <ska@appnovation.com>2023-11-17 03:04:59 +0000
commite38a132e37fcd3307b7a93c5c867145454f79b4e (patch)
tree1e582510fb60981f0de4c7d7763e07de576ad9ef /src/tls
parent26597a785ec2dd4e9ec9fb7d9765d2ee8779ee16 (diff)
downloads6-networking-e38a132e37fcd3307b7a93c5c867145454f79b4e.tar.xz
Fix stls_run; sbearssl_run needs a rewrite
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/tls')
-rw-r--r--src/tls/s6-tlsclient.c11
-rw-r--r--src/tls/s6-tlsserver.c11
-rw-r--r--src/tls/s6tls_prep_tlscio.c6
-rw-r--r--src/tls/s6tls_prep_tlsdio.c4
4 files changed, 21 insertions, 11 deletions
diff --git a/src/tls/s6-tlsclient.c b/src/tls/s6-tlsclient.c
index 261c8be..888c11a 100644
--- a/src/tls/s6-tlsclient.c
+++ b/src/tls/s6-tlsclient.c
@@ -13,7 +13,7 @@
#define USAGE "s6-tlsclient [ options ] host port prog...\n" \
"s6-tcpclient options: [ -q | -Q | -v ] [ -4 | -6 ] [ -d | -D ] [ -r | -R ] [ -h | -H ] [ -n | -N ] [ -t timeout ] [ -l localname ] [ -T timeoutconn ] [ -i localip ] [ -p localport ]\n" \
-"s6-tlsc options: [ -S | -s ] [ -Y | -y ] [ -K timeout ] [ -k servername ] [ -Z | -z ]"
+"s6-tlsc options: [ -S | -s ] [ -J | -j ] [ -Y | -y ] [ -K timeout ] [ -k servername ] [ -Z | -z ]"
#define dieusage() strerr_dieusage(100, USAGE)
@@ -36,6 +36,7 @@ struct options_s
unsigned int flagr : 1 ;
unsigned int flagN : 1 ;
unsigned int flagS : 1 ;
+ unsigned int flagJ : 1 ;
unsigned int flagy : 1 ;
unsigned int flagZ : 1 ;
unsigned int doxy : 1 ;
@@ -59,6 +60,7 @@ struct options_s
.flagr = 0, \
.flagN = 0, \
.flagS = 0, \
+ .flagJ = 0, \
.flagy = 0, \
.flagZ = 0, \
.doxy = 0 \
@@ -72,7 +74,7 @@ int main (int argc, char const *const *argv)
subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "qQv46DdHhRrnNt:l:T:i:p:SsYyK:k:Zz", &l) ;
+ int opt = subgetopt_r(argc, argv, "qQv46DdHhRrnNt:l:T:i:p:SsJjYyK:k:Zz", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -109,6 +111,8 @@ int main (int argc, char const *const *argv)
case 'p' : if (!uint160_scan(l.arg, &o.localport)) dieusage() ; break ;
case 'S' : o.flagS = 1 ; break ;
case 's' : o.flagS = 0 ; break ;
+ case 'J' : o.flagJ = 1 ; break ;
+ case 'j' : o.flagJ = 0 ; break ;
case 'Y' : o.flagy = 0 ; break ;
case 'y' : o.flagy = 1 ; break ;
case 'K' : if (!uint0_scan(l.arg, &o.kimeout)) dieusage() ; break ;
@@ -133,7 +137,7 @@ int main (int argc, char const *const *argv)
size_t pos = 0 ;
unsigned int m = 0 ;
char fmt[UINT_FMT * 4 + UINT16_FMT + IP46_FMT] ;
- char const *newargv[31 + argc] ;
+ char const *newargv[32 + argc] ;
newargv[m++] = S6_NETWORKING_BINPREFIX "s6-tcpclient" ;
if (o.verbosity != 1) newargv[m++] = o.verbosity ? "-v" : "-q" ;
if (o.flag4) newargv[m++] = "-4" ;
@@ -182,6 +186,7 @@ int main (int argc, char const *const *argv)
newargv[m++] = *argv++ ;
newargv[m++] = S6_NETWORKING_BINPREFIX "s6-tlsc" ;
if (o.flagS) newargv[m++] = "-S" ;
+ if (o.flagJ) newargv[m++] = "-J" ;
if (o.flagy) newargv[m++] = "-y" ;
if (o.kimeout)
{
diff --git a/src/tls/s6-tlsserver.c b/src/tls/s6-tlsserver.c
index be96f39..0c38600 100644
--- a/src/tls/s6-tlsserver.c
+++ b/src/tls/s6-tlsserver.c
@@ -15,7 +15,7 @@
#define USAGE "s6-tlsserver [ options ] ip port prog...\n" \
"s6-tcpserver options: [ -q | -Q | -v ] [ -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 ] [ -k snilevel ]"
+"s6-tlsd options: [ -S | -s ] [ -J | -j ] [ -Y | -y ] [ -K timeout ] [ -Z | -z ] [ -k snilevel ]"
#define dieusage() strerr_dieusage(100, USAGE)
@@ -45,6 +45,7 @@ struct options_s
unsigned int flagp : 1 ;
unsigned int rulesx : 1 ;
unsigned int flagS : 1 ;
+ unsigned int flagJ : 1 ;
unsigned int flagy : 1 ;
unsigned int flagY : 1 ;
unsigned int flagZ : 1 ;
@@ -75,6 +76,7 @@ struct options_s
.flagp = 0, \
.rulesx = 0, \
.flagS = 0, \
+ .flagJ = 0, \
.flagy = 0, \
.flagY = 0, \
.flagZ = 0, \
@@ -89,7 +91,7 @@ int main (int argc, char const *const *argv)
subgetopt l = SUBGETOPT_ZERO ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "qQv1c:C:b:G:g:u:UWwDdHhRrPpl:B:t:i:x:SsYyK:Zzk:", &l) ;
+ int opt = subgetopt_r(argc, argv, "qQv1c:C:b:G:g:u:UWwDdHhRrPpl:B:t:i:x:SsJjYyK:Zzk:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -121,6 +123,8 @@ int main (int argc, char const *const *argv)
case 'x' : o.rules = l.arg ; o.rulesx = 1 ; break ;
case 'S' : o.flagS = 1 ; break ;
case 's' : o.flagS = 0 ; break ;
+ case 'J' : o.flagJ = 1 ; break ;
+ case 'j' : o.flagJ = 0 ; break ;
case 'Y' : o.flagY = 1 ; o.flagy = 0 ; break ;
case 'y' : o.flagy = 1 ; o.flagY = 0 ; break ;
case 'K' : if (!uint0_scan(l.arg, &o.kimeout)) dieusage() ; break ;
@@ -138,7 +142,7 @@ int main (int argc, char const *const *argv)
size_t pos = 0 ;
unsigned int m = 0 ;
char fmt[UINT_FMT * 6 + UID_FMT + GID_FMT * (NGROUPS_MAX + 1)] ;
- char const *newargv[49 + argc] ;
+ char const *newargv[50 + argc] ;
int doaccess = o.flagw || o.flagD || !o.flagH || o.flagr || o.flagp || o.localname || o.banner || o.timeout || o.rules ;
newargv[m++] = S6_NETWORKING_BINPREFIX "s6-tcpserver" ;
if (o.verbosity != 1)
@@ -216,6 +220,7 @@ int main (int argc, char const *const *argv)
newargv[m++] = fmt ;
}
if (o.flagS) newargv[m++] = "-S" ;
+ if (o.flagJ) newargv[m++] = "-J" ;
if (o.flagy) newargv[m++] = "-y" ;
else if (o.flagY) newargv[m++] = "-Y" ;
if (o.kimeout)
diff --git a/src/tls/s6tls_prep_tlscio.c b/src/tls/s6tls_prep_tlscio.c
index 0b7ff1f..f56106f 100644
--- a/src/tls/s6tls_prep_tlscio.c
+++ b/src/tls/s6tls_prep_tlscio.c
@@ -25,9 +25,9 @@ void s6tls_prep_tlscio (char const **argv, char *buf, int const *p, uint32_t opt
n += uint_fmt(buf + n, p[5]) ;
buf[n++] = 0 ;
}
- argv[m++] = options & 4 ? "-S" : "-s" ;
- argv[m++] = options & 2 ? "-J" : "-j" ;
- argv[m++] = options & 1 ? "-y" : "-Y" ;
+ if (options & 4) argv[m++] = "-S" ;
+ if (options & 2) argv[m++] = "-J" ;
+ if (options & 1) argv[m++] = "-y" ;
if (kimeout)
{
argv[m++] = "-K" ;
diff --git a/src/tls/s6tls_prep_tlsdio.c b/src/tls/s6tls_prep_tlsdio.c
index 59cc536..8408010 100644
--- a/src/tls/s6tls_prep_tlsdio.c
+++ b/src/tls/s6tls_prep_tlsdio.c
@@ -25,8 +25,8 @@ void s6tls_prep_tlsdio (char const **argv, char *buf, int const *p, uint32_t opt
n += uint_fmt(buf + n, p[5]) ;
buf[n++] = 0 ;
}
- argv[m++] = options & 4 ? "-S" : "-s" ;
- argv[m++] = options & 8 ? "-J" : "-j" ;
+ if (options & 4) argv[m++] = "-S" ;
+ if (options & 8) argv[m++] = "-J" ;
if (options & 1)
argv[m++] = options & 2 ? "-y" : "-Y" ;
if (kimeout)