cjdns/cjdns.cap3.patch

28 lines
1.3 KiB
Diff

diff -up ./util/Setuid_linux.c.cap3 ./util/Setuid_linux.c
--- ./util/Setuid_linux.c.cap3 2016-01-31 22:04:56.591743457 -0500
+++ ./util/Setuid_linux.c 2016-01-31 22:05:42.699060985 -0500
@@ -50,9 +50,9 @@ static inline int capGet(cap_user_header
void Setuid_preSetuid(struct Allocator* alloc, struct Except* eh)
{
cap_user_header_t hdr = Allocator_calloc(alloc, sizeof(*hdr), 1);
- cap_user_data_t data = Allocator_calloc(alloc, sizeof(*data), 1);
+ cap_user_data_t data = Allocator_calloc(alloc, sizeof(*data), 2);
- hdr->version = _LINUX_CAPABILITY_VERSION;
+ hdr->version = _LINUX_CAPABILITY_VERSION_3;
hdr->pid = 0;
if (capGet(hdr, data)) {
Except_throw(eh, "Error getting capabilities: [errno:%d (%s)]", errno, strerror(errno));
@@ -73,9 +73,9 @@ void Setuid_preSetuid(struct Allocator*
void Setuid_postSetuid(struct Allocator* alloc, struct Except* eh)
{
cap_user_header_t hdr = Allocator_calloc(alloc, sizeof(*hdr), 1);
- cap_user_data_t data = Allocator_calloc(alloc, sizeof(*data), 1);
+ cap_user_data_t data = Allocator_calloc(alloc, sizeof(*data), 2);
- hdr->version = _LINUX_CAPABILITY_VERSION;
+ hdr->version = _LINUX_CAPABILITY_VERSION_3;
hdr->pid = 0;
if (capGet(hdr, data)) {
Except_throw(eh, "Error getting capabilities (post-setuid): [errno:%d (%s)]",