@@ -86,7 +86,7 @@ def run_host(ip)
86
86
87
87
entries_returned = 0
88
88
89
- print_status ( "#{ peer } Connecting ..." )
89
+ print_status ( "#{ peer } Connecting..." )
90
90
ldap_new do |ldap |
91
91
if ldap . get_operation_result . code == 0
92
92
vprint_status ( "#{ peer } LDAP connection established" )
@@ -107,9 +107,7 @@ def run_host(ip)
107
107
naming_contexts = get_naming_contexts ( ldap )
108
108
end
109
109
rescue Timeout ::Error
110
- print_error ( "#{ peer } Host timeout reached" )
111
- # fail_with(Failure::TimeoutExpired, 'The timeout expired while reading naming contects')
112
- return
110
+ fail_with ( Failure ::TimeoutExpired , 'The timeout expired while reading naming contexts' )
113
111
ensure
114
112
unless ldap . get_operation_result . code == 0
115
113
print_ldap_error ( ldap )
@@ -151,15 +149,12 @@ def run_host(ip)
151
149
152
150
# Safe if server did not returned anything
153
151
unless ( entries_returned > 0 )
154
- print_error ( "#{ peer } Server did not return any data, seems to be safe" )
155
- # fail_with(Failure::NotVulnerable, 'Server does not return any data.')
152
+ fail_with ( Failure ::NotVulnerable , 'Server did not return any data, seems to be safe' )
156
153
end
157
154
rescue Timeout ::Error
158
- print_error ( "#{ peer } Host timeout reached" )
159
- # fail_with(Failure::TimeoutExpired, 'The timeout expired while searching directory')
155
+ fail_with ( Failure ::TimeoutExpired , 'The timeout expired while searching directory' )
160
156
rescue Net ::LDAP ::PDU ::Error , Net ::BER ::BerError , Net ::LDAP ::Error , NoMethodError => e
161
- print_error ( "#{ peer } #{ e . class } : #{ e . message } " )
162
- # fail_with(Failure::UnexpectedReply, "Exception occured: #{e.class}: #{e.message}")
157
+ fail_with ( Failure ::UnexpectedReply , "Exception occurred: #{ e . class } : #{ e . message } " )
163
158
end
164
159
165
160
def ldap_search ( ldap , base_dn , args )
0 commit comments