diff options
author | Djalal Harouni <tixxdz@opendz.org> | 2014-10-22 20:44:23 +0100 |
---|---|---|
committer | Djalal Harouni <tixxdz@opendz.org> | 2014-10-22 20:44:23 +0100 |
commit | aa81005e886a6d3f29645053f90d8bf56faca4c4 (patch) | |
tree | 367018e0ace52fd93104ebfdc8d0b7fc21402c01 /test | |
parent | 4dd958862ce46d4126568bdb83ff0b9c086981b1 (diff) | |
download | kdbus-bus-aa81005e886a6d3f29645053f90d8bf56faca4c4.tar.gz kdbus-bus-aa81005e886a6d3f29645053f90d8bf56faca4c4.tar.bz2 kdbus-bus-aa81005e886a6d3f29645053f90d8bf56faca4c4.zip |
test-fd: make sure that passed fds do not also allow fd queueing
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/test-fd.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/test-fd.c b/test/test-fd.c index b635b2c45c1..adc687d3966 100644 --- a/test/test-fd.c +++ b/test/test-fd.c @@ -9,7 +9,9 @@ #include <stdint.h> #include <errno.h> #include <assert.h> +#include <sys/types.h> #include <sys/ioctl.h> +#include <sys/socket.h> #include "kdbus-test.h" #include "kdbus-util.h" @@ -274,6 +276,7 @@ int kdbus_test_fd_passing(struct kdbus_test_env *env) unsigned int i; time_t now; int fds_conn[2]; + int sock_pair[2]; int fds[2]; int memfd; int ret; @@ -288,6 +291,9 @@ int kdbus_test_fd_passing(struct kdbus_test_env *env) fds_conn[0] = conn_src->fd; fds_conn[1] = conn_dst->fd; + ret = socketpair(AF_UNIX, SOCK_STREAM, 0, sock_pair); + ASSERT_RETURN(ret == 0); + /* * Try to ass the handle of a connection as message payload. * This must fail. @@ -295,7 +301,10 @@ int kdbus_test_fd_passing(struct kdbus_test_env *env) ret = send_fds(conn_src, conn_dst->id, fds_conn, 2); ASSERT_RETURN(ret == -ENOTSUP); - ret = send_fds(conn_src, conn_dst->id, fds_conn, 2); + ret = send_fds(conn_dst, conn_src->id, fds_conn, 2); + ASSERT_RETURN(ret == -ENOTSUP); + + ret = send_fds(conn_src, conn_dst->id, sock_pair, 2); ASSERT_RETURN(ret == -ENOTSUP); ret = pipe(fds); @@ -343,6 +352,8 @@ int kdbus_test_fd_passing(struct kdbus_test_env *env) close(fds[0]); close(fds[1]); + close(sock_pair[0]); + close(sock_pair[1]); close(memfd); kdbus_conn_free(conn_src); |