krb5 commit: Allow using locales when gettext is absent
Benjamin Kaduk
kaduk at MIT.EDU
Fri Jul 6 17:05:52 EDT 2012
https://github.com/krb5/krb5/commit/7afeca0d0f821e12298d6987a9d1cd65be7539b0
commit 7afeca0d0f821e12298d6987a9d1cd65be7539b0
Author: Ben Kaduk <kaduk at mit.edu>
Date: Fri Jul 6 15:45:20 2012 -0400
Allow using locales when gettext is absent
Previously, if configure did not detect dgettext(), we disabled
anything that smelled like localization, inadvertently including
setlocale(). Now that we use setlocale(LC_ALL, ""), we have
localized dates available as well as messages, so we should not
disable calls to setlocale() any more.
Since the routines from locale.h are only used in a relatively
small number of places, just include the header directly in those
files and remove it from k5-platform.h.
src/clients/kdestroy/kdestroy.c | 1 +
src/clients/kinit/kinit.c | 1 +
src/clients/klist/klist.c | 1 +
src/clients/kpasswd/kpasswd.c | 1 +
src/clients/kswitch/kswitch.c | 1 +
src/clients/kvno/kvno.c | 1 +
src/include/k5-platform.h | 8 +++-----
src/kadmin/cli/ss_wrapper.c | 1 +
src/kadmin/dbutil/kdb5_util.c | 1 +
src/kadmin/ktutil/ktutil.c | 1 +
src/kadmin/server/ovsec_kadmd.c | 1 +
src/kdc/main.c | 1 +
src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c | 1 +
src/slave/kprop.c | 1 +
src/slave/kpropd.c | 1 +
src/slave/kproplog.c | 1 +
16 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/clients/kdestroy/kdestroy.c b/src/clients/kdestroy/kdestroy.c
index 2d13cd9..299838f 100644
--- a/src/clients/kdestroy/kdestroy.c
+++ b/src/clients/kdestroy/kdestroy.c
@@ -27,6 +27,7 @@
#include "k5-platform.h"
#include <krb5.h>
#include <com_err.h>
+#include <locale.h>
#include <string.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c
index b24c32a..dcec9b7 100644
--- a/src/clients/kinit/kinit.c
+++ b/src/clients/kinit/kinit.c
@@ -28,6 +28,7 @@
#include "k5-platform.h" /* for asprintf */
#include <krb5.h>
#include "extern.h"
+#include <locale.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
diff --git a/src/clients/klist/klist.c b/src/clients/klist/klist.c
index 402858e..fefd895 100644
--- a/src/clients/klist/klist.c
+++ b/src/clients/klist/klist.c
@@ -27,6 +27,7 @@
#include "k5-int.h"
#include <krb5.h>
#include <com_err.h>
+#include <locale.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
diff --git a/src/clients/kpasswd/kpasswd.c b/src/clients/kpasswd/kpasswd.c
index 4fc773e..9f4952b 100644
--- a/src/clients/kpasswd/kpasswd.c
+++ b/src/clients/kpasswd/kpasswd.c
@@ -1,4 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+#include <locale.h>
#include <stdio.h>
#include <sys/types.h>
#include "k5-platform.h"
diff --git a/src/clients/kswitch/kswitch.c b/src/clients/kswitch/kswitch.c
index 6c721d2..b649479 100644
--- a/src/clients/kswitch/kswitch.c
+++ b/src/clients/kswitch/kswitch.c
@@ -24,6 +24,7 @@
* or implied warranty.
*/
+#include <locale.h>
#include "k5-int.h"
extern int optind;
diff --git a/src/clients/kvno/kvno.c b/src/clients/kvno/kvno.c
index 9b4f205..134accb 100644
--- a/src/clients/kvno/kvno.c
+++ b/src/clients/kvno/kvno.c
@@ -25,6 +25,7 @@
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include "k5-platform.h"
diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h
index 9516524..c927291 100644
--- a/src/include/k5-platform.h
+++ b/src/include/k5-platform.h
@@ -41,7 +41,7 @@
* + mkstemp
* + zap (support function; macro is in k5-int.h)
* + path manipulation
- * + _, N_, dgettext, bindtextdomain, setlocale (for localization)
+ * + _, N_, dgettext, bindtextdomain (for localization)
*/
#ifndef K5_PLATFORM_H
@@ -1061,13 +1061,12 @@ int k5_path_isabs(const char *path);
/*
* Localization macros. If we have gettext, define _ appropriately for
- * translating a string. If we do not have gettext, define _, bindtextdomain,
- * and setlocale as no-ops. N_ is always a no-op; it marks a string for
+ * translating a string. If we do not have gettext, define _ and
+ * bindtextdomain as no-ops. N_ is always a no-op; it marks a string for
* extraction to pot files but does not translate it.
*/
#ifdef ENABLE_NLS
#include <libintl.h>
-#include <locale.h>
#define KRB5_TEXTDOMAIN "mit-krb5"
#define _(s) dgettext(KRB5_TEXTDOMAIN, s)
#else
@@ -1075,7 +1074,6 @@ int k5_path_isabs(const char *path);
#define dgettext(d, m) m
#define ngettext(m1, m2, n) (((n) == 1) ? m1 : m2)
#define bindtextdomain(p, d)
-#define setlocale(c, l)
#endif
#define N_(s) s
diff --git a/src/kadmin/cli/ss_wrapper.c b/src/kadmin/cli/ss_wrapper.c
index bf884d1..54f5671 100644
--- a/src/kadmin/cli/ss_wrapper.c
+++ b/src/kadmin/cli/ss_wrapper.c
@@ -25,6 +25,7 @@
#include <krb5.h>
#include <k5-platform.h>
+#include <locale.h>
#include <ss/ss.h>
#include "kadmin.h"
diff --git a/src/kadmin/dbutil/kdb5_util.c b/src/kadmin/dbutil/kdb5_util.c
index e4d8d6c..ca1cdd2 100644
--- a/src/kadmin/dbutil/kdb5_util.c
+++ b/src/kadmin/dbutil/kdb5_util.c
@@ -56,6 +56,7 @@
#include <stdio.h>
#include <k5-int.h>
#include <kadm5/admin.h>
+#include <locale.h>
#include <adm_proto.h>
#include <time.h>
#include "kdb5_util.h"
diff --git a/src/kadmin/ktutil/ktutil.c b/src/kadmin/ktutil/ktutil.c
index a969a46..ef16d37 100644
--- a/src/kadmin/ktutil/ktutil.c
+++ b/src/kadmin/ktutil/ktutil.c
@@ -27,6 +27,7 @@
#include "k5-int.h"
#include "ktutil.h"
#include <com_err.h>
+#include <locale.h>
#include "adm_proto.h"
#include <ss/ss.h>
#include <stdio.h>
diff --git a/src/kadmin/server/ovsec_kadmd.c b/src/kadmin/server/ovsec_kadmd.c
index 0976a8a..dbb90cb 100644
--- a/src/kadmin/server/ovsec_kadmd.c
+++ b/src/kadmin/server/ovsec_kadmd.c
@@ -31,6 +31,7 @@
*/
#include <errno.h>
+#include <locale.h>
#include <stdio.h>
#include <signal.h>
#include <syslog.h>
diff --git a/src/kdc/main.c b/src/kdc/main.c
index 4c8bf88..7f77969 100644
--- a/src/kdc/main.c
+++ b/src/kdc/main.c
@@ -50,6 +50,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <locale.h>
#include <stdio.h>
#include <syslog.h>
#include <signal.h>
diff --git a/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c b/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c
index 6fb458d..c5f2863 100644
--- a/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c
+++ b/src/plugins/kdb/ldap/ldap_util/kdb5_ldap_util.c
@@ -75,6 +75,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <locale.h>
#include <stdio.h>
#include <time.h>
diff --git a/src/slave/kprop.c b/src/slave/kprop.c
index a8c55f3..540d14b 100644
--- a/src/slave/kprop.c
+++ b/src/slave/kprop.c
@@ -25,6 +25,7 @@
*/
#include <errno.h>
+#include <locale.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/file.h>
diff --git a/src/slave/kpropd.c b/src/slave/kpropd.c
index c3ac3a8..aa6e979 100644
--- a/src/slave/kpropd.c
+++ b/src/slave/kpropd.c
@@ -60,6 +60,7 @@
*/
+#include <locale.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/file.h>
diff --git a/src/slave/kproplog.c b/src/slave/kproplog.c
index b97604a..e58ca20 100644
--- a/src/slave/kproplog.c
+++ b/src/slave/kproplog.c
@@ -10,6 +10,7 @@
* This module will parse the update logs on the master or slave servers.
*/
+#include <locale.h>
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
More information about the cvs-krb5
mailing list