Commit fd955b67 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

Add a daemon/ConsoleCannotHandle key which lists languages which should


Wed May 26 18:23:14 2004  George Lebl <jirka@5z.com>

	* daemon/auth.c, daemon/display.c, daemon/gdm.[ch], daemon/misc.[ch],
	  daemon/server.c, daemon/slave.c, daemon/verify-pam.c, docs/C/gdm.xml,
	  config/gdm.conf.in:  Add a daemon/ConsoleCannotHandle key which
	  lists languages which should not be used on the console because
	  they won't work.  Uses "C" locale strings instead then.  Should
	  "fix" #135387, but I suppose there's no clean way to do this,
	  just let the distributors ship proper config files and have them
	  test it (yeah right).  I've tested the current set on RH9 and I
	  listed all of the ones that didn't work.
parent 883d9163
Wed May 26 18:23:14 2004 George Lebl <jirka@5z.com>
* daemon/auth.c, daemon/display.c, daemon/gdm.[ch], daemon/misc.[ch],
daemon/server.c, daemon/slave.c, daemon/verify-pam.c, docs/C/gdm.xml,
config/gdm.conf.in: Add a daemon/ConsoleCannotHandle key which
lists languages which should not be used on the console because
they won't work. Uses "C" locale strings instead then. Should
"fix" #135387, but I suppose there's no clean way to do this,
just let the distributors ship proper config files and have them
test it (yeah right). I've tested the current set on RH9 and I
listed all of the ones that didn't work.
Wed May 26 17:34:51 2004 George Lebl <jirka@5z.com>
* daemon/slave.c: Ensure proper .ICEauthority permissions, this
......
......@@ -153,6 +153,12 @@ Xnest=@X_SERVER_PATH@/Xnest -audit 0 -name Xnest
# like that as it will be run when no one is logged in yet.
#SoundProgram=/usr/bin/play
# These are the languages that the console cannot handle because of font
# issues. Here we mean the text console, not X. This is only used
# when there are errors to report and we cannot start X.
# This is the default:
#ConsoleCannotHandle=am,ar,az,bn,el,fa,gu,hi,ja,ko,ml,mr,pa,ta,zh
[security]
# If any distributions ship with this one off, they should be shot
# this is only local, so it's only for say kiosk use, when you
......
......@@ -71,8 +71,8 @@ display_add_error (GdmDisplay *d)
"add_auth_entry");
if (d->console) {
char *s = g_strdup_printf
(_("GDM could not write a new authorization "
"entry to disk. Possibly out of diskspace.%s%s"),
(C_(N_("GDM could not write a new authorization "
"entry to disk. Possibly out of diskspace.%s%s")),
errno != 0 ? " Error: " : "",
errno != 0 ? strerror (errno) : "");
gdm_text_message_dialog (s);
......
......@@ -111,12 +111,12 @@ gdm_display_check_loop (GdmDisplay *disp)
* that should give people ample time to stop gdm if needed,
* or just wait for the stupid malicious user to get bored
* and go away */
char *s = g_strdup_printf (_("The display server has been shut down "
"about 6 times in the last 90 seconds, "
"it is likely that something bad is "
"going on. I will wait for 2 minutes "
"before trying again on display %s."),
disp->name);
char *s = g_strdup_printf (C_(N_("The display server has been shut down "
"about 6 times in the last 90 seconds, "
"it is likely that something bad is "
"going on. I will wait for 2 minutes "
"before trying again on display %s.")),
disp->name);
/* only display a dialog box if this is a local display */
if (disp->type == TYPE_LOCAL ||
disp->type == TYPE_FLEXI) {
......
......@@ -194,6 +194,7 @@ gboolean GdmVTAllocation = TRUE;
gboolean GdmDisallowTCP = TRUE;
gchar *GdmSoundProgram = NULL;
gchar *GdmSoundOnLoginFile = NULL;
gchar *GdmConsoleCannotHandle = NULL;
/* set in the main function */
......@@ -243,11 +244,11 @@ check_servauthdir (struct stat *statbuf)
VE_IGNORE_EINTR (r = stat (GdmServAuthDir, statbuf));
if G_UNLIKELY (r < 0) {
char *s = g_strdup_printf
(_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but this does not exist. Please "
"correct gdm configuration %s and "
"restart gdm."), GdmServAuthDir,
(C_(N_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but this does not exist. Please "
"correct gdm configuration %s and "
"restart gdm.")), GdmServAuthDir,
GDM_CONFIG_FILE);
if ( ! no_console)
gdm_text_message_dialog (s);
......@@ -257,11 +258,11 @@ check_servauthdir (struct stat *statbuf)
if G_UNLIKELY (! S_ISDIR (statbuf->st_mode)) {
char *s = g_strdup_printf
(_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but this is not a directory. Please "
"correct gdm configuration %s and "
"restart gdm."), GdmServAuthDir,
(C_(N_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but this is not a directory. Please "
"correct gdm configuration %s and "
"restart gdm.")), GdmServAuthDir,
GDM_CONFIG_FILE);
if ( ! no_console)
gdm_text_message_dialog (s);
......@@ -421,6 +422,7 @@ gdm_config_parse (void)
GdmSoundProgram = ve_config_get_string (cfg, GDM_KEY_SOUND_PROGRAM);
GdmSoundOnLoginFile = ve_config_get_string (cfg, GDM_KEY_SOUND_ON_LOGIN_FILE);
GdmConsoleCannotHandle = ve_config_get_string (cfg, GDM_KEY_SOUND_PROGRAM);
GdmDebug = ve_config_get_bool (cfg, GDM_KEY_DEBUG);
......@@ -608,11 +610,11 @@ gdm_config_parse (void)
GdmTimedLogin = NULL;
} else {
char *s = g_strdup_printf
(_("XDMCP is disabled and gdm "
"cannot find any local server "
"to start. Aborting! Please "
"correct the configuration %s "
"and restart gdm."),
(C_(N_("XDMCP is disabled and gdm "
"cannot find any local server "
"to start. Aborting! Please "
"correct the configuration %s "
"and restart gdm.")),
GDM_CONFIG_FILE);
gdm_text_message_dialog (s);
GdmPidFile = NULL;
......@@ -630,9 +632,9 @@ gdm_config_parse (void)
if G_UNLIKELY (pwent == NULL) {
char *s = g_strdup_printf
(_("The gdm user does not exist. "
"Please correct gdm configuration %s "
"and restart gdm."),
(C_(N_("The gdm user does not exist. "
"Please correct gdm configuration %s "
"and restart gdm.")),
GDM_CONFIG_FILE);
if ( ! no_console)
gdm_text_message_dialog (s);
......@@ -644,11 +646,11 @@ gdm_config_parse (void)
if G_UNLIKELY (GdmUserId == 0) {
char *s = g_strdup_printf
(_("The gdm user is set to be root, but "
"this is not allowed since it can "
"pose a security risk. Please "
"correct gdm configuration %s and "
"restart gdm."), GDM_CONFIG_FILE);
(C_(N_("The gdm user is set to be root, but "
"this is not allowed since it can "
"pose a security risk. Please "
"correct gdm configuration %s and "
"restart gdm.")), GDM_CONFIG_FILE);
if ( ! no_console)
gdm_text_message_dialog (s);
GdmPidFile = NULL;
......@@ -659,9 +661,9 @@ gdm_config_parse (void)
if G_UNLIKELY (grent == NULL) {
char *s = g_strdup_printf
(_("The gdm group does not exist. "
(C_(N_("The gdm group does not exist. "
"Please correct gdm configuration %s "
"and restart gdm."),
"and restart gdm.")),
GDM_CONFIG_FILE);
if ( ! no_console)
gdm_text_message_dialog (s);
......@@ -673,11 +675,11 @@ gdm_config_parse (void)
if G_UNLIKELY (GdmGroupId == 0) {
char *s = g_strdup_printf
(_("The gdm group is set to be root, but "
"this is not allowed since it can "
"pose a security risk. Please "
"correct gdm configuration %s and "
"restart gdm."), GDM_CONFIG_FILE);
(C_(N_("The gdm group is set to be root, but "
"this is not allowed since it can "
"pose a security risk. Please "
"correct gdm configuration %s and "
"restart gdm.")), GDM_CONFIG_FILE);
if ( ! no_console)
gdm_text_message_dialog (s);
GdmPidFile = NULL;
......@@ -723,7 +725,7 @@ gdm_config_parse (void)
if G_UNLIKELY (ve_string_empty (GdmServAuthDir)) {
if ( ! no_console)
gdm_text_message_dialog
(_("No daemon/ServAuthDir specified in the configuration file"));
(C_(N_("No daemon/ServAuthDir specified in the configuration file")));
GdmPidFile = NULL;
gdm_fail (_("%s: No daemon/ServAuthDir specified."), "gdm_config_parse");
}
......@@ -749,12 +751,12 @@ gdm_config_parse (void)
if G_UNLIKELY (statbuf.st_uid != 0 || statbuf.st_gid != GdmGroupId) {
char *s = g_strdup_printf
(_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but is not owned by user %s and group "
"%s. Please correct the ownership or "
"gdm configuration %s and restart "
"gdm."),
(C_(N_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but is not owned by user %s and group "
"%s. Please correct the ownership or "
"gdm configuration %s and restart "
"gdm.")),
GdmServAuthDir, GdmUser, GdmGroup,
GDM_CONFIG_FILE);
if ( ! no_console)
......@@ -766,13 +768,13 @@ gdm_config_parse (void)
if G_UNLIKELY (statbuf.st_mode != (S_IFDIR|S_IRWXU|S_IRWXG|S_ISVTX)) {
char *s = g_strdup_printf
(_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but has the wrong permissions, it "
"should have permissions of %o. "
"Please correct the permissions or "
"the gdm configuration %s and "
"restart gdm."),
(C_(N_("Server Authorization directory "
"(daemon/ServAuthDir) is set to %s "
"but has the wrong permissions, it "
"should have permissions of %o. "
"Please correct the permissions or "
"the gdm configuration %s and "
"restart gdm.")),
GdmServAuthDir, (S_IRWXU|S_IRWXG|S_ISVTX), GDM_CONFIG_FILE);
if ( ! no_console)
gdm_text_message_dialog (s);
......@@ -1097,6 +1099,13 @@ deal_with_x_crashes (GdmDisplay *d)
ve_setenv ("TEXTDOMAIN", GETTEXT_PACKAGE, TRUE);
ve_setenv ("TEXTDOMAINDIR", GNOMELOCALEDIR, TRUE);
if ( ! gdm_ok_console_language ()) {
ve_unsetenv ("LANG");
ve_unsetenv ("LC_ALL");
ve_unsetenv ("LC_MESSAGES");
ve_setenv ("LANG", "C", TRUE);
}
VE_IGNORE_EINTR (execv (argv[0], argv));
/* yaikes! */
......@@ -1156,11 +1165,11 @@ deal_with_x_crashes (GdmDisplay *d)
* the above script would have been defined and we'd run
* it for them */
const char *error =
_("I cannot start the X server (your graphical "
"interface). It is likely that it is not set "
"up correctly. You will need to log in on a "
"console and rerun the X configuration "
"program. Then restart GDM.");
C_(N_("I cannot start the X server (your graphical "
"interface). It is likely that it is not set "
"up correctly. You will need to log in on a "
"console and rerun the X configuration "
"program. Then restart GDM."));
gdm_text_message_dialog (error);
} /* else {
* At this point .... screw the user, we don't know how to
......
......@@ -178,6 +178,8 @@ enum {
#define GDM_KEY_FIRSTVT "daemon/FirstVT=7"
#define GDM_KEY_VTALLOCATION "daemon/VTAllocation=true"
#define GDM_KEY_CONSOLE_CANNOT_HANDLE "daemon/ConsoleCannotHandle=am,ar,az,bn,el,fa,gu,hi,ja,ko,ml,mr,pa,ta,zh"
/* Per server definitions */
#define GDM_KEY_SERVER_NAME "name=Standard server"
#define GDM_KEY_SERVER_COMMAND "command=" X_SERVER
......
......@@ -57,6 +57,7 @@ extern gboolean GdmDebug;
extern GSList *displays;
extern int gdm_xdmcpfd;
extern gboolean GdmXdmcp;
extern gchar *GdmConsoleCannotHandle;
extern char **environ;
......@@ -505,6 +506,13 @@ gdm_text_message_dialog (const char *msg)
dialog = g_find_program_in_path ("whiptail");
if (dialog != NULL) {
char *argv[6];
if ( ! gdm_ok_console_language ()) {
ve_unsetenv ("LANG");
ve_unsetenv ("LC_ALL");
ve_unsetenv ("LC_MESSAGES");
ve_setenv ("LANG", "C", TRUE);
}
argv[0] = EXPANDED_LIBEXECDIR "/gdmopen";
argv[1] = "-l";
......@@ -580,6 +588,13 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
char *argv[6];
int retint;
if ( ! gdm_ok_console_language ()) {
ve_unsetenv ("LANG");
ve_unsetenv ("LC_ALL");
ve_unsetenv ("LC_MESSAGES");
ve_setenv ("LANG", "C", TRUE);
}
argv[0] = EXPANDED_LIBEXECDIR "/gdmopen";
argv[1] = "-l";
argv[2] = "/bin/sh";
......@@ -2307,4 +2322,49 @@ gdm_get_last_info (const char *username)
return info;
}
gboolean
gdm_ok_console_language (void)
{
int i;
char **v;
static gboolean cached = FALSE;
static gboolean is_ok;
const char *loc;
if (cached)
return is_ok;
cached = TRUE;
loc = setlocale (LC_MESSAGES, NULL);
if (loc == NULL) {
is_ok = TRUE;
return TRUE;
}
v = g_strsplit (GdmConsoleCannotHandle, ",", -1);
for (i = 0; v != NULL && v[i] != NULL; i++) {
if ( ! ve_string_empty (v[i]) &&
strncmp (v[i], loc, strlen (v[i])) == 0) {
is_ok = FALSE;
return FALSE;
}
}
if (v != NULL)
g_strfreev (v);
is_ok = TRUE;
return TRUE;
}
const char *
gdm_console_translate (const char *str)
{
if (gdm_ok_console_language ())
return _(str);
else
return str;
}
/* EOF */
......@@ -174,6 +174,11 @@ void gdm_twiddle_pointer (GdmDisplay *disp);
char * gdm_get_last_info (const char *username);
gboolean gdm_ok_console_language (void);
const char * gdm_console_translate (const char *str);
/* Use with C_(N_("foo")) to make gettext work it out right */
#define C_(x) (gdm_console_translate(x))
#endif /* GDM_MISC_H */
/* EOF */
......@@ -338,17 +338,17 @@ busy_ask_user (GdmDisplay *disp)
/* if we have "open" we can talk to the user */
if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) == 0) {
char *error = g_strdup_printf
(_("There already appears to be an X server "
"running on display %s. Should I try another "
"display number? If you answer no, I will "
"attempt to start the server on %s again.%s"),
(C_(N_("There already appears to be an X server "
"running on display %s. Should I try another "
"display number? If you answer no, I will "
"attempt to start the server on %s again.%s")),
disp->name,
disp->name,
#ifdef __linux__
_(" (You can change consoles by pressing Ctrl-Alt "
"plus a function key, such as Ctrl-Alt-F7 to go "
"to console 7. X servers usually run on consoles "
"7 and higher.)")
C_(N_(" (You can change consoles by pressing Ctrl-Alt "
"plus a function key, such as Ctrl-Alt-F7 to go "
"to console 7. X servers usually run on consoles "
"7 and higher.)"))
#else /* ! __linux__ */
/* no info for non linux users */
""
......
......@@ -1218,14 +1218,14 @@ gdm_slave_run (GdmDisplay *display)
* that we've given up. The error is likely something
* internal. */
gdm_text_message_dialog
(_("I could not start the X\n"
"server (your graphical environment)\n"
"due to some internal error.\n"
"Please contact your system administrator\n"
"or check your syslog to diagnose.\n"
"In the meantime this display will be\n"
"disabled. Please restart gdm when\n"
"the problem is corrected."));
(C_(N_("I could not start the X\n"
"server (your graphical environment)\n"
"due to some internal error.\n"
"Please contact your system administrator\n"
"or check your syslog to diagnose.\n"
"In the meantime this display will be\n"
"disabled. Please restart gdm when\n"
"the problem is corrected.")));
gdm_slave_quick_exit (DISPLAY_ABORT);
}
gdm_slave_send_num (GDM_SOP_XPID, d->servpid);
......
......@@ -1080,7 +1080,7 @@ gdm_verify_check (void)
if ( ! no_console)
gdm_text_message_dialog
(_("Can't find PAM configuration for gdm."));
(C_(N_("Can't find PAM configuration for gdm.")));
gdm_fail ("gdm_verify_check: %s",
_("Can't find PAM configuration for gdm."));
}
......
......@@ -1147,6 +1147,19 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ConsoleCannotHandle</term>
<listitem>
<synopsis>ConsoleCannotHandle=am,ar,az,bn,el,fa,gu,hi,ja,ko,ml,mr,pa,ta,zh</synopsis>
<para>
These are the languages that the console cannot handle because
of font issues. Here we mean the text console, not X. This
is only used when there are errors to report and we cannot
start X.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DefaultPath</term>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment