2012-02-10 Javier Acosta <
[email protected]>
CR 7116350 Solaris11 GDM accessed remotely from dtlogin(Xsun)
defaults GDM_KEYBOARD_LAYOUT to "us" on 2nd login
* base-specs/gdm.spec:
* patches/gdm-36-no-remote-layout.diff:
--- a/ChangeLog Fri Feb 10 03:13:53 2012 +0000
+++ b/ChangeLog Fri Feb 10 09:36:30 2012 +0000
@@ -1,3 +1,10 @@
+2012-02-10 Javier Acosta <[email protected]>
+
+ CR 7116350 Solaris11 GDM accessed remotely from dtlogin(Xsun)
+ defaults GDM_KEYBOARD_LAYOUT to "us" on 2nd login
+ * base-specs/gdm.spec:
+ * patches/gdm-36-no-remote-layout.diff:
+
2012-02-10 Leon Fan <[email protected]>
CR 7142889 typo in pacrunner_mozjs.cpp cause libproxy-mozjs build failed
--- a/base-specs/gdm.spec Fri Feb 10 03:13:53 2012 +0000
+++ b/base-specs/gdm.spec Fri Feb 10 09:36:30 2012 +0000
@@ -106,6 +106,8 @@
Patch34: gdm-34-vt.diff
#owner:yippi date:2011-11-07 type:bug bugster:7096672
Patch35: gdm-35-restart.diff
+#owner:ja208388 date:2012-02-01 type:bug bugster:7116350
+Patch36: gdm-36-no-remote-layout.diff
URL: http://projects.gnome.org/gdm/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -153,6 +155,7 @@
%patch33 -p1
%patch34 -p1
%patch35 -p1
+%patch36 -p1
cp %SOURCE1 gui/simple-greeter
cp %SOURCE2 gui/simple-greeter
@@ -264,6 +267,10 @@
%{_localstatedir}/lib/gdm
%changelog
+* Wed Feb 01 2012 - [email protected]
+- Add patch gdm-36-no-remote-layout.diff to fix #7116350 (Escalated).
+ Do not display Keyboard Layout Selection in GDM when GDM is
+ is launched remotely.
* Mon Nov 07 2011 - [email protected]
- Add patch gdm-35-restart.diff to fix CR #7096672, so that GDM will stop
trying to manage a display if it fails 5 times in less than 60 seconds.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/gdm-36-no-remote-layout.diff Fri Feb 10 09:36:30 2012 +0000
@@ -0,0 +1,183 @@
+--- gdm-2.30.7/gui/simple-greeter/gdm-greeter-panel.c 2012-02-01 14:18:54.932680691 +0100
++++ gdm-2.30.7/gui/simple-greeter/gdm-greeter-panel.c 2012-02-01 14:29:27.255918276 +0100
+@@ -1096,6 +1096,11 @@
+ const char *layout_name)
+ {
+ #ifdef HAVE_LIBXKLAVIER
++ /* Unless we have both xclient/xserver running in the local */
++ /* machine we won't display the keyboard layout tab */
++
++ if (!is_xclient_local() || !is_xserver_local())
++ return;
+ g_return_if_fail (GDM_IS_GREETER_PANEL (panel));
+
+ if (layout_name != NULL &&
+--- gdm-2.30.7/gui/simple-greeter/gdm-layouts.c 2012-02-01 14:18:54.967140816 +0100
++++ gdm-2.30.7/gui/simple-greeter/gdm-layouts.c 2012-02-01 15:13:14.159363229 +0100
+@@ -29,6 +29,7 @@
+
+ #ifdef HAVE_LIBXKLAVIER
+ #include <libxklavier/xklavier.h>
++#include <ucred.h>
+ #endif
+
+ #include <gconf/gconf-client.h>
+@@ -46,9 +47,67 @@
+ static XklConfigRegistry *config_registry = NULL;
+ static XklConfigRec *initial_config = NULL;
+
++/*
++ * Function to determine if a connection is local or not.
++ * Returns: FALSE for remote, TRUE for local
++ */
++gboolean
++is_xclient_local (void)
++{
++ Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++ int c = ConnectionNumber(dpy);
++ struct stat statbuf;
++ gboolean rv = FALSE;
++ ucred_t *ucred = NULL;
++ const char *disp_name;
++
++ if (c >= 0) {
++ /*
++ * stat the connection fd. If we succeed and the type of file
++ * is a FIFO, then we must be local.
++ */
++ if ((fstat(c, &statbuf) >= 0) && S_ISFIFO(statbuf.st_mode)) {
++ return TRUE;
++ }
++ /*
++ * Then call getpeerucred - if it succeeds, the other end of the
++ * connection must be on the same machine (though possibly in a
++ * different zone).
++ */
++ if (getpeerucred(c, &ucred) == 0) {
++ if (ucred_getzoneid(ucred) != -1)
++ rv = TRUE;
++ ucred_free(ucred);
++ }
++ }
++ return rv;
++}
++
++gboolean
++is_xserver_local (void)
++{
++ const char *dt_xserver_loc;
++ const char *gdm_xserver_loc;
++
++ dt_xserver_loc = g_getenv ("DTXSERVERLOCATION");
++ gdm_xserver_loc = g_getenv ("GDM_XSERVER_LOCATION");
++
++ if ((dt_xserver_loc && strcmp (dt_xserver_loc, "remote") == 0) ||
++ (gdm_xserver_loc && strcmp (gdm_xserver_loc, "xdmcp") == 0))
++ return FALSE;
++
++ return TRUE;
++}
++
+ static void
+ init_xkl (void)
+ {
++ /* Unless we have both xclient/xserver running in the local */
++ /* machine we won't display the keyboard layout tab */
++
++ if (!is_xclient_local() || !is_xserver_local())
++ return;
++
+ if (config_registry == NULL) {
+ engine = xkl_engine_get_instance (GDK_DISPLAY ());
+ config_registry = xkl_config_registry_get_instance (engine);
+@@ -66,6 +125,8 @@
+ xci_desc_to_utf8 (XklConfigItem * ci)
+ {
+ char *sd = g_strstrip (ci->description);
++ if (!is_xclient_local() || !is_xserver_local())
++ return NULL;
+ return sd[0] == 0 ? g_strdup (ci->name) :
+ g_locale_to_utf8 (sd, -1, NULL, NULL, NULL);
+ }
+@@ -77,6 +138,9 @@
+ {
+ LayoutData *ldata = data;
+
++ if (!is_xclient_local() || !is_xserver_local())
++ return;
++
+ ldata->list = g_slist_prepend (ldata->list, g_strdup_printf ("%s\t%s", ldata->layout, item->name));
+ }
+
+@@ -87,6 +151,9 @@
+ {
+ LayoutData *ldata = data;
+
++ if (!is_xclient_local() || !is_xserver_local())
++ return;
++
+ ldata->layout = item->name;
+ ldata->list = g_slist_prepend (ldata->list, g_strdup (item->name));
+ xkl_config_registry_foreach_layout_variant (config, item->name, add_variant, data);
+@@ -106,6 +173,9 @@
+ char *id2;
+ char *p;
+
++ if (!is_xclient_local() || !is_xserver_local())
++ return NULL;
++
+ init_xkl ();
+
+ id1 = g_strdup (name);
+@@ -168,6 +238,9 @@
+ data.list = NULL;
+ data.layout = NULL;
+
++ if (!is_xclient_local() || !is_xserver_local())
++ return NULL;
++
+ init_xkl ();
+
+ xkl_config_registry_foreach_layout (config_registry, add_layout, &data);
+@@ -198,6 +271,9 @@
+ char *variant;
+ gboolean retval;
+
++ if (!is_xclient_local() || !is_xserver_local())
++ return TRUE;
++
+ if (layout_variant != NULL && strcmp (layout_variant, GDM_LAST_LAYOUT) == 0) {
+ return TRUE;
+ }
+@@ -232,6 +308,10 @@
+ gdm_layout_get_default_layout (void)
+ {
+ #ifdef HAVE_LIBXKLAVIER
++
++ if (!is_xclient_local() || !is_xserver_local())
++ return NULL;
++
+ init_xkl ();
+
+ if (initial_config->layouts)
+@@ -250,6 +330,9 @@
+ XklConfigRec *config;
+ char *p;
+
++ if (!is_xclient_local() || !is_xserver_local())
++ return;
++
+ if (layout != NULL && strcmp (layout, GDM_LAST_LAYOUT) == 0) {
+ return;
+ }
+--- gdm-2.30.7/gui/simple-greeter/gdm-layouts.h 2012-02-01 14:18:54.926446809 +0100
++++ gdm-2.30.7/gui/simple-greeter/gdm-layouts.h 2012-02-01 15:14:04.894492766 +0100
+@@ -29,6 +29,8 @@
+ gboolean gdm_layout_is_valid (const char *layout);
+ const char * gdm_layout_get_default_layout (void);
+ void gdm_layout_activate (const char *layout);
++gboolean is_xclient_local (void);
++gboolean is_xserver_local (void);
+
+ G_END_DECLS
+