Fixed windows
This commit is contained in:
parent
6e2d901bf6
commit
1c448ed41c
@ -138,8 +138,6 @@ set(SOURCE_FILES
|
|||||||
src/protocol/ringbuffer.cpp
|
src/protocol/ringbuffer.cpp
|
||||||
src/protocol/AcknowledgeManager.cpp
|
src/protocol/AcknowledgeManager.cpp
|
||||||
src/protocol/PacketLossCalculator.cpp
|
src/protocol/PacketLossCalculator.cpp
|
||||||
|
|
||||||
src/lookup/ip.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(HEADER_FILES
|
set(HEADER_FILES
|
||||||
@ -219,6 +217,7 @@ if (TEASPEAK_SERVER)
|
|||||||
|
|
||||||
set(SOURCE_FILES ${SOURCE_FILES}
|
set(SOURCE_FILES ${SOURCE_FILES}
|
||||||
src/BasicChannel.cpp
|
src/BasicChannel.cpp
|
||||||
|
src/lookup/ip.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(HEADER_FILES ${HEADER_FILES}
|
set(HEADER_FILES ${HEADER_FILES}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include "misc/spin_mutex.h"
|
#include "misc/spin_mutex.h"
|
||||||
#include "Definitions.h"
|
#include "Definitions.h"
|
||||||
#include "Variable.h"
|
#include "Variable.h"
|
||||||
#include "spdlog/fmt/ostr.h" // must be included
|
|
||||||
|
|
||||||
#define permNotGranted (-2)
|
#define permNotGranted (-2)
|
||||||
#define PERM_ID_GRANT ((ts::permission::PermissionType) (1U << 15U))
|
#define PERM_ID_GRANT ((ts::permission::PermissionType) (1U << 15U))
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "misc/memtracker.h"
|
#include "misc/memtracker.h"
|
||||||
#include <ThreadPool/Mutex.h>
|
|
||||||
#include "Variable.h"
|
#include "Variable.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <algorithm>
|
||||||
#include "bbcodes.h"
|
#include "bbcodes.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -7,8 +8,9 @@ using namespace bbcode;
|
|||||||
|
|
||||||
bool bbcode::sloppy::has_tag(std::string message, std::deque<std::string> tag) {
|
bool bbcode::sloppy::has_tag(std::string message, std::deque<std::string> tag) {
|
||||||
std::transform(message.begin(), message.end(), message.begin(), ::tolower);
|
std::transform(message.begin(), message.end(), message.begin(), ::tolower);
|
||||||
for(auto& entry : tag)
|
for(auto& entry : tag) {
|
||||||
std::transform(entry.begin(), entry.end(), entry.begin(), ::tolower);
|
std::transform(entry.begin(), entry.end(), entry.begin(), ::tolower);
|
||||||
|
}
|
||||||
|
|
||||||
std::deque<std::string> begins;
|
std::deque<std::string> begins;
|
||||||
size_t index = 0, found, length = 0;
|
size_t index = 0, found, length = 0;
|
||||||
@ -17,19 +19,25 @@ bool bbcode::sloppy::has_tag(std::string message, std::deque<std::string> tag) {
|
|||||||
for(auto it = tag.begin(); it != tag.end() && found == string::npos; it++) {
|
for(auto it = tag.begin(); it != tag.end() && found == string::npos; it++) {
|
||||||
found = message.find(*it, index);
|
found = message.find(*it, index);
|
||||||
length = it->length();
|
length = it->length();
|
||||||
};
|
}
|
||||||
|
|
||||||
if(found > 0 && found + length < message.length()) {
|
if(found > 0 && found + length < message.length()) {
|
||||||
if(message[found + length] == ']' || (message[found + length] == '=' && message.find(']', found + length) != string::npos)) {
|
if(message[found + length] == ']' || (message[found + length] == '=' && message.find(']', found + length) != string::npos)) {
|
||||||
if(message[found - 1] == '/') {
|
if(message[found - 1] == '/') {
|
||||||
auto found_tag = message.substr(found, length);
|
auto found_tag = message.substr(found, length);
|
||||||
for(const auto& entry : begins)
|
for(const auto& entry : begins) {
|
||||||
if(entry == found_tag) return true;
|
if(entry == found_tag) {
|
||||||
} else if(message[found - 1] == '[' && (found < 2 || message[found - 2] != '\\'))
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(message[found - 1] == '[' && (found < 2 || message[found - 2] != '\\')) {
|
||||||
begins.push_back(message.substr(found, length));
|
begins.push_back(message.substr(found, length));
|
||||||
if(message[found + length] != ']')
|
}
|
||||||
|
if(message[found + length] != ']') {
|
||||||
found = message.find(']', found + length);
|
found = message.find(']', found + length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
index = found + 1;
|
index = found + 1;
|
||||||
} while(index != 0);
|
} while(index != 0);
|
||||||
|
|
||||||
|
@ -3,12 +3,11 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include "./ip.h"
|
#include "./ip.h"
|
||||||
|
|
||||||
namespace lookup {
|
namespace lookup::ipv4_impl {
|
||||||
namespace ipv4_impl {
|
|
||||||
union uaddress_t {
|
union uaddress_t {
|
||||||
struct {
|
struct {
|
||||||
uint32_t address{0};
|
uint32_t address;
|
||||||
uint16_t port{0};
|
uint16_t port;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
@ -33,14 +32,3 @@ namespace lookup {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
using ip_v4 = ip_vx<
|
|
||||||
T,
|
|
||||||
sockaddr_in,
|
|
||||||
ipv4_impl::uaddress_t,
|
|
||||||
ipv4_impl::converter,
|
|
||||||
ipv4_impl::comparator,
|
|
||||||
ipv4_impl::hash
|
|
||||||
>;
|
|
||||||
}
|
|
@ -1,12 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
||||||
#include "./ip.h"
|
#include "./ip.h"
|
||||||
|
|
||||||
namespace lookup {
|
namespace lookup::ipv6_impl {
|
||||||
namespace ipv6_impl {
|
|
||||||
struct address_t {
|
struct address_t {
|
||||||
union {
|
union {
|
||||||
uint64_t address_u64[ 2];
|
uint64_t address_u64[ 2];
|
||||||
@ -40,14 +37,3 @@ namespace lookup {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
using ip_v6 = ip_vx<
|
|
||||||
T,
|
|
||||||
sockaddr_in6,
|
|
||||||
ipv6_impl::address_t,
|
|
||||||
ipv6_impl::converter,
|
|
||||||
ipv6_impl::comparator,
|
|
||||||
ipv6_impl::hash
|
|
||||||
>;
|
|
||||||
}
|
|
@ -1,13 +1,14 @@
|
|||||||
//#define NO_OPEN_SSL /* because we're lazy and dont want to build this lib extra for the TeaClient */
|
//#define NO_OPEN_SSL /* because we're lazy and dont want to build this lib extra for the TeaClient */
|
||||||
#define FIXEDINT_H_INCLUDED /* else it will be included by ge */
|
#define FIXEDINT_H_INCLUDED /* else it will be included by ge */
|
||||||
|
#include <stdint.h>
|
||||||
#include "misc/endianness.h"
|
|
||||||
#include <ed25519/ed25519.h>
|
|
||||||
#include <ed25519/ge.h>
|
#include <ed25519/ge.h>
|
||||||
#include <log/LogUtils.h>
|
#include <ed25519/ed25519.h>
|
||||||
#include "misc/memtracker.h"
|
#include <mutex>
|
||||||
#include "misc/digest.h"
|
|
||||||
#include "CryptHandler.h"
|
#include "./CryptHandler.h"
|
||||||
|
#include "../misc/endianness.h"
|
||||||
|
#include "../misc/memtracker.h"
|
||||||
|
#include "../misc/digest.h"
|
||||||
#include "../misc/sassert.h"
|
#include "../misc/sassert.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -69,7 +70,7 @@ bool CryptHandler::setupSharedSecret(const std::string& alpha, const std::string
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
lock_guard lock(this->cache_key_lock);
|
std::lock_guard lock(this->cache_key_lock);
|
||||||
memcpy(this->iv_struct, iv_buffer, SHA_DIGEST_LENGTH);
|
memcpy(this->iv_struct, iv_buffer, SHA_DIGEST_LENGTH);
|
||||||
this->iv_struct_length = SHA_DIGEST_LENGTH;
|
this->iv_struct_length = SHA_DIGEST_LENGTH;
|
||||||
|
|
||||||
@ -171,7 +172,9 @@ bool CryptHandler::generate_key_nonce(
|
|||||||
) {
|
) {
|
||||||
auto& key_cache_array = to_server ? this->cache_key_client : this->cache_key_server;
|
auto& key_cache_array = to_server ? this->cache_key_client : this->cache_key_server;
|
||||||
if(type < 0 || type >= key_cache_array.max_size()) {
|
if(type < 0 || type >= key_cache_array.max_size()) {
|
||||||
|
#if 0
|
||||||
logError(0, "Tried to generate a crypt key with invalid type ({})!", type);
|
logError(0, "Tried to generate a crypt key with invalid type ({})!", type);
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +183,7 @@ bool CryptHandler::generate_key_nonce(
|
|||||||
auto& key_cache = key_cache_array[type];
|
auto& key_cache = key_cache_array[type];
|
||||||
if(key_cache.generation != generation) {
|
if(key_cache.generation != generation) {
|
||||||
const size_t buffer_length = 6 + this->iv_struct_length;
|
const size_t buffer_length = 6 + this->iv_struct_length;
|
||||||
sassert(buffer_length < GENERATE_BUFFER_LENGTH);
|
assert(buffer_length < GENERATE_BUFFER_LENGTH);
|
||||||
|
|
||||||
char buffer[GENERATE_BUFFER_LENGTH];
|
char buffer[GENERATE_BUFFER_LENGTH];
|
||||||
memset(buffer, 0, buffer_length);
|
memset(buffer, 0, buffer_length);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <array>
|
||||||
#include <pipes/buffer.h>
|
#include <pipes/buffer.h>
|
||||||
#include "../query/Command.h"
|
#include "../query/Command.h"
|
||||||
|
|
||||||
|
@ -11,10 +11,6 @@
|
|||||||
#include "./Packet.h"
|
#include "./Packet.h"
|
||||||
#include "../misc/queue.h"
|
#include "../misc/queue.h"
|
||||||
|
|
||||||
#ifndef NO_LOG
|
|
||||||
#include <log/LogUtils.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace ts::buffer {
|
namespace ts::buffer {
|
||||||
struct RawBuffer {
|
struct RawBuffer {
|
||||||
public:
|
public:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef byte
|
#ifdef byte
|
||||||
#define byte asdd
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#warning The byte macro is already defined! Undefining it!
|
#warning The byte macro is already defined! Undefining it!
|
||||||
#endif
|
#endif
|
||||||
@ -22,6 +21,7 @@ namespace ts {
|
|||||||
BaseCommandParm(std::string key, type value) : BaseCommandParm(std::pair<std::string, std::string>(key, "")) { \
|
BaseCommandParm(std::string key, type value) : BaseCommandParm(std::pair<std::string, std::string>(key, "")) { \
|
||||||
toString; \
|
toString; \
|
||||||
} \
|
} \
|
||||||
|
\
|
||||||
BaseCommandParm& operator=(type value){ \
|
BaseCommandParm& operator=(type value){ \
|
||||||
toString; \
|
toString; \
|
||||||
return *this; \
|
return *this; \
|
||||||
@ -43,7 +43,6 @@ operator type(){ \
|
|||||||
public:
|
public:
|
||||||
ParameterBulk(const ParameterBulk& ref) : parms(ref.parms) {}
|
ParameterBulk(const ParameterBulk& ref) : parms(ref.parms) {}
|
||||||
|
|
||||||
|
|
||||||
variable operator[](size_t index){
|
variable operator[](size_t index){
|
||||||
if(parms.size() > index) return parms[index];
|
if(parms.size() > index) return parms[index];
|
||||||
return variable{"", "", VARTYPE_NULL};
|
return variable{"", "", VARTYPE_NULL};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user