[PATCH 7/8] io: Handle data_size of -1 as unlimited data in print_iovec

2016-09-29 Thread Eugene Syromyatnikov
Otherwise it can be depleted and print_iovec starts printing empty strings. * io.c (print_iovec): Interpret c->data_size of -1 as unlimited data and do not decrease it in this case. --- io.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/io.c b/io.c index

[PATCH 8/8] tests: Add add_key, keyctl, request_key tests

2016-09-29 Thread Eugene Syromyatnikov
* tests/Makefile.am (DECODER_TESTS): Add add_key.test, keyctl.test, request_key.test. (check_PROGRAMS): Add add_key, keyctl, request_key. * tests/.gitignore: Likewise. * tests/add_key.c: New file. * tests/add_key.test: Likewise. * tests/keyctl.c: Likewise. * tests/keyctl.test: Likewise. *

[PATCH 5/8] keyctl: Print errno name in KEYCTL_REJECT in case it is available

2016-09-29 Thread Eugene Syromyatnikov
* keyctl.c (keyctl_reject_key): Get errno string via err_name and print it if it is not NULL. --- keyctl.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/keyctl.c b/keyctl.c index c9081b7..1fb1da5 100644 --- a/keyctl.c +++ b/keyctl.c @@ -175,8 +175,16 @@ static

[PATCH 6/8] keyctl: Add support for KEYCTL_DH_COMPUTE

2016-09-29 Thread Eugene Syromyatnikov
* keyctl.c (struct keyctl_dh_params): New structure. (print_dh_params): New function. (keyctl_dh_compute): New function. (SYS_FUNC(keyctl)): Add support for KEYCTL_DH_COMPUTE cmd value. --- keyctl.c | 46 ++ 1 file changed, 46 insertions(+)

[PATCH 3/8] keyctl: Do not print comma for KEYCTL_SESSION_TO_PARENT command

2016-09-29 Thread Eugene Syromyatnikov
Since this command doesn't have any additional arguments, the comma does not needed. Since this is the only command which lacks additional arguments, it's better to add special case for it rather than add printing of comma to all other commands. * keyctl.c (SYS_FUNC(keyctl)): Add check for

[PATCH 2/8] keyctl: Use getarg_ull for printing generic arguments

2016-09-29 Thread Eugene Syromyatnikov
Otherwise it is erroneous on x32, for example. * keyctl.c (SYS_FUNC(keyctl)): Use "%#llx" conversion specifier and getarg_ull for fallback argument printing. --- keyctl.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keyctl.c b/keyctl.c index ecb3e79..a0bbbd0

[PATCH 4/8] Add function for getting errno string.

2016-09-29 Thread Eugene Syromyatnikov
* syscall.c (err_name): New function. * defs.h: Add declaration of err_name(). --- defs.h|1 + syscall.c |9 + 2 files changed, 10 insertions(+) diff --git a/defs.h b/defs.h index ffea23f..1e2363b 100644 --- a/defs.h +++ b/defs.h @@ -457,6 +457,7 @@ extern void

[PATCH 1/8] keyctl: Use printuid for printing UID/GID

2016-09-29 Thread Eugene Syromyatnikov
UID/GID are unsigned except special -1 value (which is also special in context of specific keyctl commands), so special printing function should be used. * keyctl.c (keyctl_chown_key): Use printuid instead of printf with "%d" conversion for printing UID/GID. (keyctl_get_persistent): Likewise.

[PATCH 0/8] keyctl tests

2016-09-29 Thread Eugene Syromyatnikov
Hello. This patchset provides minor updates to decoders in keyctl.c along with tests for add_key, keyctl, and request_key syscall decoders. Eugene Syromyatnikov (8): keyctl: Use printuid for printing UID/GID keyctl: Use getarg_ull for printing generic arguments keyctl: Do not print comma