dtlogin.c revision 766
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive/* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
34420effba1fde4ef7a4aaadba1c92ac0c8be339fielding * Permission is hereby granted, free of charge, to any person obtaining a
34420effba1fde4ef7a4aaadba1c92ac0c8be339fielding * copy of this software and associated documentation files (the
34420effba1fde4ef7a4aaadba1c92ac0c8be339fielding * "Software"), to deal in the Software without restriction, including
34420effba1fde4ef7a4aaadba1c92ac0c8be339fielding * without limitation the rights to use, copy, modify, merge, publish,
34420effba1fde4ef7a4aaadba1c92ac0c8be339fielding * distribute, and/or sell copies of the Software, and to permit persons
34420effba1fde4ef7a4aaadba1c92ac0c8be339fielding * to whom the Software is furnished to do so, provided that the above
273eafe6bf1d6f7e307eada091fef9a80ab1f440nd * copyright notice(s) and this permission notice appear in all copies of
273eafe6bf1d6f7e307eada091fef9a80ab1f440nd * the Software and that both the above copyright notice(s) and this
273eafe6bf1d6f7e307eada091fef9a80ab1f440nd * permission notice appear in supporting documentation.
273eafe6bf1d6f7e307eada091fef9a80ab1f440nd * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
273eafe6bf1d6f7e307eada091fef9a80ab1f440nd * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
273eafe6bf1d6f7e307eada091fef9a80ab1f440nd * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
273eafe6bf1d6f7e307eada091fef9a80ab1f440nd * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
273eafe6bf1d6f7e307eada091fef9a80ab1f440nd * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * Except as contained in this notice, the name of a copyright holder
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * shall not be used in advertising or otherwise to promote the sale, use
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * or other dealings in this Software without prior written authorization
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * of the copyright holder.
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive#pragma ident "@(#)dtlogin.c 1.19 09/08/14 SMI"
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive/* Implementation of Display Manager (dtlogin/gdm/xdm/etc.) to X server
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * communication pipe. The Display Manager process will start
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * the X window server at system boot time before any user
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * has logged into the system. The X server is by default
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * started as the root UID "0".
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * At login time the Xserver local communication pipe is provided
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * by the Xserver for user specific configuration data supplied
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * by the display manager. It notifies the Xserver it needs to change
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * over to the user's credentials (UID, GID, GID_LIST) and
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * also switch CWD (current working directory) of to match
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * the user's CWD home.
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive * ASARC case 1995/390
extern const char *GetAuthFilename(void);
struct dmdata {
int pipeFD;
int groupid_cnt;
char * homedir;
#ifndef XSUN
* Called from CreateWellKnownSockets in os/connection.c
_X_HIDDEN void
DtloginInit(void)
int displayNumber = 0;
if (getuid() != 0) return;
#ifdef XSUN
return pipeFD;
int done = 0;
while (!done) {
if (done) {
if (p == NULL) {
if (p == NULL) {
int val;
errno = 0;
if (auth_file) {