diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2016-02-06 01:40:09 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2016-02-08 18:21:10 +0000 |
commit | a59fcec4c937c4854600ec8f1f2161fad75ce5e7 (patch) | |
tree | bd80325b42577ab0a271a87dc0ba6e7027caa2b1 /tests/caps.c | |
parent | 48d97b6a833027775f732fe4e135726fa6e01016 (diff) | |
download | strace-a59fcec4c937c4854600ec8f1f2161fad75ce5e7.tar.gz |
tests: extend coverage of capget syscall
* tests/caps.c (main): Check decoding of inaccessible cap_user_header_t
and/or cap_user_data_t.
* tests/caps.awk: Update match patterns.
* tests/caps.test: Update.
Diffstat (limited to 'tests/caps.c')
-rw-r--r-- | tests/caps.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/caps.c b/tests/caps.c index 2aca8625..17e10777 100644 --- a/tests/caps.c +++ b/tests/caps.c @@ -1,4 +1,6 @@ /* + * This file is part of caps strace test. + * * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org> * All rights reserved. * @@ -27,6 +29,7 @@ #include "tests.h" #include <errno.h> +#include <string.h> extern int capget(int *, int *); extern int capset(int *, const int *); @@ -34,15 +37,24 @@ extern int capset(int *, const int *); int main(void) { - int unused[6]; const int data[] = { 2, 4, 0, 8, 16, 0 }; const int v3 = 0x20080522; - int head[] = { v3, 0 }; - if (capget(head, unused)) + int * const head = tail_alloc(sizeof(int) * 2); + head[0] = v3; + head[1] = 0; + int * const tail_data = tail_alloc(sizeof(data)); + + capget(NULL, NULL); + capget(head + 2, tail_data); + capget(head, tail_data + ARRAY_SIZE(data)); + + if (capget(head, tail_data)) perror_msg_and_skip("capget"); if (head[0] != v3) error_msg_and_skip("capget: v3 expected"); + + memcpy(tail_data, data, sizeof(data)); if (capset(head, data) == 0 || errno != EPERM) perror_msg_and_skip("capset"); |