Exemple #1
0
void
StartDisplay (struct display *d)
{
    pid_t	pid;

    Debug ("StartDisplay %s\n", d->name);
    LogInfo ("Starting X server on %s\n", d->name);
    LoadServerResources (d);
    if (d->authorize)
    {
        Debug ("SetLocalAuthorization %s, auth %s\n",
               d->name, d->authNames[0]);
        SetLocalAuthorization (d);
    }
    if (d->serverPid == -1 && !StartServer (d))
    {
        LogError ("Server for display %s can't be started, session disabled\n", d->name);
        RemoveDisplay (d);
        return;
    }
    if (!nofork_session)
	pid = fork ();
    else
	pid = 0;
    switch (pid)
    {
    case 0:
	if (!nofork_session) {
	    CleanUpChild ();
	    (void) signal (SIGPIPE, SIG_IGN);
	}
	openlog("xenodm", LOG_PID, LOG_AUTHPRIV);
	LoadSessionResources (d);
	SetAuthorization (d);
	if (!WaitForServer (d))
	    exit (OPENFAILED_DISPLAY);
	SetWindowPath(d);
	if (pledge("stdio rpath cpath wpath fattr flock proc dns inet unix exec prot_exec getpw id", NULL) != 0)
	    exit(OPENFAILED_DISPLAY);
	ManageSession (d);
	exit (REMANAGE_DISPLAY);
    case -1:
	break;
    default:
	Debug ("pid: %d\n", pid);
	d->pid = pid;
	d->status = running;
	break;
    }
}
Exemple #2
0
void StartDisplay(struct display *d)
{
	int pid;

	WDMDebug("StartDisplay %s\n", d->name);
	LoadServerResources(d);
	if (d->displayType.location == Local) {
		/* don't bother pinging local displays; we'll
		 * certainly notice when they exit
		 */
		d->pingInterval = 0;
		if (d->authorize) {
			WDMDebug("SetLocalAuthorization %s, auth %s\n", d->name, d->authNames[0]);
			SetLocalAuthorization(d);
			/*
			 * reset the server after writing the authorization information
			 * to make it read the file (for compatibility with old
			 * servers which read auth file only on reset instead of
			 * at first connection)
			 */
			if (d->serverPid != -1 && d->resetForAuth && d->resetSignal)
				kill(d->serverPid, d->resetSignal);
		}
		if (d->serverPid == -1 && !StartServer(d)) {
			WDMError("Server for display %s can't be started, session disabled\n", d->name);
			RemoveDisplay(d);
			return;
		}
	} else {
		/* this will only happen when using XDMCP */
		if (d->authorizations)
			SaveServerAuthorizations(d, d->authorizations, d->authNum);
	}
	pid = fork();
	switch (pid) {
	case 0:
		CleanUpChild();
		LoadSessionResources(d);
		SetAuthorization(d);
		(void)Signal(SIGPIPE, SIG_IGN);
		(void)Signal(SIGHUP, SIG_IGN);
		if (!WaitForServer(d))
			exit(OPENFAILED_DISPLAY);
#ifdef XDMCP
		if (d->useChooser)
			RunChooser(d);
		else
#endif
			ManageSession(d);
		exit(REMANAGE_DISPLAY);
	case -1:
		break;
	default:
		WDMDebug("pid: %d\n", pid);
		d->pid = pid;
		d->status = running;
		/* checking a predeclared X resource DisplayManager*wdmSequentialXServerLaunch here */
		if (wdmSequentialXServerLaunch)
			WaitForServer(d);
		break;
	}
}
Exemple #3
0
void
StartDisplay (struct display *d)
{
    pid_t	pid;

    Debug ("StartDisplay %s\n", d->name);
    LogInfo ("Starting X server on %s\n", d->name);
    LoadServerResources (d);
    if (d->displayType.location == Local)
    {
	/* don't bother pinging local displays; we'll
	 * certainly notice when they exit
	 */
	d->pingInterval = 0;
	if (d->authorize)
	{
	    Debug ("SetLocalAuthorization %s, auth %s\n",
		    d->name, d->authNames[0]);
	    SetLocalAuthorization (d);
	    /*
	     * reset the server after writing the authorization information
	     * to make it read the file (for compatibility with old
	     * servers which read auth file only on reset instead of
	     * at first connection)
	     */
	    if (d->serverPid != -1 && d->resetForAuth && d->resetSignal)
		kill (d->serverPid, d->resetSignal);
	}
	if (d->serverPid == -1 && !StartServer (d))
	{
	    LogError ("Server for display %s can't be started, session disabled\n", d->name);
	    RemoveDisplay (d);
	    return;
	}
    }
    else
    {
	/* this will only happen when using XDMCP */
	if (d->authorizations)
	    SaveServerAuthorizations (d, d->authorizations, d->authNum);
    }
    if (!nofork_session)
	pid = fork ();
    else
	pid = 0;
    switch (pid)
    {
    case 0:
	if (!nofork_session) {
	    CleanUpChild ();
	    (void) Signal (SIGPIPE, SIG_IGN);
	}
#ifdef USE_SYSLOG
	openlog("xdm", LOG_PID, LOG_AUTHPRIV);
#endif
	LoadSessionResources (d);
	SetAuthorization (d);
	if (!WaitForServer (d))
	    exit (OPENFAILED_DISPLAY);
	SetWindowPath(d);
#ifdef XDMCP
	if (d->useChooser)
	    RunChooser (d);
	else
#endif
	    ManageSession (d);
	exit (REMANAGE_DISPLAY);
    case -1:
	break;
    default:
	Debug ("pid: %d\n", pid);
	d->pid = pid;
	d->status = running;
	break;
    }
}