Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpcs
dfss
Commits
bf8f560a
Commit
bf8f560a
authored
May 24, 2016
by
Loïck Bonniot
Browse files
[d] Net is now blocking
parent
b647a8ab
Pipeline
#2187
passed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dfssd/gui/events.go
View file @
bf8f560a
...
@@ -35,10 +35,10 @@ func (w *Window) AddEvent(e *api.Log) {
...
@@ -35,10 +35,10 @@ func (w *Window) AddEvent(e *api.Log) {
var
receiver
string
var
receiver
string
var
index
int
var
index
int
if
n
,
_
:=
fmt
.
Sscanf
(
e
.
Log
,
"sent promise to %s"
,
&
receiver
);
n
>
0
{
if
n
,
_
:=
fmt
.
Sscanf
(
e
.
Log
,
"
successfully
sent promise to %s"
,
&
receiver
);
n
>
0
{
event
.
Type
=
PROMISE
event
.
Type
=
PROMISE
event
.
Receiver
=
w
.
scene
.
identifierToIndex
(
receiver
)
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
,
"
successfully
sent signature to %s"
,
&
receiver
);
n
>
0
{
event
.
Type
=
SIGNATURE
event
.
Type
=
SIGNATURE
event
.
Receiver
=
w
.
scene
.
identifierToIndex
(
receiver
)
event
.
Receiver
=
w
.
scene
.
identifierToIndex
(
receiver
)
}
else
if
n
,
_
:=
fmt
.
Sscanf
(
e
.
Log
,
"contacting TTP with resolve index %d"
,
&
index
);
n
>
0
{
}
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) {
...
@@ -43,32 +43,6 @@ func TestWrongRegisterRequest(t *testing.T) {
assert
.
Equal
(
t
,
errCode
.
Code
,
api
.
ErrorCode_INVARG
)
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
)
{
func
TestAuthUserNotFound
(
t
*
testing
.
T
)
{
mail
:=
"wrong@wrong.wrong"
mail
:=
"wrong@wrong.wrong"
token
:=
"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
...
@@ -60,6 +60,7 @@ func Connect(addrPort string, cert *x509.Certificate, key *rsa.PrivateKey, ca *x
addrPort
,
addrPort
,
grpc
.
WithTransportCredentials
(
&
tlsCreds
{
config
:
conf
,
serverCertHash
:
serverCertHash
}),
grpc
.
WithTransportCredentials
(
&
tlsCreds
{
config
:
conf
,
serverCertHash
:
serverCertHash
}),
grpc
.
WithTimeout
(
DefaultTimeout
),
grpc
.
WithTimeout
(
DefaultTimeout
),
grpc
.
WithBlock
(),
)
)
}
}
...
...
net/net_test.go
View file @
bf8f560a
...
@@ -138,13 +138,7 @@ func TestServerClientBadAuthWrongCertificateHash(t *testing.T) {
...
@@ -138,13 +138,7 @@ func TestServerClientBadAuthWrongCertificateHash(t *testing.T) {
cert
,
_
:=
auth
.
PEMToCertificate
([]
byte
(
clientCertFixture
))
cert
,
_
:=
auth
.
PEMToCertificate
([]
byte
(
clientCertFixture
))
key
,
_
:=
auth
.
PEMToPrivateKey
([]
byte
(
clientKeyFixture
))
key
,
_
:=
auth
.
PEMToPrivateKey
([]
byte
(
clientKeyFixture
))
// The connection won't fail immediately, because grpc is connecting in the background
_
,
err
:=
Connect
(
"localhost:9000"
,
cert
,
key
,
ca
,
auth
.
GetCertificateHash
(
cert
))
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
})
if
err
==
nil
{
if
err
==
nil
{
t
.
Fatal
(
"Successfully connected with bad hash"
)
t
.
Fatal
(
"Successfully connected with bad hash"
)
}
}
...
...
Write
Preview
Supports
Markdown
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