check_and_open-tests.c revision 78b36a46eab73605439b88307e7d4848787da236
/*
SSSD
Utilities tests check_and_open
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2009 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <check.h>
#include <unistd.h>
#define SUFFIX ".symlink"
#define FILENAME_TEMPLATE "check_and_open-tests-XXXXXX"
char *filename;
int fd;
void setup_check_and_open(void)
{
int ret;
fd = -1;
}
void teardown_check_and_open(void)
{
int ret;
if (fd != -1) {
}
}
{
int ret;
"check_and_open_readonly succeeded on non-existing file");
}
{
int ret;
char *newpath;
ret);
"check_and_open_readonly succeeded on symlink");
}
{
int ret;
char *newpath;
ret);
"check_and_open_readonly failed on symlink with follow=true");
}
{
int ret;
"check_and_open_readonly succeeded on non-regular file");
}
{
int ret;
"check_and_open_readonly succeeded with wrong uid");
}
{
int ret;
"check_and_open_readonly succeeded with wrong gid");
}
{
int ret;
"check_and_open_readonly succeeded with wrong mode");
}
{
int ret;
"check_and_open_readonly failed");
fail_unless(fd >= 0,
"check_and_open_readonly returned illegal file descriptor");
}
{
int ret;
"check_and_open_readonly failed");
fail_unless(fd >= 0,
"check_and_open_readonly returned illegal file descriptor");
"write failed for other reason than readonly");
}
Suite *check_and_open_suite (void)
{
return s;
}
int main(void)
{
int number_failed;
Suite *s = check_and_open_suite ();
/* If CK_VERBOSITY is set, use that, otherwise it defaults to CK_NORMAL */
srunner_free (sr);
}