summaryrefslogtreecommitdiff
path: root/src/conn-tools/s6-connlimit.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-01-15 20:51:39 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-01-15 20:51:39 +0000
commitebfd0ba17e0d4b220725018d16e294e8e22a1745 (patch)
tree4b29683050ce9e8f24f1920f1be38b2f837ef5ad /src/conn-tools/s6-connlimit.c
parent20c7d8e1b328155145ce9e8648435e127b60c208 (diff)
downloads6-networking-ebfd0ba17e0d4b220725018d16e294e8e22a1745.tar.xz
Move Unix domain socket and access control stuff to s6.
Move seekablepipe to s6-portable-utils. Version: 2.0.1.0, release candidate
Diffstat (limited to 'src/conn-tools/s6-connlimit.c')
-rw-r--r--src/conn-tools/s6-connlimit.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/conn-tools/s6-connlimit.c b/src/conn-tools/s6-connlimit.c
deleted file mode 100644
index 19f4a2d..0000000
--- a/src/conn-tools/s6-connlimit.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
-#include <skalibs/strerr2.h>
-#include <skalibs/env.h>
-#include <skalibs/djbunix.h>
-
-int main (int argc, char const *const *argv, char const *const *envp)
-{
- char const *x ;
- unsigned int protolen ;
- PROG = "s6-connlimit" ;
- x = env_get2(envp, "PROTO") ;
- if (!x) strerr_dienotset(100, "PROTO") ;
- protolen = str_len(x) ;
- if (!protolen) strerr_dief1x(100, "empty PROTO") ;
- {
- unsigned int num ;
- char s[protolen + 8] ;
- byte_copy(s, protolen, x) ;
- byte_copy(s + protolen, 8, "CONNNUM") ;
- x = env_get2(envp, s) ;
- if (!x) strerr_dienotset(100, s) ;
- if (!uint0_scan(x, &num)) strerr_dief2x(100, "invalid ", s) ;
- byte_copy(s + protolen + 4, 4, "MAX") ;
- x = env_get2(envp, s) ;
- if (x)
- {
- unsigned int max ;
- if (!uint0_scan(x, &max)) strerr_dief2x(100, "invalid ", s) ;
- if (num > max)
- strerr_dief2x(1, "number of connections from this client limited to ", x) ;
- }
- }
- pathexec0_run(argv+1, envp) ;
- (void)argc ;
- strerr_dieexec(111, argv[1]) ;
-}