Browse code

Apply patch for CVE-2017-9800

Change-Id: Ie987dbfe335a00373aba55aa7d3fd42337c2c887
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/3650
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

xiaolin-vmware authored on 2017/08/29 06:28:29
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,113 @@
0
+Patch from: http://subversion.apache.org/security/CVE-2017-9800-advisory.txtPatches:
1
+
2
+========
3
+
4
+  Patch for Subversion 1.9.6:
5
+[[[
6
+Index: subversion/libsvn_ra_svn/client.c
7
+===================================================================
8
+--- a/subversion/libsvn_ra_svn/client.c	(revision 1803926)
9
+@@ -46,6 +46,7 @@
10
+ #include "svn_props.h"
11
+ #include "svn_mergeinfo.h"
12
+ #include "svn_version.h"
13
++#include "svn_ctype.h"
14
+ 
15
+ #include "svn_private_config.h"
16
+ 
17
+@@ -396,7 +397,7 @@
18
+        * versions have it too. If the user is using some other ssh
19
+        * implementation that doesn't accept it, they can override it
20
+        * in the [tunnels] section of the config. */
21
+-      val = "$SVN_SSH ssh -q";
22
++      val = "$SVN_SSH ssh -q --";
23
+     }
24
+ 
25
+   if (!val || !*val)
26
+@@ -441,7 +442,7 @@
27
+   for (n = 0; cmd_argv[n] != NULL; n++)
28
+     argv[n] = cmd_argv[n];
29
+ 
30
+-  argv[n++] = svn_path_uri_decode(hostinfo, pool);
31
++  argv[n++] = hostinfo;
32
+   argv[n++] = "svnserve";
33
+   argv[n++] = "-t";
34
+   argv[n] = NULL;
35
+@@ -802,7 +803,33 @@
36
+ }
37
+ 
38
+ 
39
++/* A simple whitelist to ensure the following are valid:
40
++ *   user@server
41
++ *   [::1]:22
42
++ *   server-name
43
++ *   server_name
44
++ *   127.0.0.1
45
++ * with an extra restriction that a leading '-' is invalid.
46
++ */
47
++static svn_boolean_t
48
++is_valid_hostinfo(const char *hostinfo)
49
++{
50
++  const char *p = hostinfo;
51
+ 
52
++  if (p[0] == '-')
53
++    return FALSE;
54
++
55
++  while (*p)
56
++    {
57
++      if (!svn_ctype_isalnum(*p) && !strchr(":.-_[]@", *p))
58
++        return FALSE;
59
++
60
++      ++p;
61
++    }
62
++
63
++  return TRUE;
64
++}
65
++
66
+ static svn_error_t *ra_svn_open(svn_ra_session_t *session,
67
+                                 const char **corrected_url,
68
+                                 const char *url,
69
+@@ -835,8 +862,18 @@
70
+           || (callbacks->check_tunnel_func && callbacks->open_tunnel_func
71
+               && !callbacks->check_tunnel_func(callbacks->tunnel_baton,
72
+                                                tunnel))))
73
+-    SVN_ERR(find_tunnel_agent(tunnel, uri.hostinfo, &tunnel_argv, config,
74
+-                              result_pool));
75
++    {
76
++      const char *decoded_hostinfo;
77
++
78
++      decoded_hostinfo = svn_path_uri_decode(uri.hostinfo, result_pool);
79
++
80
++      if (!is_valid_hostinfo(decoded_hostinfo))
81
++        return svn_error_createf(SVN_ERR_BAD_URL, NULL, _("Invalid host '%s'"),
82
++                                 uri.hostinfo);
83
++
84
++      SVN_ERR(find_tunnel_agent(tunnel, decoded_hostinfo, &tunnel_argv,
85
++                                config, result_pool));
86
++    }
87
+   else
88
+     tunnel_argv = NULL;
89
+ 
90
+Index: subversion/libsvn_subr/config_file.c
91
+===================================================================
92
+--- a/subversion/libsvn_subr/config_file.c	(revision 1803926)
93
+@@ -1248,12 +1248,12 @@
94
+         "### passed to the tunnel agent as <user>@<hostname>.)  If the"      NL
95
+         "### built-in ssh scheme were not predefined, it could be defined"   NL
96
+         "### as:"                                                            NL
97
+-        "# ssh = $SVN_SSH ssh -q"                                            NL
98
++        "# ssh = $SVN_SSH ssh -q --"                                         NL
99
+         "### If you wanted to define a new 'rsh' scheme, to be used with"    NL
100
+         "### 'svn+rsh:' URLs, you could do so as follows:"                   NL
101
+-        "# rsh = rsh"                                                        NL
102
++        "# rsh = rsh --"                                                     NL
103
+         "### Or, if you wanted to specify a full path and arguments:"        NL
104
+-        "# rsh = /path/to/rsh -l myusername"                                 NL
105
++        "# rsh = /path/to/rsh -l myusername --"                              NL
106
+         "### On Windows, if you are specifying a full path to a command,"    NL
107
+         "### use a forward slash (/) or a paired backslash (\\\\) as the"    NL
108
+         "### path separator.  A single backslash will be treated as an"      NL
109
+]]]
110
+
... ...
@@ -1,43 +1,45 @@
1
-Summary:    	The Apache Subversion control system
2
-Name:       	subversion
3
-Version:    	1.9.4
4
-Release:    	1%{?dist}
5
-License:    	Apache License 2.0
6
-URL:        	http://subversion.apache.org/
7
-Group:      	Utilities/System
8
-Vendor:     	VMware, Inc.
9
-Distribution: 	Photon
1
+Summary:        The Apache Subversion control system
2
+Name:           subversion
3
+Version:        1.9.4
4
+Release:        2%{?dist}
5
+License:        Apache License 2.0
6
+URL:            http://subversion.apache.org/
7
+Group:          Utilities/System
8
+Vendor:         VMware, Inc.
9
+Distribution:   Photon
10 10
 Source0:        http://archive.apache.org/dist/%{name}/%{name}-%{version}.tar.bz2
11
-%define sha1 subversion=bc7d51fdda43bea01e1272dfe9d23d0a9d6cd11c
12
-Requires:   	apr
13
-Requires:   	apr-util
14
-BuildRequires: 	apr-devel
15
-BuildRequires: 	apr-util
16
-BuildRequires: 	apr-util-devel
17
-BuildRequires: 	sqlite-autoconf
18
-BuildRequires: 	libtool
19
-BuildRequires: 	expat
11
+%define sha1    subversion=bc7d51fdda43bea01e1272dfe9d23d0a9d6cd11c
12
+Patch0:         subversion-CVE-2017-9800.patch
13
+Requires:       apr
14
+Requires:       apr-util
15
+BuildRequires:  apr-devel
16
+BuildRequires:  apr-util
17
+BuildRequires:  apr-util-devel
18
+BuildRequires:  sqlite-autoconf
19
+BuildRequires:  libtool
20
+BuildRequires:  expat
20 21
 
21 22
 %description
22 23
 The Apache version control system.
23 24
 
24
-%package	devel
25
-Summary:	Header and development files for mesos
26
-Requires:	%{name} = %{version}
25
+%package    devel
26
+Summary:    Header and development files for mesos
27
+Requires:   %{name} = %{version}
27 28
 %description    devel
28 29
  subversion-devel package contains header files, libraries.
29 30
 
30 31
 %prep
31 32
 %setup -q
33
+%patch0 -p1
32 34
 %build
33
-./configure --prefix=%{_prefix}                        	\
34
-	    --disable-static				\
35
-	    --with-apache-libexecdir 
35
+./configure --prefix=%{_prefix}         \
36
+            --disable-static            \
37
+            --with-apache-libexecdir
36 38
 
37 39
 make %{?_smp_mflags}
38 40
 
39 41
 %install
40
-make -j1 DESTDIR=%{buildroot} install 
42
+make -j1 DESTDIR=%{buildroot} install
41 43
 %find_lang %{name}
42 44
 %files -f %{name}.lang
43 45
 %defattr(-,root,root)
... ...
@@ -52,19 +54,21 @@ make -j1 DESTDIR=%{buildroot} install
52 52
 %exclude %{_libdir}/debug/
53 53
 
54 54
 %changelog
55
-*	Wed Nov 23 2016 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.9.4-1
56
--	Upgraded to version 1.9.4, fixes CVE-2016-2167  CVE-2016-2168
57
-*	Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.9.3-6
58
--	GA - Bump release of all rpms
55
+*   Mon Aug 28 2017 Xiaolin Li <xiaolinl@vmware.com> 1.9.4-2
56
+-   Apply patch for CVE-2017-9800
57
+*   Wed Nov 23 2016 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.9.4-1
58
+-   Upgraded to version 1.9.4, fixes CVE-2016-2167  CVE-2016-2168
59
+*   Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.9.3-6
60
+-   GA - Bump release of all rpms
59 61
 *   Tue Feb 23 2016 Xiaolin Li <xiaolinl@vmware.com> 1.9.3-1
60 62
 -   Updated to version 1.9.3
61
-*	Tue Nov 10 2015 Xiaolin Li <xiaolinl@vmware.com> 1.8.13-5
62
--	Handled locale files with macro find_lang
63
-* 	Tue Sep 22 2015 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.8.13-4
64
--	Updated build-requires after creating devel package for apr. 
63
+*   Tue Nov 10 2015 Xiaolin Li <xiaolinl@vmware.com> 1.8.13-5
64
+-   Handled locale files with macro find_lang
65
+*   Tue Sep 22 2015 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.8.13-4
66
+-   Updated build-requires after creating devel package for apr.
65 67
 *   Mon Sep 21 2015 Xiaolin Li <xiaolinl@vmware.com> 1.8.13-3
66 68
 -   Move .a, and .so files to devel pkg.
67
-*	Tue Sep 08 2015 Vinay Kulkarni <kulkarniv@vmware.com> 1.8.13-2
68
--	Move headers into devel pkg.
69
-*	Fri Jun 26 2015 Sarah Choi <sarahc@vmware.com> 1.8.13-1
70
--	Initial build. First version
69
+*   Tue Sep 08 2015 Vinay Kulkarni <kulkarniv@vmware.com> 1.8.13-2
70
+-   Move headers into devel pkg.
71
+*   Fri Jun 26 2015 Sarah Choi <sarahc@vmware.com> 1.8.13-1
72
+-   Initial build. First version