From e538a9f2c05799e8d74cf44002639f80e6971963 Mon Sep 17 00:00:00 2001 From: Brian Cameron Date: Wed, 29 Sep 2004 22:18:51 +0000 Subject: Cleaned up code and moved final di_devperm_logout call in gdm.c so it Wed Sep 29 17:15:00 2004 Brian Cameron * daemon/gdm.c, daemon/verify-pam.c: Cleaned up code and moved final di_devperm_logout call in gdm.c so it properly resets permissions to root when gdm-stop is run. --- daemon/gdm.c | 22 ++++++++-------------- daemon/verify-pam.c | 8 +++----- 2 files changed, 11 insertions(+), 19 deletions(-) (limited to 'daemon') diff --git a/daemon/gdm.c b/daemon/gdm.c index 8e718469..fd057ac3 100644 --- a/daemon/gdm.c +++ b/daemon/gdm.c @@ -933,10 +933,6 @@ gdm_final_cleanup (void) gdm_in_final_cleanup = TRUE; -#ifdef HAVE_LOGINDEVPERM - (void) di_devperm_logout("/dev/console"); -#endif /* HAVE_LOGINDEVPERM */ - if (extra_process > 1) { /* we sigterm extra processes, and we * don't wait */ @@ -1030,6 +1026,10 @@ gdm_final_cleanup (void) if (GdmPidFile != NULL) { VE_IGNORE_EINTR (unlink (GdmPidFile)); } + +#ifdef HAVE_LOGINDEVPERM + (void) di_devperm_logout("/dev/console"); +#endif /* HAVE_LOGINDEVPERM */ } static gboolean @@ -2045,16 +2045,6 @@ main (int argc, char *argv[]) /* Parse configuration file */ gdm_config_parse(); -#ifdef HAVE_LOGINDEVPERM - { - struct passwd *gdm_pwent = NULL; - gdm_pwent = getpwnam (GdmUser); - - di_devperm_login("/dev/console", gdm_pwent->pw_uid, - gdm_pwent->pw_gid, NULL); - } -#endif /* HAVE_LOGINDEVPERM */ - /* Check if another gdm process is already running */ if (access (GdmPidFile, R_OK) == 0) { @@ -2201,6 +2191,10 @@ main (int argc, char *argv[]) gdm_debug ("gdm_main: Here we go..."); +#ifdef HAVE_LOGINDEVPERM + di_devperm_login("/dev/console", GdmUserId, GdmGroupId, NULL); +#endif /* HAVE_LOGINDEVPERM */ + /* Init XDMCP if applicable */ if (GdmXdmcp && ! gdm_wait_for_go) gdm_xdmcp_init(); diff --git a/daemon/verify-pam.c b/daemon/verify-pam.c index 55e85adf..54625280 100644 --- a/daemon/verify-pam.c +++ b/daemon/verify-pam.c @@ -1377,12 +1377,10 @@ gdm_verify_cleanup (GdmDisplay *d) #ifdef HAVE_LOGINDEVPERM if (old_opened_session && old_did_setcred && d->console) { - struct passwd *gdm_pwent = NULL; (void) di_devperm_logout("/dev/console"); - - gdm_pwent = getpwnam (GdmUser); - (void) di_devperm_login("/dev/console", gdm_pwent->pw_uid, - gdm_pwent->pw_gid, NULL); + /* give it back to gdm user */ + (void) di_devperm_login("/dev/console", GdmUserId, GdmGroupId, + NULL); } #endif /* HAVE_LOGINDEVPERM */ -- cgit v1.2.1