summaryrefslogtreecommitdiff
path: root/src/conn-tools/s6-tcpserver-access.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-11-26 09:47:02 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-11-26 09:47:02 +0000
commit26cd94b2a8f6da396058b6c5d6446e237ec9d78f (patch)
tree13706df3bc9657d911a26133625044ae1e1acb30 /src/conn-tools/s6-tcpserver-access.c
parent51a612c34446e10a086947c410aa206fa978d169 (diff)
downloads6-networking-26cd94b2a8f6da396058b6c5d6446e237ec9d78f.tar.xz
Convert to new exec.h syntax
Diffstat (limited to 'src/conn-tools/s6-tcpserver-access.c')
-rw-r--r--src/conn-tools/s6-tcpserver-access.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/conn-tools/s6-tcpserver-access.c b/src/conn-tools/s6-tcpserver-access.c
index ec2ac63..4dc6a5b 100644
--- a/src/conn-tools/s6-tcpserver-access.c
+++ b/src/conn-tools/s6-tcpserver-access.c
@@ -4,6 +4,7 @@
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
+#include <stdlib.h>
#include <skalibs/gccattributes.h>
#include <skalibs/types.h>
@@ -18,9 +19,11 @@
#include <skalibs/djbunix.h>
#include <skalibs/socket.h>
#include <skalibs/ip46.h>
+#include <skalibs/exec.h>
#include <skalibs/unix-timed.h>
#include <s6/accessrules.h>
+
#include <s6-dns/s6dns.h>
#include <s6-networking/config.h>
@@ -57,7 +60,7 @@ static inline void log_deny (pid_t pid, ip46_t const *ip)
}
-int main (int argc, char const *const *argv, char const *const *envp)
+int main (int argc, char const *const *argv)
{
s6_accessrules_params_t params = S6_ACCESSRULES_PARAMS_ZERO ;
stralloc modifs = STRALLOC_ZERO ;
@@ -118,7 +121,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (!argc) dieusage() ;
if (!*argv[0]) dieusage() ;
- proto = env_get2(envp, "PROTO") ;
+ proto = getenv("PROTO") ;
if (!proto) strerr_dienotset(100, "PROTO") ;
protolen = strlen(proto) ;
{
@@ -126,11 +129,11 @@ int main (int argc, char const *const *argv, char const *const *envp)
char tmp[protolen + 11] ;
memcpy(tmp, proto, protolen) ;
memcpy(tmp + protolen, "REMOTEIP", 9) ;
- x = env_get2(envp, tmp) ;
+ x = getenv(tmp) ;
if (!x) strerr_dienotset(100, tmp) ;
if (!ip46_scan(x, &remoteip)) strerr_dieinvalid(100, tmp) ;
memcpy(tmp + protolen + 6, "PORT", 5) ;
- x = env_get2(envp, tmp) ;
+ x = getenv(tmp) ;
if (!x) strerr_dienotset(100, tmp) ;
if (!uint160_scan(x, &remoteport)) strerr_dieinvalid(100, tmp) ;
}
@@ -388,13 +391,13 @@ int main (int argc, char const *const *argv, char const *const *envp)
#ifdef S6_NETWORKING_USE_EXECLINE
{
char *specialargv[4] = { EXECLINE_EXTBINPREFIX "execlineb", "-c", params.exec.s, 0 } ;
- xpathexec_r((char const *const *)specialargv, envp, env_len(envp), params.env.s, params.env.len) ;
+ xmexec_m((char const *const *)specialargv, params.env.s, params.env.len) ;
}
#else
strerr_warnw1x("exec file found but ignored because s6-networking was compiled without execline support!") ;
#endif
- xpathexec_r(argv, envp, env_len(envp), params.env.s, params.env.len) ;
+ xmexec_m(argv, params.env.s, params.env.len) ;
reject:
if (verbosity >= 2)