From 27e4bd8accb0a58c6ceb98c0329862a7f1efc116 Mon Sep 17 00:00:00 2001 From: scatterflower Date: Thu, 7 Jul 2022 11:08:52 -0500 Subject: [PATCH 1/8] Add new tests --- core/src/packet/packet_casea.cpp | 2 +- core/src/packet/packet_setcase.cpp | 2 +- .../tst_unittest_aopacket.cpp | 88 +++++++++++++++++++ 3 files changed, 90 insertions(+), 2 deletions(-) diff --git a/core/src/packet/packet_casea.cpp b/core/src/packet/packet_casea.cpp index 2dd7452..b811696 100644 --- a/core/src/packet/packet_casea.cpp +++ b/core/src/packet/packet_casea.cpp @@ -15,7 +15,7 @@ PacketInfo PacketCasea::getPacketInfo() const PacketInfo info{ .acl_permission = ACLRole::Permission::NONE, .min_args = 6, - .header = "Casea"}; + .header = "CASEA"}; return info; } diff --git a/core/src/packet/packet_setcase.cpp b/core/src/packet/packet_setcase.cpp index 1453b35..9303194 100644 --- a/core/src/packet/packet_setcase.cpp +++ b/core/src/packet/packet_setcase.cpp @@ -13,7 +13,7 @@ PacketInfo PacketSetcase::getPacketInfo() const PacketInfo info{ .acl_permission = ACLRole::Permission::NONE, .min_args = 7, - .header = "Setcase"}; + .header = "SETCASE"}; return info; } diff --git a/tests/unittest_aopacket/tst_unittest_aopacket.cpp b/tests/unittest_aopacket/tst_unittest_aopacket.cpp index 3232610..e8d7743 100644 --- a/tests/unittest_aopacket/tst_unittest_aopacket.cpp +++ b/tests/unittest_aopacket/tst_unittest_aopacket.cpp @@ -35,6 +35,12 @@ class Packet : public QObject * @brief Tests the creation of AOPackets from incoming string formatted packets. */ void createPacketFromString(); + + /** + * @brief Test packet-specific classes + */ + void createPacketSubclass_data(); + void createPacketSubclass(); }; void Packet::init() @@ -42,6 +48,88 @@ void Packet::init() AOPacket::registerPackets(); } +void Packet::createPacketSubclass_data() +{ + QTest::addColumn("incoming_packet"); + QTest::addColumn("expected_header"); + QTest::addColumn("expected_minargs"); + + QTest::newRow("askchaa") << "askchaa#" + << "askchaa" + << 0; + QTest::newRow("CASEA") << "CASEA#" + << "CASEA" + << 6; + QTest::newRow("CC") << "CC#" + << "CC" + << 3; + QTest::newRow("CH") << "CH#" + << "CH" + << 1; + QTest::newRow("CT") << "CT#" + << "CT" + << 2; + QTest::newRow("DE") << "DE#" + << "DE" + << 1; + QTest::newRow("EE") << "EE#" + << "EE" + << 4; + QTest::newRow("GENERIC") << "GENERIC#" + << "GENERIC" + << 0; + QTest::newRow("HI") << "HI#" + << "HI" + << 1; + QTest::newRow("HP") << "HP#" + << "HP" + << 2; + QTest::newRow("ID") << "ID#" + << "ID" + << 2; + QTest::newRow("MC") << "MC#" + << "MC" + << 2; + QTest::newRow("MS") << "MS#" + << "MS" + << 15; + QTest::newRow("PE") << "PE#" + << "PE" + << 3; + QTest::newRow("PW") << "PW#" + << "PW" + << 1; + QTest::newRow("RC") << "RC#" + << "RC" + << 0; + QTest::newRow("RD") << "RD#" + << "RD" + << 0; + QTest::newRow("RM") << "RM#" + << "RM" + << 0; + QTest::newRow("RT") << "RT#" + << "RT" + << 1; + QTest::newRow("SETCASE") << "SETCASE#" + << "SETCASE" + << 7; + QTest::newRow("ZZ") << "ZZ#" + << "ZZ" + << 0; +} + +void Packet::createPacketSubclass() +{ + QFETCH(QString, incoming_packet); + QFETCH(QString, expected_header); + QFETCH(int, expected_minargs); + + AOPacket *packet = PacketFactory::createPacket(incoming_packet); + QCOMPARE(packet->getPacketInfo().header, expected_header); + QCOMPARE(packet->getPacketInfo().min_args, expected_minargs); +} + void Packet::createPacket() { AOPacket *packet = PacketFactory::createPacket("HI", {"HDID"}); From 2459aa540151e752dbf676b6e466f0b1c45a10e8 Mon Sep 17 00:00:00 2001 From: scatterflower Date: Sun, 10 Jul 2022 10:25:19 -0500 Subject: [PATCH 2/8] Don't allow exploit to change background --- core/src/packet/packet_ms.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/packet/packet_ms.cpp b/core/src/packet/packet_ms.cpp index dbdbda2..f174226 100644 --- a/core/src/packet/packet_ms.cpp +++ b/core/src/packet/packet_ms.cpp @@ -159,6 +159,7 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const l_args.append(l_incoming_args[5].toString()); if (client.m_pos != l_incoming_args[5].toString()) { client.m_pos = l_incoming_args[5].toString(); + client.m_pos.replace("../", ""); client.updateEvidenceList(client.getServer()->getAreaById(client.m_current_area)); } From 6063c9b443093f69b66719b0b934245e1b345c17 Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Sat, 23 Jul 2022 13:45:20 +0200 Subject: [PATCH 3/8] Comitting my own suggestion --- core/src/packet/packet_ms.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/packet/packet_ms.cpp b/core/src/packet/packet_ms.cpp index f174226..61f9814 100644 --- a/core/src/packet/packet_ms.cpp +++ b/core/src/packet/packet_ms.cpp @@ -159,7 +159,7 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const l_args.append(l_incoming_args[5].toString()); if (client.m_pos != l_incoming_args[5].toString()) { client.m_pos = l_incoming_args[5].toString(); - client.m_pos.replace("../", ""); + client.m_pos.replace("../", "").replace("..\\",""); client.updateEvidenceList(client.getServer()->getAreaById(client.m_current_area)); } From b59c522c51774ec3ee7c0026fd4ff9c181d54a07 Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Sat, 20 Aug 2022 15:41:57 +0200 Subject: [PATCH 4/8] Format --- core/src/packet/packet_ms.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/packet/packet_ms.cpp b/core/src/packet/packet_ms.cpp index 61f9814..2026d1c 100644 --- a/core/src/packet/packet_ms.cpp +++ b/core/src/packet/packet_ms.cpp @@ -159,7 +159,7 @@ AOPacket *PacketMS::validateIcPacket(AOClient &client) const l_args.append(l_incoming_args[5].toString()); if (client.m_pos != l_incoming_args[5].toString()) { client.m_pos = l_incoming_args[5].toString(); - client.m_pos.replace("../", "").replace("..\\",""); + client.m_pos.replace("../", "").replace("..\\", ""); client.updateEvidenceList(client.getServer()->getAreaById(client.m_current_area)); } From 08f5e0e6f2051019622d57394bfd5c6b571ae0e9 Mon Sep 17 00:00:00 2001 From: AwesomeAim <30537683+AwesomeAim@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:48:16 -0800 Subject: [PATCH 5/8] correct names for the commands I feel like this should be an automatic thing, no? --- bin/config_sample/text/commandhelp.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/config_sample/text/commandhelp.json b/bin/config_sample/text/commandhelp.json index bdf9bef..7fd8352 100644 --- a/bin/config_sample/text/commandhelp.json +++ b/bin/config_sample/text/commandhelp.json @@ -102,16 +102,16 @@ }, { "names": [ - "setperm" + "setperms" ], - "usage":"/addperm ", - "text":"Sets the role of the user.." + "usage":"/setperms ", + "text":"Sets the role of the user." }, { "names": [ - "removeperm" + "removeperms" ], - "usage":"/removeperm ", + "usage":"/removeperms ", "text":"Removes the role from a given user." }, { From c1115fcee3764b1a39627f859b67993d3b0ca582 Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Thu, 15 Dec 2022 20:08:11 +0100 Subject: [PATCH 6/8] That package does not exist anymore --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a00e63..0a4254d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install qt5-default libqt5websockets5-dev g++ make + sudo apt-get install qt5-qmake libqt5websockets5-dev g++ make # Runs a set of commands using the runners shell - name: qmake and build run: | From dcdf28c0f620c164260a47c7662cf5fd5a9bf33d Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Thu, 15 Dec 2022 20:14:51 +0100 Subject: [PATCH 7/8] Update coverage CI run --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a4254d..4b5d2d6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install qt5-default libqt5websockets5-dev g++ make + sudo apt-get install qt5-qmake libqt5websockets5-dev g++ make # Runs a set of commands using the runners shell - name: qmake and build run: | From 8af2a9148dbdcfefce1f9707555a37ab9ebccdbf Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Thu, 15 Dec 2022 20:23:29 +0100 Subject: [PATCH 8/8] OpenSSL Version boogaloo --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4b5d2d6..3aacc56 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -145,8 +145,8 @@ jobs: - name: Deploy OpenSSL run: | - curl https://mirror.firedaemon.com/OpenSSL/openssl-1.1.1p.zip --output openssl-1.1.1p.zip - tar -xf openssl-1.1.1p.zip + curl https://mirror.firedaemon.com/OpenSSL/openssl-1.1.1r.zip --output openssl-1.1.1.zip + tar -xf openssl-1.1.1.zip copy .\openssl-1.1\x64\bin\libcrypto-1_1-x64.dll .\bin\libcrypto-1_1-x64.dll copy .\openssl-1.1\x64\bin\libssl-1_1-x64.dll .\bin\libssl-1_1-x64.dll