summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-02-26 16:25:07 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-03-19 14:07:41 +0100
commit233a3c6c48972b177e60d6ef4cecfacd3cf31659 (patch)
treee67d6eaed705d8c76173af0c06b49072224460be /src/util
parent4f2e932acd5266e9d4e3f55966baafbdbd2ae210 (diff)
downloadsssd-233a3c6c48972b177e60d6ef4cecfacd3cf31659.tar.gz
sssd-233a3c6c48972b177e60d6ef4cecfacd3cf31659.tar.xz
sssd-233a3c6c48972b177e60d6ef4cecfacd3cf31659.zip
Use common error facility instead of sdap_result
Simplifies and consolidates error reporting for ldap authentication paths. Adds 3 new error codes: ERR_CHPASS_DENIED - Used when password constraints deny password changes ERR_ACCOUNT_EXPIRED - Account is expired ERR_PASSWORD_EXPIRED - Password is expired
Diffstat (limited to 'src/util')
-rw-r--r--src/util/sss_ldap.c9
-rw-r--r--src/util/sss_ldap.h2
-rw-r--r--src/util/util_errors.c3
-rw-r--r--src/util/util_errors.h3
4 files changed, 9 insertions, 8 deletions
diff --git a/src/util/sss_ldap.c b/src/util/sss_ldap.c
index 060aacf9e..f7834d940 100644
--- a/src/util/sss_ldap.c
+++ b/src/util/sss_ldap.c
@@ -32,12 +32,9 @@
const char* sss_ldap_err2string(int err)
{
- static const char *password_expired = "Password expired";
-
- switch (err) {
- case LDAP_X_SSSD_PASSWORD_EXPIRED:
- return password_expired;
- default:
+ if (IS_SSSD_ERROR(err)) {
+ return sss_strerror(err);
+ } else {
return ldap_err2string(err);
}
}
diff --git a/src/util/sss_ldap.h b/src/util/sss_ldap.h
index 46829259a..7399c4d0a 100644
--- a/src/util/sss_ldap.h
+++ b/src/util/sss_ldap.h
@@ -27,8 +27,6 @@
#include <talloc.h>
#include <tevent.h>
-#define LDAP_X_SSSD_PASSWORD_EXPIRED 0x555D
-
#ifndef LDAP_CONTROL_PWEXPIRED
#define LDAP_CONTROL_PWEXPIRED "2.16.840.1.113730.3.4.4"
#endif
diff --git a/src/util/util_errors.c b/src/util/util_errors.c
index 1760c8d84..88806f531 100644
--- a/src/util/util_errors.c
+++ b/src/util/util_errors.c
@@ -35,8 +35,11 @@ struct err_string error_to_str[] = {
{ "Cached credentials are expired" }, /* ERR_CACHED_CREDS_EXPIRED */
{ "Authentication Denied" }, /* ERR_AUTH_DENIED */
{ "Authentication Failed" }, /* ERR_AUTH_FAILED */
+ { "Password Change Denied" }, /* ERR_CHPASS_DENIED */
{ "Password Change Failed" }, /* ERR_CHPASS_FAILED */
{ "Network I/O Error" }, /* ERR_NETWORK_IO */
+ { "Account Expired" }, /* ERR_ACCOUNT_EXPIRED */
+ { "Password Expired" }, /* ERR_PASSWORD_EXPIRED */
};
diff --git a/src/util/util_errors.h b/src/util/util_errors.h
index 91fea1766..3e74de64c 100644
--- a/src/util/util_errors.h
+++ b/src/util/util_errors.h
@@ -57,8 +57,11 @@ enum sssd_errors {
ERR_CACHED_CREDS_EXPIRED,
ERR_AUTH_DENIED,
ERR_AUTH_FAILED,
+ ERR_CHPASS_DENIED,
ERR_CHPASS_FAILED,
ERR_NETWORK_IO,
+ ERR_ACCOUNT_EXPIRED,
+ ERR_PASSWORD_EXPIRED,
ERR_LAST /* ALWAYS LAST */
};