-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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().

Fixes https://fedorahosted.org/sssd/ticket/636

Note: the first argument to pam_strerror() requiring a PAM handle is
historical and not necessary. I tested that passing it NULL results in
no unexpected behavior.

- -- 
Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkzmzqkACgkQeiVVYja6o6PIXwCgqWXP1Sm1ym1PaDcWeBjgxB+K
FcQAn3o5A0KmgT/Z0X0itrTmqiO3sGQl
=1LHe
-----END PGP SIGNATURE-----
From 3bfc7b32ae6dea5c9be3f882a1d6bbbc49d45e08 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgall...@redhat.com>
Date: Fri, 19 Nov 2010 14:16:10 -0500
Subject: [PATCH] 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().

https://fedorahosted.org/sssd/ticket/636
---
 Makefile.am                      |    3 ++-
 src/providers/data_provider_be.c |    6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 102149a8cd2734b9080c34f318a2e97ff79a78ba..6d91cf695b6385eb15cd9a76feb7244a9a9c38bd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -403,7 +403,8 @@ sssd_be_SOURCES = \
 sssd_be_LDADD = $(SSSD_LIBS) $(CARES_LIBS)
 sssd_be_LDFLAGS = \
     -Wl,--version-script,$(srcdir)/src/providers/sssd_be.exports \
-    -export-dynamic
+    -export-dynamic \
+    $(PAM_LIBS)
 
 if BUILD_PYTHON_BINDINGS
 sss_obfuscate_pythondir = $(sbindir)
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
index 764635a73ff9f5ea8c93eb3240ba8dbe511da6b0..3390ed56a3aecd0af5309ccb77d7a985eae3ccce 100644
--- a/src/providers/data_provider_be.c
+++ b/src/providers/data_provider_be.c
@@ -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;
     }
 
-- 
1.7.3.2

Attachment: 0001-Print-correct-error-messages-for-dp_err_to_string.patch.sig
Description: PGP signature

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to