Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
420a56c8c4 | ||
|
|
5e262c573a | ||
|
|
df4b1b0aa7 | ||
|
|
dfc25da57a | ||
|
|
4c7ec14d52 | ||
|
|
0aab8e0bd6 | ||
|
|
86c714fb1b | ||
|
|
3a126db081 | ||
|
|
0b5306f689 | ||
|
|
00c4ee1521 | ||
|
|
aa115c645e | ||
|
|
723d6e07b9 | ||
|
|
8d83d5ecca | ||
|
|
58a4c9df84 | ||
|
|
ddf6e96660 | ||
|
|
2711a463a2 | ||
|
|
736afc5d1f | ||
|
|
9aa1fb0474 | ||
|
|
670c7c5b02 | ||
|
|
a1fd39932a | ||
|
|
db47788db9 | ||
|
|
1c172cbfc7 |
Executable
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
cd "$(dirname $0)/../.."
|
||||||
|
|
||||||
|
if [[ $PLATFORM == Linux* ]]; then
|
||||||
|
$CC --version
|
||||||
|
$CXX --version
|
||||||
|
|
||||||
|
apt install -y python3-pip
|
||||||
|
|
||||||
|
# buildbot/generate_header.py is ran by ambuild and we want git to not fail due to user-perms (because docker)
|
||||||
|
git config --global --add safe.directory $PWD
|
||||||
|
else
|
||||||
|
python -m pip install --upgrade pip setuptools wheel
|
||||||
|
fi
|
||||||
|
|
||||||
|
python -m pip install $CACHE_PATH/ambuild
|
||||||
|
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
python ../configure.py --enable-auto-versioning --enable-optimize --sdks="$SDKS" --mms-path="$CACHE_PATH/metamod-source" --hl2sdk-root="$CACHE_PATH" --sm-path="$CACHE_PATH/sourcemod"
|
||||||
|
ambuild
|
||||||
+37
-42
@@ -11,9 +11,10 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-22.04, windows-2022]
|
python-version: ['3.14']
|
||||||
|
os: [ubuntu-latest, windows-2022]
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-latest
|
||||||
cc: clang-11
|
cc: clang-11
|
||||||
cxx: clang++-11
|
cxx: clang++-11
|
||||||
- os: windows-2022
|
- os: windows-2022
|
||||||
@@ -38,32 +39,19 @@ jobs:
|
|||||||
# This will be used in our cache key
|
# This will be used in our cache key
|
||||||
echo "SDKS_KEY=${SDKS_VAR//[[:blank:]]/}" >> $GITHUB_ENV
|
echo "SDKS_KEY=${SDKS_VAR//[[:blank:]]/}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Linux dependencies
|
- uses: actions/setup-python@v6
|
||||||
if: startsWith(runner.os, 'Linux')
|
if: startsWith(matrix.os, 'windows-')
|
||||||
run: |
|
name: Setup Python ${{ matrix.python-version }}
|
||||||
sudo dpkg --add-architecture i386
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y --no-install-recommends \
|
|
||||||
gcc-multilib g++-multilib libstdc++6 lib32stdc++6 \
|
|
||||||
libc6-dev libc6-dev-i386 linux-libc-dev \
|
|
||||||
linux-libc-dev:i386 lib32z1-dev ${{ matrix.cc }}
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
name: Setup Python 3.9
|
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Install Python dependencies
|
- uses: actions/checkout@v6
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip setuptools wheel
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Repository checkout
|
name: Repository checkout
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
path: extension
|
path: extension
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v5
|
||||||
name: Cache dependencies
|
name: Cache dependencies
|
||||||
env:
|
env:
|
||||||
cache-name: connect-cache
|
cache-name: connect-cache
|
||||||
@@ -105,31 +93,38 @@ jobs:
|
|||||||
# But maybe others aren't (also probably unnecessary because git actions but paranoia)
|
# But maybe others aren't (also probably unnecessary because git actions but paranoia)
|
||||||
git config --global advice.detachedHead true
|
git config --global advice.detachedHead true
|
||||||
|
|
||||||
- name: Setup AMBuild
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
cd "${{ env.CACHE_PATH }}"
|
|
||||||
python -m pip install ./ambuild
|
|
||||||
|
|
||||||
- name: Select clang compiler
|
|
||||||
if: startsWith(runner.os, 'Linux')
|
|
||||||
run: |
|
|
||||||
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
|
|
||||||
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
|
|
||||||
${{ matrix.cc }} --version
|
|
||||||
${{ matrix.cxx }} --version
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: extension
|
working-directory: extension
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
export PLATFORM="${{ runner.os }}"
|
||||||
cd build
|
|
||||||
python ../configure.py --enable-auto-versioning --enable-optimize --sdks="${{ env.SDKS }}" --mms-path="${{ env.CACHE_PATH }}/metamod-source" --hl2sdk-root="${{ env.CACHE_PATH }}" --sm-path="${{ env.CACHE_PATH }}/sourcemod"
|
|
||||||
ambuild
|
|
||||||
|
|
||||||
PLATFORM="${{ runner.os }}"
|
if [[ $PLATFORM == Linux* ]]; then
|
||||||
FILENAME="$(cat ./includes/filename_versioning.txt)"
|
# docker instead of podman because:
|
||||||
|
# - we don't need a job to `sudo apt install podman`
|
||||||
|
# - `sudo apt install -y python3-pip` didn't work inside podman for me?
|
||||||
|
docker run \
|
||||||
|
-e PLATFORM="$PLATFORM" \
|
||||||
|
-e PROJECT=${{ env.PROJECT }} \
|
||||||
|
-e SDKS="${{ env.SDKS }}" \
|
||||||
|
-e MMSOURCE_VERSION=${{ env.MMSOURCE_VERSION }} \
|
||||||
|
-e SOURCEMOD_VERSION=${{ env.MMSOURCE_SOURCEMOD_VERSION }} \
|
||||||
|
-e CACHE_PATH=${{ env.CACHE_PATH }} \
|
||||||
|
-e SDKS_KEY=${{ env.SDKS_KEY }} \
|
||||||
|
-e CC=${{ matrix.cc }} \
|
||||||
|
-e CXX=${{ matrix.cxx }} \
|
||||||
|
--mount type=bind,source=${{ env.CACHE_PATH }},target=${{ env.CACHE_PATH }} \
|
||||||
|
--mount type=bind,source=$PWD,target=$PWD \
|
||||||
|
"registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest" \
|
||||||
|
"$PWD/.github/workflows/build.sh"
|
||||||
|
|
||||||
|
# need to fix the owner because docker root-ed stuff?
|
||||||
|
sudo chown -R $USER .
|
||||||
|
else
|
||||||
|
bash ./.github/workflows/build.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILENAME="$(cat build/includes/filename_versioning.txt)"
|
||||||
ZIP_FILENAME="${{ env.PROJECT }}-${FILENAME}-${PLATFORM,}.zip"
|
ZIP_FILENAME="${{ env.PROJECT }}-${FILENAME}-${PLATFORM,}.zip"
|
||||||
|
|
||||||
echo "ZIP_FILENAME=${ZIP_FILENAME}" >> $GITHUB_ENV
|
echo "ZIP_FILENAME=${ZIP_FILENAME}" >> $GITHUB_ENV
|
||||||
@@ -165,7 +160,7 @@ jobs:
|
|||||||
echo "Upload successful!"
|
echo "Upload successful!"
|
||||||
|
|
||||||
- name: Upload a Build Artifact
|
- name: Upload a Build Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
with:
|
with:
|
||||||
# Artifact name
|
# Artifact name
|
||||||
name: ${{ matrix.os }}_${{ matrix.cc }}_${{ env.ZIP_FILENAME }}
|
name: ${{ matrix.os }}_${{ matrix.cc }}_${{ env.ZIP_FILENAME }}
|
||||||
|
|||||||
@@ -2,3 +2,5 @@ build
|
|||||||
Containerfile
|
Containerfile
|
||||||
.venv
|
.venv
|
||||||
safetyhook
|
safetyhook
|
||||||
|
.env
|
||||||
|
secret.h
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
# Connect - A safer OnClientPreConnect forward
|
||||||
|
|
||||||
|
This extension provides a OnClientPreConnect forward (similar to CBaseServer's), but does proper checking to prevent malicious people spoofing SteamIDs.
|
||||||
|
|
||||||
|
If you are currently using CBaseServer for reserved slots, it's possible for a client to spoof an admin's SteamID and cause someone to be kicked from the server (although they would be later denied, so they couldn't actually join the game).
|
||||||
|
This extension does these checks before OnClientPreConnect is fired, so this isn't possible.
|
||||||
|
|
||||||
|
There are some additional features such as being able to change the password provided before it's checked (see included example plugin) and the ability to reject the client with a reason (like SourceMod's later OnClientConnect forward).
|
||||||
|
|
||||||
|
Only the Source 2009 engine is supported, as it's the only one that's been updated to use the new authentication system.
|
||||||
|
|
||||||
|
# Provided forwards
|
||||||
|
|
||||||
|
```
|
||||||
|
public bool OnClientPreConnectEx
|
||||||
|
(
|
||||||
|
const char[] name,
|
||||||
|
char password[255],
|
||||||
|
const char[] ip,
|
||||||
|
const char[] steamID,
|
||||||
|
char rejectReason[255]
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`return false;` to disallow the client from joining, and change `rejectReason` to what you want them to be shown when denied.
|
||||||
|
|
||||||
|
Note that this function is called before the client has a client index on the server.
|
||||||
|
|
||||||
|
|
||||||
|
# [Builds](https://builds.limetech.io/?project=connect)
|
||||||
|
|
||||||
|
|
||||||
|
# helpful commands for building on the unloze machine
|
||||||
|
|
||||||
|
## the environment
|
||||||
|
export PATH=":/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11/bin:/home/gameservers/.local/bin":/sbin:/bin:
|
||||||
|
export SOURCEMOD=/home/gameservers/automate/sourcemod_1.13.0.7207
|
||||||
|
export MMSOURCE=/home/gameservers/automate/mmsource-1.13
|
||||||
|
|
||||||
|
## building
|
||||||
|
rm -r -f build; mkdir build; cd build; python ../configure.py --sdks css --targets=x86 --enable-optimize; ambuild; cd ..
|
||||||
@@ -40,7 +40,7 @@ for cxx_task in Extension.extensions:
|
|||||||
pdblog.write(cxx_task.debug.path + '\n')
|
pdblog.write(cxx_task.debug.path + '\n')
|
||||||
pdblog.close()
|
pdblog.close()
|
||||||
|
|
||||||
CopyFiles('connect.games.txt', folders['addons/sourcemod/gamedata'])
|
CopyFiles('connect2.games.txt', folders['addons/sourcemod/gamedata'])
|
||||||
CopyFiles('connect.inc', folders['addons/sourcemod/scripting/include'])
|
CopyFiles('connect.inc', folders['addons/sourcemod/scripting/include'])
|
||||||
CopyFiles('connect.sp', folders['addons/sourcemod/scripting'])
|
CopyFiles('connect.sp', folders['addons/sourcemod/scripting'])
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ parser.options.add_argument('--enable-auto-versioning', action='store_false', de
|
|||||||
default=True, help='Enables the auto versioning script')
|
default=True, help='Enables the auto versioning script')
|
||||||
parser.options.add_argument('-s', '--sdks', default='all', dest='sdks',
|
parser.options.add_argument('-s', '--sdks', default='all', dest='sdks',
|
||||||
help='Build against specified SDKs; valid args are "all", "present", or '
|
help='Build against specified SDKs; valid args are "all", "present", or '
|
||||||
'space-delimited list of engine names (default: %default)')
|
'space-delimited list of engine names (default: %(default)s)')
|
||||||
parser.options.add_argument('--targets', type=str, dest='targets', default=None,
|
parser.options.add_argument('--targets', type=str, dest='targets', default=None,
|
||||||
help="Override the target architecture (use commas to separate multiple targets).")
|
help="Override the target architecture (use commas to separate multiple targets).")
|
||||||
parser.Configure()
|
parser.Configure()
|
||||||
+10
@@ -4,7 +4,17 @@
|
|||||||
|
|
||||||
#define _connect_included
|
#define _connect_included
|
||||||
|
|
||||||
|
enum EConnect
|
||||||
|
{
|
||||||
|
k_OnClientPreConnectEx_Reject = 0,
|
||||||
|
k_OnClientPreConnectEx_Accept = 1,
|
||||||
|
k_OnClientPreConnectEx_Async = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
forward bool OnClientPreConnectEx(const char[] name, char password[255], const char[] ip, const char[] steamID, char rejectReason[255]);
|
forward bool OnClientPreConnectEx(const char[] name, char password[255], const char[] ip, const char[] steamID, char rejectReason[255]);
|
||||||
|
native bool ClientPreConnectEx(const char[] sSteam32ID, EConnect RetVal, char sRejectReason[255]);
|
||||||
|
native bool SteamClientAuthenticated(const char[] sSteam32ID);
|
||||||
|
|
||||||
public Extension __ext_Connect =
|
public Extension __ext_Connect =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,12 +37,12 @@
|
|||||||
|
|
||||||
"Signatures"
|
"Signatures"
|
||||||
{
|
{
|
||||||
"Steam3Server"
|
"Steam3Server"
|
||||||
{
|
{
|
||||||
"library" "engine"
|
"library" "engine"
|
||||||
"linux" "@_Z12Steam3Serverv"
|
"linux" "@_Z12Steam3Serverv"
|
||||||
"linux64" "@_Z12Steam3Serverv"
|
"linux64" "@_Z12Steam3Serverv"
|
||||||
}
|
}
|
||||||
|
|
||||||
"CBaseServer__ConnectClient"
|
"CBaseServer__ConnectClient"
|
||||||
{
|
{
|
||||||
@@ -68,6 +68,18 @@
|
|||||||
"windows" "\x55\x8B\xEC\x83\xEC\x1C\x53\x57\x33\xD2"
|
"windows" "\x55\x8B\xEC\x83\xEC\x1C\x53\x57\x33\xD2"
|
||||||
"windows64" "\x4C\x8B\xDC\x49\x89\x5B\x2A\x49\x89\x6B\x2A\x56\x57\x41\x54\x41\x56\x41\x57\x48\x83\xEC\x60\x48\x8B\x05\x2A\x2A\x2A\x2A\x48\x8D\x1D"
|
"windows64" "\x4C\x8B\xDC\x49\x89\x5B\x2A\x49\x89\x6B\x2A\x56\x57\x41\x54\x41\x56\x41\x57\x48\x83\xEC\x60\x48\x8B\x05\x2A\x2A\x2A\x2A\x48\x8D\x1D"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"CSteam3Server__OnValidateAuthTicketResponse"
|
||||||
|
{
|
||||||
|
"library" "engine"
|
||||||
|
"linux" "@_ZN13CSteam3Server28OnValidateAuthTicketResponseEP28ValidateAuthTicketResponse_t"
|
||||||
|
}
|
||||||
|
|
||||||
|
"CBaseClient__SetSteamID"
|
||||||
|
{
|
||||||
|
"library" "engine"
|
||||||
|
"linux" "@_ZN11CBaseClient10SetSteamIDERK8CSteamID"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+802
-259
File diff suppressed because it is too large
Load Diff
@@ -55,6 +55,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
//virtual void SDK_OnPauseChange(bool paused);
|
//virtual void SDK_OnPauseChange(bool paused);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This is called once all known extensions have been loaded.
|
||||||
|
* Note: It is is a good idea to add natives here, if any are provided.
|
||||||
|
*/
|
||||||
|
virtual void SDK_OnAllLoaded();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief this is called when Core wants to know if your extension is working.
|
* @brief this is called when Core wants to know if your extension is working.
|
||||||
*
|
*
|
||||||
@@ -110,6 +117,11 @@ public: \
|
|||||||
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type) = NULL; \
|
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type) = NULL; \
|
||||||
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name)
|
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name)
|
||||||
|
|
||||||
|
#define DETOUR_MEMBER_MCALL_CALLBACK(name, classptr) \
|
||||||
|
((name##Class *)classptr->*(&name##Class::name))
|
||||||
|
#define DETOUR_MEMBER_MCALL_ORIGINAL(name, classptr) \
|
||||||
|
((name##Class *)classptr->*(name##Class::name##_Actual))
|
||||||
|
|
||||||
struct mfpDetails {
|
struct mfpDetails {
|
||||||
void *addr;
|
void *addr;
|
||||||
intptr_t adjustor;
|
intptr_t adjustor;
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#pragma once
|
||||||
|
#define NAME_SALT "your-salt-here"
|
||||||
@@ -40,8 +40,8 @@
|
|||||||
#define SMEXT_CONF_NAME "Connect"
|
#define SMEXT_CONF_NAME "Connect"
|
||||||
#define SMEXT_CONF_DESCRIPTION "Forward for early connection"
|
#define SMEXT_CONF_DESCRIPTION "Forward for early connection"
|
||||||
#define SMEXT_CONF_VERSION SM_FULL_VERSION
|
#define SMEXT_CONF_VERSION SM_FULL_VERSION
|
||||||
#define SMEXT_CONF_AUTHOR "Asher \"asherkin\" Baker"
|
#define SMEXT_CONF_AUTHOR "Asher \"asherkin\" Baker + jenz + zacade"
|
||||||
#define SMEXT_CONF_URL "http://limetech.org/"
|
#define SMEXT_CONF_URL "https://git.unloze.com/UNLOZE/sm-ext-connect"
|
||||||
#define SMEXT_CONF_LOGTAG "CONNECT"
|
#define SMEXT_CONF_LOGTAG "CONNECT"
|
||||||
#define SMEXT_CONF_LICENSE "GPL"
|
#define SMEXT_CONF_LICENSE "GPL"
|
||||||
#define SMEXT_CONF_DATESTRING __DATE__
|
#define SMEXT_CONF_DATESTRING __DATE__
|
||||||
|
|||||||
Reference in New Issue
Block a user