Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9735ce15
Commit
9735ce15
authored
May 19, 2017
by
Horatiu Eugen Vlad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid resource intensive login checks if password is not provided
Fixes #32598
parent
b0642299
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
changelogs/unreleased/32598-avoid-resource-intensive-login-checks-if-password-is-not-provided-for-git-http.yml
...login-checks-if-password-is-not-provided-for-git-http.yml
+4
-0
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+4
-1
No files found.
changelogs/unreleased/32598-avoid-resource-intensive-login-checks-if-password-is-not-provided-for-git-http.yml
0 → 100644
View file @
9735ce15
---
title
:
Avoid resource intensive login checks if password is not provided.
merge_request
:
11537
author
:
Horatiu Eugen Vlad
lib/gitlab/auth.rb
View file @
9735ce15
...
@@ -37,6 +37,9 @@ module Gitlab
...
@@ -37,6 +37,9 @@ module Gitlab
end
end
def
find_with_user_password
(
login
,
password
)
def
find_with_user_password
(
login
,
password
)
# Avoid resource intensive login checks if password is not provided
return
unless
password
.
present?
Gitlab
::
Auth
::
UniqueIpsLimiter
.
limit_user!
do
Gitlab
::
Auth
::
UniqueIpsLimiter
.
limit_user!
do
user
=
User
.
by_login
(
login
)
user
=
User
.
by_login
(
login
)
...
@@ -44,7 +47,7 @@ module Gitlab
...
@@ -44,7 +47,7 @@ module Gitlab
# LDAP users are only authenticated via LDAP
# LDAP users are only authenticated via LDAP
if
user
.
nil?
||
user
.
ldap_user?
if
user
.
nil?
||
user
.
ldap_user?
# Second chance - try LDAP authentication
# Second chance - try LDAP authentication
return
nil
unless
Gitlab
::
LDAP
::
Config
.
enabled?
return
unless
Gitlab
::
LDAP
::
Config
.
enabled?
Gitlab
::
LDAP
::
Authentication
.
login
(
login
,
password
)
Gitlab
::
LDAP
::
Authentication
.
login
(
login
,
password
)
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment