rust/cargo-c: update to 0.10.7+cargo-0.84.0
[oi-userland.git] / components / desktop / lightdm / patches / 18-set-path.patch
bloba103428425802c602b4541a736641cd60dc63f69
1 --- lightdm-1.19.3/src/session-child.c.~7~ 2017-04-25 12:24:59.852060367 +0300
2 +++ lightdm-1.19.3/src/session-child.c 2017-04-25 12:27:23.569942688 +0300
3 @@ -8,6 +8,7 @@
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <sys/wait.h>
7 +#include <deflt.h>
8 #include <fcntl.h>
9 #include <pwd.h>
10 #include <grp.h>
11 @@ -97,6 +97,29 @@
12 return value;
15 +/*
16 + * lightdm_read_default
17 + *
18 + * This function is used to support systems that have the /etc/default/login
19 + * interface to control programs that affect security. This is a Solaris
20 + * thing, though some users on other systems may find it useful.
21 + */
22 +static gchar *
23 +lightdm_read_default (gchar *key)
25 + gchar *retval = NULL;
27 + if (defopen ("/etc/default/login") == 0) {
28 + int flags = defcntl (DC_GETFLAGS, 0);
30 + TURNOFF (flags, DC_CASE);
31 + (void) defcntl (DC_SETFLAGS, flags); /* ignore case */
32 + retval = g_strdup (defread (key));
33 + (void) defopen ((char *)NULL);
34 + }
35 + return retval;
38 static void
39 run_linc_cleanup(User *user)
41 @@ -536,8 +536,20 @@
43 else
45 + char * path_str = NULL;
47 /* Set POSIX variables */
48 - pam_putenv (pam_handle, "PATH=/usr/local/bin:/usr/bin:/bin");
49 + if (user_get_uid(user) == 0)
50 + path_str = lightdm_read_default ("SUPATH=");
52 + if (path_str == NULL)
53 + path_str = lightdm_read_default ("PATH=");
55 + /* Sane fallback */
56 + if (path_str == NULL)
57 + path_str = "/usr/bin:/usr/sbin:/sbin:/usr/gnu/bin";
59 + pam_putenv (pam_handle, g_strdup_printf ("PATH=%s", path_str));
60 pam_putenv (pam_handle, g_strdup_printf ("USER=%s", username));
61 pam_putenv (pam_handle, g_strdup_printf ("LOGNAME=%s", username));
62 pam_putenv (pam_handle, g_strdup_printf ("HOME=%s", user_get_home_directory (user)));