summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2014-01-21 16:44:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-17 14:44:37 +0000
commita7ec08e2b5a78e05212562763d1927223c243d78 (patch)
treef62763f4da3d90ea2a0c4eab79ea9915f807b30d /bitbake
parent90547d53a1b4ab90b1c8b3dd81988a8d0d5759e1 (diff)
downloadpoky-a7ec08e2b5a78e05212562763d1927223c243d78.tar.gz
bitbake: fetch2: Don't allow '/' in user:pass, fix branch containing '@'
* currently decode_url regexp parses branch=@foo as username so it ends like this: - ('git', '', 'foo', 'git.openembedded.org/bitbake;branch=', '', {}) + ('git', 'git.openembedded.org', '/bitbake', '', '', {'branch': '@foo'}) * http://hg.python.org/cpython/file/2.7/Lib/urlparse.py also assumes that there is at least one '/' as separator between netloc and path, params, so it looks reasonable to prevent including '/' in username (Bitbake rev: 66d01338ab1095775b854ad7509f4d2631c6e6ed) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py2
-rw-r--r--bitbake/lib/bb/tests/fetch.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 377fa01ed4..98840c91b0 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -325,7 +325,7 @@ def decodeurl(url):
325 user, password, parameters). 325 user, password, parameters).
326 """ 326 """
327 327
328 m = re.compile('(?P<type>[^:]*)://((?P<user>.+)@)?(?P<location>[^;]+)(;(?P<parm>.*))?').match(url) 328 m = re.compile('(?P<type>[^:]*)://((?P<user>[^/]+)@)?(?P<location>[^;]+)(;(?P<parm>.*))?').match(url)
329 if not m: 329 if not m:
330 raise MalformedUrl(url) 330 raise MalformedUrl(url)
331 331
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 4bcff543fc..e134a31f12 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -407,7 +407,8 @@ class URLHandle(unittest.TestCase):
407 datatable = { 407 datatable = {
408 "http://www.google.com/index.html" : ('http', 'www.google.com', '/index.html', '', '', {}), 408 "http://www.google.com/index.html" : ('http', 'www.google.com', '/index.html', '', '', {}),
409 "cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', '', {'module': 'familiar/dist/ipkg'}), 409 "cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', '', {'module': 'familiar/dist/ipkg'}),
410 "cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', {'tag': 'V0-99-81', 'module': 'familiar/dist/ipkg'}) 410 "cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', {'tag': 'V0-99-81', 'module': 'familiar/dist/ipkg'}),
411 "git://git.openembedded.org/bitbake;branch=@foo" : ('git', 'git.openembedded.org', '/bitbake', '', '', {'branch': '@foo'})
411 } 412 }
412 413
413 def test_decodeurl(self): 414 def test_decodeurl(self):