author | Alan Coopersmith <Alan.Coopersmith@Sun.COM> |
Tue, 02 Mar 2010 13:31:46 -0800 | |
changeset 919 | 425233ae7236 |
parent 907 | 3c35d611cdaa |
child 943 | 294f64612d23 |
permissions | -rw-r--r-- |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
1 |
/* Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
919
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
2 |
* Use is subject to license terms. |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
3 |
* |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
4 |
* Permission is hereby granted, free of charge, to any person obtaining a |
919
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
5 |
* copy of this software and associated documentation files (the "Software"), |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
6 |
* to deal in the Software without restriction, including without limitation |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
7 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
8 |
* and/or sell copies of the Software, and to permit persons to whom the |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
9 |
* Software is furnished to do so, subject to the following conditions: |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
10 |
* |
919
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
11 |
* The above copyright notice and this permission notice (including the next |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
12 |
* paragraph) shall be included in all copies or substantial portions of the |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
13 |
* Software. |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
14 |
* |
919
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
15 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
16 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
17 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
18 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
19 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
20 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
425233ae7236
6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
907
diff
changeset
|
21 |
* DEALINGS IN THE SOFTWARE. |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
22 |
*/ |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
23 |
|
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
24 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
25 |
/* Implementation of Display Manager (dtlogin/gdm/xdm/etc.) to X server |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
26 |
* communication pipe. The Display Manager process will start |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
27 |
* the X window server at system boot time before any user |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
28 |
* has logged into the system. The X server is by default |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
29 |
* started as the root UID "0". |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
30 |
* |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
31 |
* At login time the Xserver local communication pipe is provided |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
32 |
* by the Xserver for user specific configuration data supplied |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
33 |
* by the display manager. It notifies the Xserver it needs to change |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
34 |
* over to the user's credentials (UID, GID, GID_LIST) and |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
35 |
* also switch CWD (current working directory) of to match |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
36 |
* the user's CWD home. |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
37 |
* |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
38 |
* When shutting down, the Xserver restores it's original uid/gid as |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
39 |
* needed by the cleanup/teardown actions in several drivers. |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
40 |
* |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
41 |
* For the original definition, see Sun ASARC case 1995/390 |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
42 |
*/ |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
43 |
|
98
c21b46ed1efd
6489660 Xorg server 7.2 [PSARC 2007/051]
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
0
diff
changeset
|
44 |
#include <X11/Xos.h> |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
45 |
#include <sys/param.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
46 |
#include <sys/socket.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
47 |
#include <netinet/in.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
48 |
#include <netdb.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
49 |
#include <stdio.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
50 |
#include <fcntl.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
51 |
#include <sys/types.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
52 |
#include <sys/stat.h> |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
53 |
#include <errno.h> |
98
c21b46ed1efd
6489660 Xorg server 7.2 [PSARC 2007/051]
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
0
diff
changeset
|
54 |
#include <X11/X.h> |
c21b46ed1efd
6489660 Xorg server 7.2 [PSARC 2007/051]
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
0
diff
changeset
|
55 |
#include <X11/Xmd.h> |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
56 |
#include "misc.h" |
98
c21b46ed1efd
6489660 Xorg server 7.2 [PSARC 2007/051]
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
0
diff
changeset
|
57 |
#include <X11/Xpoll.h> |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
58 |
#include "osdep.h" |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
59 |
#include "input.h" |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
60 |
#include "dixstruct.h" |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
61 |
#include "dixfont.h" |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
62 |
#include "opaque.h" |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
63 |
#include <pwd.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
64 |
#include <project.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
65 |
#include <sys/task.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
66 |
#include <ctype.h> |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
67 |
#include "scrnintstr.h" |
766
ac938085d487
6480003 Xorg should support virtual console on Solaris
Aaron Zang <Aaron.Zang@Sun.COM>
parents:
419
diff
changeset
|
68 |
#include <sys/vt.h> |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
69 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
70 |
#define DTLOGIN_PATH "/var/dt/sdtlogin" |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
71 |
|
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
72 |
#define BUFLEN 1024 |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
73 |
|
766
ac938085d487
6480003 Xorg should support virtual console on Solaris
Aaron Zang <Aaron.Zang@Sun.COM>
parents:
419
diff
changeset
|
74 |
int xf86ConsoleFd = -1; |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
75 |
|
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
76 |
/* in Xserver/os/auth.c */ |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
77 |
extern const char *GetAuthFilename(void); |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
78 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
79 |
/* Data about the user we need to switch to */ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
80 |
struct dmuser { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
81 |
uid_t uid; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
82 |
gid_t gid; /* Primary group */ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
83 |
gid_t groupids[NGROUPS_UMAX]; /* Supplementary groups */ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
84 |
int groupid_cnt; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
85 |
char * homedir; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
86 |
projid_t projid; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
87 |
}; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
88 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
89 |
/* Data passed to block/wakeup handlers */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
90 |
struct dmdata { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
91 |
int pipeFD; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
92 |
char * pipename; /* path to pipe */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
93 |
char * buf; /* contains characters to be processed */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
94 |
int bufsize; /* size allocated for buf */ |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
95 |
struct dmuser user; /* target user, to switch to on login */ |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
96 |
}; |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
97 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
98 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
99 |
/* Data stored in screen privates */ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
100 |
struct dmScreenPriv { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
101 |
CloseScreenProcPtr CloseScreen; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
102 |
}; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
103 |
static int dmScreenKeyIndex; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
104 |
static DevPrivateKey dmScreenKey = &dmScreenKeyIndex; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
105 |
static struct dmdata *dmHandlerData; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
106 |
static struct dmuser originalUser; /* user to switch back to in CloseDown */ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
107 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
108 |
static Bool DtloginCloseScreen(int i, ScreenPtr pScreen); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
109 |
static void DtloginBlockHandler(pointer, struct timeval **, pointer); |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
110 |
static void DtloginWakeupHandler(pointer, int, pointer); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
111 |
static int dtlogin_create_pipe(int, struct dmdata *); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
112 |
static void dtlogin_receive_packet(struct dmdata *); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
113 |
static int dtlogin_parse_packet(struct dmdata *, char *); |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
114 |
static void dtlogin_process(struct dmuser *user, int user_logged_in); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
115 |
static void dtlogin_close_pipe(struct dmdata *); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
116 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
117 |
#define DtloginError(fmt, arg) LogMessageVerb(X_ERROR, 1, fmt ": %s\n", \ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
118 |
arg, strerror(errno)) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
119 |
#define DtloginInfo(fmt, arg) LogMessageVerb(X_INFO, 5, fmt, arg) |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
120 |
|
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
121 |
/* |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
122 |
* initialize DTLOGIN: create pipe; set handlers. |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
123 |
* Called from main loop in os/main.c |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
124 |
*/ |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
125 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
126 |
_X_HIDDEN void |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
127 |
DtloginInit(void) |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
128 |
{ |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
129 |
int displayNumber = 0; |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
130 |
struct dmdata *dmd; |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
131 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
132 |
if (serverGeneration != 1) return; |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
133 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
134 |
originalUser.uid = geteuid(); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
135 |
originalUser.gid = getegid(); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
136 |
getgroups(NGROUPS_UMAX, originalUser.groupids); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
137 |
originalUser.homedir = getcwd(NULL, 0); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
138 |
originalUser.projid = getprojid(); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
139 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
140 |
if (getuid() != 0) return; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
141 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
142 |
dmd = Xcalloc(sizeof(struct dmdata)); |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
143 |
if (dmd == NULL) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
144 |
DtloginError("Failed to allocate %d bytes for display manager pipe", |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
145 |
sizeof(struct dmdata)); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
146 |
return; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
147 |
} |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
148 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
149 |
dmd->user.uid = (uid_t) -1; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
150 |
dmd->user.gid = (gid_t) -1; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
151 |
dmd->user.projid = (projid_t) -1; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
152 |
|
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
153 |
displayNumber = atoi(display); /* Assigned in dix/main.c */ |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
154 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
155 |
dmd->pipeFD = dtlogin_create_pipe(displayNumber, dmd); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
156 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
157 |
if (dmd->pipeFD == -1) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
158 |
xfree(dmd); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
159 |
return; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
160 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
161 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
162 |
dmHandlerData = dmd; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
163 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
164 |
RegisterBlockAndWakeupHandlers (DtloginBlockHandler, |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
165 |
DtloginWakeupHandler, |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
166 |
(pointer) dmd); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
167 |
} |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
168 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
169 |
/* |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
170 |
* cleanup dtlogin pipe at exit if still running, reset privs back to |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
171 |
* root as needed for various cleanup tasks. |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
172 |
* Called from main loop in os/main.c & CloseScreen wrappers |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
173 |
*/ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
174 |
_X_HIDDEN void |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
175 |
DtloginCloseDown(void) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
176 |
{ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
177 |
if (geteuid() != 0) { /* reset privs back to root */ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
178 |
if (seteuid(0) < 0) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
179 |
DtloginError("Error in resetting euid to %d", 0); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
180 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
181 |
dtlogin_process(&originalUser, 0); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
182 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
183 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
184 |
if (dmHandlerData != NULL) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
185 |
dtlogin_close_pipe(dmHandlerData); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
186 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
187 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
188 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
189 |
static Bool |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
190 |
DtloginCloseScreen (int i, ScreenPtr pScreen) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
191 |
{ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
192 |
struct dmScreenPriv *pScreenPriv; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
193 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
194 |
DtloginCloseDown(); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
195 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
196 |
/* Unwrap CloseScreen and call down to further levels */ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
197 |
pScreenPriv = (struct dmScreenPriv *) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
198 |
dixLookupPrivate(&pScreen->devPrivates, dmScreenKey); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
199 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
200 |
pScreen->CloseScreen = pScreenPriv->CloseScreen; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
201 |
xfree ((pointer) pScreenPriv); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
202 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
203 |
return (*pScreen->CloseScreen) (i, pScreen); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
204 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
205 |
|
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
206 |
static void |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
207 |
DtloginBlockHandler( |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
208 |
pointer data, |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
209 |
struct timeval **wt, /* unused */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
210 |
pointer pReadmask) |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
211 |
{ |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
212 |
struct dmdata *dmd = (struct dmdata *) data; |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
213 |
fd_set *LastSelectMask = (fd_set*)pReadmask; |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
214 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
215 |
FD_SET(dmd->pipeFD, LastSelectMask); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
216 |
} |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
217 |
|
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
218 |
static void |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
219 |
DtloginWakeupHandler( |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
220 |
pointer data, /* unused */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
221 |
int i, |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
222 |
pointer pReadmask) |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
223 |
{ |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
224 |
struct dmdata *dmd = (struct dmdata *) data; |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
225 |
fd_set* LastSelectMask = (fd_set*)pReadmask; |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
226 |
|
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
227 |
if (i > 0) |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
228 |
{ |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
229 |
if (FD_ISSET(dmd->pipeFD, LastSelectMask)) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
230 |
{ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
231 |
FD_CLR(dmd->pipeFD, LastSelectMask); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
232 |
dtlogin_receive_packet(dmd); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
233 |
/* dmd may have been freed in dtlogin_receive_packet, do |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
234 |
not use after this point */ |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
235 |
} |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
236 |
} |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
237 |
} |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
238 |
|
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
239 |
static int |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
240 |
dtlogin_create_pipe(int port, struct dmdata *dmd) |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
241 |
{ |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
242 |
struct stat statbuf; |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
243 |
char pipename[128]; |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
244 |
int pipeFD = -1; |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
245 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
246 |
if (stat(DTLOGIN_PATH, &statbuf) == -1) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
247 |
if (mkdir(DTLOGIN_PATH, 0700) == -1) { |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
248 |
DtloginError("Cannot create %s directory for display " |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
249 |
"manager pipe", DTLOGIN_PATH); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
250 |
return -1; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
251 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
252 |
} else if (!S_ISDIR(statbuf.st_mode)) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
253 |
DtloginError("Cannot create display manager pipe: " |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
254 |
"%s is not a directory", DTLOGIN_PATH); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
255 |
return -1; |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
256 |
} |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
257 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
258 |
snprintf(pipename, sizeof(pipename), "%s/%d", DTLOGIN_PATH, port); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
259 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
260 |
if (mkfifo(pipename, S_IRUSR | S_IWUSR) < 0) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
261 |
return -1; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
262 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
263 |
if ((pipeFD = open(pipename, O_RDONLY | O_NONBLOCK)) < 0) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
264 |
remove(pipename); |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
265 |
return -1; |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
266 |
} |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
267 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
268 |
dmd->pipename = xstrdup(pipename); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
269 |
|
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
270 |
/* To make sure root has rw permissions. */ |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
271 |
(void) fchmod(pipeFD, 0600); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
272 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
273 |
return pipeFD; |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
274 |
} |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
275 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
276 |
static void dtlogin_close_pipe(struct dmdata *dmd) |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
277 |
{ |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
278 |
RemoveBlockAndWakeupHandlers (DtloginBlockHandler, |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
279 |
DtloginWakeupHandler, dmd); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
280 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
281 |
close(dmd->pipeFD); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
282 |
remove(dmd->pipename); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
283 |
xfree(dmd->pipename); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
284 |
xfree(dmd->buf); |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
285 |
xfree(dmd->user.homedir); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
286 |
xfree(dmd); |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
287 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
288 |
if (dmHandlerData == dmd) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
289 |
dmHandlerData = NULL; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
290 |
} |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
291 |
} |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
292 |
|
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
293 |
static void |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
294 |
dtlogin_receive_packet(struct dmdata *dmd) |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
295 |
{ |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
296 |
int bufLen, nbRead; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
297 |
char *p, *n; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
298 |
int done = 0; |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
299 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
300 |
if (dmd->buf == NULL) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
301 |
dmd->bufsize = BUFLEN; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
302 |
dmd->buf = xalloc(dmd->bufsize); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
303 |
dmd->buf[0] = '\0'; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
304 |
} |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
305 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
306 |
/* Read data from pipe and split into tokens, buffering the rest */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
307 |
while (!done) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
308 |
bufLen = strlen(dmd->buf); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
309 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
310 |
/* |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
311 |
* Realloc only if buf has filled up and we don't have a record |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
312 |
* delimiter yet. Keep track of alloced size. |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
313 |
*/ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
314 |
if (bufLen > (dmd->bufsize/2)) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
315 |
dmd->bufsize += BUFLEN; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
316 |
dmd->buf = xrealloc(dmd->buf, dmd->bufsize); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
317 |
} |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
318 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
319 |
nbRead = read(dmd->pipeFD, dmd->buf + bufLen, |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
320 |
dmd->bufsize - bufLen - 1); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
321 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
322 |
if (nbRead == -1) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
323 |
if (errno == EINTR) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
324 |
continue; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
325 |
} else if (errno == EAGAIN) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
326 |
return; /* return to WaitFor, wait for select() */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
327 |
} else { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
328 |
dtlogin_close_pipe(dmd); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
329 |
return; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
330 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
331 |
} |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
332 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
333 |
if (nbRead == 0) { /* End of file */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
334 |
dtlogin_close_pipe(dmd); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
335 |
return; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
336 |
} |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
337 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
338 |
bufLen += nbRead; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
339 |
dmd->buf[bufLen] = '\0'; |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
340 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
341 |
DtloginInfo("Data buffer: %s\n", dmd->buf); |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
342 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
343 |
p = dmd->buf; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
344 |
while ((n = strchr(p, ';')) != NULL) { /* Next complete packet */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
345 |
*n = '\0'; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
346 |
DtloginInfo("Next packet: %s\n", p); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
347 |
done = dtlogin_parse_packet(dmd, p); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
348 |
if (done) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
349 |
dtlogin_close_pipe(dmd); /* free's dmd */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
350 |
return; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
351 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
352 |
p = n+1; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
353 |
} |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
354 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
355 |
/* save the rest for the next iteration */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
356 |
if (p < (dmd->buf + bufLen)) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
357 |
DtloginInfo("Left over: %s\n", p); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
358 |
strcpy(dmd->buf, p); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
359 |
} |
0
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
360 |
} |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
361 |
} |
b949c5054bc4
Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff
changeset
|
362 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
363 |
/* Parse data from packet |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
364 |
* |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
365 |
* Example Record: |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
366 |
* UID="xxx" GID="yyy"; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
367 |
* G_LIST_ID="aaa" G_LIST_ID="bbb" G_LIST_ID="ccc"; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
368 |
* HOME="/nn/mmm/ooo" EOF=""; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
369 |
*/ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
370 |
static int |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
371 |
dtlogin_parse_packet(struct dmdata *dmd, char *s) |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
372 |
{ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
373 |
char *k, *v, *p; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
374 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
375 |
while (s < (dmd->buf + dmd->bufsize)) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
376 |
/* format is key="value" - split into key & value pair */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
377 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
378 |
for (k = s ; (*k != '\0') && isspace(*k); k++) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
379 |
/* Skip over whitespace */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
380 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
381 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
382 |
if (*k == '\0') { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
383 |
break; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
384 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
385 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
386 |
p = strchr(k, '='); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
387 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
388 |
if (p == NULL) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
389 |
DtloginInfo("Malformed key \'%s\'\n", k); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
390 |
return 0; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
391 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
392 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
393 |
*p = '\0'; /* end of key string */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
394 |
p++; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
395 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
396 |
if (*p != '\"') { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
397 |
DtloginInfo("Bad delimiter at \'%s\'\n", p); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
398 |
return 0; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
399 |
} |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
400 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
401 |
v = p + 1; /* start of value string */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
402 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
403 |
p = strchr(v, '\"'); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
404 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
405 |
if (p == NULL) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
406 |
DtloginInfo("Missing quote after value \'%s\'\n", v); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
407 |
break; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
408 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
409 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
410 |
*p = '\0'; /* end of value string */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
411 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
412 |
s = p + 1; /* start of next pair */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
413 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
414 |
DtloginInfo("Received key \"%s\" =>", k); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
415 |
DtloginInfo(" value \"%s\"\n", v); |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
416 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
417 |
/* Found key & value, now process & put into dmd */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
418 |
if (strcmp(k, "EOF") == 0) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
419 |
/* End of transmission, process & close */ |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
420 |
dtlogin_process(&(dmd->user), 1); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
421 |
return 1; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
422 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
423 |
else if (strcmp(k, "HOME") == 0) { |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
424 |
dmd->user.homedir = xstrdup(v); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
425 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
426 |
else if ( (strcmp(k, "UID") == 0) || (strcmp(k, "GID") == 0) |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
427 |
|| (strcmp(k, "G_LIST_ID") == 0) ) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
428 |
/* Value is numeric, convert to int */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
429 |
int val; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
430 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
431 |
errno = 0; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
432 |
val = strtol(v, NULL, 10); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
433 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
434 |
if ((val == 0) && (strcmp(v, "0") != 0)) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
435 |
/* strtol couldn't parse the results */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
436 |
DtloginInfo("Invalid number \"%s\"\n", v); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
437 |
continue; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
438 |
} |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
439 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
440 |
if ( ((val == LONG_MAX) || (val == LONG_MIN)) |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
441 |
&& (errno == ERANGE) ) { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
442 |
/* Value out of range */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
443 |
DtloginInfo("Out of range number \"%s\"\n", v); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
444 |
continue; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
445 |
} |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
446 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
447 |
if (strcmp(k, "UID") == 0) { |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
448 |
dmd->user.uid = val; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
449 |
} |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
450 |
else if (strcmp(k, "GID") == 0) { |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
451 |
dmd->user.gid = val; |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
452 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
453 |
else if (strcmp(k, "G_LIST_ID") == 0) { |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
454 |
if (dmd->user.groupid_cnt < NGROUPS_UMAX) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
455 |
dmd->user.groupids[dmd->user.groupid_cnt++] = val; |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
456 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
457 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
458 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
459 |
else { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
460 |
DtloginInfo("Unrecognized key \"%s\"\n", k); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
461 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
462 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
463 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
464 |
return 0; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
465 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
466 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
467 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
468 |
static void |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
469 |
dtlogin_process(struct dmuser *user, int user_logged_in) |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
470 |
{ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
471 |
struct project proj; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
472 |
char proj_buf[PROJECT_BUFSZ]; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
473 |
struct passwd *ppasswd; |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
474 |
const char *auth_file = NULL; |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
475 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
476 |
auth_file = GetAuthFilename(); |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
477 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
478 |
if (auth_file) { |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
479 |
if (chown(auth_file, user->uid, user->gid) < 0) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
480 |
DtloginError("Error in changing owner to %d", user->uid); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
481 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
482 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
483 |
/* This gid dance is necessary in order to make sure |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
484 |
our "saved-set-gid" is 0 so that we can regain gid |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
485 |
0 when necessary for priocntl & power management. |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
486 |
The first step sets rgid to the user's gid and |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
487 |
makes the egid & saved-gid be 0. The second then |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
488 |
sets the egid to the users gid, but leaves the |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
489 |
saved-gid as 0. */ |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
490 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
491 |
if (user->gid != (gid_t) -1) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
492 |
DtloginInfo("Setting gid to %d\n", user->gid); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
493 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
494 |
if (setregid(user->gid, 0) < 0) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
495 |
DtloginError("Error in setting regid to %d\n", user->gid); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
496 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
497 |
if (setegid(user->gid) < 0) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
498 |
DtloginError("Error in setting egid to %d\n", user->gid); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
499 |
} |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
500 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
501 |
if (user->groupid_cnt >= 0) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
502 |
if (setgroups(user->groupid_cnt, user->groupids) < 0) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
503 |
DtloginError("Error in setting supplemental (%d) groups", |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
504 |
user->groupid_cnt); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
505 |
} |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
506 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
507 |
|
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
508 |
/* |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
509 |
* BUG: 4462531: Set project ID for Xserver |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
510 |
* Get user name and default project. |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
511 |
* Set before the uid value is set. |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
512 |
*/ |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
513 |
if (user->projid != (uid_t) -1) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
514 |
if (settaskid(user->projid, TASK_NORMAL) == (taskid_t) -1) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
515 |
DtloginError("Error in setting project id to %d", user->projid); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
516 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
517 |
} else if (user->uid != (uid_t) -1) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
518 |
ppasswd = getpwuid(user->uid); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
519 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
520 |
if (ppasswd == NULL) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
521 |
DtloginError("Error in getting user name for %d", user->uid); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
522 |
} else { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
523 |
if (getdefaultproj(ppasswd->pw_name, &proj, |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
524 |
(void *)&proj_buf, PROJECT_BUFSZ) == NULL) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
525 |
DtloginError("Error in getting project id for %s", |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
526 |
ppasswd->pw_name); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
527 |
} else { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
528 |
DtloginInfo("Setting project to %s\n", proj.pj_name); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
529 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
530 |
if (setproject(proj.pj_name, ppasswd->pw_name, |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
531 |
TASK_NORMAL) == -1) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
532 |
DtloginError("Error in setting project to %s", |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
533 |
proj.pj_name); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
534 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
535 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
536 |
} |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
537 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
538 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
539 |
if (user->uid != (uid_t) -1) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
540 |
DtloginInfo("Setting uid to %d\n", user->uid); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
541 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
542 |
if (setreuid(user->uid, -1) < 0) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
543 |
DtloginError("Error in setting ruid to %d", user->uid); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
544 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
545 |
if (setreuid(-1, user->uid) < 0) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
546 |
DtloginError("Error in setting euid to %d", user->uid); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
547 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
548 |
/* Wrap closeScreen to allow resetting uid on closedown */ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
549 |
if ((user->uid != 0) && (user != &originalUser)) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
550 |
int i; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
551 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
552 |
for (i = 0; i < screenInfo.numScreens; i++) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
553 |
{ |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
554 |
ScreenPtr pScreen = screenInfo.screens[i]; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
555 |
struct dmScreenPriv *pScreenPriv; |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
556 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
557 |
pScreenPriv = (struct dmScreenPriv *) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
558 |
Xcalloc(sizeof(struct dmScreenPriv)); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
559 |
dixSetPrivate(&pScreen->devPrivates, dmScreenKey, pScreenPriv); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
560 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
561 |
if (pScreenPriv != NULL) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
562 |
pScreenPriv->CloseScreen = pScreen->CloseScreen; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
563 |
pScreen->CloseScreen = DtloginCloseScreen; |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
564 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
565 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
566 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
567 |
} |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
568 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
569 |
if (user->homedir != NULL) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
570 |
char *env_str = Xprintf("HOME=%s", user->homedir); |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
571 |
|
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
572 |
if (env_str == NULL) { |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
573 |
DtloginError("Not enough memory to setenv HOME=%s", user->homedir); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
574 |
} else { |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
575 |
DtloginInfo("Setting %s\n",env_str); |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
576 |
|
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
577 |
if (putenv(env_str) < 0) |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
578 |
DtloginError("Failed to setenv %s", env_str); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
579 |
} |
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
580 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
581 |
if (chdir(user->homedir) < 0) |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
582 |
DtloginError("Error in changing working directory to %s", |
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
583 |
user->homedir); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
584 |
} |
766
ac938085d487
6480003 Xorg should support virtual console on Solaris
Aaron Zang <Aaron.Zang@Sun.COM>
parents:
419
diff
changeset
|
585 |
|
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
586 |
/* Inform the kernel whether a user has logged in on this VT device */ |
766
ac938085d487
6480003 Xorg should support virtual console on Solaris
Aaron Zang <Aaron.Zang@Sun.COM>
parents:
419
diff
changeset
|
587 |
if (xf86ConsoleFd != -1) |
781
bf2bd78db20e
6874875 Xorg needs to have privilege to make PCITOOL_DEVICE_SET_REG and PCITOOL_DEVICE_GET_REG ioctl calls
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
766
diff
changeset
|
588 |
ioctl(xf86ConsoleFd, VT_SETDISPLOGIN, user_logged_in); |
419
fa1e52e3bd2e
6671756 Several bugs in Xserver reading of login information pipe
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
98
diff
changeset
|
589 |
} |