mirror of
https://github.com/bol-van/zapret.git
synced 2025-05-24 22:32:58 +03:00
nfqws,tpws: separate droproot from dropcaps
This commit is contained in:
@@ -293,7 +293,7 @@ static int nfq_main(void)
|
||||
ssize_t rd;
|
||||
|
||||
sec_harden();
|
||||
if (params.droproot && !droproot(params.uid, params.gid))
|
||||
if (params.droproot && !droproot(params.uid, params.gid) || !dropcaps())
|
||||
return 1;
|
||||
print_id();
|
||||
if (params.droproot && !test_list_files())
|
||||
|
@@ -287,7 +287,7 @@ bool can_drop_root(void)
|
||||
{
|
||||
#ifdef __linux__
|
||||
// has some caps
|
||||
return checkpcap((1<<CAP_SETUID)|(1<<CAP_SETGID)|(1<<CAP_SETPCAP));
|
||||
return checkpcap((1<<CAP_SETUID)|(1<<CAP_SETGID));
|
||||
#else
|
||||
// effective root
|
||||
return !geteuid();
|
||||
@@ -319,11 +319,7 @@ bool droproot(uid_t uid, gid_t gid)
|
||||
DLOG_PERROR("setuid");
|
||||
return false;
|
||||
}
|
||||
#ifdef __linux__
|
||||
return dropcaps();
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void print_id(void)
|
||||
|
Reference in New Issue
Block a user