Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dfss
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mpcs
dfss
Commits
bf8f560a
Commit
bf8f560a
authored
May 24, 2016
by
Loïck Bonniot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[d] Net is now blocking
parent
b647a8ab
Pipeline
#2187
passed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
35 deletions
+4
-35
dfssd/gui/events.go
dfssd/gui/events.go
+2
-2
dfssp/user/create_test.go
dfssp/user/create_test.go
+0
-26
net/client.go
net/client.go
+1
-0
net/net_test.go
net/net_test.go
+1
-7
No files found.
dfssd/gui/events.go
View file @
bf8f560a
...
...
@@ -35,10 +35,10 @@ func (w *Window) AddEvent(e *api.Log) {
var
receiver
string
var
index
int
if
n
,
_
:=
fmt
.
Sscanf
(
e
.
Log
,
"sent promise to %s"
,
&
receiver
);
n
>
0
{
if
n
,
_
:=
fmt
.
Sscanf
(
e
.
Log
,
"s
uccessfully s
ent promise to %s"
,
&
receiver
);
n
>
0
{
event
.
Type
=
PROMISE
event
.
Receiver
=
w
.
scene
.
identifierToIndex
(
receiver
)
}
else
if
n
,
_
:=
fmt
.
Sscanf
(
e
.
Log
,
"sent signature to %s"
,
&
receiver
);
n
>
0
{
}
else
if
n
,
_
:=
fmt
.
Sscanf
(
e
.
Log
,
"s
uccessfully s
ent signature to %s"
,
&
receiver
);
n
>
0
{
event
.
Type
=
SIGNATURE
event
.
Receiver
=
w
.
scene
.
identifierToIndex
(
receiver
)
}
else
if
n
,
_
:=
fmt
.
Sscanf
(
e
.
Log
,
"contacting TTP with resolve index %d"
,
&
index
);
n
>
0
{
...
...
dfssp/user/create_test.go
View file @
bf8f560a
...
...
@@ -43,32 +43,6 @@ func TestWrongRegisterRequest(t *testing.T) {
assert
.
Equal
(
t
,
errCode
.
Code
,
api
.
ErrorCode_INVARG
)
}
func
TestWrongAuthRequest
(
t
*
testing
.
T
)
{
// Get a client to the invalid server (cert duration is -1)
client
:=
clientTest
(
t
,
InvalidServ
)
// Invalid mail length
inv
:=
&
api
.
AuthRequest
{}
msg
,
err
:=
client
.
Auth
(
context
.
Background
(),
inv
)
if
msg
!=
nil
||
err
==
nil
{
t
.
Fatal
(
"The request should have been evaluated as invalid"
)
}
// Invalid token length
inv
.
Email
=
"foo"
msg
,
err
=
client
.
Auth
(
context
.
Background
(),
inv
)
if
msg
!=
nil
||
err
==
nil
{
t
.
Fatal
(
"The request should have been evaluated as invalid"
)
}
// Invalid certificate validity duration
inv
.
Token
=
"foo"
msg
,
err
=
client
.
Auth
(
context
.
Background
(),
inv
)
if
msg
!=
nil
||
err
==
nil
{
t
.
Fatal
(
"The request should have been evaluated as invalid"
)
}
}
func
TestAuthUserNotFound
(
t
*
testing
.
T
)
{
mail
:=
"wrong@wrong.wrong"
token
:=
"wrong"
...
...
net/client.go
View file @
bf8f560a
...
...
@@ -60,6 +60,7 @@ func Connect(addrPort string, cert *x509.Certificate, key *rsa.PrivateKey, ca *x
addrPort
,
grpc
.
WithTransportCredentials
(
&
tlsCreds
{
config
:
conf
,
serverCertHash
:
serverCertHash
}),
grpc
.
WithTimeout
(
DefaultTimeout
),
grpc
.
WithBlock
(),
)
}
...
...
net/net_test.go
View file @
bf8f560a
...
...
@@ -138,13 +138,7 @@ func TestServerClientBadAuthWrongCertificateHash(t *testing.T) {
cert
,
_
:=
auth
.
PEMToCertificate
([]
byte
(
clientCertFixture
))
key
,
_
:=
auth
.
PEMToPrivateKey
([]
byte
(
clientKeyFixture
))
// The connection won't fail immediately, because grpc is connecting in the background
conn
,
_
:=
Connect
(
"localhost:9000"
,
cert
,
key
,
ca
,
auth
.
GetCertificateHash
(
cert
))
// We have to ask for a specific query in order to test the certificate hash
client
:=
pb
.
NewTestClient
(
conn
)
_
,
err
:=
client
.
Ping
(
context
.
Background
(),
&
pb
.
Hop
{
Id
:
1
})
_
,
err
:=
Connect
(
"localhost:9000"
,
cert
,
key
,
ca
,
auth
.
GetCertificateHash
(
cert
))
if
err
==
nil
{
t
.
Fatal
(
"Successfully connected with bad hash"
)
}
...
...
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