diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2010-11-19 14:16:10 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-11-24 10:09:16 -0500 |
commit | 4b0309363dbfb9a1409e082b3a84f17b53a751c1 (patch) | |
tree | 5eaa9c86090f9edcece17c836d65789baef0cb91 /src | |
parent | fa6c70fabb8dc2fab580a014cdcf1b0dd3e99554 (diff) | |
download | sssd-4b0309363dbfb9a1409e082b3a84f17b53a751c1.tar.gz sssd-4b0309363dbfb9a1409e082b3a84f17b53a751c1.tar.bz2 sssd-4b0309363dbfb9a1409e082b3a84f17b53a751c1.zip |
Print correct error messages for dp_err_to_string()
All errnum values passed into this function throughout the code
are PAM error codes, but we were passing them through strerror()
to print them, which is only meaningful for ERRNO error codes.
This patch changes dp_err_to_string() to use pam_strerror() and
renames it to dp_pam_err_to_string() for clarity.
https://fedorahosted.org/sssd/ticket/636
Diffstat (limited to 'src')
-rw-r--r-- | src/providers/data_provider_be.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 764635a7..e094c65b 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -228,7 +228,7 @@ static int be_check_online(DBusMessage *message, struct sbus_connection *conn) return EOK; } -static char *dp_err_to_string(TALLOC_CTX *memctx, int dp_err_type, int errnum) +static char *dp_pam_err_to_string(TALLOC_CTX *memctx, int dp_err_type, int errnum) { switch (dp_err_type) { case DP_ERR_OK: @@ -238,20 +238,20 @@ static char *dp_err_to_string(TALLOC_CTX *memctx, int dp_err_type, int errnum) case DP_ERR_OFFLINE: return talloc_asprintf(memctx, "Provider is Offline (%s)", - strerror(errnum)); + pam_strerror(NULL, errnum)); break; case DP_ERR_TIMEOUT: return talloc_asprintf(memctx, "Request timed out (%s)", - strerror(errnum)); + pam_strerror(NULL, errnum)); break; case DP_ERR_FATAL: default: return talloc_asprintf(memctx, "Internal Error (%s)", - strerror(errnum)); + pam_strerror(NULL, errnum)); break; } @@ -284,7 +284,7 @@ static void acctinfo_callback(struct be_req *req, if (errstr) { err_msg = errstr; } else { - err_msg = dp_err_to_string(req, dp_err_type, errnum); + err_msg = dp_pam_err_to_string(req, dp_err_type, errnum); } if (!err_msg) { DEBUG(1, ("Failed to set err_msg, Out of memory?\n")); @@ -492,7 +492,7 @@ static void be_pam_handler_callback(struct be_req *req, DEBUG(4, ("Backend returned: (%d, %d, %s) [%s]\n", dp_err_type, errnum, errstr?errstr:"<NULL>", - dp_err_to_string(req, dp_err_type, errnum))); + dp_pam_err_to_string(req, dp_err_type, errnum))); pd = talloc_get_type(req->req_data, struct pam_data); |