BytemarkHosting / symbiosis

A hosting environment that works with you, not against you.
GNU General Public License v2.0
21 stars 14 forks source link

Don't crash if a password file is empty #110

Closed skx closed 5 years ago

skx commented 6 years ago

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?