Browse code

package:shadow: Upgrade to version 4.6

Update the the package shadow to latest
version 4.6

Change-Id: I8decb61636d434a1252f536d0da177027dde1690
Signed-off-by: srinidhira0 <srinidhir@vmware.com>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6536
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

srinidhira0 authored on 2019/01/20 22:34:12
Showing 4 changed files
1 1
deleted file mode 100644
... ...
@@ -1,74 +0,0 @@
1
-diff -ruN shadow-4.2.1/libmisc/idmapping.c shadow-4.2.1.new/libmisc/idmapping.c
2
-+++ shadow-4.2.1.new/libmisc/idmapping.c	2016-07-19 10:55:49.339097323 +0200
3
-@@ -77,6 +77,11 @@
4
- 			return NULL;
5
- 		if (!getulong(argv[argidx + 2], &mapping->count))
6
- 			return NULL;
7
-+
8
-+		if (ULONG_MAX - mapping->upper <= mapping->count || ULONG_MAX - mapping->lower <= mapping->count) {
9
-+			fprintf(stderr, _( "%s: subuid overflow detected.\n"), Prog);
10
-+			exit(EXIT_FAILURE);
11
-+		}
12
- 	}
13
- 	return mappings;
14
- }
15
-diff -ruN shadow-4.2.1/libmisc/myname.c shadow-4.2.1.new/libmisc/myname.c
16
-+++ shadow-4.2.1.new/libmisc/myname.c	2016-07-19 10:14:49.298852058 +0200
17
-@@ -44,25 +44,13 @@
18
- /*@null@*/ /*@only@*/struct passwd *get_my_pwent (void)
19
- {
20
- 	struct passwd *pw;
21
--	const char *cp = getlogin ();
22
- 	uid_t ruid = getuid ();
23
- 
24
--	/*
25
--	 * Try getlogin() first - if it fails or returns a non-existent
26
--	 * username, or a username which doesn't match the real UID, fall
27
--	 * back to getpwuid(getuid()).  This should work reasonably with
28
--	 * usernames longer than the utmp limit (8 characters), as well as
29
--	 * shared UIDs - but not both at the same time...
30
-+	/* Do not use getlogin(). Its not suitable for suid binaries.
31
- 	 *
32
- 	 * XXX - when running from su, will return the current user (not
33
- 	 * the original user, like getlogin() does).  Does this matter?
34
- 	 */
35
--	if ((NULL != cp) && ('\0' != *cp)) {
36
--		pw = xgetpwnam (cp);
37
--		if ((NULL != pw) && (pw->pw_uid == ruid)) {
38
--			return pw;
39
--		}
40
--	}
41
- 
42
- 	return xgetpwuid (ruid);
43
- }
44
-
45
-diff -ruN shadow-4.2.1/lib/getulong.c shadow-4.2.1.new/lib/getulong.c
46
-+++ shadow-4.2.1.new/lib/getulong.c	2016-07-19 10:36:14.476785123 +0200
47
-@@ -44,22 +44,19 @@
48
-  */
49
- int getulong (const char *numstr, /*@out@*/unsigned long int *result)
50
- {
51
--	long long int val;
52
-+	unsigned long int val;
53
- 	char *endptr;
54
- 
55
- 	errno = 0;
56
--	val = strtoll (numstr, &endptr, 0);
57
-+	val = strtoul (numstr, &endptr, 0);
58
- 	if (    ('\0' == *numstr)
59
- 	     || ('\0' != *endptr)
60
- 	     || (ERANGE == errno)
61
--	     /*@+ignoresigns@*/
62
--	     || (val != (unsigned long int)val)
63
--	     /*@=ignoresigns@*/
64
- 	   ) {
65
- 		return 0;
66
- 	}
67
- 
68
--	*result = (unsigned long int)val;
69
-+	*result = val;
70
- 	return 1;
71
- }
72 1
deleted file mode 100644
... ...
@@ -1,39 +0,0 @@
1
-From 954e3d2e7113e9ac06632aee3c69b8d818cc8952 Mon Sep 17 00:00:00 2001
2
-From: Tomas Mraz <tmraz@fedoraproject.org>
3
-Date: Fri, 31 Mar 2017 16:25:06 +0200
4
-Subject: [PATCH] Fix buffer overflow if NULL line is present in db.
5
-
6
-If ptr->line == NULL for an entry, the first cycle will exit,
7
-but the second one will happily write past entries buffer.
8
-We actually do not want to exit the first cycle prematurely
9
-on ptr->line == NULL.
10
-Signed-off-by: Tomas Mraz <tmraz@fedoraproject.org>
11
- lib/commonio.c | 8 ++++----
12
- 1 file changed, 4 insertions(+), 4 deletions(-)
13
-
14
-diff --git a/lib/commonio.c b/lib/commonio.c
15
-index b10da06a..31edbaaf 100644
16
-+++ b/lib/commonio.c
17
-@@ -751,16 +751,16 @@ commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *))
18
- 	for (ptr = db->head;
19
- 	        (NULL != ptr)
20
- #if KEEP_NIS_AT_END
21
--	     && (NULL != ptr->line)
22
--	     && (   ('+' != ptr->line[0])
23
--	         && ('-' != ptr->line[0]))
24
-+	     && ((NULL == ptr->line)
25
-+	         || (('+' != ptr->line[0])
26
-+	             && ('-' != ptr->line[0])))
27
- #endif
28
- 	     ;
29
- 	     ptr = ptr->next) {
30
- 		n++;
31
- 	}
32
- #if KEEP_NIS_AT_END
33
--	if ((NULL != ptr) && (NULL != ptr->line)) {
34
-+	if (NULL != ptr) {
35
- 		nis = ptr;
36
- 	}
37
- #endif
38 1
deleted file mode 100644
... ...
@@ -1,135 +0,0 @@
1
-+++ b/src/newgidmap.c	2018-07-31 06:03:36.578802898 +0530
2
-@@ -46,32 +46,36 @@
3
-  */
4
- const char *Prog;
5
- 
6
--static bool verify_range(struct passwd *pw, struct map_range *range)
7
-+static bool verify_range(struct passwd *pw, struct map_range *range, bool *allow_setgroups)
8
- {
9
- 	/* An empty range is invalid */
10
- 	if (range->count == 0)
11
- 		return false;
12
- 
13
--	/* Test /etc/subgid */
14
--	if (have_sub_gids(pw->pw_name, range->lower, range->count))
15
-+	/* Test /etc/subgid. If the mapping is valid then we allow setgroups. */
16
-+	if (have_sub_gids(pw->pw_name, range->lower, range->count)) {
17
-+		*allow_setgroups = true;
18
- 		return true;
19
-+	}
20
- 
21
- 	/* Allow a process to map it's own gid */
22
--	if ((range->count == 1) && (pw->pw_gid == range->lower))
23
-+	if ((range->count == 1) && (pw->pw_gid == range->lower)) {
24
-+		/* noop -- if setgroups is enabled already we won't disable it. */
25
- 		return true;
26
-+	}
27
- 
28
- 	return false;
29
- }
30
- 
31
- static void verify_ranges(struct passwd *pw, int ranges,
32
--	struct map_range *mappings)
33
-+	struct map_range *mappings, bool *allow_setgroups)
34
- {
35
- 	struct map_range *mapping;
36
- 	int idx;
37
- 
38
- 	mapping = mappings;
39
- 	for (idx = 0; idx < ranges; idx++, mapping++) {
40
--		if (!verify_range(pw, mapping)) {
41
-+		if (!verify_range(pw, mapping, allow_setgroups)) {
42
- 			fprintf(stderr, _( "%s: gid range [%lu-%lu) -> [%lu-%lu) not allowed\n"),
43
- 				Prog,
44
- 				mapping->upper,
45
-@@ -83,6 +87,70 @@ static void verify_ranges(struct passwd
46
- 	}
47
- }
48
- 
49
-+void write_setgroups(int proc_dir_fd, bool allow_setgroups)
50
-+{
51
-+	int setgroups_fd;
52
-+	char *policy, policy_buffer[4096];
53
-+
54
-+	/*
55
-+	 * Default is "deny", and any "allow" will out-rank a "deny". We don't
56
-+	 * forcefully write an "allow" here because the process we are writing
57
-+	 * mappings for may have already set themselves to "deny" (and "allow"
58
-+	 * is the default anyway). So allow_setgroups == true is a noop.
59
-+	 */
60
-+	policy = "deny\n";
61
-+	if (allow_setgroups)
62
-+		return;
63
-+
64
-+	setgroups_fd = openat(proc_dir_fd, "setgroups", O_RDWR|O_CLOEXEC);
65
-+	if (setgroups_fd < 0) {
66
-+		/*
67
-+		 * If it's an ENOENT then we are on too old a kernel for the setgroups
68
-+		 * code to exist. Emit a warning and bail on this.
69
-+		 */
70
-+		if (ENOENT == errno) {
71
-+			fprintf(stderr, _("%s: kernel doesn't support setgroups restrictions\n"), Prog);
72
-+			goto out;
73
-+		}
74
-+		fprintf(stderr, _("%s: couldn't open process setgroups: %s\n"),
75
-+			Prog,
76
-+			strerror(errno));
77
-+		exit(EXIT_FAILURE);
78
-+	}
79
-+
80
-+	/*
81
-+	 * Check whether the policy is already what we want. /proc/self/setgroups
82
-+	 * is write-once, so attempting to write after it's already written to will
83
-+	 * fail.
84
-+	 */
85
-+	if (read(setgroups_fd, policy_buffer, sizeof(policy_buffer)) < 0) {
86
-+		fprintf(stderr, _("%s: failed to read setgroups: %s\n"),
87
-+			Prog,
88
-+			strerror(errno));
89
-+		exit(EXIT_FAILURE);
90
-+	}
91
-+	if (!strncmp(policy_buffer, policy, strlen(policy)))
92
-+		goto out;
93
-+
94
-+	/* Write the policy. */
95
-+	if (lseek(setgroups_fd, 0, SEEK_SET) < 0) {
96
-+		fprintf(stderr, _("%s: failed to seek setgroups: %s\n"),
97
-+			Prog,
98
-+			strerror(errno));
99
-+		exit(EXIT_FAILURE);
100
-+	}
101
-+	if (dprintf(setgroups_fd, "%s", policy) < 0) {
102
-+		fprintf(stderr, _("%s: failed to setgroups %s policy: %s\n"),
103
-+			Prog,
104
-+			policy,
105
-+			strerror(errno));
106
-+		exit(EXIT_FAILURE);
107
-+	}
108
-+
109
-+out:
110
-+	close(setgroups_fd);
111
-+}
112
-+
113
- static void usage(void)
114
- {
115
- 	fprintf(stderr, _("usage: %s <pid> <gid> <lowergid> <count> [ <gid> <lowergid> <count> ] ... \n"), Prog);
116
-@@ -103,6 +171,7 @@ int main(int argc, char **argv)
117
- 	struct stat st;
118
- 	struct passwd *pw;
119
- 	int written;
120
-+	bool allow_setgroups = false;
121
- 
122
- 	Prog = Basename (argv[0]);
123
- 
124
-@@ -174,8 +243,9 @@ int main(int argc, char **argv)
125
- 	if (!mappings)
126
- 		usage();
127
- 
128
--	verify_ranges(pw, ranges, mappings);
129
-+	verify_ranges(pw, ranges, mappings, &allow_setgroups);
130
- 
131
-+	write_setgroups(proc_dir_fd, allow_setgroups);
132
- 	write_mapping(proc_dir_fd, ranges, mappings, "gid_map");
133
- 	sub_gid_close();
134
- 
... ...
@@ -1,14 +1,14 @@
1 1
 Summary:	Programs for handling passwords in a secure way
2 2
 Name:		shadow
3
-Version:	4.2.1
4
-Release:	13%{?dist}
5
-URL:		http://pkg-shadow.alioth.debian.org/
3
+Version:	4.6
4
+Release:	1%{?dist}
5
+URL:		https://github.com/shadow-maint/
6 6
 License:	BSD
7 7
 Group:		Applications/System
8 8
 Vendor:		VMware, Inc.
9 9
 Distribution:	Photon
10
-Source0:	http://pkg-shadow.alioth.debian.org/releases/%{name}-%{version}.tar.xz
11
-%define sha1 shadow=0917cbadd4ce0c7c36670e5ecd37bbed92e6d82d
10
+Source0:	https://github.com/shadow-maint/shadow/releases/download/%{version}/%{name}-%{version}.tar.xz
11
+%define sha1 shadow=0b84eb1010fda5edca2a9d1733f9480200e02de6
12 12
 Source1:        chage
13 13
 Source2:        chpasswd
14 14
 Source3:        login
... ...
@@ -21,9 +21,6 @@ Source9:        system-auth
21 21
 Source10:       system-password
22 22
 Source11:       system-session
23 23
 Patch0: chkname-allowcase.patch
24
-Patch1: shadow-4.2.1-CVE-2016-6252-fix.patch
25
-Patch2: shadow-4.2.1-CVE-2017-12424.patch
26
-Patch3: shadow-4.2.1-CVE-2018-7169.patch
27 24
 BuildRequires: 	cracklib
28 25
 BuildRequires: 	cracklib-devel
29 26
 Requires:   	cracklib
... ...
@@ -37,9 +34,6 @@ in a secure way.
37 37
 %prep
38 38
 %setup -q -n %{name}-%{version}
39 39
 %patch0 -p1
40
-%patch1 -p1
41
-%patch2 -p1
42
-%patch3 -p1
43 40
 sed -i 's/groups$(EXEEXT) //' src/Makefile.in
44 41
 find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
45 42
 sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
... ...
@@ -124,6 +118,8 @@ done
124 124
 %{_mandir}/*/*
125 125
 %config(noreplace) %{_sysconfdir}/pam.d/*
126 126
 %changelog
127
+*   Fri Jan 19 2019 Srinidhi Rao <srinidhir@vmware.com> 4.6-1
128
+-   Upgrading the version to 4.6.
127 129
 *   Mon Jul 30 2018 Tapas Kundu <tkundu@vmware.com> 4.2.1-13
128 130
 -   Added fix for CVE-2018-7169.
129 131
 *   Fri Apr 20 2018 Alexey Makhalov <amakhalov@vmware.com> 4.2.1-12