summaryrefslogtreecommitdiff
path: root/src/conn-tools
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-01-10 02:17:16 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-01-10 02:17:16 +0000
commit334d807b924427434b42d4fbae745d3d1b38a218 (patch)
tree6daf12c1e2fa07d2ac6255ef4439e2fb95a57f57 /src/conn-tools
parent43cb3ee4227de70e0225e9ac142b4d397f93cc41 (diff)
downloads6-networking-334d807b924427434b42d4fbae745d3d1b38a218.tar.xz
Types fix, first pass
XXX marks what must change when skalibs changes. Also started writing functions for client certificate support in sbearssl, but it's not working yet (need more high-level support from BearSSL before it can work)
Diffstat (limited to 'src/conn-tools')
-rw-r--r--src/conn-tools/s6-getservbyname.c7
-rw-r--r--src/conn-tools/s6-ident-client.c3
-rw-r--r--src/conn-tools/s6-tcpclient.c8
-rw-r--r--src/conn-tools/s6-tcpserver-access.c8
-rw-r--r--src/conn-tools/s6-tcpserver.c16
-rw-r--r--src/conn-tools/s6-tcpserver4-socketbinder.c3
-rw-r--r--src/conn-tools/s6-tcpserver4.c16
-rw-r--r--src/conn-tools/s6-tcpserver4d.c31
-rw-r--r--src/conn-tools/s6-tcpserver6.c16
-rw-r--r--src/conn-tools/s6-tcpserver6d.c17
-rw-r--r--src/conn-tools/s6-tlsc.c1
-rw-r--r--src/conn-tools/s6-tlsclient.c6
-rw-r--r--src/conn-tools/s6-tlsd.c5
-rw-r--r--src/conn-tools/s6-tlsserver.c2
14 files changed, 79 insertions, 60 deletions
diff --git a/src/conn-tools/s6-getservbyname.c b/src/conn-tools/s6-getservbyname.c
index 0888df5..a7ccc9d 100644
--- a/src/conn-tools/s6-getservbyname.c
+++ b/src/conn-tools/s6-getservbyname.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <netdb.h>
#include <skalibs/uint16.h>
#include <skalibs/buffer.h>
@@ -10,15 +11,15 @@
int main (int argc, char const *const *argv)
{
char fmt[UINT16_FMT] ;
- uint16 port ;
+ uint16_t port ;
PROG = "s6-getservbyname" ;
if (argc < 3) strerr_dieusage(100, USAGE) ;
if (!uint160_scan(argv[1], &port))
{
struct servent *se = getservbyname(argv[1], argv[2]) ;
- uint16 tmpport ;
+ uint16_t tmpport ;
if (!se) return 1 ;
- tmpport = (uint16)se->s_port ;
+ tmpport = (uint16_t)se->s_port ;
uint16_unpack_big((char const *)&tmpport, &port) ;
}
if ((buffer_put(buffer_1small, fmt, uint16_fmt(fmt, port)) < 0)
diff --git a/src/conn-tools/s6-ident-client.c b/src/conn-tools/s6-ident-client.c
index e475870..d4876ae 100644
--- a/src/conn-tools/s6-ident-client.c
+++ b/src/conn-tools/s6-ident-client.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
#include <skalibs/uint16.h>
#include <skalibs/uint.h>
@@ -19,7 +20,7 @@ int main (int argc, char const *const *argv)
{
tain_t deadline ;
ip46_t ra, la ;
- uint16 rp, lp ;
+ uint16_t rp, lp ;
PROG = "s6-ident-client" ;
{
unsigned int t = 0 ;
diff --git a/src/conn-tools/s6-tcpclient.c b/src/conn-tools/s6-tcpclient.c
index f2cb9d7..3085e06 100644
--- a/src/conn-tools/s6-tcpclient.c
+++ b/src/conn-tools/s6-tcpclient.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <skalibs/uint16.h>
#include <skalibs/uint.h>
@@ -39,7 +41,7 @@ struct tflags_s
unsigned int timeout ;
unsigned int timeoutconn[2] ;
ip46_t localip ;
- uint16 localport ;
+ uint16_t localport ;
unsigned int verbosity : 2 ;
#ifdef SKALIBS_IPV6_ENABLED
unsigned int ip4 : 1 ;
@@ -57,7 +59,7 @@ int main (int argc, char const *const *argv)
{
int s ;
tflags flags = TFLAGS_DEFAULT ;
- uint16 remoteport ;
+ uint16_t remoteport ;
PROG = "s6-tcpclient" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
@@ -86,7 +88,7 @@ int main (int argc, char const *const *argv)
case 'l' : flags.localname = l.arg ; break ;
case 'T' :
{
- unsigned int n = uint_scan(l.arg, &flags.timeoutconn[0]) ;
+ size_t n = uint_scan(l.arg, &flags.timeoutconn[0]) ;
if (!n) usage() ;
if (!l.arg[n])
{
diff --git a/src/conn-tools/s6-tcpserver-access.c b/src/conn-tools/s6-tcpserver-access.c
index 2e14845..72a3d2f 100644
--- a/src/conn-tools/s6-tcpserver-access.c
+++ b/src/conn-tools/s6-tcpserver-access.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/gccattributes.h>
@@ -62,12 +64,12 @@ int main (int argc, char const *const *argv, char const *const *envp)
int cdbfd = -1 ;
unsigned int rulestype = 0 ;
unsigned int verbosity = 1 ;
- unsigned int protolen ;
+ size_t protolen ;
s6_accessrules_result_t accepted ;
ip46_t remoteip, localip ;
int flagfatal = 1, flagnodelay = 0, flagdnslookup = 1,
flagident = 0, flagparanoid = 0, e = 0 ;
- uint16 remoteport, localport ;
+ uint16_t remoteport, localport ;
PROG = "s6-tcpserver-access" ;
{
unsigned int timeout = 0 ;
@@ -92,7 +94,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
case 'l' : localname = l.arg ; break ;
case 'B' :
{
- register unsigned int n = str_len(l.arg) ;
+ register size_t n = str_len(l.arg) ;
if (buffer_putnoflush(buffer_1small, l.arg, n) < n)
strerr_dief1x(100, "banner too long") ;
break ;
diff --git a/src/conn-tools/s6-tcpserver.c b/src/conn-tools/s6-tcpserver.c
index 751b2b8..3036ce7 100644
--- a/src/conn-tools/s6-tcpserver.c
+++ b/src/conn-tools/s6-tcpserver.c
@@ -2,6 +2,7 @@
#include <sys/types.h>
#include <limits.h>
+#include <skalibs/uint64.h>
#include <skalibs/uint.h>
#include <skalibs/gidstuff.h>
#include <skalibs/sgetopt.h>
@@ -20,7 +21,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
int flag1 = 0 ;
int flagU = 0 ;
int flagreuse = 1 ;
- unsigned int uid = 0, gid = 0 ;
+ uint64 uid = 0 ;
+ gid_t gid = 0 ;
gid_t gids[NGROUPS_MAX] ;
unsigned int gidn = (unsigned int)-1 ;
unsigned int maxconn = 0 ;
@@ -46,8 +48,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
case 'c' : if (!uint0_scan(l.arg, &maxconn)) dieusage() ; if (!maxconn) maxconn = 1 ; break ;
case 'C' : if (!uint0_scan(l.arg, &localmaxconn)) dieusage() ; if (!localmaxconn) localmaxconn = 1 ; break ;
case 'b' : if (!uint0_scan(l.arg, &backlog)) dieusage() ; break ;
- case 'u' : if (!uint0_scan(l.arg, &uid)) dieusage() ; break ;
- case 'g' : if (!uint0_scan(l.arg, &gid)) dieusage() ; break ;
+ case 'u' : if (!uint640_scan(l.arg, &uid)) dieusage() ; break ;
+ case 'g' : if (!gid0_scan(l.arg, &gid)) dieusage() ; break ;
case 'G' : if (!gid_scanlist(gids, NGROUPS_MAX, l.arg, &gidn) && *l.arg) dieusage() ; break ;
case '1' : flag1 = 1 ; break ;
case 'U' : flagU = 1 ; uid = 0 ; gid = 0 ; gidn = (unsigned int)-1 ; break ;
@@ -66,9 +68,9 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
{
+ size_t pos = 0 ;
unsigned int m = 0 ;
- unsigned int pos = 0 ;
- char fmt[UINT_FMT * 5 + GID_FMT * NGROUPS_MAX] ;
+ char fmt[UINT_FMT * 3 + UINT64_FMT + GID_FMT * (NGROUPS_MAX + 1)] ;
char const *newargv[23 + argc] ;
newargv[m++] = what == 6 ? S6_NETWORKING_BINPREFIX "s6-tcpserver6-socketbinder" : S6_NETWORKING_BINPREFIX "s6-tcpserver4-socketbinder" ;
if (!flagreuse) newargv[m++] = "-D" ;
@@ -90,14 +92,14 @@ int main (int argc, char const *const *argv, char const *const *envp)
{
newargv[m++] = "-u" ;
newargv[m++] = fmt + pos ;
- pos += uint_fmt(fmt + pos, uid) ;
+ pos += uint64_fmt(fmt + pos, uid) ;
fmt[pos++] = 0 ;
}
if (gid)
{
newargv[m++] = "-g" ;
newargv[m++] = fmt + pos ;
- pos += uint_fmt(fmt + pos, gid) ;
+ pos += gid_fmt(fmt + pos, gid) ;
fmt[pos++] = 0 ;
}
if (gidn != (unsigned int)-1)
diff --git a/src/conn-tools/s6-tcpserver4-socketbinder.c b/src/conn-tools/s6-tcpserver4-socketbinder.c
index 5550820..a15e5f1 100644
--- a/src/conn-tools/s6-tcpserver4-socketbinder.c
+++ b/src/conn-tools/s6-tcpserver4-socketbinder.c
@@ -1,6 +1,7 @@
/* ISC license. */
#include <sys/types.h>
+#include <stdint.h>
#include <unistd.h>
#include <sys/socket.h>
#include <skalibs/uint16.h>
@@ -20,7 +21,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
int flagreuse = 1 ;
int flagudp = 0 ;
char ip[4] ;
- uint16 port ;
+ uint16_t port ;
PROG = "s6-tcpserver4-socketbinder" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
diff --git a/src/conn-tools/s6-tcpserver4.c b/src/conn-tools/s6-tcpserver4.c
index 7baa66c..f0836d3 100644
--- a/src/conn-tools/s6-tcpserver4.c
+++ b/src/conn-tools/s6-tcpserver4.c
@@ -2,6 +2,7 @@
#include <sys/types.h>
#include <limits.h>
+#include <skalibs/uint64.h>
#include <skalibs/uint.h>
#include <skalibs/gidstuff.h>
#include <skalibs/sgetopt.h>
@@ -19,7 +20,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
int flag1 = 0 ;
int flagU = 0 ;
int flagreuse = 1 ;
- unsigned int uid = 0, gid = 0 ;
+ uint64 uid = 0 ;
+ gid_t gid = 0 ;
gid_t gids[NGROUPS_MAX] ;
unsigned int gidn = (unsigned int)-1 ;
unsigned int maxconn = 0 ;
@@ -40,8 +42,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
case 'c' : if (!uint0_scan(l.arg, &maxconn)) dieusage() ; if (!maxconn) maxconn = 1 ; break ;
case 'C' : if (!uint0_scan(l.arg, &localmaxconn)) dieusage() ; if (!localmaxconn) localmaxconn = 1 ; break ;
case 'b' : if (!uint0_scan(l.arg, &backlog)) dieusage() ; break ;
- case 'u' : if (!uint0_scan(l.arg, &uid)) dieusage() ; break ;
- case 'g' : if (!uint0_scan(l.arg, &gid)) dieusage() ; break ;
+ case 'u' : if (!uint640_scan(l.arg, &uid)) dieusage() ; break ;
+ case 'g' : if (!gid0_scan(l.arg, &gid)) dieusage() ; break ;
case 'G' : if (!gid_scanlist(gids, NGROUPS_MAX, l.arg, &gidn) && *l.arg) dieusage() ; break ;
case '1' : flag1 = 1 ; break ;
case 'U' : flagU = 1 ; uid = 0 ; gid = 0 ; gidn = (unsigned int)-1 ; break ;
@@ -53,9 +55,9 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
{
+ size_t pos = 0 ;
unsigned int m = 0 ;
- unsigned int pos = 0 ;
- char fmt[UINT_FMT * 6 + GID_FMT * NGROUPS_MAX] ;
+ char fmt[UINT_FMT * 4 + UINT64_FMT + GID_FMT * (NGROUPS_MAX + 1)] ;
char const *newargv[24 + argc] ;
newargv[m++] = S6_NETWORKING_BINPREFIX "s6-tcpserver4-socketbinder" ;
if (!flagreuse) newargv[m++] = "-D" ;
@@ -78,14 +80,14 @@ int main (int argc, char const *const *argv, char const *const *envp)
{
newargv[m++] = "-u" ;
newargv[m++] = fmt + pos ;
- pos += uint_fmt(fmt + pos, uid) ;
+ pos += uint64_fmt(fmt + pos, uid) ;
fmt[pos++] = 0 ;
}
if (gid)
{
newargv[m++] = "-g" ;
newargv[m++] = fmt + pos ;
- pos += uint_fmt(fmt + pos, gid) ;
+ pos += gid_fmt(fmt + pos, gid) ;
fmt[pos++] = 0 ;
}
if (gidn != (unsigned int)-1)
diff --git a/src/conn-tools/s6-tcpserver4d.c b/src/conn-tools/s6-tcpserver4d.c
index c594b41..e176ee5 100644
--- a/src/conn-tools/s6-tcpserver4d.c
+++ b/src/conn-tools/s6-tcpserver4d.c
@@ -1,6 +1,7 @@
/* ISC license. */
#include <sys/types.h>
+#include <stdint.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <errno.h>
@@ -94,7 +95,7 @@ static void log_status (void)
strerr_warni3x("status: ", fmt, fmtmaxconn) ;
}
-static void log_deny (uint32 ip, uint16 port, unsigned int num)
+static void log_deny (uint32_t ip, uint16_t port, unsigned int num)
{
char fmtip[UINT32_FMT] ;
char fmtport[UINT16_FMT] ;
@@ -105,12 +106,12 @@ static void log_deny (uint32 ip, uint16 port, unsigned int num)
strerr_warni7sys("deny ", fmtip, ":", fmtport, " count ", fmtnum, fmtlocalmaxconn) ;
}
-static void log_accept (uint32 pid, uint32 ip, uint16 port, unsigned int num)
+static void log_accept (uint32_t pid, uint32_t ip, uint16_t port, unsigned int num)
{
char fmtipport[IP4_FMT + UINT16_FMT + 1] ;
char fmtpid[UINT32_FMT] ;
char fmtnum[UINT_FMT] ;
- register unsigned int n ;
+ register size_t n ;
n = ip4_fmtu32(fmtipport, ip) ;
fmtipport[n++] = ':' ;
n += uint16_fmt(fmtipport + n, port) ;
@@ -120,7 +121,7 @@ static void log_accept (uint32 pid, uint32 ip, uint16 port, unsigned int num)
strerr_warni7x("allow ", fmtipport, " pid ", fmtpid, " count ", fmtnum, fmtlocalmaxconn) ;
}
-static void log_close (uint32 pid, uint32 ip, int w)
+static void log_close (uint32_t pid, uint32_t ip, int w)
{
char fmtpid[UINT32_FMT] ;
char fmtip[IP4_FMT] = "?" ;
@@ -146,7 +147,7 @@ static void wait_children (void)
{
unsigned int i ;
int w ;
- register int pid = wait_nohang(&w) ;
+ register pid_t pid = wait_nohang(&w) ;
if (pid < 0)
if (errno != ECHILD) strerr_diefu1sys(111, "wait_nohang") ;
else break ;
@@ -154,7 +155,7 @@ static void wait_children (void)
i = lookup_pid(pid) ;
if (i < numconn) /* it's one of ours ! */
{
- uint32 ip = pidip[i].right ;
+ uint32_t ip = pidip[i].right ;
register unsigned int j = lookup_ip(ip) ;
if (j >= iplen) X() ;
if (!--ipnum[j].right) ipnum[j] = ipnum[--iplen] ;
@@ -214,11 +215,11 @@ static void handle_signals (void)
/* New connection handling */
-static void run_child (int, uint32, uint16, unsigned int, char const *const *, char const *const *) gccattr_noreturn ;
-static void run_child (int s, uint32 ip, uint16 port, unsigned int num, char const *const *argv, char const *const *envp)
+static void run_child (int, uint32_t, uint16_t, unsigned int, char const *const *, char const *const *) gccattr_noreturn ;
+static void run_child (int s, uint32_t ip, uint16_t port, unsigned int num, char const *const *argv, char const *const *envp)
{
char fmt[74] ;
- unsigned int n = 0 ;
+ size_t n = 0 ;
PROG = "s6-tcpserver (child)" ;
if ((fd_move(0, s) < 0) || (fd_copy(1, 0) < 0))
strerr_diefu1sys(111, "move fds") ;
@@ -232,11 +233,11 @@ static void run_child (int s, uint32 ip, uint16 port, unsigned int num, char con
strerr_dieexec(111, argv[0]) ;
}
-static void new_connection (int s, uint32 ip, uint16 port, char const *const *argv, char const *const *envp)
+static void new_connection (int s, uint32_t ip, uint16_t port, char const *const *argv, char const *const *envp)
{
unsigned int i = lookup_ip(ip) ;
unsigned int num = (i < iplen) ? ipnum[i].right : 0 ;
- register int pid ;
+ register pid_t pid ;
if (num >= localmaxconn)
{
log_deny(ip, port, num) ;
@@ -260,11 +261,11 @@ static void new_connection (int s, uint32 ip, uint16 port, char const *const *ar
ipnum[iplen].left = ip ;
ipnum[iplen++].right = 1 ;
}
- pidip[numconn].left = (uint32)pid ;
+ pidip[numconn].left = (uint32_t)pid ;
pidip[numconn++].right = ip ;
if (verbosity >= 2)
{
- log_accept((uint32)pid, ip, port, ipnum[i].right) ;
+ log_accept((uint32_t)pid, ip, port, ipnum[i].right) ;
log_status() ;
}
}
@@ -353,7 +354,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (x[1].revents & IOPAUSE_READ)
{
char packedip[4] ;
- uint16 port ;
+ uint16_t port ;
register int fd = socket_accept4(x[1].fd, packedip, &port) ;
if (fd < 0)
{
@@ -361,7 +362,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
else
{
- uint32 ip ;
+ uint32_t ip ;
uint32_unpack_big(packedip, &ip) ;
new_connection(fd, ip, port, argv, envp) ;
fd_close(fd) ;
diff --git a/src/conn-tools/s6-tcpserver6.c b/src/conn-tools/s6-tcpserver6.c
index 90a6e8f..d48efe1 100644
--- a/src/conn-tools/s6-tcpserver6.c
+++ b/src/conn-tools/s6-tcpserver6.c
@@ -2,6 +2,7 @@
#include <sys/types.h>
#include <limits.h>
+#include <skalibs/uint64.h>
#include <skalibs/uint.h>
#include <skalibs/gidstuff.h>
#include <skalibs/sgetopt.h>
@@ -19,7 +20,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
int flag1 = 0 ;
int flagU = 0 ;
int flagreuse = 1 ;
- unsigned int uid = 0, gid = 0 ;
+ uint64 uid = 0 ;
+ gid_t gid = 0 ;
gid_t gids[NGROUPS_MAX] ;
unsigned int gidn = (unsigned int)-1 ;
unsigned int maxconn = 0 ;
@@ -40,8 +42,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
case 'c' : if (!uint0_scan(l.arg, &maxconn)) dieusage() ; if (!maxconn) maxconn = 1 ; break ;
case 'C' : if (!uint0_scan(l.arg, &localmaxconn)) dieusage() ; if (!localmaxconn) localmaxconn = 1 ; break ;
case 'b' : if (!uint0_scan(l.arg, &backlog)) dieusage() ; break ;
- case 'u' : if (!uint0_scan(l.arg, &uid)) dieusage() ; break ;
- case 'g' : if (!uint0_scan(l.arg, &gid)) dieusage() ; break ;
+ case 'u' : if (!uint640_scan(l.arg, &uid)) dieusage() ; break ;
+ case 'g' : if (!gid0_scan(l.arg, &gid)) dieusage() ; break ;
case 'G' : if (!gid_scanlist(gids, NGROUPS_MAX, l.arg, &gidn) && *l.arg) dieusage() ; break ;
case '1' : flag1 = 1 ; break ;
case 'U' : flagU = 1 ; uid = 0 ; gid = 0 ; gidn = (unsigned int)-1 ; break ;
@@ -53,9 +55,9 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
{
+ size_t pos = 0 ;
unsigned int m = 0 ;
- unsigned int pos = 0 ;
- char fmt[UINT_FMT * 6 + GID_FMT * NGROUPS_MAX] ;
+ char fmt[UINT_FMT * 4 + UINT64_FMT + GID_FMT * (NGROUPS_MAX + 1)] ;
char const *newargv[24 + argc] ;
newargv[m++] = S6_NETWORKING_BINPREFIX "s6-tcpserver6-socketbinder" ;
if (!flagreuse) newargv[m++] = "-D" ;
@@ -78,14 +80,14 @@ int main (int argc, char const *const *argv, char const *const *envp)
{
newargv[m++] = "-u" ;
newargv[m++] = fmt + pos ;
- pos += uint_fmt(fmt + pos, uid) ;
+ pos += uint64_fmt(fmt + pos, uid) ;
fmt[pos++] = 0 ;
}
if (gid)
{
newargv[m++] = "-g" ;
newargv[m++] = fmt + pos ;
- pos += uint_fmt(fmt + pos, gid) ;
+ pos += gid_fmt(fmt + pos, gid) ;
fmt[pos++] = 0 ;
}
if (gidn != (unsigned int)-1)
diff --git a/src/conn-tools/s6-tcpserver6d.c b/src/conn-tools/s6-tcpserver6d.c
index 3e535c5..5079d2e 100644
--- a/src/conn-tools/s6-tcpserver6d.c
+++ b/src/conn-tools/s6-tcpserver6d.c
@@ -1,6 +1,7 @@
/* ISC license. */
#include <sys/types.h>
+#include <stdint.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <errno.h>
@@ -96,7 +97,7 @@ static void log_status (void)
strerr_warni3x("status: ", fmt, fmtmaxconn) ;
}
-static void log_deny (char const *ip, uint16 port, unsigned int num)
+static void log_deny (char const *ip, uint16_t port, unsigned int num)
{
char fmtip[IP6_FMT] ;
char fmtport[UINT16_FMT] ;
@@ -107,12 +108,12 @@ static void log_deny (char const *ip, uint16 port, unsigned int num)
strerr_warni7sys("deny ", fmtip, " port ", fmtport, " count ", fmtnum, fmtlocalmaxconn) ;
}
-static void log_accept (unsigned int pid, char const *ip, uint16 port, unsigned int num)
+static void log_accept (unsigned int pid, char const *ip, uint16_t port, unsigned int num)
{
char fmtipport[IP6_FMT + UINT16_FMT + 6] ;
char fmtpid[UINT_FMT] ;
char fmtnum[UINT_FMT] ;
- register unsigned int n ;
+ register size_t n ;
n = ip6_fmt(fmtipport, ip) ;
byte_copy(fmtipport + n, 6, " port ") ; n += 6 ;
n += uint16_fmt(fmtipport + n, port) ;
@@ -216,11 +217,11 @@ static void handle_signals (void)
/* New connection handling */
-static void run_child (int, char const *, uint16, unsigned int, char const *const *, char const *const *) gccattr_noreturn ;
-static void run_child (int s, char const *ip, uint16 port, unsigned int num, char const *const *argv, char const *const *envp)
+static void run_child (int, char const *, uint16_t, unsigned int, char const *const *, char const *const *) gccattr_noreturn ;
+static void run_child (int s, char const *ip, uint16_t port, unsigned int num, char const *const *argv, char const *const *envp)
{
char fmt[98] ;
- unsigned int n = 0 ;
+ size_t n = 0 ;
PROG = "s6-tcpserver6 (child)" ;
if ((fd_move(0, s) < 0) || (fd_copy(1, 0) < 0))
strerr_diefu1sys(111, "move fds") ;
@@ -234,7 +235,7 @@ static void run_child (int s, char const *ip, uint16 port, unsigned int num, cha
strerr_dieexec(111, argv[0]) ;
}
-static void new_connection (int s, char const *ip, uint16 port, char const *const *argv, char const *const *envp)
+static void new_connection (int s, char const *ip, uint16_t port, char const *const *argv, char const *const *envp)
{
unsigned int i = lookup_ip(ip) ;
unsigned int num = (i < iplen) ? ipnum[i].num : 0 ;
@@ -353,7 +354,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (x[1].revents & IOPAUSE_READ)
{
char ip[16] ;
- uint16 port ;
+ uint16_t port ;
register int fd = socket_accept6(x[1].fd, ip, &port) ;
if (fd < 0)
{
diff --git a/src/conn-tools/s6-tlsc.c b/src/conn-tools/s6-tlsc.c
index 0c26ab0..3e355f1 100644
--- a/src/conn-tools/s6-tlsc.c
+++ b/src/conn-tools/s6-tlsc.c
@@ -1,6 +1,7 @@
/* ISC license. */
#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <skalibs/uint64.h>
#include <skalibs/uint.h>
diff --git a/src/conn-tools/s6-tlsclient.c b/src/conn-tools/s6-tlsclient.c
index a536171..eb5311d 100644
--- a/src/conn-tools/s6-tlsclient.c
+++ b/src/conn-tools/s6-tlsclient.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <skalibs/uint16.h>
#include <skalibs/uint.h>
#include <skalibs/bytestr.h>
@@ -24,7 +26,7 @@ struct options_s
unsigned int ximeout ;
unsigned int yimeout ;
unsigned int kimeout ;
- uint16 localport ;
+ uint16_t localport ;
ip46full_t localip ;
unsigned int verbosity : 2 ;
unsigned int flag4 : 1 ;
@@ -128,8 +130,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
{
+ size_t pos = 0 ;
unsigned int m = 0 ;
- unsigned int pos = 0 ;
char fmt[UINT_FMT * 4 + UINT16_FMT + IP46_FMT] ;
char const *newargv[29 + argc] ;
newargv[m++] = S6_NETWORKING_BINPREFIX "s6-tcpclient" ;
diff --git a/src/conn-tools/s6-tlsd.c b/src/conn-tools/s6-tlsd.c
index a4a1d4c..da90179 100644
--- a/src/conn-tools/s6-tlsd.c
+++ b/src/conn-tools/s6-tlsd.c
@@ -1,6 +1,7 @@
/* ISC license. */
#include <sys/types.h>
+#include <stdint.h>
#include <skalibs/uint64.h>
#include <skalibs/uint.h>
#include <skalibs/gidstuff.h>
@@ -54,8 +55,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
{
case 'S' : options &= ~(uint32_t)1 ; break ;
case 's' : options |= 1 ; break ;
- case 'Y' : preoptions &= ~(uint32_t)1 ; break ;
- case 'y' : preoptions |= 1 ; break ;
+ case 'Y' : preoptions |= 1 ; preoptions &= ~(uint32_t)4 ; break ;
+ case 'y' : preoptions |= 5 ; break ;
case 'v' : if (!uint0_scan(l.arg, &verbosity)) dieusage() ; break ;
case 'K' : if (!uint0_scan(l.arg, &t)) dieusage() ; break ;
case 'Z' : preoptions &= ~(uint32_t)2 ; break ;
diff --git a/src/conn-tools/s6-tlsserver.c b/src/conn-tools/s6-tlsserver.c
index e0c3387..82f857a 100644
--- a/src/conn-tools/s6-tlsserver.c
+++ b/src/conn-tools/s6-tlsserver.c
@@ -135,8 +135,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
{
+ size_t pos = 0 ;
unsigned int m = 0 ;
- unsigned int pos = 0 ;
char fmt[UINT_FMT * 5 + GID_FMT * (NGROUPS_MAX + 1) + UINT64_FMT] ;
char const *newargv[45 + argc] ;
newargv[m++] = S6_NETWORKING_BINPREFIX "s6-tcpserver" ;