[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RFC: Test code for SCM_CREDS



Hi,

attached is a test program for SCM_CREDS support for GNU/Linux,
GNU/kFreeBSD and GNU/Hurd. With the soon to be submitted patches Hurd
works as given below. LD_PRELOAD is used for the Hurd tests.

Options: 
none: send an integer as data
-z: send a zero credentials byte as data (used by dbus)
-n: don't create explicit credentials structure
-nz, -zn: combine the two options above

1) Sent credentials are correct:
./scm_cred_recv &
./scm_cred_send
Linux: OK, only sent ids
kFreeBSD: OK, sent ids + groups
Hurd: OK, only sent ids

./scm_cred_recv -z&
./scm_cred_send -z
Linux: OK, same as above
kFreeBSD: OK, same as above
Hurd: OK, sent IDs + groups

./scm_cred_recv &
./scm_cred_send -n
Linux: OK, same as above
kFreeBSD: nOK; ERROR: bad cmsg header cmhp == NULL, data: OK
Hurd: same as kFreeBSD

./scm_cred_recv -z&
./scm_cred_send -nz
Linux: OK, same as above
kFreeBSD: nOK; ERROR: bad cmsg header cmhp == NULL, data: OK
Hurd: OK, sent IDs + groups

2) When wrong credentials are sent the behaviour is different:

Linux:
no flag: ERROR [EPERM Operation not permitted] sendmsg
-z: ERROR [EPERM Operation not permitted] sendmsg
-n: sent credentials are not honoured, received ones are created
-zn: sent credentials are not honoured, received ones are created

kFreeBSD: 
no flag: sent credentials are not honoured, received ones are created
-n: ERROR: bad cmsg header cmhp == NULL
-z: sent credentials are not honoured, received ones are created
-zn: ERROR: bad cmsg header cmhp == NULL

Hurd:
no flag: ERROR [EPERM Operation not permitted] sendmsg
-z: sent credentials are not honoured, received ones are created
-n: ERROR: bad cmsg header cmhp == NULL
-zn: sent credentials are not honoured, received ones are created

Is the implemented behaviour OK, anything to add/change/remove?

Attachment: test_scm_cred.tar.gz
Description: application/compressed-tar


Reply to: