summaryrefslogtreecommitdiff
path: root/src/conn-tools/s6-sudo.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-sudo.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-sudo.c')
-rw-r--r--src/conn-tools/s6-sudo.c67
1 files changed, 0 insertions, 67 deletions
diff --git a/src/conn-tools/s6-sudo.c b/src/conn-tools/s6-sudo.c
deleted file mode 100644
index 5e91951..0000000
--- a/src/conn-tools/s6-sudo.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/uint.h>
-#include <skalibs/sgetopt.h>
-#include <skalibs/strerr2.h>
-#include <skalibs/djbunix.h>
-#include <s6-networking/config.h>
-
-#define USAGE "s6-sudo [ -q | -Q | -v ] [ -p bindpath ] [ -l localname ] [ -e ] [ -t timeout ] [ -T timeoutrun ] path [ args... ]"
-#define dieusage() strerr_dieusage(100, USAGE)
-
-int main (int argc, char const *const *argv, char const *const *envp)
-{
- unsigned int verbosity = 1, t = 0, T = 0 ;
- char const *bindpath = 0 ;
- char const *localname = 0 ;
- int nodoenv = 0 ;
- PROG = "s6-sudo" ;
- {
- subgetopt_t l = SUBGETOPT_ZERO ;
- for (;;)
- {
- register int opt = subgetopt_r(argc, argv, "qQvp:l:et:T:", &l) ;
- if (opt == -1) break ;
- switch (opt)
- {
- case 'q' : if (verbosity) verbosity-- ; break ;
- case 'Q' : verbosity = 1 ; break ;
- case 'v' : verbosity++ ; break ;
- case 'p' : bindpath = l.arg ; break ;
- case 'l' : localname = l.arg ; break ;
- case 'e' : nodoenv = 1 ; break ;
- case 't' : if (!uint0_scan(l.arg, &t)) dieusage() ; break ;
- case 'T' : if (!uint0_scan(l.arg, &T)) dieusage() ; break ;
- default : dieusage() ;
- }
- }
- argc -= l.ind ; argv += l.ind ;
- }
- if (!argc) dieusage() ;
- {
- char const *eargv[9 + argc + ((verbosity < 2 ? 1 : verbosity-1)) + ((!!bindpath + !!localname) << 1) + nodoenv] ;
- char fmt1[UINT_FMT] ;
- char fmt2[UINT_FMT] ;
- unsigned int n = 0 ;
- eargv[n++] = S6_NETWORKING_BINPREFIX "s6-ipcclient" ;
- if (!verbosity) eargv[n++] = "-Q" ;
- else while (--verbosity) eargv[n++] = "-v" ;
- if (bindpath) { eargv[n++] = "-p" ; eargv[n++] = bindpath ; }
- if (localname) { eargv[n++] = "-l" ; eargv[n++] = localname ; }
- eargv[n++] = "--" ;
- eargv[n++] = *argv++ ; argc-- ;
- eargv[n++] = S6_NETWORKING_BINPREFIX "s6-sudoc" ;
- if (nodoenv) eargv[n++] = "-e" ;
- eargv[n++] = "-t" ;
- fmt1[uint_fmt(fmt1, t)] = 0 ;
- eargv[n++] = fmt1 ;
- eargv[n++] = "-T" ;
- fmt2[uint_fmt(fmt2, T)] = 0 ;
- eargv[n++] = fmt2 ;
- eargv[n++] = "--" ;
- while (argc--) eargv[n++] = *argv++ ;
- eargv[n++] = 0 ;
- pathexec_run(eargv[0], eargv, envp) ;
- }
- strerr_dieexec(111, S6_NETWORKING_BINPREFIX "s6-ipcclient") ;
-}