Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sfu
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alain Takoudjou
sfu
Commits
b30d4fe5
Commit
b30d4fe5
authored
Dec 02, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add delay after login failure.
parent
2f6c710f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
group/group.go
group/group.go
+8
-5
rtpconn/webclient.go
rtpconn/webclient.go
+3
-0
webserver/webserver.go
webserver/webserver.go
+3
-1
No files found.
group/group.go
View file @
b30d4fe5
...
@@ -7,6 +7,7 @@ package group
...
@@ -7,6 +7,7 @@ package group
import
(
import
(
"encoding/json"
"encoding/json"
"errors"
"log"
"log"
"os"
"os"
"path"
"path"
...
@@ -23,6 +24,8 @@ import (
...
@@ -23,6 +24,8 @@ import (
var
Directory
string
var
Directory
string
var
UseMDNS
bool
var
UseMDNS
bool
var
ErrNotAuthorised
=
errors
.
New
(
"not authorised"
)
type
UserError
string
type
UserError
string
func
(
err
UserError
)
Error
()
string
{
func
(
err
UserError
)
Error
()
string
{
...
@@ -268,7 +271,7 @@ func Delete(name string) bool {
...
@@ -268,7 +271,7 @@ func Delete(name string) bool {
defer
groups
.
mu
.
Unlock
()
defer
groups
.
mu
.
Unlock
()
g
:=
groups
.
groups
[
name
]
g
:=
groups
.
groups
[
name
]
if
g
==
nil
{
if
g
==
nil
{
return
false
;
return
false
}
}
g
.
mu
.
Lock
()
g
.
mu
.
Lock
()
...
@@ -642,22 +645,22 @@ func (desc *description) GetPermission(group string, c Challengeable) (ClientPer
...
@@ -642,22 +645,22 @@ func (desc *description) GetPermission(group string, c Challengeable) (ClientPer
}
}
return
p
,
nil
return
p
,
nil
}
}
return
p
,
UserError
(
"not authorised"
)
return
p
,
ErrNotAuthorised
}
}
if
found
,
good
:=
matchClient
(
group
,
c
,
desc
.
Presenter
);
found
{
if
found
,
good
:=
matchClient
(
group
,
c
,
desc
.
Presenter
);
found
{
if
good
{
if
good
{
p
.
Present
=
true
p
.
Present
=
true
return
p
,
nil
return
p
,
nil
}
}
return
p
,
UserError
(
"not authorised"
)
return
p
,
ErrNotAuthorised
}
}
if
found
,
good
:=
matchClient
(
group
,
c
,
desc
.
Other
);
found
{
if
found
,
good
:=
matchClient
(
group
,
c
,
desc
.
Other
);
found
{
if
good
{
if
good
{
return
p
,
nil
return
p
,
nil
}
}
return
p
,
UserError
(
"not authorised"
)
return
p
,
ErrNotAuthorised
}
}
return
p
,
UserError
(
"not authorised"
)
return
p
,
ErrNotAuthorised
}
}
type
Public
struct
{
type
Public
struct
{
...
...
rtpconn/webclient.go
View file @
b30d4fe5
...
@@ -707,6 +707,9 @@ func StartClient(conn *websocket.Conn) (err error) {
...
@@ -707,6 +707,9 @@ func StartClient(conn *websocket.Conn) (err error) {
if
err
!=
nil
{
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
if
os
.
IsNotExist
(
err
)
{
err
=
group
.
UserError
(
"group does not exist"
)
err
=
group
.
UserError
(
"group does not exist"
)
}
else
if
err
==
group
.
ErrNotAuthorised
{
err
=
group
.
UserError
(
"not authorised"
)
time
.
Sleep
(
200
*
time
.
Millisecond
)
}
}
return
return
}
}
...
...
webserver/webserver.go
View file @
b30d4fe5
...
@@ -559,8 +559,10 @@ func checkGroupPermissions(w http.ResponseWriter, r *http.Request, groupname str
...
@@ -559,8 +559,10 @@ func checkGroupPermissions(w http.ResponseWriter, r *http.Request, groupname str
}
}
p
,
err
:=
desc
.
GetPermission
(
groupname
,
httpClient
{
user
,
pass
})
p
,
err
:=
desc
.
GetPermission
(
groupname
,
httpClient
{
user
,
pass
})
if
err
!=
nil
||
!
p
.
Record
{
if
err
!=
nil
||
!
p
.
Record
{
if
err
==
group
.
ErrNotAuthorised
{
time
.
Sleep
(
200
*
time
.
Millisecond
)
}
return
false
return
false
}
}
...
...
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