Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
siniStar7 committed Jul 31, 2024
2 parents 1a72db1 + 863c3b3 commit 79659cf
Show file tree
Hide file tree
Showing 20 changed files with 1,265 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: Linux CI
name: Check v3 modules
on:
push:
paths:
- '.github/*'
- '3.0/*'
- '3/*'
pull_request:
paths:
- '3.0/*'
- '.github/*'
- '3/*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -37,20 +39,20 @@ jobs:
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
echo INSPIRCD_TARGET=$( \
git diff --name-only origin/${{ github.base_ref }} ${{ github.sha }} | \
for f in `cat`; do if [[ "$f" = "3.0/"*".cpp" ]]; \
for f in `cat`; do if [[ "$f" = "3/"*".cpp" ]]; \
then echo "$(basename $f .cpp) "; fi; done) >> $GITHUB_ENV
- name: (Push/PR Fallback) Set the build target to all of the modules
if: github.event_name == 'push' || env.INSPIRCD_TARGET == ''
run: echo INSPIRCD_TARGET=$(for f in contrib/3.0/*; do echo "$(basename $f .cpp) "; done) >> $GITHUB_ENV
run: echo INSPIRCD_TARGET=$(for f in contrib/3/*; do echo "$(basename $f .cpp) "; done) >> $GITHUB_ENV
- name: Symlink the modules
run: |
cd inspircd/src/modules
ln -s ../../../contrib/3.0/* .
ln -s ../../../contrib/3/* .
- name: Check for additional dependencies
run: |
cd inspircd
echo PACKAGES=$( \
for f in ../contrib/3.0/*; do if [[ "$INSPIRCD_TARGET" = *"$(basename $f .cpp)"* ]]; \
for f in ../contrib/3/*; do if [[ "$INSPIRCD_TARGET" = *"$(basename $f .cpp)"* ]]; \
then ./tools/directive $f PackageInfo; fi; done) >> $GITHUB_ENV
- name: Install additional dependencies
if: env.PACKAGES != ''
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/check-v4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Check v4 modules
on:
push:
paths:
- .github/workflows/check-v4.yml
- 4/*
pull_request:
paths:
- .github/workflows/check-v4.yml
- 4/*
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
CXX: ${{ matrix.compiler }}
INSPIRCD_DEBUG: 3
steps:
- name: Install dependencies
run: |
sudo apt-get update --assume-yes
sudo apt-get install --assume-yes --no-install-recommends \
clang \
curl \
g++ \
git \
jq \
make \
pkg-config
- name: Retrieve latest release
run: |
echo INSPIRCD_VERSION=$(curl https://api.github.com/repos/inspircd/inspircd/releases | jq --raw-output 'map(select((.draft or .prerelease | not) and (.tag_name | startswith("v4.")))) | first .tag_name') >> $GITHUB_ENV
- name: Checkout InspIRCd
uses: actions/checkout@v4
with:
repository: inspircd/inspircd
ref: ${{ env.INSPIRCD_VERSION }}
path: inspircd

- name: Checkout InspIRCd contrib
uses: actions/checkout@v4
with:
path: contrib

- name: Get changed modules
id: changed-modules
uses: tj-actions/changed-files@v44
with:
files: 4/*.cpp
path: contrib

- name: Work out what modules to build
working-directory: inspircd
run: |
if [ '${{ steps.changed-modules.outputs.any_changed }}' = true ]
then
export FILES=$(cd ${{ github.workspace }}/contrib && readlink -f ${{ steps.changed-modules.outputs.all_changed_files }})
else
export FILES=$(readlink -f ${{ github.workspace }}/contrib/4/*.cpp)
fi
for FILE in ${FILES}
do
export MODULES="${MODULES} ${FILE}"
export PACKAGES="${PACKAGES} $(./tools/directive ${FILE} PackageInfo)"
export TARGETS="${TARGETS} $(basename $FILE .cpp)"
done
echo "INSPIRCD_MODULES=${MODULES%% }" >> $GITHUB_ENV
echo "INSPIRCD_PACKAGES=${PACKAGES%% }" >> $GITHUB_ENV
echo "INSPIRCD_TARGET=${TARGETS%% }" >> $GITHUB_ENV
- name: Install module dependencies
if: env.INSPIRCD_PACKAGES != ''
working-directory: inspircd
run: |
sudo apt-get install --assume-yes --no-install-recommends ${INSPIRCD_PACKAGES}
- name: Build the changed modules
working-directory: inspircd
run: |
cp -v ${INSPIRCD_MODULES} src/modules
./configure --development --disable-auto-extras
make --jobs $(($(getconf _NPROCESSORS_ONLN) + 1))
strategy:
fail-fast: false
matrix:
compiler:
- clang++
- g++
66 changes: 0 additions & 66 deletions .github/workflows/ci-macos.yml

This file was deleted.

2 changes: 1 addition & 1 deletion 3/m_antisnoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ModuleAntiSnoop CXX11_FINAL
{
}

void ReadConfig(ConfigStatus& status)
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
ConfigTag* tag = ServerInstance->Config->ConfValue("antisnoop");
exemptrank = tag->getUInt("exemptrank", VOICE_VALUE);
Expand Down
55 changes: 55 additions & 0 deletions 3/m_cve_2024_39844.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2022 Sadie Powell <[email protected]>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


/// $ModAuthor: Sadie Powell
/// $ModAuthorMail: [email protected]
/// $ModDesc: Prevents clients from sending messages that trigger CVE-2024-39844.
/// $ModDepends: core 3

#include "inspircd.h"

class ModuleCVE202439844 CXX11_FINAL
: public Module
{
private:
std::string find;
std::string replace;

public:
ModuleCVE202439844()
: find("}")
, replace(" ")
{
}

void OnUserKick(User* source, Membership* memb, const std::string &reason, CUList& except_list) CXX11_OVERRIDE
{
// HACK HACK HACK
std::string& mutreason = const_cast<std::string&>(reason);
stdalgo::string::replace_all(mutreason, find, replace);
}

Version GetVersion() CXX11_OVERRIDE
{
return Version("Prevents clients from sending messages that trigger CVE-2024-39844.");
}
};

MODULE_INIT(ModuleCVE202439844)

2 changes: 2 additions & 0 deletions 3/m_eventexec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class CommandThread CXX11_FINAL
{
}

virtual ~CommandThread() { }

void Run() CXX11_OVERRIDE
{
for (std::vector<std::string>::const_iterator iter = commands.begin(); iter != commands.end(); ++iter)
Expand Down
Loading

0 comments on commit 79659cf

Please sign in to comment.