diff options
author | Simo Sorce <simo@redhat.com> | 2012-11-21 16:52:33 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-03-04 23:40:25 +0100 |
commit | ab967283b710dfa05d11ee5b30c7ac916486ceec (patch) | |
tree | 636b0ded10d3a282cbd3c8ff88e9c94de60d26e3 /src/tests | |
parent | 8bcabb97d988d1602882a1f036aac2eaf5e09234 (diff) | |
download | sssd-ab967283b710dfa05d11ee5b30c7ac916486ceec.tar.gz sssd-ab967283b710dfa05d11ee5b30c7ac916486ceec.tar.xz sssd-ab967283b710dfa05d11ee5b30c7ac916486ceec.zip |
Use SSSD specific errors for offline auth
This prevents reportin false errors when internal functions return
a generic EINVAL or EACCES that should just be treated as internal
errors.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/auth-tests.c | 6 | ||||
-rw-r--r-- | src/tests/sysdb-tests.c | 12 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/tests/auth-tests.c b/src/tests/auth-tests.c index 7b53c9b92..02fb39c88 100644 --- a/src/tests/auth-tests.c +++ b/src/tests/auth-tests.c @@ -229,8 +229,8 @@ START_TEST(test_failed_login_attempts) * failed attempts >= offline_failed_login_attempts */ do_failed_login_test(0, 0, 2, 0, EOK, 0, -1); do_failed_login_test(0, time(NULL), 2, 0, EOK, 0, -1); - do_failed_login_test(2, 0, 2, 0, EACCES, 2, -1); - do_failed_login_test(2, time(NULL), 2, 0, EACCES, 2, -1); + do_failed_login_test(2, 0, 2, 0, ERR_AUTH_DENIED, 2, -1); + do_failed_login_test(2, time(NULL), 2, 0, ERR_AUTH_DENIED, 2, -1); /* if offline_failed_login_attempts != 0 and * offline_failed_login_delay != 0 a login is denied only if the number of @@ -240,7 +240,7 @@ START_TEST(test_failed_login_attempts) do_failed_login_test(0, time(NULL), 2, 5, EOK, 0, -1); do_failed_login_test(2, 0, 2, 5, EOK, 0, -1); now = time(NULL); - do_failed_login_test(2, now, 2, 5, EACCES, 2, (now + 5 * 60)); + do_failed_login_test(2, now, 2, 5, ERR_AUTH_DENIED, 2, (now + 5 * 60)); } END_TEST diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index 081df6cf6..ada0ccc56 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -1845,8 +1845,10 @@ START_TEST (test_sysdb_cached_authentication_missing_password) username = talloc_asprintf(tmp_ctx, "testuser%d", _i); fail_unless(username != NULL, "talloc_asprintf failed."); - cached_authentication_without_expiration(username, "abc", ENOENT); - cached_authentication_with_expiration(username, "abc", ENOENT); + cached_authentication_without_expiration(username, "abc", + ERR_NO_CACHED_CREDS); + cached_authentication_with_expiration(username, "abc", + ERR_NO_CACHED_CREDS); talloc_free(tmp_ctx); @@ -1864,8 +1866,10 @@ START_TEST (test_sysdb_cached_authentication_wrong_password) username = talloc_asprintf(tmp_ctx, "testuser%d", _i); fail_unless(username != NULL, "talloc_asprintf failed."); - cached_authentication_without_expiration(username, "abc", EINVAL); - cached_authentication_with_expiration(username, "abc", EINVAL); + cached_authentication_without_expiration(username, "abc", + ERR_AUTH_FAILED); + cached_authentication_with_expiration(username, "abc", + ERR_AUTH_FAILED); talloc_free(tmp_ctx); |