diff options
| author | Steve Kemp <steve@steve.org.uk> | 2013-02-18 10:46:11 +0000 | 
|---|---|---|
| committer | Steve Kemp <steve@steve.org.uk> | 2013-02-18 10:46:11 +0000 | 
| commit | 8aa89dc0aa76ad0b81e906a1795cae04df4d7113 (patch) | |
| tree | 59ff3888d079aca6034a9b6c20daf5355c13c639 | |
| parent | e7415eb1fe40cc6d50c6980274cbdccb4f6f2e23 (diff) | |
  Deleted trailing whitespace.
| -rw-r--r-- | lib/custodian/protocoltest/smtprelay.rb | 27 | 
1 files changed, 21 insertions, 6 deletions
| diff --git a/lib/custodian/protocoltest/smtprelay.rb b/lib/custodian/protocoltest/smtprelay.rb index 2280f10..d3a223a 100644 --- a/lib/custodian/protocoltest/smtprelay.rb +++ b/lib/custodian/protocoltest/smtprelay.rb @@ -56,6 +56,21 @@ module Custodian            @line        end + +      # +      # Read the hostname for usage in the SMTP-transaction. +      # +      def get_hostname +        hostname = "localhost.localdomain" + +        if ( File.exists?( "/etc/hostname" ) ) +        end + +        hostname +      end + + +        #        # run the test for open relays of SMTP protocol - return true on success.        # false on fail. @@ -67,26 +82,26 @@ module Custodian          begin -          Net::SMTP.start(@host,@port) do |smtp| +          Net::SMTP.start(@host,@port, get_hostname() ) do |smtp|              sent    = smtp.send_message message, "noreply@bytemark.co.uk", "noreply@bytemark.co.uk"              @status = sent.status.to_s              if @status === "250"                @error = "NOT OK: message sent on #{@host} with status #{@status}" -            else  +            else                @error = "OK: message not sent on #{@host} with status #{@status}"              end -             +              #              # give the parser an appropriate response depending on the smtp code              # and whether or not we're inverting the test. (eg, 'must not')              # -             +              return @inverted  if @status == "250" and @inverted              return !@inverted if @status == "250" and !@inverted              return @inverted  if @status != "250" and !@inverted              return !@inverted if @status != "250" and @inverted -             +            end # Net SMTP          rescue Exception => ex @@ -95,7 +110,7 @@ module Custodian            #            @error = "OK: Timed out or connection refused on #{@host} with status #{@status}"            return !@inverted if @inverted -          return @inverted if !@inverted           +          return @inverted if !@inverted          end        end | 
