Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match channel path in BannedUser struct #2066

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Library/TeamTalkLib/teamtalk/Channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
#if !defined(CHANNEL_H)
#define CHANNEL_H

#include <ace/SString.h>

#include <myace/MyACE.h>
#include "ttassert.h"
#include "Common.h"
#include "PacketLayout.h"
#include "ttassert.h"

#include <myace/MyACE.h>

#include <ace/SString.h>

#include <map>
#include <vector>
Expand Down
2 changes: 2 additions & 0 deletions Library/TeamTalkLib/teamtalk/CodecCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
*/

#include "CodecCommon.h"
#include "PacketLayout.h"

#include <myace/MyACE.h>

#define SPEEX_NB_MODE 0
Expand Down
9 changes: 5 additions & 4 deletions Library/TeamTalkLib/teamtalk/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
#if !defined(COMMANDS_H)
#define COMMANDS_H

#include <vector>
#include <set>
#include <map>
#include "Common.h"

#include <ace/ACE.h>
#include <ace/SString.h>
#include "Common.h"

#include <vector>
#include <set>
#include <map>

#define TEAMTALK_PROTOCOL_VERSION ACE_TEXT("5.13")

Expand Down
16 changes: 10 additions & 6 deletions Library/TeamTalkLib/teamtalk/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "Common.h"
#include "Commands.h"
#include "Channel.h"
#include <myace/MyINet.h>

#include <time.h>
Expand Down Expand Up @@ -71,8 +72,9 @@ namespace teamtalk

bool BannedUser::Match(const BannedUser& user) const
{
bool match = true;
if((bantype & BANTYPE_IPADDR) && ipaddr.length())
bool match = bantype != BANTYPE_NONE;

if ((bantype & BANTYPE_IPADDR) && ipaddr.length())
{
const ACE_TString rgxsubnet = ACE_TEXT("^") ACE_TEXT("(.*)/(\\d+)") ACE_TEXT("$");
#if defined(UNICODE)
Expand All @@ -97,11 +99,13 @@ namespace teamtalk
match &= std::regex_search(user.ipaddr.c_str(), buildregex(rgx.c_str()));
}
}
if((bantype & BANTYPE_USERNAME))

if ((bantype & BANTYPE_USERNAME))
match &= username == user.username;
if((bantype & BANTYPE_CHANNEL))
match &= chanpath == user.chanpath;
match &= bantype != BANTYPE_NONE;

if ((bantype & BANTYPE_CHANNEL))
match &= ChannelsEquals(chanpath, user.chanpath);

return match;
}

Expand Down
1 change: 0 additions & 1 deletion Library/TeamTalkLib/teamtalk/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#ifndef COMMON_H
#define COMMON_H

#include "PacketLayout.h"
#include <TeamTalkDefs.h>
#include <codec/MediaUtil.h>

Expand Down
1 change: 0 additions & 1 deletion Library/TeamTalkLib/teamtalk/DesktopSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#define DESKTOPSESSION_H

#include "Common.h"
#include "PacketLayout.h"
#include <vector>

#define RGB8_BLOCK_PIXEL_W 120
Expand Down
1 change: 1 addition & 0 deletions Library/TeamTalkLib/teamtalk/PacketLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

#include "PacketLayout.h"
#include "Common.h"

using namespace std;

Expand Down
2 changes: 0 additions & 2 deletions Library/TeamTalkLib/teamtalk/PacketLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
#if !defined(PACKETLAYOUT_H)
#define PACKETLAYOUT_H

#include "Common.h"
#include <myace/MyACE.h>

#include <ace/ACE.h>
#include <vector>
#include <memory>
#include <map>
Expand Down
5 changes: 3 additions & 2 deletions Library/TeamTalkLib/teamtalk/User.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
#if !defined(USER_H)
#define USER_H

#include <map>
#include "Common.h"
#include "PacketLayout.h"

#include <ace/SString.h>
#include <ace/INET_Addr.h>

#include "PacketLayout.h"
#include <map>

namespace teamtalk {

Expand Down
3 changes: 2 additions & 1 deletion Library/TeamTalkLib/teamtalk/client/AudioThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@

#include "AudioThread.h"

#include <myace/MyACE.h>
#include <teamtalk/ttassert.h>
#include <teamtalk/CodecCommon.h>
#include <teamtalk/PacketLayout.h>
#include <codec/MediaUtil.h>
#include <myace/MyACE.h>

using namespace std;
using namespace teamtalk;
Expand Down
14 changes: 7 additions & 7 deletions Library/TeamTalkLib/teamtalk/client/DesktopShare.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
#ifndef DESKTOPSHARE_H
#define DESKTOPSHARE_H

#include <map>
#include <vector>
#include <set>
#include <memory>
#include <teamtalk/PacketLayout.h>
#include <teamtalk/PacketHelper.h>
#include <teamtalk/DesktopSession.h>

#include <ace/Task.h>
#include <ace/Reactor.h>
#include <ace/Semaphore.h>

#include <teamtalk/PacketLayout.h>
#include <teamtalk/PacketHelper.h>
#include <teamtalk/DesktopSession.h>
#include <map>
#include <vector>
#include <set>
#include <memory>

namespace teamtalk {

Expand Down
6 changes: 3 additions & 3 deletions Library/TeamTalkLib/teamtalk/client/VideoThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
#ifndef VIDEOTHREAD_H
#define VIDEOTHREAD_H

#include <ace/Task.h>
#include <ace/Message_Block.h>

#if defined(ENABLE_VPX)
#include <codec/VpxEncoder.h>
#endif

#include <teamtalk/Common.h>
#include <codec/MediaUtil.h>

#include <ace/Task.h>
#include <ace/Message_Block.h>

#include <memory>

//Get VideoFrame from ACE_Message_Block
Expand Down
4 changes: 2 additions & 2 deletions Library/TeamTalkLib/teamtalk/server/AcceptHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#if !defined(ACCEPTHANDLER_H)
#define ACCEPTHANDLER_H

#include <teamtalk/StreamHandler.h>

#include <ace/Acceptor.h>
#include <ace/SOCK_Stream.h>
#include <ace/SOCK_Acceptor.h>

#include <teamtalk/StreamHandler.h>

#if defined(ENABLE_ENCRYPTION)
#include <ace/SSL/SSL_SOCK_Stream.h>
#include <ace/SSL/SSL_SOCK_Acceptor.h>
Expand Down
15 changes: 7 additions & 8 deletions Library/TeamTalkLib/teamtalk/server/ServerNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,21 @@
#if !defined(SERVERNODE_H)
#define SERVERNODE_H

#include "AcceptHandler.h"
#include "ServerChannel.h"
#include "ServerUser.h"
#include "Server.h"

// ACE
#include <ace/Recursive_Thread_Mutex.h>
#include <ace/Guard_T.h>
#include <ace/Acceptor.h>

#include <teamtalk/Commands.h>
#include <teamtalk/PacketHandler.h>

#include <myace/TimerHandler.h>
#include <myace/MyACE.h>

#include "AcceptHandler.h"
#include "ServerChannel.h"
#include "ServerUser.h"
// ACE
#include <ace/Recursive_Thread_Mutex.h>
#include <ace/Guard_T.h>
#include <ace/Acceptor.h>

// STL
#include <map>
Expand Down
4 changes: 2 additions & 2 deletions Library/TeamTalkLib/teamtalk/ttassert.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#ifndef _TTASSERT_H
#define _TTASSERT_H

#include <assert.h>

void tt_assert(const char* assertion, const char* file, int line);

#if defined(NDEBUG)
Expand All @@ -32,8 +34,6 @@ void tt_assert(const char* assertion, const char* file, int line);

#else // !NDEBUG

#include <assert.h>

#define TTASSERT(_EX) do { (_EX)? (void)0 : tt_assert(#_EX, __FILE__, __LINE__); assert(_EX); } while(0)

#endif
Expand Down
Loading