1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Merge PR #682: src/Cedar/Session: resolve coverity "issue", remove unused functions

This commit is contained in:
Davide Beatrici 2018-08-29 09:47:47 +02:00 committed by GitHub
commit 3fcd8bc4a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 94 deletions

View File

@ -1261,21 +1261,10 @@ void StopSessionEx(SESSION *s, bool no_wait)
// Event
Set(s->HaltEvent);
if (s->ServerMode == false)
// Server and client mode
if (s->Connection)
{
// Client mode
if (s->Connection)
{
StopConnection(s->Connection, no_wait);
}
}
else
{
// Server mode
if (s->Connection)
{
StopConnection(s->Connection, no_wait);
}
StopConnection(s->Connection, no_wait);
}
// Wait until the stop
@ -1863,23 +1852,6 @@ SKIP:
}
}
// Name comparison of sessions
int CompareSession(void *p1, void *p2)
{
SESSION *s1, *s2;
if (p1 == NULL || p2 == NULL)
{
return 0;
}
s1 = *(SESSION **)p1;
s2 = *(SESSION **)p2;
if (s1 == NULL || s2 == NULL)
{
return 0;
}
return StrCmpi(s1->Name, s2->Name);
}
// Create an RPC session
SESSION *NewRpcSession(CEDAR *cedar, CLIENT_OPTION *option)
{
@ -2109,52 +2081,6 @@ SESSION *NewClientSession(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth
return NewClientSessionEx(cedar, option, auth, pa, NULL, NicDownOnDisconnect);
}
// Get the session from the 32bit session key
SESSION *GetSessionFromKey32(CEDAR *cedar, UINT key32)
{
HUB *h;
UINT i, j;
// Validate arguments
if (cedar == NULL)
{
return NULL;
}
LockList(cedar->HubList);
{
for (i = 0;i < LIST_NUM(cedar->HubList);i++)
{
h = LIST_DATA(cedar->HubList, i);
LockList(h->SessionList);
{
for (j = 0;j < LIST_NUM(h->SessionList);j++)
{
SESSION *s = LIST_DATA(h->SessionList, j);
Lock(s->lock);
{
if (s->SessionKey32 == key32)
{
// Session found
AddRef(s->ref);
// Unlock
Unlock(s->lock);
UnlockList(h->SessionList);
UnlockList(cedar->HubList);
return s;
}
}
Unlock(s->lock);
}
}
UnlockList(h->SessionList);
}
}
UnlockList(cedar->HubList);
return NULL;
}
// Get the session from the session key
SESSION *GetSessionFromKey(CEDAR *cedar, UCHAR *session_key)
{
@ -2391,20 +2317,6 @@ bool IsIpcMacAddress(UCHAR *mac)
return false;
}
// Display the session key for debugging
void DebugPrintSessionKey(UCHAR *session_key)
{
char tmp[MAX_SIZE];
// Validate arguments
if (session_key == NULL)
{
return;
}
Bit160ToStr(tmp, session_key);
Debug("SessionKey: %s\n", tmp);
}
// Display the status on the client
void PrintStatus(SESSION *s, wchar_t *str)
{

View File

@ -413,15 +413,12 @@ void StopSession(SESSION *s);
void StopSessionEx(SESSION *s, bool no_wait);
bool SessionConnect(SESSION *s);
bool ClientConnect(CONNECTION *c);
int CompareSession(void *p1, void *p2);
PACKET_ADAPTER *NewPacketAdapter(PA_INIT *init, PA_GETCANCEL *getcancel, PA_GETNEXTPACKET *getnext,
PA_PUTPACKET *put, PA_FREE *free);
void FreePacketAdapter(PACKET_ADAPTER *pa);
void SessionMain(SESSION *s);
void NewSessionKey(CEDAR *cedar, UCHAR *session_key, UINT *session_key_32);
SESSION *GetSessionFromKey(CEDAR *cedar, UCHAR *session_key);
SESSION *GetSessionFromKey32(CEDAR *cedar, UINT key32);
void DebugPrintSessionKey(UCHAR *session_key);
bool IsIpcMacAddress(UCHAR *mac);
void ClientAdditionalConnectChance(SESSION *s);
void SessionAdditionalConnect(SESSION *s);