Re: SESSION_MANAGER env var in rawhide and XSMP spec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ti., 27.05.2008 kl. 10.14 -0400, skrev Adam Jackson:
> On Tue, 2008-05-27 at 01:08 +0200, Kjartan Maraas wrote:
> > Hi
> > 
> > I've been trying to track down some issues with gnome-session in GNOME
> > 2.23.x which is in rawhide now. I first noticed this when trying out a
> > jhbuild of GNOME 2.23.x, but then noticed that rawhide suffers from the
> > same symptoms. A bunch of processes are left in [defunct] state after
> > login and starting new programs complains about not being able to
> > connect to the session manager.
> > 
> > After some investigation and help from one of the gnome-session
> > maintainers we noticed that the SESSION_MANAGER env var in rawhide
> > differs from other distros. What I see in rawhide is this:
> > 
> > [kmaraas@localhost gnome-session]$ echo $SESSION_MANAGER
> > local/unix:@/tmp/.ICE-unix/2994
> > 
> > and he had:
> > 
> > local/henderson:/tmp/.ICE-unix/14577
> 
> I'm not aware of any code placing semantic meaning on the
> SESSION_MANAGER variable.  libSM doesn't even look at the right hand
> side of the / in the transport spec when the transport is "local", so
> the different hostnames shouldn't matter.
> 
No, I don't think it's really the difference in semantics that causes
gnome-session to break after all. The code only seems to look at the
"local/" part of the string anyway. The code is like this:

/**
 * gsm_xsmp_init:
 *
 * Initializes XSMP. Notably, it creates the XSMP listening socket and
 * sets the SESSION_MANAGER environment variable to point to it.
 **/
void
gsm_xsmp_init (void)
{
  char error[256];
  mode_t saved_umask;
  IceListenObj *listeners;
  int num_listeners;
  int i, local_listener;

  /* Set up sane error handlers */
  IceSetErrorHandler (ice_error_handler);
  IceSetIOErrorHandler (ice_io_error_handler);
  SmsSetErrorHandler (sms_error_handler);

  /* Initialize libSM; we pass NULL for hostBasedAuthProc to disable
   * host-based authentication.
   */
  if (!SmsInitialize (PACKAGE, VERSION, accept_xsmp_connection,
                      NULL, NULL, sizeof (error), error))
    gsm_initialization_error (TRUE, "Could not initialize libSM: %s", error);

#ifdef HAVE_X11_XTRANS_XTRANS_H
  /* By default, IceListenForConnections will open one socket for each
   * transport type known to X. We don't want connections from remote
   * hosts, so for security reasons it would be best if ICE didn't
   * even open any non-local sockets. So we use an internal ICElib
   * method to disable them here. Unfortunately, there is no way to
   * ask X what transport types it knows about, so we're forced to
   * guess.
   */
  _IceTransNoListen ("tcp");
#endif

  /* Create the XSMP socket. Older versions of IceListenForConnections
   * have a bug which causes the umask to be set to 0 on certain types
   * of failures. Probably not an issue on any modern systems, but
   * we'll play it safe.
   */
  saved_umask = umask (0);
  umask (saved_umask);
  if (!IceListenForConnections (&num_listeners, &listeners,
                                sizeof (error), error))
    gsm_initialization_error (TRUE, _("Could not create ICE listening socket: %s"), error);
  umask (saved_umask);

  /* Find the local socket in the returned socket list. */
  local_listener = -1;
  for (i = 0; i < num_listeners; i++)
    {
      char *id = IceGetListenConnectionString (listeners[i]);

      if (!strncmp (id, "local/", sizeof ("local/") - 1))
        {
          local_listener = i;
          xsmp_network_id = g_strdup (id);
          g_free (id);
          break;
        }

      g_free (id);
    }

  if (local_listener == -1)
    gsm_initialization_error (TRUE, "IceListenForConnections did not return a local listener!");

  if (num_listeners == 1)
    xsmp_sockets = listeners;
  else
    {
      /* Xtrans was apparently compiled with support for some
       * non-local transport besides TCP (which we disabled above). We
       * close those additional sockets here. (There's no API for
       * closing a subset of the returned connections, so we have to
       * cheat...)
       *
       * If the g_warning below is triggering for you and you want to
       * stop it, the fix is to add additional _IceTransNoListen()
       * calls above.
       */
      IceListenObj local_listener_socket = listeners[local_listener];

      listeners[local_listener] = listeners[num_listeners - 1];
#ifdef HAVE_X11_XTRANS_XTRANS_H
      g_warning ("IceListenForConnections returned %d non-local listeners: %s",
                 num_listeners - 1,
                 IceComposeNetworkIdList (num_listeners - 1, listeners));
#endif
      IceFreeListenObjs (num_listeners - 1, listeners);

      xsmp_sockets = malloc (sizeof (IceListenObj));
      xsmp_sockets[0] = local_listener_socket;
    }

  /* Update .ICEauthority with new auth entries for our socket */
  if (!update_iceauthority (TRUE, xsmp_network_id))
    {
      /* FIXME: is this really fatal? Hm... */
      gsm_initialization_error (TRUE, "Could not update ICEauthority file %s",
                                IceAuthFileName ());
    }

  g_setenv ("SESSION_MANAGER", xsmp_network_id, TRUE);
  g_debug ("SESSION_MANAGER=%s\n", xsmp_network_id);
}

Cheers
Kjartan


-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux