summaryrefslogtreecommitdiff
path: root/src/conn-tools/s6-tcpserver4.c
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/s6-tcpserver4.c
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/s6-tcpserver4.c')
-rw-r--r--src/conn-tools/s6-tcpserver4.c16
1 files changed, 9 insertions, 7 deletions
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)