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

src/Cedar/Logging: remove unused functions, redundant condition

[src/Cedar/Logging.c:679]: (style) The function 'HubLog' is never used.
[src/Cedar/Logging.c:888]: (style) The function 'IPCLog' is never used.
[src/Cedar/Logging.c:295]: (style) The function 'PrintEraseFileList' is never used.
[src/Cedar/Logging.c:1025]: (style) The function 'SecLog' is never used.
[src/Cedar/Logging.c:622]: (style) The function 'ServerLog' is never used.
[src/Cedar/Logging.c:2273]: (style) The function 'SetLogDirName' is never used.
[src/Cedar/Logging.c:2293]: (style) The function 'SetLogPrefix' is never used.
[src/Cedar/Logging.c:997]: (style) The function 'WriteMultiLineLog' is never used.
[src/Cedar/Logging.c:918]: (style) The function 'WriteSecurityLog' is never used.
[src/Cedar/Logging.c:1018] -> [src/Cedar/Logging.c:1006]:

(warning) Either the condition 'src_session!=NULL' is redundant or there is possible null
pointer dereference: src_session.
This commit is contained in:
Ilya Shipitsin 2018-08-13 07:13:56 +05:00
parent 6af1a2eb46
commit 3ca4bc0aa9
2 changed files with 1 additions and 192 deletions

View File

@ -291,23 +291,6 @@ void FreeEraseFileList(LIST *o)
ReleaseList(o); ReleaseList(o);
} }
// Show the deleting file list
void PrintEraseFileList(LIST *o)
{
UINT i;
// Validate arguments
if (o == NULL)
{
return;
}
for (i = 0;i < LIST_NUM(o);i++)
{
ERASE_FILE *f = LIST_DATA(o, i);
Print("%I64u - %s\n", f->UpdateTime, f->FullPath);
}
}
// Generate a deleting file list of the specified directory // Generate a deleting file list of the specified directory
void EnumEraseFile(LIST *o, char *dirname) void EnumEraseFile(LIST *o, char *dirname)
{ {
@ -618,23 +601,6 @@ void ELog(ERASER *e, char *name, ...)
va_end(args); va_end(args);
} }
// Take the log of the server
void ServerLog(CEDAR *c, wchar_t *fmt, ...)
{
wchar_t buf[MAX_SIZE * 2];
va_list args;
// Validate arguments
if (fmt == NULL)
{
return;
}
va_start(args, fmt);
UniFormatArgs(buf, sizeof(buf), fmt, args);
WriteServerLog(c, buf);
va_end(args);
}
void SLog(CEDAR *c, char *name, ...) void SLog(CEDAR *c, char *name, ...)
{ {
wchar_t buf[MAX_SIZE * 2]; wchar_t buf[MAX_SIZE * 2];
@ -675,23 +641,6 @@ void CLog(CLIENT *c, char *name, ...)
va_end(args); va_end(args);
} }
// Take the security log of the HUB
void HubLog(HUB *h, wchar_t *fmt, ...)
{
wchar_t buf[MAX_SIZE * 2];
va_list args;
// Validate arguments
if (fmt == NULL)
{
return;
}
va_start(args, fmt);
UniFormatArgs(buf, sizeof(buf), fmt, args);
WriteHubLog(h, buf);
va_end(args);
}
void ALog(ADMIN *a, HUB *h, char *name, ...) void ALog(ADMIN *a, HUB *h, char *name, ...)
{ {
wchar_t buf[MAX_SIZE * 2]; wchar_t buf[MAX_SIZE * 2];
@ -884,34 +833,6 @@ void PPPLog(PPP_SESSION *p, char *name, ...)
WriteServerLog(p->Cedar, buf); WriteServerLog(p->Cedar, buf);
} }
// Write an IPC log
void IPCLog(IPC *ipc, char *name, ...)
{
wchar_t buf[MAX_SIZE * 2];
va_list args;
HUB *h;
// Validate arguments
if (name == NULL)
{
return;
}
h = GetHub(ipc->Cedar, ipc->HubName);
if (h == NULL)
{
return;
}
va_start(args, name);
UniFormatArgs(buf, sizeof(buf), _UU(name), args);
WriteHubLog(h, buf);
va_end(args);
ReleaseHub(h);
}
// Save the security log of the HUB // Save the security log of the HUB
void WriteHubLog(HUB *h, wchar_t *str) void WriteHubLog(HUB *h, wchar_t *str)
{ {
@ -993,69 +914,6 @@ void WriteServerLog(CEDAR *c, wchar_t *str)
} }
} }
// Write a multi-line log
void WriteMultiLineLog(LOG *g, BUF *b)
{
// Validate arguments
if (g == NULL || b == NULL)
{
return;
}
SeekBuf(b, 0, 0);
while (true)
{
char *s = CfgReadNextLine(b);
if (s == NULL)
{
break;
}
if (IsEmptyStr(s) == false)
{
InsertStringRecord(g, s);
}
Free(s);
}
}
// Take the security log (variable-length argument) *abolished
void SecLog(HUB *h, char *fmt, ...)
{
char buf[MAX_SIZE * 2];
va_list args;
// Validate arguments
if (fmt == NULL)
{
return;
}
if (h->LogSetting.SaveSecurityLog == false)
{
return;
}
va_start(args, fmt);
FormatArgs(buf, sizeof(buf), fmt, args);
WriteSecurityLog(h, buf);
va_end(args);
}
// Take a security log
void WriteSecurityLog(HUB *h, char *str)
{
// Validate arguments
if (h == NULL || str == NULL)
{
return;
}
InsertStringRecord(h->SecurityLogger, str);
}
// Take a packet log // Take a packet log
bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now) bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now)
{ {
@ -1157,7 +1015,7 @@ bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packe
if (opt == NULL || opt->NoPhysicalIPOnPacketLog == false) if (opt == NULL || opt->NoPhysicalIPOnPacketLog == false)
{ {
if (src_session != NULL && src_session->NormalClient) if (src_session->NormalClient)
{ {
StrCpy(pl->SrcPhysicalIP, sizeof(pl->SrcPhysicalIP), src_session->ClientIP); StrCpy(pl->SrcPhysicalIP, sizeof(pl->SrcPhysicalIP), src_session->ClientIP);
} }
@ -2269,46 +2127,6 @@ void ReplaceForCsv(char *str)
} }
} }
// Set the directory name of the log
void SetLogDirName(LOG *g, char *dir)
{
// Validate arguments
if (g == NULL || dir == NULL)
{
return;
}
LockLog(g);
{
if (g->DirName != NULL)
{
Free(g->DirName);
}
g->DirName = CopyStr(dir);
}
UnlockLog(g);
}
// Set the name of the log
void SetLogPrefix(LOG *g, char *prefix)
{
// Validate arguments
if (g == NULL || prefix == NULL)
{
return;
}
LockLog(g);
{
if (g->DirName != NULL)
{
Free(g->Prefix);
}
g->DirName = CopyStr(prefix);
}
UnlockLog(g);
}
// Set the switch type of log // Set the switch type of log
void SetLogSwitchType(LOG *g, UINT switch_type) void SetLogSwitchType(LOG *g, UINT switch_type)
{ {

View File

@ -223,8 +223,6 @@ char *StringRecordParseProc(RECORD *rec);
bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UINT64 tick, UINT switch_type, UINT num, char *old_datestr); bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UINT64 tick, UINT switch_type, UINT num, char *old_datestr);
void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UINT switch_type); void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UINT switch_type);
void WriteRecordToBuffer(BUF *b, RECORD *r); void WriteRecordToBuffer(BUF *b, RECORD *r);
void SetLogDirName(LOG *g, char *dir);
void SetLogPrefix(LOG *g, char *prefix);
void SetLogSwitchType(LOG *g, UINT switch_type); void SetLogSwitchType(LOG *g, UINT switch_type);
bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now); bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now);
char *PacketLogParseProc(RECORD *rec); char *PacketLogParseProc(RECORD *rec);
@ -234,17 +232,12 @@ char *GenCsvLine(TOKEN_LIST *t);
void ReplaceForCsv(char *str); void ReplaceForCsv(char *str);
char *PortStr(CEDAR *cedar, UINT port, bool udp); char *PortStr(CEDAR *cedar, UINT port, bool udp);
char *TcpFlagStr(UCHAR flag); char *TcpFlagStr(UCHAR flag);
void WriteSecurityLog(HUB *h, char *str);
void SecLog(HUB *h, char *fmt, ...);
void SiSetDefaultLogSetting(HUB_LOG *g); void SiSetDefaultLogSetting(HUB_LOG *g);
void DebugLog(CEDAR *c, char *fmt, ...); void DebugLog(CEDAR *c, char *fmt, ...);
void HubLog(HUB *h, wchar_t *fmt, ...);
void ServerLog(CEDAR *c, wchar_t *fmt, ...);
void SLog(CEDAR *c, char *name, ...); void SLog(CEDAR *c, char *name, ...);
void WriteHubLog(HUB *h, wchar_t *str); void WriteHubLog(HUB *h, wchar_t *str);
void HLog(HUB *h, char *name, ...); void HLog(HUB *h, char *name, ...);
void NLog(VH *v, char *name, ...); void NLog(VH *v, char *name, ...);
void IPCLog(IPC *ipc, char *name, ...);
void PPPLog(PPP_SESSION *p, char *name, ...); void PPPLog(PPP_SESSION *p, char *name, ...);
void IPsecLog(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, IPSECSA *ipsec_sa, char *name, ...); void IPsecLog(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, IPSECSA *ipsec_sa, char *name, ...);
void EtherIPLog(ETHERIP_SERVER *s, char *name, ...); void EtherIPLog(ETHERIP_SERVER *s, char *name, ...);
@ -261,13 +254,11 @@ bool CheckEraserDiskFreeSpace(ERASER *e);
int CompareEraseFile(void *p1, void *p2); int CompareEraseFile(void *p1, void *p2);
LIST *GenerateEraseFileList(ERASER *e); LIST *GenerateEraseFileList(ERASER *e);
void FreeEraseFileList(LIST *o); void FreeEraseFileList(LIST *o);
void PrintEraseFileList(LIST *o);
void EnumEraseFile(LIST *o, char *dirname); void EnumEraseFile(LIST *o, char *dirname);
SLOG *NewSysLog(char *hostname, UINT port, IP *ip); SLOG *NewSysLog(char *hostname, UINT port, IP *ip);
void SetSysLog(SLOG *g, char *hostname, UINT port); void SetSysLog(SLOG *g, char *hostname, UINT port);
void FreeSysLog(SLOG *g); void FreeSysLog(SLOG *g);
void SendSysLog(SLOG *g, wchar_t *str); void SendSysLog(SLOG *g, wchar_t *str);
void WriteMultiLineLog(LOG *g, BUF *b);
char *BuildHttpLogStr(HTTPLOG *h); char *BuildHttpLogStr(HTTPLOG *h);
void MakeSafeLogStr(char *str); void MakeSafeLogStr(char *str);
void AddLogBufToStr(BUF *b, char *name, char *value); void AddLogBufToStr(BUF *b, char *name, char *value);