7199N/AFrom 0ccf6e6afa7eb6f5dc8b8c6689caa8bb190fef0d Mon Sep 17 00:00:00 2001
7199N/AFrom: Alan Coopersmith <alan.coopersmith@oracle.com>
7199N/ADate: Tue, 29 Dec 2015 14:21:38 -0800
7199N/AOriginal date:2009-03-31 owner:yippi type:feature
7199N/A 1 file changed, 76 insertions(+), 7 deletions(-)
7199N/Aindex 93c9e82..5fc83d6 100644
7199N/A@@ -222,6 +222,33 @@ G_DEFINE_TYPE_WITH_CODE (GdmSessionWorker,
7199N/A G_IMPLEMENT_INTERFACE (GDM_DBUS_TYPE_WORKER,
7199N/A+ * interface to control programs that affect security. This is a Solaris
7199N/A+ * thing, though some users on other systems may find it useful.
7199N/A+gdm_read_default (gchar *key)
7199N/A+ int flags = defcntl (DC_GETFLAGS, 0);
7199N/A+ (void) defcntl (DC_SETFLAGS, flags); /* ignore case */
7199N/A+ retval = g_strdup (defread (key));
7199N/A+ (void) defopen ((char *)NULL);
7199N/A open_ck_session (GdmSessionWorker *worker)
7199N/A@@ -1351,6 +1378,28 @@ gdm_session_worker_authorize_user (GdmSessionWorker *worker,
7199N/A g_debug ("GdmSessionWorker: determining if authenticated user (password required:%d) is authorized to session",
7199N/A+ char *consoleonly = gdm_read_default ("CONSOLE=");
7199N/A+ if ((consoleonly != NULL) &&
7199N/A+ if (worker->priv->hostname != NULL &&
7199N/A+ worker->priv->hostname[0] != '\0') {
7199N/A+ struct passwd *passwd_entry;
7199N/A+ passwd_entry = getpwnam (worker->priv->username);
7199N/A+ if (passwd_entry->pw_uid == 0) {
7199N/A+ error_code = PAM_PERM_DENIED;
7199N/A+ g_debug ("The system administrator is not allowed to log in remotely");
7199N/A+ g_set_error (error, GDM_SESSION_WORKER_ERROR, GDM_SESSION_WORKER_ERROR_AUTHORIZING, "%s", pam_strerror (worker->priv->pam_handle, error_code));
7199N/A if (password_is_required) {
7199N/A@@ -1716,6 +1765,7 @@ gdm_session_worker_accredit_user (GdmSessionWorker *worker,
7199N/A@@ -1756,18 +1806,26 @@ gdm_session_worker_accredit_user (GdmSessionWorker *worker,
7199N/A- /* Let's give the user a default PATH if he doesn't already have one
7199N/A- if (!gdm_session_worker_environment_variable_is_set (worker, "PATH")) {
7199N/A+ path_str = gdm_read_default ("SUPATH=");
7199N/A+ path_str = gdm_read_default ("PATH=");
7199N/A- gdm_session_worker_set_environment_variable (worker, "PATH",
7199N/A- GDM_SESSION_DEFAULT_PATH);
7199N/A+ path_str = GDM_SESSION_DEFAULT_PATH;
7199N/A- gdm_session_worker_set_environment_variable (worker, "PATH",
7199N/A- BINDIR ":" GDM_SESSION_DEFAULT_PATH);
7199N/A+ path_str = BINDIR ":" GDM_SESSION_DEFAULT_PATH;
7199N/A+ gdm_session_worker_set_environment_variable (worker, "PATH", path_str);
7199N/A if (! _change_user (worker, uid, gid)) {
7199N/A g_debug ("GdmSessionWorker: Unable to change to user");
7199N/A error_code = PAM_SYSTEM_ERR;
7199N/A@@ -2768,6 +2826,17 @@ do_setup (GdmSessionWorker *worker)
7199N/A+ passreq = gdm_read_default ("PASSREQ=");
7199N/A+ if ((passreq != NULL) && g_ascii_strcasecmp (passreq, "YES") == 0)
7199N/A+ worker->priv->password_is_required = TRUE;
7199N/A+ worker->priv->password_is_required = FALSE;
7199N/A res = gdm_session_worker_initialize_pam (worker,