Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stunserver
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
nanahira
Stunserver
Commits
1fb49dbe
Commit
1fb49dbe
authored
Sep 18, 2011
by
John Selbie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Memory leaks, Makefile, and gitignore file.
parent
03f02ccb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
12 deletions
+43
-12
.gitignore
.gitignore
+12
-0
Makefile
Makefile
+1
-1
common.inc
common.inc
+2
-2
stuncore/stunreader.cpp
stuncore/stunreader.cpp
+7
-0
testcode/testclientlogic.cpp
testcode/testclientlogic.cpp
+3
-0
testcode/testcode.cpp
testcode/testcode.cpp
+18
-9
No files found.
.gitignore
0 → 100644
View file @
1fb49dbe
nbproject/
*.o
*.gch
*.a
*.txtcode
stunclient
stunserver
stuntestcode
Makefile
View file @
1fb49dbe
...
@@ -10,7 +10,7 @@ everything:
...
@@ -10,7 +10,7 @@ everything:
$(MAKE)
$(T)
--directory
=
client
$(MAKE)
$(T)
--directory
=
client
$(MAKE)
$(T)
--directory
=
server
$(MAKE)
$(T)
--directory
=
server
copybin
:
copybin
:
everything
rm
-f
./stunserver ./stunclient ./stuntestcode
rm
-f
./stunserver ./stunclient ./stuntestcode
cp
server/stunserver .
cp
server/stunserver .
cp
client/stunclient .
cp
client/stunclient .
...
...
common.inc
View file @
1fb49dbe
BOOST_INCLUDE
:=
-
I
/
home
/
jselbie
/
lib
/
boost_1_46_1
#
BOOST_INCLUDE := -I/home/jselbie/lib/boost_1_46_1
# OPENSSL_INCLUDE := /home/jselbie/lib/openssl
# OPENSSL_INCLUDE :=
-I
/home/jselbie/lib/openssl
DEFINES
:=
-
DNDEBUG
DEFINES
:=
-
DNDEBUG
...
...
stuncore/stunreader.cpp
View file @
1fb49dbe
...
@@ -145,6 +145,7 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
...
@@ -145,6 +145,7 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
CRefCountedBuffer
spBuffer
;
CRefCountedBuffer
spBuffer
;
StunAttribute
attribIntegrity
;
StunAttribute
attribIntegrity
;
int
cmp
=
0
;
int
cmp
=
0
;
bool
fContextInit
=
false
;
ChkIf
(
_state
!=
BodyValidated
,
E_FAIL
);
ChkIf
(
_state
!=
BodyValidated
,
E_FAIL
);
ChkIf
(
_indexMessageIntegrity
<
0
,
E_FAIL
);
ChkIf
(
_indexMessageIntegrity
<
0
,
E_FAIL
);
...
@@ -171,6 +172,7 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
...
@@ -171,6 +172,7 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
// Here comes the fun part. If there is a fingerprint attribute, we have to adjust the length header in computing the hash
// Here comes the fun part. If there is a fingerprint attribute, we have to adjust the length header in computing the hash
HMAC_CTX_init
(
&
ctx
);
HMAC_CTX_init
(
&
ctx
);
fContextInit
=
true
;
HMAC_Init
(
&
ctx
,
key
,
keylength
,
EVP_sha1
());
HMAC_Init
(
&
ctx
,
key
,
keylength
,
EVP_sha1
());
// message type
// message type
...
@@ -213,6 +215,11 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
...
@@ -213,6 +215,11 @@ HRESULT CStunMessageReader::ValidateMessageIntegrity(uint8_t* key, size_t keylen
hr
=
(
cmp
==
0
?
S_OK
:
E_FAIL
);
hr
=
(
cmp
==
0
?
S_OK
:
E_FAIL
);
Cleanup:
Cleanup:
if
(
fContextInit
)
{
HMAC_CTX_cleanup
(
&
ctx
);
}
return
hr
;
return
hr
;
}
}
...
...
testcode/testclientlogic.cpp
View file @
1fb49dbe
...
@@ -352,6 +352,9 @@ HRESULT CTestClientLogic::TestBehaviorAndFiltering(bool fBehaviorTest, NatBehavi
...
@@ -352,6 +352,9 @@ HRESULT CTestClientLogic::TestBehaviorAndFiltering(bool fBehaviorTest, NatBehavi
ChkIfA
(
results
.
behavior
!=
behavior
,
E_UNEXPECTED
);
ChkIfA
(
results
.
behavior
!=
behavior
,
E_UNEXPECTED
);
Cleanup:
Cleanup:
_spTransport
.
ReleaseAndClear
();
return
hr
;
return
hr
;
}
}
...
...
testcode/testcode.cpp
View file @
1fb49dbe
...
@@ -67,15 +67,24 @@ void ReaderFuzzTest()
...
@@ -67,15 +67,24 @@ void ReaderFuzzTest()
void
RunUnitTests
()
void
RunUnitTests
()
{
{
std
::
vector
<
IUnitTest
*>
vecTests
;
std
::
vector
<
IUnitTest
*>
vecTests
;
vecTests
.
push_back
(
new
CTestDataStream
());
boost
::
shared_ptr
<
CTestDataStream
>
spTestDataStream
(
new
CTestDataStream
);
vecTests
.
push_back
(
new
CTestReader
());
boost
::
shared_ptr
<
CTestReader
>
spTestReader
(
new
CTestReader
);
vecTests
.
push_back
(
new
CTestBuilder
());
boost
::
shared_ptr
<
CTestBuilder
>
spTestBuilder
(
new
CTestBuilder
);
vecTests
.
push_back
(
new
CTestIntegrity
());
boost
::
shared_ptr
<
CTestIntegrity
>
spTestIntegrity
(
new
CTestIntegrity
);
vecTests
.
push_back
(
new
CTestMessageHandler
());
boost
::
shared_ptr
<
CTestMessageHandler
>
spTestMessageHandler
(
new
CTestMessageHandler
);
vecTests
.
push_back
(
new
CTestCmdLineParser
());
boost
::
shared_ptr
<
CTestCmdLineParser
>
spTestCmdLineParser
(
new
CTestCmdLineParser
);
vecTests
.
push_back
(
new
CTestClientLogic
());
boost
::
shared_ptr
<
CTestClientLogic
>
spTestClientLogic
(
new
CTestClientLogic
);
vecTests
.
push_back
(
new
CTestRecvFromEx
());
boost
::
shared_ptr
<
CTestRecvFromEx
>
spTestRecvFromEx
(
new
CTestRecvFromEx
);
vecTests
.
push_back
(
spTestDataStream
.
get
());
vecTests
.
push_back
(
spTestReader
.
get
());
vecTests
.
push_back
(
spTestBuilder
.
get
());
vecTests
.
push_back
(
spTestIntegrity
.
get
());
vecTests
.
push_back
(
spTestMessageHandler
.
get
());
vecTests
.
push_back
(
spTestCmdLineParser
.
get
());
vecTests
.
push_back
(
spTestClientLogic
.
get
());
vecTests
.
push_back
(
spTestRecvFromEx
.
get
());
for
(
size_t
index
=
0
;
index
<
vecTests
.
size
();
index
++
)
for
(
size_t
index
=
0
;
index
<
vecTests
.
size
();
index
++
)
{
{
...
...
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