blob: f3bc999220913b82c137cd069d6d1d0294ce1ea1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* ISC license. */
#include <skalibs/types.h>
#include <skalibs/exec.h>
#include <s6-networking/config.h>
#include "s6tls-internal.h"
void s6tls_exec_tlsdio (int const *fds, uint32_t options, unsigned int verbosity, unsigned int kimeout, unsigned int snilevel)
{
char const *newargv[15] ;
unsigned int m = 0 ;
char fmtv[UINT_FMT] ;
char fmtd[UINT_FMT] ;
char fmtk[UINT_FMT] ;
char fmtr[UINT_FMT] ;
char fmtw[UINT_FMT] ;
char fmti[UINT_FMT] ;
newargv[m++] = S6_NETWORKING_BINPREFIX "s6-tlsd-io" ;
if (verbosity != 1)
{
newargv[m++] = "-v" ;
newargv[m++] = fmtv ;
fmtv[uint_fmt(fmtv, verbosity)] = 0 ;
}
if (fds[2])
{
newargv[m++] = "-d" ;
newargv[m++] = fmtd ;
fmtd[uint_fmt(fmtd, fds[2])] = 0 ;
}
newargv[m++] = options & 4 ? "-S" : "-s" ;
if (options & 1)
newargv[m++] = options & 2 ? "-y" : "-Y" ;
if (kimeout)
{
newargv[m++] = "-K" ;
newargv[m++] = fmtk ;
fmtk[uint_fmt(fmtk, kimeout)] = 0 ;
}
if (snilevel)
{
newargv[m++] = "-k" ;
newargv[m++] = fmti ;
fmti[uint_fmt(fmti, snilevel)] = 0 ;
}
newargv[m++] = "--" ;
newargv[m++] = fmtr ;
fmtr[uint_fmt(fmtr, fds[0])] = 0 ;
newargv[m++] = fmtw ;
fmtw[uint_fmt(fmtw, fds[1])] = 0 ;
newargv[m++] = 0 ;
xexec(newargv) ;
}
|