aboutsummaryrefslogtreecommitdiff
path: root/libpam/pam_start.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpam/pam_start.c')
-rw-r--r--libpam/pam_start.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libpam/pam_start.c b/libpam/pam_start.c
index 5e9b0948..c32ce61c 100644
--- a/libpam/pam_start.c
+++ b/libpam/pam_start.c
@@ -25,6 +25,21 @@ static int _pam_start_internal (
D(("called pam_start: [%s] [%s] [%p] [%p]"
,service_name, user, pam_conversation, pamh));
+#ifdef HAVE_BINDTEXTDOMAIN
+ /* Bind text domain to pull in PAM translations for a case where
+ linux-pam is installed to non-default prefix.
+
+ It is safe to call bindtextdomain() from multiple threads, but it
+ has a chance to have some overhead. Let's try to do it once (or a
+ small number of times as `bound_text_domain` is not protected by
+ a lock. */
+ static int bound_text_domain = 0;
+ if (!bound_text_domain) {
+ bound_text_domain = 1;
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ }
+#endif
+
if (pamh == NULL) {
pam_syslog(NULL, LOG_CRIT,
"pam_start: invalid argument: pamh == NULL");