Exemplo n.º 1
0
static void on_xserver_stop(void *data,int pid, int status)
{
	LXSession *s=data;
	LXSession *greeter;

	g_message("xserver stop, restart. return status %x\n",status);

	stop_pid(pid);
	s->server = -1;
	lxsession_stop(s);
	greeter=lxsession_find_greeter();
	if(s->greeter || !greeter)
	{
		s->greeter=TRUE;
		xconn_close(s->dpy);
		s->dpy=NULL;
		lxdm_startx(s);
		ui_drop();
		ui_prepare();
		lxsession_set_active(greeter);
	}
	else
	{
		lxsession_free(s);
		lxsession_set_active(greeter);
	}
}
Exemplo n.º 2
0
static void lxsession_stop(LXSession *s)
{
	if(s->greeter)
	{
		ui_drop();
		s->greeter=FALSE;
	}
	if(s->child>0)
	{
		lxcom_del_child_watch(s->child);
		killpg(s->child, SIGHUP);
		stop_pid(s->child);
		s->child = -1;
	}
	if( s->server > 0 )
	{
		xconn_clean(s->dpy);
	}
	lxdm_auth_session_end(&s->auth);
#if HAVE_LIBCK_CONNECTOR
	if( s->ckc != NULL )
	{
		DBusError error;
		dbus_error_init(&error);
		ck_connector_close_session(s->ckc, &error);
		if(dbus_error_is_set(&error))
		{
			dbus_error_free(&error);
		}
		ck_connector_unref(s->ckc);
		s->ckc=NULL;
	}
#endif
	s->idle=TRUE;
}
Exemplo n.º 3
0
static void exit_cb(void)
{
	g_message("exit cb\n");
	ui_drop();
	while(session_list)
		lxsession_free(session_list->data);
	g_message("free session\n");
	put_lock();
	set_active_vt(old_tty);
	g_key_file_free(config);
}
Exemplo n.º 4
0
static gboolean on_greeter_input(GIOChannel *source, GIOCondition condition, gpointer data)
{
	GIOStatus ret;
	char *str;

	if( !(G_IO_IN & condition) )
		return FALSE;
	ret = g_io_channel_read_line(source, &str, NULL, NULL, NULL);
	if( ret != G_IO_STATUS_NORMAL )
		return FALSE;

	if( !strncmp(str, "reboot", 6) )
		lxdm_do_reboot();
	else if( !strncmp(str, "shutdown", 6) )
		lxdm_do_shutdown();
	else if( !strncmp(str, "log ", 4) )
		g_message("%s",str + 4);
	else if( !strncmp(str, "login ", 6) )
	{
		char *user = greeter_param(str, "user");
		char *pass = greeter_param(str, "pass");
		char *session = greeter_param(str, "session");
		char *lang = greeter_param(str, "lang");
		if( user/* && pass */)
		{
			struct passwd *pw;
			int ret = lxdm_auth_user(AUTH_TYPE_NORMAL, user, pass, &pw);
			if( AUTH_SUCCESS == ret && pw != NULL )
			{
				ui_drop();
				lxdm_do_login(pw, session, lang,NULL);
			}
			else
			{
				if(pass!=NULL)
					xwrite(greeter_pipe[0], "reset\n", 6);
				else
					xwrite(greeter_pipe[0], "password\n", 9);
			}
		}
		g_free(user);
		g_free(pass);
		g_free(session);
		g_free(lang);
	}
	else if(!strncmp(str, "autologin ", 10))
	{
		char *user=g_key_file_get_string(config,"base","autologin",NULL);
		char *pass=g_key_file_get_string(config,"base","password",NULL);
		char *session = greeter_param(str, "session");
		char *lang = greeter_param(str, "lang");

		if(user)
		{
			struct passwd *pw;
			int ret = lxdm_auth_user(AUTH_TYPE_AUTO_LOGIN, user, pass, &pw);
			if( AUTH_SUCCESS == ret && pw != NULL )
			{
				ui_drop();
				lxdm_do_login(pw, session, lang,NULL);
			}
			else
			{
				ui_reset();
			}
		}
		else
		{
			ui_reset();
		}
			
		g_free(user);
		g_free(pass);
		g_free(session);
		g_free(lang);
	}
	g_free(str);
	return TRUE;
}