mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
glibc 2.16 or later denies salt contained other than [0-9A-Za-z./] [Bug #7312]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5051186a0b
commit
64757d284a
1 changed files with 10 additions and 0 deletions
|
@ -720,7 +720,17 @@ class TestM17NComb < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_str_crypt
|
||||
begin
|
||||
# glibc 2.16 or later denies salt contained other than [0-9A-Za-z./] #7312
|
||||
glibcver = `/lib/libc.so.6`[/\AGNU C Library.*version ([0-9.]+)/, 1].split('.')
|
||||
strict_crypt = (glibcver <=> [2, 16]) > -1
|
||||
rescue
|
||||
end
|
||||
|
||||
combination(STRINGS, STRINGS) {|str, salt|
|
||||
if strict_crypt
|
||||
next unless /\A[0-9a-zA-Z.\/]+\z/ =~ salt
|
||||
end
|
||||
if a(salt).length < 2
|
||||
assert_raise(ArgumentError) { str.crypt(salt) }
|
||||
next
|
||||
|
|
Loading…
Add table
Reference in a new issue