diff options
author | Pavel Březina <pbrezina@redhat.com> | 2011-09-05 09:54:46 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-09-06 14:23:19 -0400 |
commit | 3fff68f56b3c68897821c49ec7357a4f36bafa96 (patch) | |
tree | 84006dee316aecb5aea5d41a4a0f3dcd5895282e /src | |
parent | 9135228669caa308bef109eec3710600362738b5 (diff) | |
download | sssd-3fff68f56b3c68897821c49ec7357a4f36bafa96.tar.gz sssd-3fff68f56b3c68897821c49ec7357a4f36bafa96.tar.xz sssd-3fff68f56b3c68897821c49ec7357a4f36bafa96.zip |
sss_ldap_err2string() - function created
https://fedorahosted.org/sssd/ticket/986
Diffstat (limited to 'src')
-rw-r--r-- | src/providers/ldap/sdap_async_connection.c | 2 | ||||
-rw-r--r-- | src/util/sss_ldap.c | 12 | ||||
-rw-r--r-- | src/util/sss_ldap.h | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c index b391aa96f..83e66708b 100644 --- a/src/providers/ldap/sdap_async_connection.c +++ b/src/providers/ldap/sdap_async_connection.c @@ -29,8 +29,6 @@ #include "providers/ldap/sdap_async_private.h" #include "providers/ldap/ldap_common.h" -#define LDAP_X_SSSD_PASSWORD_EXPIRED 0x555D - errno_t deref_string_to_val(const char *str, int *val) { if (strcasecmp(str, "never") == 0) { diff --git a/src/util/sss_ldap.c b/src/util/sss_ldap.c index de4bebf88..e799e4312 100644 --- a/src/util/sss_ldap.c +++ b/src/util/sss_ldap.c @@ -29,6 +29,18 @@ #include "util/sss_ldap.h" #include "util/util.h" +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: + return ldap_err2string(err); + } +} + int sss_ldap_get_diagnostic_msg(TALLOC_CTX *mem_ctx, LDAP *ld, char **_errmsg) { char *errmsg = NULL; diff --git a/src/util/sss_ldap.h b/src/util/sss_ldap.h index 4b4d9c1bd..38785b5a0 100644 --- a/src/util/sss_ldap.h +++ b/src/util/sss_ldap.h @@ -27,6 +27,8 @@ #include <talloc.h> #include <tevent.h> +#define LDAP_X_SSSD_PASSWORD_EXPIRED 0x555D + #ifdef LDAP_OPT_DIAGNOSTIC_MESSAGE #define SDAP_DIAGNOSTIC_MESSAGE LDAP_OPT_DIAGNOSTIC_MESSAGE #else @@ -37,6 +39,8 @@ #endif #endif +const char* sss_ldap_err2string(int err); + int sss_ldap_get_diagnostic_msg(TALLOC_CTX *mem_ctx, LDAP *ld, char **_errmsg); |