[sqm-scripts/luci-app-sqm] Document how to disable shaping on a per direction basis
[feed/packages.git] / libs / libpam / patches / 007-cve-2014-2583.patch
1 From 9dcead87e6d7f66d34e7a56d11a30daca367dffb Mon Sep 17 00:00:00 2001
2 From: "Dmitry V. Levin" <ldv@altlinux.org>
3 Date: Wed, 26 Mar 2014 22:17:23 +0000
4 Subject: pam_timestamp: fix potential directory traversal issue (ticket #27)
5
6 pam_timestamp uses values of PAM_RUSER and PAM_TTY as components of
7 the timestamp pathname it creates, so extra care should be taken to
8 avoid potential directory traversal issues.
9
10 * modules/pam_timestamp/pam_timestamp.c (check_tty): Treat
11 "." and ".." tty values as invalid.
12 (get_ruser): Treat "." and ".." ruser values, as well as any ruser
13 value containing '/', as invalid.
14
15 Fixes CVE-2014-2583.
16
17 Reported-by: Sebastian Krahmer <krahmer@suse.de>
18
19 diff --git a/modules/pam_timestamp/pam_timestamp.c b/modules/pam_timestamp/pam_timestamp.c
20 index 5193733..b3f08b1 100644
21 --- a/modules/pam_timestamp/pam_timestamp.c
22 +++ b/modules/pam_timestamp/pam_timestamp.c
23 @@ -158,7 +158,7 @@ check_tty(const char *tty)
24 tty = strrchr(tty, '/') + 1;
25 }
26 /* Make sure the tty wasn't actually a directory (no basename). */
27 - if (strlen(tty) == 0) {
28 + if (!strlen(tty) || !strcmp(tty, ".") || !strcmp(tty, "..")) {
29 return NULL;
30 }
31 return tty;
32 @@ -243,6 +243,17 @@ get_ruser(pam_handle_t *pamh, char *ruserbuf, size_t ruserbuflen)
33 if (pwd != NULL) {
34 ruser = pwd->pw_name;
35 }
36 + } else {
37 + /*
38 + * This ruser is used by format_timestamp_name as a component
39 + * of constructed timestamp pathname, so ".", "..", and '/'
40 + * are disallowed to avoid potential path traversal issues.
41 + */
42 + if (!strcmp(ruser, ".") ||
43 + !strcmp(ruser, "..") ||
44 + strchr(ruser, '/')) {
45 + ruser = NULL;
46 + }
47 }
48 if (ruser == NULL || strlen(ruser) >= ruserbuflen) {
49 *ruserbuf = '\0';
50 --
51 cgit v0.10.2
52