2012-08-09 13:15:30 -07:00
# include "entrance.h"
# include <sys/types.h>
# include <fcntl.h>
# include <unistd.h>
2014-10-02 15:57:38 -07:00
# include <Eina.h>
2012-08-09 13:15:30 -07:00
# include "Ecore_Getopt.h"
# include <xcb/xcb.h>
# define ENTRANCE_DISPLAY ":0.0"
2013-09-03 11:08:37 -07:00
# define ENTRANCE_XEPHYR ":1.0"
2012-08-09 13:15:30 -07:00
static Eina_Bool _open_log ( ) ;
2013-09-03 11:08:37 -07:00
static Eina_Bool _entrance_main ( const char * dname ) ;
2012-08-09 13:15:30 -07:00
static void _remove_lock ( ) ;
2012-09-11 12:29:11 -07:00
static void _signal_cb ( int sig ) ;
static void _signal_log ( int sig ) ;
2014-10-02 15:57:38 -07:00
static void _entrance_autologin_lock_set ( void ) ;
static Eina_Bool _entrance_autologin_lock_get ( void ) ;
static Eina_Bool _entrance_client_error ( void * data , int type , void * event ) ;
static Eina_Bool _entrance_client_data ( void * data , int type , void * event ) ;
2012-08-09 13:15:30 -07:00
static Eina_Bool _entrance_client_del ( void * data , int type , void * event ) ;
2014-10-02 15:57:38 -07:00
static void _entrance_wait ( void ) ;
2012-08-09 13:15:30 -07:00
static Eina_Bool _testing = 0 ;
static Eina_Bool _xephyr = 0 ;
static Ecore_Exe * _entrance_client = NULL ;
static void
_signal_cb ( int sig )
{
2014-10-02 15:57:38 -07:00
PT ( " signal %d received " , sig ) ;
2012-08-09 13:15:30 -07:00
//FIXME if I don't have main loop at this time ?
2013-09-03 11:08:37 -07:00
if ( _entrance_client )
ecore_exe_terminate ( _entrance_client ) ;
else
ecore_main_loop_quit ( ) ;
2012-08-09 13:15:30 -07:00
}
static void
2013-10-29 11:26:56 -07:00
_signal_log ( int sig EINA_UNUSED )
2012-08-09 13:15:30 -07:00
{
2014-10-02 15:57:38 -07:00
PT ( " reopen the log file " ) ;
2012-08-09 13:15:30 -07:00
entrance_close_log ( ) ;
_open_log ( ) ;
}
static Eina_Bool
_get_lock ( )
{
FILE * f ;
char buf [ 128 ] ;
int my_pid ;
my_pid = getpid ( ) ;
f = fopen ( entrance_config - > lockfile , " r " ) ;
if ( ! f )
{
/* No lockfile, so create one */
f = fopen ( entrance_config - > lockfile , " w " ) ;
if ( ! f )
{
2014-10-02 15:57:38 -07:00
PT ( " Couldn't create lockfile! " ) ;
2012-08-09 13:15:30 -07:00
return ( EINA_FALSE ) ;
}
2014-10-02 15:57:38 -07:00
snprintf ( buf , sizeof ( buf ) , " %d " , my_pid ) ;
2012-08-09 13:15:30 -07:00
if ( ! fwrite ( buf , strlen ( buf ) , 1 , f ) )
{
fclose ( f ) ;
2014-10-02 15:57:38 -07:00
PT ( " Couldn't write the lockfile " ) ;
2012-08-09 13:15:30 -07:00
return EINA_FALSE ;
}
fclose ( f ) ;
}
else
{
int pid = 0 ;
/* read the lockfile */
if ( fgets ( buf , sizeof ( buf ) , f ) )
pid = atoi ( buf ) ;
fclose ( f ) ;
if ( pid = = my_pid )
return EINA_TRUE ;
2012-09-11 12:29:11 -07:00
2014-10-02 15:57:38 -07:00
PT ( " A lock file are present another instance are present ? " ) ;
2012-08-09 13:15:30 -07:00
return EINA_FALSE ;
}
return EINA_TRUE ;
}
static void
_update_lock ( )
{
FILE * f ;
char buf [ 128 ] ;
f = fopen ( entrance_config - > lockfile , " w " ) ;
2014-10-02 15:57:38 -07:00
snprintf ( buf , sizeof ( buf ) , " %d " , getpid ( ) ) ;
2012-08-09 13:15:30 -07:00
if ( ! fwrite ( buf , strlen ( buf ) , 1 , f ) )
2014-10-02 15:57:38 -07:00
PT ( " Coudn't update lockfile " ) ;
2012-08-09 13:15:30 -07:00
fclose ( f ) ;
}
static void
_remove_lock ( )
{
remove ( entrance_config - > lockfile ) ;
}
static Eina_Bool
_open_log ( )
{
FILE * elog ;
elog = fopen ( entrance_config - > logfile , " a " ) ;
if ( ! elog )
{
2014-10-02 15:57:38 -07:00
PT ( " could not open logfile ! " ) ;
2012-08-09 13:15:30 -07:00
return EINA_FALSE ;
}
fclose ( elog ) ;
if ( ! freopen ( entrance_config - > logfile , " a " , stdout ) )
2014-10-02 15:57:38 -07:00
PT ( " Error on reopen stdout " ) ;
2012-08-09 13:15:30 -07:00
setvbuf ( stdout , NULL , _IOLBF , BUFSIZ ) ;
if ( ! freopen ( entrance_config - > logfile , " a " , stderr ) )
2014-10-02 15:57:38 -07:00
PT ( " Error on reopen stderr " ) ;
2012-08-09 13:15:30 -07:00
setvbuf ( stderr , NULL , _IONBF , BUFSIZ ) ;
return EINA_TRUE ;
}
void
entrance_close_log ( )
{
{
fclose ( stderr ) ;
fclose ( stdout ) ;
}
}
static void
2013-09-03 20:00:08 -07:00
_entrance_wait ( void )
2012-08-09 13:15:30 -07:00
{
2013-09-03 20:00:08 -07:00
// XXX: use eina_prefix! hardcoding paths . :(
execl ( PACKAGE_BIN_DIR " /entrance_wait " , PACKAGE_SBIN_DIR " /entrance " , NULL ) ;
2014-10-02 15:57:38 -07:00
PT ( " HUM HUM HUM can't wait ... " ) ;
2012-09-11 12:29:11 -07:00
_exit ( 1 ) ;
2012-08-09 13:15:30 -07:00
}
2014-05-04 20:57:41 -07:00
static Eina_Bool
2014-10-02 15:57:38 -07:00
_entrance_client_error ( void * data EINA_UNUSED , int type , void * event )
2014-05-04 20:57:41 -07:00
{
char buf [ 4096 ] ;
2014-10-02 15:57:38 -07:00
Ecore_Exe_Event_Data * ev ;
size_t size ;
ev = event ;
size = ev - > size ;
2014-05-04 20:57:41 -07:00
if ( ( unsigned int ) ev - > size > sizeof ( buf ) - 1 )
size = sizeof ( buf ) - 1 ;
strncpy ( buf , ( char * ) ev - > data , size ) ;
2014-10-02 15:57:38 -07:00
EINA_LOG_DOM_ERR ( _entrance_client_log , " %s " , buf ) ;
2014-05-04 20:57:41 -07:00
return ECORE_CALLBACK_DONE ;
}
static Eina_Bool
2014-10-02 15:57:38 -07:00
_entrance_client_data ( void * d EINA_UNUSED , int t EINA_UNUSED , void * event )
2014-05-04 20:57:41 -07:00
{
char buf [ 4096 ] ;
2014-10-02 15:57:38 -07:00
Ecore_Exe_Event_Data * ev ;
size_t size ;
ev = event ;
size = ev - > size ;
2014-05-04 20:57:41 -07:00
if ( ( unsigned int ) ev - > size > sizeof ( buf ) - 1 )
size = sizeof ( buf ) - 1 ;
2014-10-02 15:57:38 -07:00
snprintf ( buf , size + 1 , " %s " , ( char * ) ev - > data ) ;
EINA_LOG_DOM_INFO ( _entrance_client_log , " %s " , buf ) ;
2014-05-04 20:57:41 -07:00
return ECORE_CALLBACK_DONE ;
}
2013-09-03 11:08:37 -07:00
static Eina_Bool
2012-08-09 13:15:30 -07:00
_entrance_main ( const char * dname )
{
2014-10-02 15:57:38 -07:00
PT ( " starting... " ) ;
2012-08-09 13:15:30 -07:00
if ( ! entrance_config - > autologin )
{
if ( ! _entrance_client )
{
char buf [ PATH_MAX ] ;
2015-08-08 05:56:55 -07:00
const char * user = NULL ;
2012-08-09 13:15:30 -07:00
ecore_event_handler_add ( ECORE_EXE_EVENT_DEL ,
_entrance_client_del , NULL ) ;
2014-05-04 20:57:41 -07:00
ecore_event_handler_add ( ECORE_EXE_EVENT_ERROR ,
2014-10-02 15:57:38 -07:00
_entrance_client_error , NULL ) ;
2014-05-04 20:57:41 -07:00
ecore_event_handler_add ( ECORE_EXE_EVENT_DATA ,
( Ecore_Event_Handler_Cb ) _entrance_client_data , NULL ) ;
2015-08-08 05:56:55 -07:00
if ( entrance_config - > start_user & & entrance_config - > start_user [ 0 ] )
{
if ( getpwnam ( entrance_config - > start_user ) )
user = entrance_config - > start_user ;
}
if ( ! user )
{
PT ( " The given user %s, is not not valid. Falling back to nobody user, possible that this wont work, set up a correct start_user in entrance.conf " , entrance_config - > start_user ) ;
user = " nobody " ;
}
2012-08-09 13:15:30 -07:00
snprintf ( buf , sizeof ( buf ) ,
2015-08-08 05:56:55 -07:00
SUDO " -u %s "
2014-05-05 13:53:11 -07:00
" LD_LIBRARY_PATH= " PACKAGE_LIB_DIR " "
2012-08-09 13:15:30 -07:00
PACKAGE_BIN_DIR " /entrance_client -d %s -t %s " ,
2015-08-08 05:56:55 -07:00
user , dname , entrance_config - > theme ) ;
2014-10-02 15:57:38 -07:00
PT ( " Exec entrance_client: %s " , buf ) ;
2013-09-03 11:08:37 -07:00
2014-05-04 20:57:41 -07:00
_entrance_client = ecore_exe_pipe_run ( buf , ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR , NULL ) ;
2012-08-09 13:15:30 -07:00
}
}
else
ecore_main_loop_quit ( ) ;
2013-09-03 11:08:37 -07:00
return ECORE_CALLBACK_CANCEL ;
2012-08-09 13:15:30 -07:00
}
static Eina_Bool
2013-10-29 11:26:56 -07:00
_entrance_client_del ( void * data EINA_UNUSED , int type EINA_UNUSED , void * event )
2012-08-09 13:15:30 -07:00
{
Ecore_Exe_Event_Del * ev ;
ev = event ;
if ( ev - > exe ! = _entrance_client )
return ECORE_CALLBACK_PASS_ON ;
2014-10-02 15:57:38 -07:00
PT ( " client have terminated " ) ;
2012-08-09 13:15:30 -07:00
ecore_main_loop_quit ( ) ;
_entrance_client = NULL ;
return ECORE_CALLBACK_DONE ;
}
2014-10-02 15:57:38 -07:00
static void
_entrance_autologin_lock_set ( void )
{
system ( " touch /var/cache/entrance/login " ) ;
}
static Eina_Bool
_entrance_autologin_lock_get ( void )
{
FILE * f ;
char buf [ 4096 ] ;
double uptime , sleep_time ;
struct stat st_login ;
f = fopen ( " /proc/uptime " , " r " ) ;
if ( f )
{
fgets ( buf , sizeof ( buf ) , f ) ;
fscanf ( f , " %lf %lf " , & uptime , & sleep_time ) ;
fclose ( f ) ;
if ( stat ( " /var/run/entrance/login " , & st_login ) > 0 )
return EINA_FALSE ;
else
return EINA_TRUE ;
}
return EINA_FALSE ;
}
2012-08-09 13:15:30 -07:00
static const Ecore_Getopt options =
{
PACKAGE ,
" %prog [options] " ,
VERSION ,
2014-10-02 15:57:38 -07:00
" (C) 201e Enlightenment, see AUTHORS " ,
2012-08-09 13:15:30 -07:00
" GPL, see COPYING " ,
" Entrance is a login manager, written using core efl libraries " ,
EINA_TRUE ,
{
ECORE_GETOPT_STORE_TRUE ( ' n ' , " nodaemon " , " Don't daemonize. " ) ,
ECORE_GETOPT_STORE_TRUE ( ' t ' , " test " , " run in test mode. " ) ,
2014-01-23 12:44:01 -08:00
ECORE_GETOPT_STORE_TRUE ( ' e ' , " fastexit " , " Will change the way entrance \
2014-10-02 15:57:38 -07:00
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 , \
2014-01-23 12:44:01 -08:00
or if the environment variable ENTRANCE_RESTART is set . " ),
2012-08-09 13:15:30 -07:00
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 " ) ,
ECORE_GETOPT_LICENSE ( ' L ' , " license " ) ,
ECORE_GETOPT_SENTINEL
}
} ;
int
main ( int argc , char * * argv )
{
int args ;
2013-09-03 11:08:37 -07:00
int pid = - 1 ;
char * dname ;
2012-08-09 13:15:30 -07:00
char * entrance_user = NULL ;
unsigned char nodaemon = 0 ;
2014-01-23 12:44:01 -08:00
unsigned char fastexit = 0 ;
2012-08-09 13:15:30 -07:00
unsigned char quit_option = 0 ;
2012-09-03 15:48:26 -07:00
2012-08-09 13:15:30 -07:00
Ecore_Getopt_Value values [ ] =
{
ECORE_GETOPT_VALUE_BOOL ( nodaemon ) ,
ECORE_GETOPT_VALUE_BOOL ( _testing ) ,
2014-01-23 12:44:01 -08:00
ECORE_GETOPT_VALUE_BOOL ( fastexit ) ,
2012-08-09 13:15:30 -07:00
ECORE_GETOPT_VALUE_BOOL ( _xephyr ) ,
ECORE_GETOPT_VALUE_BOOL ( quit_option ) ,
ECORE_GETOPT_VALUE_BOOL ( quit_option ) ,
ECORE_GETOPT_VALUE_BOOL ( quit_option ) ,
ECORE_GETOPT_VALUE_BOOL ( quit_option ) ,
ECORE_GETOPT_VALUE_NONE
} ;
2014-10-02 15:57:38 -07:00
eina_init ( ) ;
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 ) ;
eina_log_domain_level_set ( " entrance " , 5 ) ;
eina_log_domain_level_set ( " entrance_client " , 5 ) ;
2012-08-09 13:15:30 -07:00
args = ecore_getopt_parse ( & options , values , argc , argv ) ;
if ( args < 0 )
{
2014-10-02 15:57:38 -07:00
PT ( " ERROR: could not parse options. " ) ;
2012-08-09 13:15:30 -07:00
return - 1 ;
}
if ( quit_option )
return 0 ;
2012-09-03 15:48:26 -07:00
if ( getuid ( ) ! = 0 )
2012-08-09 13:15:30 -07:00
{
2014-10-02 15:57:38 -07:00
fprintf ( stderr , " Sorry, only root can run this program! " ) ;
2012-08-09 13:15:30 -07:00
return 1 ;
}
2013-09-03 11:08:37 -07:00
if ( ! _xephyr & & getenv ( " ENTRANCE_XEPHYR " ) )
_xephyr = EINA_TRUE ;
2014-01-23 12:44:01 -08:00
if ( fastexit )
{
putenv ( strdup ( " ENTRANCE_FAST_QUIT=1 " ) ) ;
2014-10-02 15:57:38 -07:00
PT ( " Fast exit enabled ! " ) ;
2014-01-23 12:44:01 -08:00
}
2013-09-03 11:08:37 -07:00
if ( _xephyr )
{
_testing = EINA_TRUE ;
dname = strdup ( ENTRANCE_XEPHYR ) ;
putenv ( strdup ( " ENTRANCE_XEPHYR=1 " ) ) ;
}
else
dname = strdup ( ENTRANCE_DISPLAY ) ;
if ( ! _testing & & getenv ( " ENTRANCE_TESTING " ) )
_testing = EINA_TRUE ;
2012-08-09 13:15:30 -07:00
if ( _testing )
2013-09-03 11:08:37 -07:00
{
putenv ( strdup ( " ENTRANCE_TESTING=1 " ) ) ;
nodaemon = EINA_TRUE ;
}
2012-08-09 13:15:30 -07:00
eet_init ( ) ;
entrance_config_init ( ) ;
2013-09-03 11:08:37 -07:00
if ( ! entrance_config )
{
PT ( " No config loaded, sorry must quit ... " ) ;
exit ( 1 ) ;
}
2012-08-09 13:15:30 -07:00
if ( ! _testing & & ! _get_lock ( ) )
{
exit ( 1 ) ;
}
if ( ! nodaemon & & entrance_config - > daemonize )
{
if ( daemon ( 0 , 1 ) = = - 1 )
{
2014-10-02 15:57:38 -07:00
PT ( " Error on daemonize ! " ) ;
2012-08-09 13:15:30 -07:00
quit_option = EINA_TRUE ;
}
_update_lock ( ) ;
int fd ;
if ( ( fd = open ( " /dev/null " , O_RDONLY ) ) )
{
dup2 ( fd , 0 ) ;
close ( fd ) ;
}
}
2012-09-03 15:48:26 -07:00
if ( quit_option )
2012-08-09 13:15:30 -07:00
{
2012-09-03 15:48:26 -07:00
entrance_config_shutdown ( ) ;
exit ( 1 ) ;
2012-08-09 13:15:30 -07:00
}
2013-09-03 11:08:37 -07:00
if ( ! _testing & & ! _open_log ( ) )
2012-08-09 13:15:30 -07:00
{
2014-10-02 15:57:38 -07:00
PT ( " Can't open log file !!!! " ) ;
2012-08-09 13:15:30 -07:00
entrance_config_shutdown ( ) ;
exit ( 1 ) ;
}
2012-09-03 15:48:26 -07:00
2012-08-09 13:15:30 -07:00
entrance_user = getenv ( " ENTRANCE_USER " ) ;
if ( entrance_user )
{
2014-02-06 18:03:08 -08:00
char * quit ;
2014-09-23 16:05:46 -07:00
entrance_xserver_wait ( ) ;
2014-10-02 15:57:38 -07:00
sleep ( 5 ) ;
2014-01-13 11:23:16 -08:00
entrance_session_init ( dname ) ;
2012-08-09 13:15:30 -07:00
entrance_session_end ( entrance_user ) ;
2014-01-13 11:23:16 -08:00
entrance_session_shutdown ( ) ;
2012-08-09 13:15:30 -07:00
quit = getenv ( " ENTRANCE_QUIT " ) ;
if ( quit )
{
unsetenv ( " ENTRANCE_QUIT " ) ;
2014-10-02 15:57:38 -07:00
PT ( " Last DE Session quit with error! " ) ;
2012-08-09 13:15:30 -07:00
}
2014-02-06 02:30:27 -08:00
_remove_lock ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " Entrance will quit, bye bye :). " ) ;
2014-02-06 02:30:27 -08:00
entrance_close_log ( ) ;
exit ( 1 ) ;
2012-08-09 13:15:30 -07:00
}
2014-10-02 15:57:38 -07:00
PT ( " Welcome " ) ;
2012-08-09 13:15:30 -07:00
ecore_init ( ) ;
2012-09-11 12:29:11 -07:00
efreet_init ( ) ;
2012-08-09 13:15:30 -07:00
/* Initialise event handler */
signal ( SIGQUIT , _signal_cb ) ;
signal ( SIGTERM , _signal_cb ) ;
signal ( SIGKILL , _signal_cb ) ;
signal ( SIGINT , _signal_cb ) ;
signal ( SIGHUP , _signal_cb ) ;
signal ( SIGPIPE , _signal_cb ) ;
signal ( SIGALRM , _signal_cb ) ;
signal ( SIGUSR2 , _signal_log ) ;
2014-10-02 15:57:38 -07:00
PT ( " session init " ) ;
2013-09-03 11:08:37 -07:00
entrance_session_init ( dname ) ;
2014-01-16 12:50:15 -08:00
entrance_session_cookie ( ) ;
2013-09-03 11:08:37 -07:00
if ( ! _xephyr )
{
2014-10-02 15:57:38 -07:00
PT ( " xserver init " ) ;
2013-09-03 11:08:37 -07:00
pid = entrance_xserver_init ( _entrance_main , dname ) ;
}
else
2014-10-02 15:57:38 -07:00
{
putenv ( strdup ( " ENTRANCE_XPID=-1 " ) ) ;
_entrance_main ( dname ) ;
}
PT ( " history init " ) ;
2012-08-09 13:15:30 -07:00
entrance_history_init ( ) ;
2014-10-02 15:57:38 -07:00
if ( ( entrance_config - > autologin ) & & _entrance_autologin_lock_get ( ) )
2012-08-09 13:15:30 -07:00
{
2014-10-02 15:57:38 -07:00
PT ( " autologin init " ) ;
2012-08-09 13:15:30 -07:00
xcb_connection_t * disp = NULL ;
disp = xcb_connect ( dname , NULL ) ;
2014-10-02 15:57:38 -07:00
PT ( " main loop begin " ) ;
2012-08-09 13:15:30 -07:00
ecore_main_loop_begin ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " auth user " ) ;
2012-08-09 13:15:30 -07:00
# ifdef HAVE_PAM
2014-09-10 14:01:51 -07:00
entrance_pam_init ( PACKAGE , dname , NULL ) ;
2014-09-10 14:13:32 -07:00
entrance_pam_item_set ( ENTRANCE_PAM_ITEM_USER ,
entrance_config - > userlogin ) ;
2012-08-09 13:15:30 -07:00
# endif
2014-10-02 15:57:38 -07:00
PT ( " login user " ) ;
2014-09-10 14:13:32 -07:00
entrance_session_login (
entrance_history_user_session_get ( entrance_config - > userlogin ) ,
EINA_FALSE ) ;
2012-08-09 13:15:30 -07:00
sleep ( 30 ) ;
xcb_disconnect ( disp ) ;
}
else
{
2014-10-02 15:57:38 -07:00
PT ( " action init " ) ;
2012-08-09 13:15:30 -07:00
entrance_action_init ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " server init " ) ;
2012-08-09 13:15:30 -07:00
entrance_server_init ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " starting main loop " ) ;
2012-08-09 13:15:30 -07:00
ecore_main_loop_begin ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " main loop end " ) ;
2012-08-09 13:15:30 -07:00
entrance_server_shutdown ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " server shutdown " ) ;
2012-08-09 13:15:30 -07:00
entrance_action_shutdown ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " action shutdown " ) ;
2012-08-09 13:15:30 -07:00
}
entrance_history_shutdown ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " history shutdown " ) ;
2013-09-03 11:08:37 -07:00
if ( _xephyr )
{
//ecore_exe_terminate(xephyr);
2014-10-02 15:57:38 -07:00
PT ( " Xephyr shutdown " ) ;
2013-09-03 11:08:37 -07:00
}
else
{
entrance_xserver_shutdown ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " xserver shutdown " ) ;
2013-09-03 11:08:37 -07:00
}
2012-08-09 13:15:30 -07:00
# ifdef HAVE_PAM
entrance_pam_shutdown ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " pam shutdown " ) ;
2012-08-09 13:15:30 -07:00
# endif
2014-10-02 15:57:38 -07:00
_entrance_autologin_lock_set ( ) ;
2012-09-11 12:29:11 -07:00
efreet_shutdown ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " ecore shutdown " ) ;
2013-09-03 11:08:37 -07:00
ecore_shutdown ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " session shutdown " ) ;
2013-09-03 11:08:37 -07:00
entrance_session_shutdown ( ) ;
2012-09-20 01:23:51 -07:00
if ( entrance_session_logged_get ( ) )
{
2014-10-02 15:57:38 -07:00
PT ( " user logged, waiting... " ) ;
2012-09-20 01:23:51 -07:00
_entrance_wait ( ) ;
2013-09-03 11:08:37 -07:00
/* no more running here */
2012-09-20 01:23:51 -07:00
}
_remove_lock ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " config shutdown " ) ;
2013-09-03 11:08:37 -07:00
entrance_config_shutdown ( ) ;
2014-10-02 15:57:38 -07:00
PT ( " eet shutdown " ) ;
2013-09-03 11:08:37 -07:00
eet_shutdown ( ) ;
2012-08-09 13:15:30 -07:00
free ( dname ) ;
2013-09-03 11:08:37 -07:00
if ( ! _xephyr )
{
2014-10-02 15:57:38 -07:00
PT ( " ending xserver " ) ;
2013-09-03 11:08:37 -07:00
kill ( pid , SIGTERM ) ;
entrance_xserver_end ( ) ;
2014-09-23 16:05:46 -07:00
entrance_xserver_wait ( ) ;
2013-09-03 11:08:37 -07:00
}
else
2014-10-02 15:57:38 -07:00
PT ( " No session to wait, exiting " ) ;
2012-08-09 13:15:30 -07:00
entrance_close_log ( ) ;
return 0 ;
}