/*
SSSD
Test for local authentication utilities
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2010 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 <unistd.h>
#include <errno.h>
#include <string.h>
#include <popt.h>
#include <talloc.h>
#include <tevent.h>
#include <check.h>
struct sysdb_test_ctx {
};
{
char *conf_db;
int ret;
/* Create tests directory if it doesn't exist */
/* (relative to current dir) */
return EFAULT;
}
fail("Could not allocate memory for test context");
return ENOMEM;
}
/* Create an event context
* It will not be used except in confdb_init and sysdb_init
*/
fail("Could not create event context");
return EIO;
}
fail("Out of memory, aborting!");
return ENOMEM;
}
/* Connect to the conf db */
fail("Could not initialize connection to the confdb");
return ret;
}
val[0] = "LOCAL";
fail("Could not initialize domains placeholder");
return ret;
}
val[0] = "local";
fail("Could not initialize provider");
return ret;
}
val[0] = "TRUE";
fail("Could not initialize LOCAL domain");
return ret;
}
val[0] = "TRUE";
fail("Could not initialize LOCAL domain");
return ret;
}
return ret;
}
return EOK;
}
int expected_result,
int expected_counter,
{
int ret;
/* Setup */
(long long) last_failed_login);
"check_failed_login_attempts returned wrong error code, "
"check_failed_login_attempts returned wrong number of failed "
"login attempts, expected [%d], got [%d]",
"check_failed_login_attempts wrong delay, "
"expected [%d], got [%d]",
}
{
/* if offline_failed_login_attempts == 0 a login is never denied */
/* if offline_failed_login_attempts != 0 and
* offline_failed_login_delay == 0 a login is denied if the number of
* failed attempts >= offline_failed_login_attempts */
/* if offline_failed_login_attempts != 0 and
* offline_failed_login_delay != 0 a login is denied only if the number of
* failed attempts >= offline_failed_login_attempts AND the last failed
* login attempt is not longer than offline_failed_login_delay ago */
}
{
suite_add_tcase (s, tc_auth);
return s;
}
static int clean_db_dir(void)
{
int ret;
return ret;
}
return ret;
}
return ret;
}
return EOK;
}
{
int ret;
int opt;
int failure_count;
Suite *s = auth_suite ();
};
/* Set debug level to invalid value so we can decide if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
ret = clean_db_dir();
return EXIT_FAILURE;
}
srunner_free (sr);
if (failure_count == 0) {
ret = clean_db_dir();
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
return EXIT_FAILURE;
}