Symbiosis: Don't crash if a password file is empty
Imported from https://www.github.com/BytemarkHosting/symbiosis/issues/110
As reported here:
The following code reproduces the problem:
#!/usr/bin/ruby
require 'cracklib'
c = CrackLib::Fascist(nil)
if c.ok?
puts "OK"
end
The following patch is probably sufficient to resolve the problem, but requires a test-case:
--- a/common/sbin/symbiosis-password-test
+++ b/common/sbin/symbiosis-password-test
@@ -155,6 +155,7 @@ Symbiosis::Domains.each(prefix) do |domain|
end
ftp_users.each do |u|
+ next if c.nil?
c = CrackLib::Fascist(u.password)
if c.ok?