summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2010-02-16 15:53:56 +0100
committerStephen Gallagher <sgallagh@redhat.com>2010-02-23 16:16:23 -0500
commit978bea5902ece9b9f01d1d6525dbe0889a410ffc (patch)
treed83a94851cb6e3fe10fdbfcee1757190c15ab4eb /src/tests
parente0bb119bdc1549d731f371202428c0cb667d3388 (diff)
downloadsssd-978bea5902ece9b9f01d1d6525dbe0889a410ffc.tar.gz
sssd-978bea5902ece9b9f01d1d6525dbe0889a410ffc.tar.xz
sssd-978bea5902ece9b9f01d1d6525dbe0889a410ffc.zip
Check and set permissions on SBUS sockets
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/check_and_open-tests.c17
-rw-r--r--src/tests/files-tests.c2
2 files changed, 10 insertions, 9 deletions
diff --git a/src/tests/check_and_open-tests.c b/src/tests/check_and_open-tests.c
index b0d638b55..32cf09f33 100644
--- a/src/tests/check_and_open-tests.c
+++ b/src/tests/check_and_open-tests.c
@@ -74,7 +74,7 @@ START_TEST(test_wrong_filename)
{
int ret;
- ret = check_and_open_readonly("/bla/bla/bla", &fd, uid, gid, mode);
+ ret = check_and_open_readonly("/bla/bla/bla", &fd, uid, gid, mode, CHECK_REG);
fail_unless(ret == ENOENT,
"check_and_open_readonly succeeded on non-existing file");
fail_unless(fd == -1, "check_and_open_readonly file descriptor not -1");
@@ -99,7 +99,7 @@ START_TEST(test_symlink)
ret = symlink(filename, newpath);
fail_unless(ret == 0, "symlink failed [%d][%s]", ret, strerror(ret));
- ret = check_and_open_readonly(newpath, &fd, uid, gid, mode);
+ ret = check_and_open_readonly(newpath, &fd, uid, gid, mode, CHECK_REG);
unlink(newpath);
fail_unless(ret == EINVAL,
"check_and_open_readonly succeeded on symlink");
@@ -111,7 +111,7 @@ START_TEST(test_not_regular_file)
{
int ret;
- ret = check_and_open_readonly("/dev/null", &fd, uid, gid, mode);
+ ret = check_and_open_readonly("/dev/null", &fd, uid, gid, mode, CHECK_REG);
fail_unless(ret == EINVAL,
"check_and_open_readonly succeeded on non-regular file");
fail_unless(fd == -1, "check_and_open_readonly file descriptor not -1");
@@ -122,7 +122,7 @@ START_TEST(test_wrong_uid)
{
int ret;
- ret = check_and_open_readonly(filename, &fd, uid+1, gid, mode);
+ ret = check_and_open_readonly(filename, &fd, uid+1, gid, mode, CHECK_REG);
fail_unless(ret == EINVAL,
"check_and_open_readonly succeeded with wrong uid");
fail_unless(fd == -1, "check_and_open_readonly file descriptor not -1");
@@ -133,7 +133,7 @@ START_TEST(test_wrong_gid)
{
int ret;
- ret = check_and_open_readonly(filename, &fd, uid, gid+1, mode);
+ ret = check_and_open_readonly(filename, &fd, uid, gid+1, mode, CHECK_REG);
fail_unless(ret == EINVAL,
"check_and_open_readonly succeeded with wrong gid");
fail_unless(fd == -1, "check_and_open_readonly file descriptor not -1");
@@ -144,7 +144,8 @@ START_TEST(test_wrong_permission)
{
int ret;
- ret = check_and_open_readonly(filename, &fd, uid, gid, (mode|S_IWOTH));
+ ret = check_and_open_readonly(filename, &fd, uid, gid, (mode|S_IWOTH),
+ CHECK_REG);
fail_unless(ret == EINVAL,
"check_and_open_readonly succeeded with wrong mode");
fail_unless(fd == -1, "check_and_open_readonly file descriptor not -1");
@@ -155,7 +156,7 @@ START_TEST(test_ok)
{
int ret;
- ret = check_and_open_readonly(filename, &fd, uid, gid, mode);
+ ret = check_and_open_readonly(filename, &fd, uid, gid, mode, CHECK_REG);
fail_unless(ret == EOK,
"check_and_open_readonly failed");
fail_unless(fd >= 0,
@@ -169,7 +170,7 @@ START_TEST(test_write)
ssize_t size;
errno_t my_errno;
- ret = check_and_open_readonly(filename, &fd, uid, gid, mode);
+ ret = check_and_open_readonly(filename, &fd, uid, gid, mode, CHECK_REG);
fail_unless(ret == EOK,
"check_and_open_readonly failed");
fail_unless(fd >= 0,
diff --git a/src/tests/files-tests.c b/src/tests/files-tests.c
index 90b971779..2ebe659da 100644
--- a/src/tests/files-tests.c
+++ b/src/tests/files-tests.c
@@ -183,7 +183,7 @@ START_TEST(test_simple_copy)
fail_unless(ret == 0, "destination directory not there\n");
tmp = talloc_asprintf(test_ctx, "%s/bar", dst_path);
- ret = check_and_open_readonly(tmp, &fd, uid, gid, 0700);
+ ret = check_and_open_readonly(tmp, &fd, uid, gid, 0700, CHECK_REG);
fail_unless(ret == EOK, "Cannot open %s\n");
close(fd);
talloc_free(tmp);