component(developer/golang-123): Add Component
[oi-userland.git] / components / desktop / lightdm / patches / 10-set-console.patch
blobf7b7b4c1abc454ed0af329aa84cecdf732d3402a
1 --- lightdm-1.26.0/src/x-server.c 2018-02-07 00:31:03.000000000 +0000
2 +++ lightdm-1.26.0/src/x-server.c.new 2018-06-01 07:07:33.856561224 +0000
3 @@ -142,7 +142,11 @@ x_server_connect_session (DisplayServer
4 g_autofree gchar *tty_text = NULL;
5 g_autofree gchar *vt_text = NULL;
7 +#ifdef __sun__
8 + tty_text = g_strdup_printf ("/dev/vt/%d", vt);
9 +#else
10 tty_text = g_strdup_printf ("/dev/tty%d", vt);
11 +#endif
12 session_set_tty (session, tty_text);
14 vt_text = g_strdup_printf ("%d", vt);
15 --- lightdm-1.19.3/src/session-child.c.~4~ 2016-08-09 20:12:33.810235770 +0300
16 +++ lightdm-1.19.3/src/session-child.c 2016-08-09 20:24:45.765910776 +0300
17 @@ -305,10 +305,50 @@
19 if (xdisplay)
21 +#ifdef __sun__
22 + gchar *out;
23 +#endif
25 #ifdef PAM_XDISPLAY
26 pam_set_item (pam_handle, PAM_XDISPLAY, xdisplay);
27 #endif
29 +#ifdef __sun__
31 + /* We can't get real device name for X display on this stage.
32 + * But we can use the following logic.
33 + * 1. Local sessions without VT support. If the display is ":0",
34 + * we can set device to tty if it starts with "/dev/vt/", otherwise we
35 + * set the device as "/dev/console" to gain device permissions.
36 + * The later only happens on those systems do not has VT support such as
37 + * old Solaris. So far, Linux and OpenSolaris with VT support.
38 + * 2. XDMCP sessions, we set device as "/dev/dtremote"
39 + * 3. Local sessions like SunRay, Xvfb, Xvnc, we set device as
40 + * "/dev/dtlocal"
41 + */
42 + if (remote_host_name) {
43 + /* This is for XDMCP sessions. */
44 + out = "/dev/dtremote";
45 + } else {
46 + if (g_str_equal (xdisplay, ":0")) {
47 + /* This is for local session run on console. */
48 + if (g_str_has_prefix(tty,"/dev/vt/")){
49 + out=tty;
50 + } else {
51 + out = "/dev/console";
52 + }
53 + } else {
54 + /* This is for local sessions like
55 + * SunRay, Xvfb, Xvnc, etc. */
56 + out = "/dev/dtlocal";
57 + }
58 + }
60 + g_printerr ("lightdm: Got tty: '%s'", out);
61 + pam_set_item (pam_handle, PAM_TTY, out);
62 +#else
63 pam_set_item (pam_handle, PAM_TTY, xdisplay);
64 +#endif