Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit 93df51c

Browse files
committed
ldap: don't crash on search when guessing an email
The `search` method from Net::LDAP might return nil. In this case simply return early as we do on other cases. See #1832 Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
1 parent 45814ba commit 93df51c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/portus/ldap.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def guess_email
232232
return nil if cfg.nil? || !cfg["enabled"]
233233

234234
record = @ldap.search(search_options)
235-
return nil if record.size != 1
235+
return nil if record.blank? || record.size != 1
236236
record = record.first
237237

238238
cfg["attr"].empty? ? guess_from_dn(record["dn"]) : guess_from_attr(record, cfg["attr"])

0 commit comments

Comments
 (0)