Browse Source

tpws : dropcaps

pull/33/head
bolvan 6 years ago
parent
commit
8b9d7f56d3
  1. BIN
      binaries/aarch64/tpws
  2. BIN
      binaries/armhf/tpws
  3. BIN
      binaries/mips32r1-lsb/tpws
  4. BIN
      binaries/mips32r1-msb/tpws
  5. BIN
      binaries/mips64r2-msb/tpws
  6. BIN
      binaries/ppc/tpws
  7. BIN
      binaries/x86/tpws
  8. BIN
      binaries/x86_64/tpws
  9. 2
      docs/compile/openwrt/package/zapret/tpws/Makefile
  10. 24
      tpws/tpws.c

BIN
binaries/aarch64/tpws

Binary file not shown.

BIN
binaries/armhf/tpws

Binary file not shown.

BIN
binaries/mips32r1-lsb/tpws

Binary file not shown.

BIN
binaries/mips32r1-msb/tpws

Binary file not shown.

BIN
binaries/mips64r2-msb/tpws

Binary file not shown.

BIN
binaries/ppc/tpws

Binary file not shown.

BIN
binaries/x86/tpws

Binary file not shown.

BIN
binaries/x86_64/tpws

Binary file not shown.

2
docs/compile/openwrt/package/zapret/tpws/Makefile

@ -12,7 +12,7 @@ define Package/tpws
CATEGORY:=Network CATEGORY:=Network
TITLE:=tpws TITLE:=tpws
SUBMENU:=Zapret SUBMENU:=Zapret
DEPENDS:=+zlib DEPENDS:=+zlib +libcap
endef endef
define Build/Prepare define Build/Prepare

24
tpws/tpws.c

@ -23,6 +23,7 @@
#include <getopt.h> #include <getopt.h>
#include <pwd.h> #include <pwd.h>
#include <signal.h> #include <signal.h>
#include <sys/capability.h>
#include "tpws.h" #include "tpws.h"
#include "tpws_conn.h" #include "tpws_conn.h"
@ -789,6 +790,26 @@ void daemonize()
/* stderror */ /* stderror */
} }
bool dropcaps()
{
cap_t capabilities;
capabilities = cap_init();
if (cap_clear(capabilities))
{
perror("cap_init");
return false;
}
if (cap_set_proc(capabilities))
{
perror("cap_set_proc");
cap_free(capabilities);
return false;
}
cap_free(capabilities);
return true;
}
bool droproot() bool droproot()
{ {
if (params.uid || params.gid) if (params.uid || params.gid)
@ -804,9 +825,10 @@ bool droproot()
return false; return false;
} }
} }
return true; return dropcaps();
} }
bool writepid(const char *filename) bool writepid(const char *filename)
{ {
FILE *F; FILE *F;

Loading…
Cancel
Save