summaryrefslogtreecommitdiff
path: root/privs.c
blob: ac4ad25c337b2db978b5a9e76cefc2218e7eb07f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <unistd.h>
#include <sys/types.h>

#include "privs.h"
#include "die.h"

void drop_privileges(bool enforce, uid_t uid, gid_t gid)
{
	if (enforce) {
		if (uid == getuid())
			panic("Uid cannot be the same as the current user!\n");
		if (gid == getgid())
			panic("Gid cannot be the same as the current user!\n");
	}
	if (setgid(gid) != 0)
		panic("Unable to drop group privileges: %s!\n", strerror(errno));
	if (setuid(uid) != 0)
		panic("Unable to drop user privileges: %s!\n", strerror(errno));
}
' selected='selected'>unified
authorMiklos Szeredi <mszeredi@redhat.com>2016-06-29 08:26:59 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2016-06-29 08:26:59 +0200
commita4859d75944a726533ab86d24bb5ffd1b2b7d6cc (patch)
tree1a1c97b15b21d90334b1ca0d0c47bae2cf0e2595 /Documentation/devicetree
parent4c2e07c6a29e0129e975727b9f57eede813eea85 (diff)
ovl: fix dentry leak for default_permissions
When using the 'default_permissions' mount option, ovl_permission() on non-directories was missing a dput(alias), resulting in "BUG Dentry still in use". Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Fixes: 8d3095f4ad47 ("ovl: default permissions") Cc: <stable@vger.kernel.org> # v4.5+
Diffstat (limited to 'Documentation/devicetree')