[Git][debian-proftpd-team/proftpd-mod-geoip2][upstream] New upstream version 0.1.1
Hilmar Preuße (@hilmar)
gitlab at salsa.debian.org
Sat May 23 09:45:12 BST 2026
Hilmar Preuße pushed to branch upstream at Debian ProFTPD Team / proftpd-mod-geoip2
Commits:
2b9bfae0 by Hilmar Preuße at 2026-05-23T10:25:03+02:00
New upstream version 0.1.1
- - - - -
7 changed files:
- + .codeql.yml
- + .github/workflows/ci.yml
- + .github/workflows/codeql.yml
- .gitignore
- − .travis.yml
- README.md
- mod_geoip2.c
Changes:
=====================================
.codeql.yml
=====================================
@@ -0,0 +1,3 @@
+---
+paths:
+ - contrib/mod_geoip2.c
=====================================
.github/workflows/ci.yml
=====================================
@@ -0,0 +1,154 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+ schedule:
+ - cron: '11 1 * * 0'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ env:
+ # Let's try opting into use of Nodejs v24; see:
+ # https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
+ # GitHub runners still causing problems with NodeJS v20; see:
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
+
+ strategy:
+ matrix:
+ compiler:
+ - clang
+ - gcc
+ container:
+ - almalinux:8
+ - alpine:3.18
+ - ubuntu:22.04
+
+ container: ${{ matrix.container }}
+
+ steps:
+ - name: Checkout ProFTPD
+ uses: actions/checkout at v6
+ with:
+ repository: proftpd/proftpd
+ path: proftpd
+
+ - name: Checkout module source code
+ uses: actions/checkout at v6
+ with:
+ path: proftpd-mod_geoip2
+
+ - name: Whitespace check
+ if: ${{ matrix.container == 'ubuntu:22.04' }}
+ run: |
+ apt-get update -qq
+ apt-get install -y git
+ cd proftpd-mod_geoip2
+ if [[ -n $(git diff --check HEAD^) ]]; then
+ echo "You must remove whitespace before submitting a pull request"
+ echo ""
+ git diff --check HEAD^
+ exit 1
+ fi
+
+ - name: Prepare module source code
+ run: |
+ cp proftpd-mod_geoip2/mod_geoip2.c proftpd/contrib/
+
+ - name: Install Alpine packages
+ if: ${{ matrix.container == 'alpine:3.18' }}
+ run: |
+ apk update
+ # for builds
+ apk add bash build-base clang compiler-rt gcc make zlib-dev
+ # for unit tests
+ apk add check check-dev subunit subunit-dev
+
+ # for geoip2 support
+ apk add libmaxminddb-dev
+
+ # for debugging
+ clang --version
+ gcc --version
+
+ - name: Install RPM packages
+ if: ${{ matrix.container == 'almalinux:8' }}
+ run: |
+ # Need to add other repos for e.g. libsodium
+ yum install -y dnf-plugins-core epel-release yum-utils clang gcc make zlib-devel
+ dnf config-manager --enable epel
+ dnf config-manager --set-enabled powertools
+ # for unit tests
+ yum install -y check-devel https://cbs.centos.org/kojifiles/packages/subunit/1.4.0/1.el8/x86_64/subunit-1.4.0-1.el8.x86_64.rpm https://cbs.centos.org/kojifiles/packages/subunit/1.4.0/1.el8/x86_64/subunit-devel-1.4.0-1.el8.x86_64.rpm
+ # for geoip2 support
+ yum install -y libmaxminddb-devel
+
+ # for debugging
+ clang --version
+ gcc --version
+
+ - name: Install Ubuntu packages
+ if: ${{ matrix.container == 'ubuntu:22.04' }}
+ run: |
+ apt-get update -qq
+ # for builds
+ apt-get install -y clang gcc make
+ # for unit tests
+ apt-get install -y check libsubunit-dev
+
+ # for geoip2 support
+ apt-get install -y libmaxminddb-dev
+
+ # for integration/regression test
+ # for test code coverage
+ apt-get install -y lcov ruby
+ gem install coveralls-lcov
+ # for HTML validation
+ apt-get install -y tidy
+ # for debugging
+ clang --version
+ gcc --version
+
+ - name: Prepare code coverage
+ if: ${{ matrix.container == 'ubuntu:22.04' }}
+ run: |
+ lcov --directory proftpd --zerocounters
+
+ - name: Build as static module
+ env:
+ CC: ${{ matrix.compiler }}
+ run: |
+ cd proftpd
+ ./configure LIBS="-lm -lsubunit -lrt -pthread" --enable-devel=coverage --enable-tests --with-modules=mod_geoip2
+ make
+
+ - name: Install as static module
+ run: |
+ cd proftpd
+ make install
+
+ - name: Build as shared module
+ env:
+ CC: ${{ matrix.compiler }}
+ run: |
+ cd proftpd
+ make clean
+ ./configure LIBS="-lm -lsubunit -lrt -pthread" --enable-devel --enable-dso --with-shared=mod_geoip2
+ make
+
+ - name: Install as shared module
+ run: |
+ cd proftpd
+ make install
+
+ - name: Check HTML docs
+ run: |
+ cd proftpd-mod_geoip2
+ echo "Processing mod_geoip2.html"
+ tidy -errors -omit -q mod_geoip2.html | exit 0
=====================================
.github/workflows/codeql.yml
=====================================
@@ -0,0 +1,82 @@
+name: CodeQL
+
+on:
+ push:
+ branches:
+ - master
+ paths-ignore:
+ - '**/*.md'
+ - '**/doc/*'
+ pull_request:
+ branches:
+ - master
+ paths-ignore:
+ - '**/*.md'
+ - '**/doc/*'
+ schedule:
+ - cron: "5 5 * * 5"
+
+jobs:
+ analyze:
+ name: CodeQL Analysis
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ env:
+ # Let's try opting into use of Nodejs v24; see:
+ # https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
+ # GitHub runners still causing problems with NodeJS v20; see:
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
+
+ strategy:
+ fail-fast: true
+ matrix:
+ language:
+ - cpp
+
+ steps:
+ - name: Checkout ProFTPD
+ uses: actions/checkout at v6
+ with:
+ repository: proftpd/proftpd
+
+ - name: Checkout mod_geoip2
+ uses: actions/checkout at v6
+ with:
+ path: proftpd-mod_geoip2
+
+ - name: Install Packages
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libmaxminddb-dev
+
+ - name: Prepare module
+ run: |
+ cp proftpd-mod_geoip2/mod_geoip2.c contrib/mod_geoip2.c
+
+ - name: Configure
+ run: |
+ ./configure --with-modules=mod_geoip2
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init at v4
+ with:
+ languages: ${{ matrix.language }}
+ config-file: proftpd-mod_geoip2/.codeql.yml
+ queries: +security-and-quality
+ source-root: proftpd-mod_geoip2
+
+ - name: Build
+ run: |
+ make
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze at v4
+ with:
+ category: "/language:${{ matrix.language }}"
+ checkout_path: proftpd-mod_geoip2
+ output: sarif-results
+ upload: true
=====================================
.gitignore
=====================================
@@ -1,3 +1,4 @@
+configure
Makefile
config.status
autom4te.cache
=====================================
.travis.yml deleted
=====================================
@@ -1,28 +0,0 @@
-language: c
-
-compiler:
- - gcc
- - clang
-
-install:
- - sudo apt-get update -qq
- # for MaxMinDB support
- - sudo apt-get install -y libmaxminddb-dev
- # for test code coverage
- - sudo apt-get install -y lcov
- - gem install coveralls-lcov
-
-before_script:
- - cd ${TRAVIS_BUILD_DIR}
- - lcov --directory . --zerocounters
-
-script:
- - git clone --depth 50 https://github.com/proftpd/proftpd.git
- - cp mod_geoip2.c proftpd/contrib/
- - cd proftpd
- - ./configure --enable-dso --with-shared=mod_geoip2
- - make
- - make clean
- - ./configure --with-modules=mod_geoip2
- - make
- # Run `tidy -e -q mod_geoip2.html` for doc validation
=====================================
README.md
=====================================
@@ -3,7 +3,7 @@ proftpd-mod_geoip2
Status
------
-[](https://travis-ci.org/Castaglia/proftpd-mod_geoip2)
+[](https://github.com/Castaglia/proftpd-mod_geoip2/actions/workflows/ci.yml)
[](https://img.shields.io/badge/license-GPL-brightgreen.svg)
Synopsis
@@ -12,5 +12,5 @@ The `mod_geoip2` module for ProFTPD uses the MaxMind GeoIP library to look
up geographic information on connecting clients, and to provide ACLs based
on that geographic information.
-See the [mod_geoip2.html](https://htmlpreview.github.io/?https://github.com/Castaglia/proftpd-mod_geoip2/blob/master/mod_geoip2.html) documentation for more
+See the [mod_geoip2.html](https://github.com/Castaglia/proftpd-mod_geoip2/blob/master/mod_geoip2.html) documentation for more
details.
=====================================
mod_geoip2.c
=====================================
@@ -1,6 +1,6 @@
/*
* ProFTPD: mod_geoip2 -- a module for looking up country/city/etc for clients
- * Copyright (c) 2019 TJ Saunders
+ * Copyright (c) 2019-2023 TJ Saunders
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@
* module for Apache.
*/
-#define MOD_GEOIP2_VERSION "mod_geoip2/0.1"
+#define MOD_GEOIP2_VERSION "mod_geoip2/0.1.1"
/* Make sure the version of proftpd is as necessary. */
#if PROFTPD_VERSION_NUMBER < 0x0001030402
@@ -324,7 +324,7 @@ static int check_geoip_filters(geoip_policy_e policy) {
pr_regex_t *filter_re;
const char *filter_name, *filter_pattern, *filter_value;
- filter = ((struct geoip_filter **) filters->elts)[i];
+ filter = ((struct geoip_filter **) filters->elts)[i];
filter_id = filter->filter_id;
filter_pattern = filter->filter_pattern;
filter_re = filter->filter_re;
@@ -488,6 +488,12 @@ static const char *get_geoip_filter_value(int filter_id) {
}
break;
+ case GEOIP_FILTER_KEY_REGION_CODE:
+ if (geoip_region_code != NULL) {
+ return geoip_region_code;
+ }
+ break;
+
case GEOIP_FILTER_KEY_REGION_NAME:
if (geoip_region_name != NULL) {
return geoip_region_name;
@@ -669,7 +675,11 @@ static const char *get_geoip_data_text(pool *p, MMDB_lookup_result_s *lookup,
char buf[64];
memset(buf, '\0', sizeof(buf));
+#if PROFTPD_VERSION_NUMBER >= 0x0001030705
pr_snprintf(buf, sizeof(buf)-1, "%lu", (unsigned long) entry_data.uint32);
+#else
+ snprintf(buf, sizeof(buf)-1, "%lu", (unsigned long) entry_data.uint32);
+#endif /* ProFTPD 1.3.7 */
text = pstrdup(p, buf);
break;
}
@@ -678,7 +688,11 @@ static const char *get_geoip_data_text(pool *p, MMDB_lookup_result_s *lookup,
char buf[64];
memset(buf, '\0', sizeof(buf));
+#if PROFTPD_VERSION_NUMBER >= 0x0001030705
pr_snprintf(buf, sizeof(buf)-1, "%f", entry_data.double_value);
+#else
+ snprintf(buf, sizeof(buf)-1, "%f", entry_data.double_value);
+#endif /* ProFTPD 1.3.7 */
text = pstrdup(p, buf);
break;
}
@@ -754,7 +768,7 @@ static void get_geoip_data(void) {
lookup_path[0] = "continent";
lookup_path[1] = "code";
- lookup_path[2] = NULL;
+ lookup_path[2] = NULL;
text = get_geoip_data_text(geoip2_pool, &lookup, lookup_path,
GEOIP_FILTER_KEY_CONTINENT);
if (text != NULL) {
@@ -1189,12 +1203,15 @@ MODRET geoip2_post_pass(cmd_rec *cmd) {
*/
res = check_geoip_filters(geoip_policy);
if (res < 0) {
+ const char *user;
+
+ user = pr_table_get(session.notes, "mod_auth.orig-user", NULL);
(void) pr_log_writefile(geoip2_logfd, MOD_GEOIP2_VERSION,
- "connection from %s denied due to GeoIP filter/policy",
- pr_netaddr_get_ipstr(session.c->remote_addr));
+ "connection from IP %s, user '%s' denied due to GeoIP filter/policy",
+ pr_netaddr_get_ipstr(session.c->remote_addr), user);
pr_log_pri(PR_LOG_NOTICE, MOD_GEOIP2_VERSION
- ": Connection denied to %s due to GeoIP filter/policy",
- pr_netaddr_get_ipstr(session.c->remote_addr));
+ ": Connection denied from IP %s, user '%s' due to GeoIP filter/policy",
+ pr_netaddr_get_ipstr(session.c->remote_addr), user);
pr_event_generate("mod_geoip.connection-denied", NULL);
pr_session_disconnect(&geoip2_module, PR_SESS_DISCONNECT_CONFIG_ACL,
@@ -1353,10 +1370,10 @@ static int geoip2_sess_init(void) {
res = check_geoip_filters(geoip_policy);
if (res < 0) {
(void) pr_log_writefile(geoip2_logfd, MOD_GEOIP2_VERSION,
- "connection from %s denied due to GeoIP filter/policy",
+ "connection from IP %s denied due to GeoIP filter/policy",
pr_netaddr_get_ipstr(session.c->remote_addr));
pr_log_pri(PR_LOG_NOTICE, MOD_GEOIP2_VERSION
- ": Connection denied to %s due to GeoIP filter/policy",
+ ": Connection denied from IP %s due to GeoIP filter/policy",
pr_netaddr_get_ipstr(session.c->remote_addr));
pr_event_generate("mod_geoip.connection-denied", NULL);
View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd-mod-geoip2/-/commit/2b9bfae094d1d648072bc562fe307315bd38232d
--
View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd-mod-geoip2/-/commit/2b9bfae094d1d648072bc562fe307315bd38232d
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
More information about the Pkg-proftpd-maintainers
mailing list