Compare commits

..

11 Commits

Author SHA1 Message Date
Andy Williams 35c8f63f3b Default to default theme 2016-06-11 14:15:18 +01:00
Michael Bouchaud 690c748bae warn-- about unused var 2015-09-24 04:36:14 +00:00
Michael Bouchaud 644102e207 the lines who containing more than 80 chars burn my eyes too 2015-09-24 04:35:55 +00:00
Michael Bouchaud 22c099eab6 white space burn my eyes 2015-09-24 03:49:01 +00:00
Michael Bouchaud 866fdf557a nobody user is right, just give him a sandbox to create some files 2015-09-24 03:48:06 +00:00
Marcel Hollerbach 07567ce696 fix possible segfault 2015-08-09 22:15:27 +02:00
Marcel Hollerbach babe4d9807 entrance: let the greeter user be configurable 2015-08-08 14:56:55 +02:00
Marcel Hollerbach 4486d92901 Fix compile warning 2015-08-03 14:44:06 +02:00
Marcel Hollerbach 6061034bf1 entrance_wait: kill server if session was killed. 2015-08-03 14:44:06 +02:00
Marcel Hollerbach 4ed615e5eb entrance: Use PT instead of ERR 2015-08-03 14:44:06 +02:00
Marcel Hollerbach b67f79219d entrance_wait: do not react on closed children
This fixes T2627
2015-08-03 14:43:12 +02:00
7 changed files with 91 additions and 15 deletions

View File

@ -69,4 +69,7 @@ group "Entrance_Config" struct {
/* Use a virtual keyboard */
value "virtual_keyboard" uchar: 0;
/* the user to log in with */
value "start_user" string: "nobody";
}

View File

@ -52,6 +52,8 @@ main(int argc, char **argv)
eina_shutdown();
return EXIT_FAILURE;
}
if (!theme)
theme = "default";
ecore_init();
ecore_x_init(display);
elm_init(argc, argv);

View File

@ -5,9 +5,11 @@
#include <Eina.h>
#include "Ecore_Getopt.h"
#include <xcb/xcb.h>
#include <assert.h>
#define ENTRANCE_DISPLAY ":0.0"
#define ENTRANCE_XEPHYR ":1.0"
#define ENTRANCE_CONFIG_HOME_PATH "/var/cache/entrance/client"
static Eina_Bool _open_log();
static Eina_Bool _entrance_main(const char *dname);
@ -147,7 +149,7 @@ _entrance_wait(void)
}
static Eina_Bool
_entrance_client_error(void *data EINA_UNUSED, int type, void *event)
_entrance_client_error(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
char buf[4096];
Ecore_Exe_Event_Data *ev;
@ -186,26 +188,88 @@ _entrance_client_data(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
static Eina_Bool
_entrance_main(const char *dname)
{
struct passwd *pwd = NULL;
const char *user;
char buf[PATH_MAX];
const char *home_path;
struct stat st;
PT("starting...");
if (!entrance_config->autologin)
{
if (!_entrance_client)
{
char buf[PATH_MAX];
ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
_entrance_client_del, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR,
_entrance_client_error, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_DATA,
(Ecore_Event_Handler_Cb)_entrance_client_data, NULL);
_entrance_client_data, NULL);
if (entrance_config->start_user
&& entrance_config->start_user[0]) {
pwd = getpwnam(entrance_config->start_user);
}
if (!pwd)
{
PT("The given user %s, is not valid."
"Falling back to nobody", entrance_config->start_user);
pwd = getpwnam("nobody");
user = "nobody";
assert(pwd);
}
else
{
user = entrance_config->start_user;
}
if (!pwd->pw_dir || !strcmp(pwd->pw_dir, "/"))
{
PT("No home directory for client");
home_path = ENTRANCE_CONFIG_HOME_PATH;
if (!ecore_file_exists(ENTRANCE_CONFIG_HOME_PATH))
{
PT("Creating new home directory for client");
ecore_file_mkdir(ENTRANCE_CONFIG_HOME_PATH);
chown(ENTRANCE_CONFIG_HOME_PATH,
pwd->pw_uid, pwd->pw_gid);
}
else
{
if (!ecore_file_is_dir(ENTRANCE_CONFIG_HOME_PATH))
{
PT("Hum a file already exists here "
ENTRANCE_CONFIG_HOME_PATH" sorry but"
"I remove it, I need it ^^");
ecore_file_remove(ENTRANCE_CONFIG_HOME_PATH);
ecore_file_mkdir(ENTRANCE_CONFIG_HOME_PATH);
chown(ENTRANCE_CONFIG_HOME_PATH,
pwd->pw_uid, pwd->pw_gid);
}
}
}
else
{
home_path = pwd->pw_dir;
}
PT("Home directory %s", home_path);
stat(home_path, &st);
if ((st.st_uid != pwd->pw_uid)
|| (st.st_gid != pwd->pw_gid))
{
PT("The permission about %s is wrong, I fix it", home_path);
chown(home_path, pwd->pw_uid, pwd->pw_gid);
}
snprintf(buf, sizeof(buf),
SUDO" -u nobody "
SUDO" --user %s HOME=%s "
"LD_LIBRARY_PATH="PACKAGE_LIB_DIR" "
PACKAGE_BIN_DIR"/entrance_client -d %s -t %s",
dname, entrance_config->theme);
user, home_path, dname, entrance_config->theme);
PT("Exec entrance_client: %s", buf);
_entrance_client = ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR, NULL);
_entrance_client =
ecore_exe_pipe_run(buf,
ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR,
NULL);
}
}
else
@ -271,11 +335,14 @@ static const Ecore_Getopt options =
{
ECORE_GETOPT_STORE_TRUE('n', "nodaemon", "Don't daemonize."),
ECORE_GETOPT_STORE_TRUE('t', "test", "run in test mode."),
ECORE_GETOPT_STORE_TRUE('e', "fastexit", "Will change the way entrance \
handles the exit of the created session. If set, entrance will exit if the session \
quits. If not, entrance will restart if the session is quit because of an error, \
or if the environment variable ENTRANCE_RESTART is set."),
ECORE_GETOPT_STORE_TRUE('x', "xephyr", "run in test mode and use Xephyr."),
ECORE_GETOPT_STORE_TRUE('e', "fastexit", "Will change the way entrance"
"handles the exit of the created session. If "
"set, entrance will exit if the session quits. "
"If not, entrance will restart if the session is "
"quit because of an error, or if the environment "
"variable ENTRANCE_RESTART is set."),
ECORE_GETOPT_STORE_TRUE('x', "xephyr", "run in test mode and use "
"Xephyr."),
ECORE_GETOPT_HELP ('h', "help"),
ECORE_GETOPT_VERSION('V', "version"),
ECORE_GETOPT_COPYRIGHT('R', "copyright"),
@ -312,7 +379,8 @@ main (int argc, char ** argv)
eina_log_threads_enable();
ecore_init();
_entrance_log = eina_log_domain_register("entrance", EINA_COLOR_CYAN);
_entrance_client_log = eina_log_domain_register("entrance_client", EINA_COLOR_CYAN);
_entrance_client_log = eina_log_domain_register("entrance_client",
EINA_COLOR_CYAN);
eina_log_domain_level_set("entrance", 5);
eina_log_domain_level_set("entrance_client", 5);

View File

@ -170,6 +170,7 @@ entrance_config_init()
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "elementary_profile", elm_profile, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "virtual_keyboard", vkbd_enabled, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "custom_conf", custom_conf, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "start_user", start_user, EET_T_STRING);
_entrance_config_descriptor = edd;
if (stat( "/var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE, &cache) == -1)

View File

@ -37,6 +37,7 @@ struct _Entrance_Config
Eina_Bool autologin;
Eina_Bool custom_conf;
Eina_Bool vkbd_enabled;
const char *start_user;
};
void entrance_config_init(void);

View File

@ -39,6 +39,7 @@ _entrance_server_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
eev.event.conf_gui.enabled = EINA_TRUE;
eev.event.conf_gui.bg.path = entrance_config->bg.path;
eev.event.conf_gui.bg.group = entrance_config->bg.group;
eev.event.conf_gui.theme = NULL;
entrance_event_send(&eev);
}
PT("Sending pools");

View File

@ -15,7 +15,7 @@ static void kill_wait();
static pid_t _x_pid = 0;
static void
_entrance_wait_action(int sig, siginfo_t * si __UNUSED__, void *data __UNUSED__)
_entrance_wait_action(int sig __UNUSED__, siginfo_t * si __UNUSED__, void *data __UNUSED__)
{
kill_wait();
setenv("ENTRANCE_QUIT", "1", 1);