Skip to contentSkip to conversation

disable policycoreutils locale option

PATCH In review Chris PeBenito 2 participants 2 messages Dec 20, 2004 – Dec 28, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 disable policycoreutils locale option

This patch make the the locale code in policycoreutils able to be disabled. I was trying to compile policycoreutils against uclibc for an embedded system, but uclibc doesn't have locale support. The patch leaves locale support on by default. The patch is against sourceforge CVS.

Signature · 8 lines
Chris PeBenito
<[email protected]>
Developer,
Hardened Gentoo Linux
Embedded Gentoo Linux
 
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243
Key fingerprint = B0E6 877A 883F A57A 8E6A  CB00 BC8E E42D E6AF 9243

Index: load_policy/Makefile
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policycoreutils/load_policy/Makefile,v retrieving revision 1.6

Makefile +1 -1
diff -u -r1.6 Makefile
@@ -5,7 +5,7 @@
 LOCALEDIR ?= /usr/share/locale
 
 CFLAGS = -Wall
-override CFLAGS += -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
+override CFLAGS += -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
 LDLIBS += -lsepol -lselinux
 
 TARGETS=$(patsubst %.c,%,$(wildcard *.c))

Index: load_policy/load_policy.c
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policycoreutils/load_policy/load_policy.c,v retrieving revision 1.8

load_policy.c +6 -0
diff -u -r1.8 load_policy.c
@@ -10,9 +10,13 @@
 #include <getopt.h>
 #include <selinux/selinux.h>
 #include <sepol/sepol.h>
+#ifdef USE_NLS
 #include <locale.h>			    /* for setlocale() */
 #include <libintl.h>			    /* for gettext() */
 #define _(msgid) gettext (msgid)
+#else
+#define _(msgid) (msgid)
+#endif
 #ifndef PACKAGE
 #define PACKAGE "policycoreutils"   /* the name of this package lang translation */
 #endif
@@ -30,9 +34,11 @@
 	void *map;
 	char *polpath, *boolpath = NULL, **names;
 
+#ifdef USE_NLS
 	setlocale (LC_ALL, "");
 	bindtextdomain (PACKAGE, LOCALEDIR);
 	textdomain (PACKAGE);
+#endif
 
 	while ((opt = getopt(argc, argv, "qb")) > 0) {
 		switch (opt) {

Index: newrole/Makefile
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policycoreutils/newrole/Makefile,v retrieving revision 1.4

Makefile +1 -1
diff -u -r1.4 Makefile
@@ -6,7 +6,7 @@
 LOCALEDIR = /usr/share/locale
 
 CFLAGS = -Wall
-override CFLAGS += -DUSE_PAM -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
+override CFLAGS += -DUSE_NLS -DUSE_PAM -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
 LDLIBS += -lselinux -ldl -lpam -lpam_misc
 
 TARGETS=$(patsubst %.c,%,$(wildcard *.c))

Index: newrole/newrole.c
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policycoreutils/newrole/newrole.c,v retrieving revision 1.4

newrole.c +6 -0
diff -u -r1.4 newrole.c
@@ -64,9 +64,13 @@
 #include <selinux/get_default_type.h>
 #include <selinux/get_context_list.h> /* for SELINUX_DEFAULTUSER */
 #include <signal.h>
+#ifdef USE_NLS
 #include <locale.h>			    /* for setlocale() */
 #include <libintl.h>			    /* for gettext() */
 #define _(msgid) gettext (msgid)
+#else
+#define _(msgid) (msgid)
+#endif
 #ifndef PACKAGE
 #define PACKAGE "policycoreutils"   /* the name of this package lang translation */
 #endif
@@ -265,9 +269,11 @@
   /* Terminate on SIGHUP. */
   signal(SIGHUP, SIG_DFL);
 
+#ifdef USE_NLS
   setlocale (LC_ALL, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif
 
   /*
    *

Index: run_init/Makefile
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policycoreutils/run_init/Makefile,v retrieving revision 1.4

Makefile +1 -1
diff -u -r1.4 Makefile
@@ -7,7 +7,7 @@
 LOCALEDIR ?= /usr/share/locale
 
 CFLAGS = -Wall
-override CFLAGS += -DUSE_PAM -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
+override CFLAGS += -DUSE_NLS -DUSE_PAM -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
 LDLIBS += -lselinux -ldl -lpam -lpam_misc
 
 TARGETS=$(patsubst %.c,%,$(wildcard *.c))

Index: run_init/run_init.c
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policycoreutils/run_init/run_init.c,v retrieving revision 1.4

run_init.c +8 -1
diff -u -r1.4 run_init.c
@@ -49,10 +49,14 @@
 #include <selinux/context.h>              /* for context-mangling functions */
 #include <fcntl.h>
 #include <ctype.h>
+#include <limits.h>
+#ifdef USE_NLS
 #include <libintl.h>
 #include <locale.h>
-#include <limits.h>
 #define _(msgid) gettext (msgid)
+#else
+#define _(msgid) (msgid)
+#endif
 #ifndef PACKAGE
 #define PACKAGE "policycoreutils"   /* the name of this package lang translation */
 #endif
@@ -314,9 +318,12 @@
   extern char *optarg;               /* used by getopt() for arg strings */
   extern int opterr;                 /* controls getopt() error messages */
   security_context_t new_context;	     /* context for the init script context  */
+  
+#ifdef USE_NLS
   setlocale(LC_ALL, "");
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
+#endif
 
   /* Verify that we are running on a flask-enabled kernel. */
   if( !is_selinux_enabled() ) {
#1 lore raw
Quoted 5 lines · Chris PeBenito

This patch make the the locale code in policycoreutils able to be disabled. I was trying to compile policycoreutils against uclibc for an embedded system, but uclibc doesn't have locale support. The patch leaves locale support on by default. The patch is against sourceforge CVS.

Thanks, merged.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.