[Git][debian-proftpd-team/proftpd-mod-msg][upstream] New upstream version 0.5.1
Hilmar Preuße (@hilmar)
gitlab at salsa.debian.org
Tue Apr 1 08:19:54 BST 2025
Hilmar Preuße pushed to branch upstream at Debian ProFTPD Team / proftpd-mod-msg
Commits:
eeec58e0 by Hilmar Preuße at 2025-04-01T09:14:52+02:00
New upstream version 0.5.1
- - - - -
22 changed files:
- + .github/workflows/ci.yml
- + .gitignore
- − .travis.yml
- README.md
- − debian/changelog
- − debian/compat
- − debian/control
- − debian/copyright
- − debian/patches/01c862d404df2e6c9c06c6229efc113a6623d215.patch
- − debian/patches/error-format-security.patch
- − debian/patches/proftpd-1.3.6_rc4-msg-refresh-api.patch
- − debian/patches/series
- − debian/proftpd-mod-msg.dirs
- − debian/proftpd-mod-msg.doc-base
- − debian/proftpd-mod-msg.docs
- − debian/proftpd-mod-msg.install
- − debian/proftpd-mod-msg.links
- − debian/rules
- − debian/source/format
- − debian/templates/msg.conf
- − debian/watch
- mod_msg.c
Changes:
=====================================
.github/workflows/ci.yml
=====================================
@@ -0,0 +1,155 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+ schedule:
+ - cron: '11 1 * * 0'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ 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 v3
+ with:
+ repository: proftpd/proftpd
+ path: proftpd
+
+ - name: Checkout module source code
+ uses: actions/checkout at v3
+ with:
+ path: proftpd-mod_msg
+
+ - name: Whitespace check
+ if: ${{ matrix.container == 'ubuntu:22.04' }}
+ run: |
+ apt-get update -qq
+ apt-get install -y git
+ cd proftpd-mod_msg
+ 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_msg/mod_msg.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 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 clang gcc make zlib-devel
+ # 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 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 integration/regression test
+ apt-get install -y \
+ libdata-dumper-simple-perl \
+ libdatetime-perl \
+ libfile-copy-recursive-perl \
+ libfile-path-tiny-perl \
+ libfile-spec-native-perl \
+ libnet-inet6glue-perl \
+ libnet-ssh2-perl \
+ libnet-ssleay-perl \
+ libnet-telnet-perl \
+ libposix-2008-perl \
+ libtest-unit-perl \
+ libtime-hr-perl \
+ libwww-perl
+ PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'install Net::FTPSSL'
+
+ # 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-ctrls --enable-devel=coverage --enable-tests --with-modules=mod_msg
+ 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-ctrls --enable-devel --enable-dso --with-shared=mod_msg
+ make
+
+ - name: Install as shared module
+ run: |
+ cd proftpd
+ make install
+
+ - name: Check HTML docs
+ run: |
+ cd proftpd-mod_msg
+ echo "Processing mod_msg.html"
+ tidy -errors -omit -q mod_msg.html | exit 0
=====================================
.gitignore
=====================================
@@ -0,0 +1,5 @@
+*.lo
+*~
+*.swo
+*.swp
+tests.log
=====================================
.travis.yml deleted
=====================================
@@ -1,36 +0,0 @@
-language: c
-
-compiler:
- - gcc
- - clang
-
-install:
- - sudo apt-get update -qq
- # for libarchive
- - sudo apt-get install -y libarchive-dev
- # for libbz2
- - sudo apt-get install -y libbz2-dev
- # for unit tests
- - sudo apt-get install -y check
- # for static code analysis
- - sudo apt-get install -y cppcheck rats
- # for test code coverage
- - sudo apt-get install -y lcov
- - gem install coveralls-lcov
-
-before_script:
- - cd ${TRAVIS_BUILD_DIR}
- - lcov --directory . --zerocounters
-
-script:
- # - find . -type f -name "*.c" -print | grep -v t\/ | xargs cppcheck 2>&1
- # - find . -type f -name "*.c" -print | grep -v t\/ | xargs rats --language=c
- - git clone --depth 10 https://github.com/proftpd/proftpd.git
- - cp mod_msg.c proftpd/contrib/
- - cd proftpd
- - ./configure LIBS='-lm -lrt -pthread' --enable-ctrls --enable-devel=coverage --enable-dso --enable-tests --with-shared=mod_msg
- - make
- - make clean
- - ./configure LIBS='-lm -lrt -pthread' --enable-ctrls --enable-devel=coverage --enable-tests --with-modules=mod_msg
- - make
- # Run `tidy -e -q mod_msg.html` for doc validation
=====================================
README.md
=====================================
@@ -3,7 +3,7 @@ proftpd-mod_msg
Status
------
-[](https://travis-ci.org/Castaglia/proftpd-mod_msg)
+[](https://github.com/Castaglia/proftpd-mod_msg/actions/workflows/ci.yml)
[](https://img.shields.io/badge/license-GPL-brightgreen.svg)
=====================================
debian/changelog deleted
=====================================
@@ -1,47 +0,0 @@
-proftpd-mod-msg (0.5-1) UNRELEASED; urgency=medium
-
- [ Hilmar Preuße ]
-
- * New upstream release
- * 01c862d404df2e6c9c06c6229efc113a6623d215.patch: address compiler warnings
- * Do not install *.la and *.a files.
-
- -- Francesco Paolo Lovergine <frankie at debian.org> Fri, 13 Apr 2018 19:51:26 +0200
-
-proftpd-mod-msg (0.4.1-2) unstable; urgency=low
-
- [ Fabrizio Regalli ]
- * Removing libacl1-dev as BD and increasing proftpd-dev to (>= 1.3.4~rc3-2~)
-
- [Hilmar Preuße]
- * Patch from Gentoo[1] to make module work w/ ProFTP 1.3.6:
- proftpd-1.3.6_rc4-msg-refresh-api.patch
- (Closes: #892372)
-
- * Remove Fabrizio Regalli from uploaders list
- * d/control: Remove "DM-Upload-Allowed" field
- * d/rules: add --without python-support to dh call
- * d/rules: overhaul clean target to make it work
- * raise dh compat level to 9, adapt bd version accordingly
- * tighten BD version of proftp-dev to 1.3.6
- * Standards Version 4.1.3, no changes needed.
-
- [1] https://gitweb.gentoo.org/repo/gentoo.git/commit/net-ftp/proftpd/files/proftpd-1.3.6_rc4-msg-refresh-api.patch?id=fba48bedb74f80376bb3a6761a052244350f4fd8
-
- -- Francesco Paolo Lovergine <frankie at debian.org> Thu, 15 Mar 2018 12:10:44 +0100
-
-proftpd-mod-msg (0.4.1-1.1) unstable; urgency=low
-
- * Non-maintainer upload.
- * Fix "FTBFS: mod_msg.c:314:5: error: format not a string literal and
- no format arguments [-Werror=format-security]": add patch
- error-format-security.patch (add format strings).
- (Closes: #666283)
-
- -- gregor herrmann <gregoa at debian.org> Sun, 15 Apr 2012 14:06:55 +0200
-
-proftpd-mod-msg (0.4.1-1) unstable; urgency=low
-
- * Initial Release. (Closes: #623225)
-
- -- Fabrizio Regalli <fabreg at fabreg.it> Mon, 18 Apr 2011 16:15:28 +0200
=====================================
debian/compat deleted
=====================================
@@ -1 +0,0 @@
-9
=====================================
debian/control deleted
=====================================
@@ -1,20 +0,0 @@
-Source: proftpd-mod-msg
-Section: net
-Priority: optional
-Maintainer: ProFTPD Maintainance Team <pkg-proftpd-maintainers at lists.alioth.debian.org>
-Uploaders: Francesco Paolo Lovergine <frankie at debian.org>
-Build-Depends: debhelper (>= 9~), proftpd-dev (>= 1.3.6)
-Standards-Version: 4.1.3
-Homepage: http://www.castaglia.org/proftpd/modules/mod_msg.html
-Vcs-Git: git://git.debian.org/pkg-proftpd/proftpd-mod-msg.git
-Vcs-Browser: http://git.debian.org/?p=pkg-proftpd/proftpd-mod-msg.git;a=summary
-
-
-Package: proftpd-mod-msg
-Architecture: any
-Depends: proftpd-basic (>= 1.3.3d-4~), ${misc:Depends}, ${shlibs:Depends}, ${proftpd:Depends}
-Description: ProFTPD module mod_msg
- The mod_msg module allows system users to send messages to connected
- clients via the ftpdctl program. The module works by creating a SysV
- message queue, which is used to pass messages from the daemon process
- to session processes.
=====================================
debian/copyright deleted
=====================================
@@ -1,30 +0,0 @@
-Format: http://dep.debian.net/deps/dep5/
-Upstream-Name: mod_msg
-Upstream-Contact: TJ Saunders
-Source: http://www.castaglia.org/proftpd/modules/mod_msg.html
-
-Files: *
-Copyright: 2007-2010, TJ Saunders
-License: GPL-2+
-
-License: GPL-2+
- This package 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; either version 2 of the License, or
- (at your option) any later version.
- .
- This package 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/>
- .
- On Debian systems, the complete text of the GNU General
- Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
-
-Files: debian/*
-Copyright: 2011, Fabrizio Regalli <fabreg at fabreg.it>
-License: GPL-2+
-
=====================================
debian/patches/01c862d404df2e6c9c06c6229efc113a6623d215.patch deleted
=====================================
@@ -1,97 +0,0 @@
-From 01c862d404df2e6c9c06c6229efc113a6623d215 Mon Sep 17 00:00:00 2001
-From: TJ Saunders <tj at castaglia.org>
-Date: Wed, 11 Apr 2018 07:06:41 -0700
-Subject: [PATCH] Address compiler warnings about signedness mismatches.
-
----
- mod_msg.c | 20 ++++++++++++--------
- 1 file changed, 12 insertions(+), 8 deletions(-)
-
-diff --git a/mod_msg.c b/mod_msg.c
-index 7567253..757a53f 100644
---- a/mod_msg.c
-+++ b/mod_msg.c
-@@ -509,7 +509,7 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
-
- /* Handle 'msg user' requests. */
- if (strcmp(reqargv[0], "user") == 0) {
-- register unsigned int i = 0;
-+ register int i = 0;
- pr_scoreboard_entry_t *score = NULL;
- const char *user, *msgstr = "";
- size_t msglen;
-@@ -530,9 +530,10 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
- * be a maximum length on this strength, depending on the maximum msg
- * size allowed for SysV message queues.
- */
-- for (i = 2; i < reqargc; i++)
-+ for (i = 2; i < reqargc; i++) {
- msgstr = pstrcat(ctrl->ctrls_tmp_pool, msgstr, *msgstr ? " " : "",
- reqargv[i], NULL);
-+ }
-
- msglen = strlen(msgstr) + 1;
-
-@@ -577,7 +578,7 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
-
- /* Handle 'msg host' requests. */
- } else if (strcmp(reqargv[0], "host") == 0) {
-- register unsigned int i = 0;
-+ register int i = 0;
- pr_scoreboard_entry_t *score = NULL;
- const char *addr, *msgstr = "";
- const pr_netaddr_t *na;
-@@ -596,9 +597,10 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
- * be a maximum length on this strength, depending on the maximum msg
- * size allowed for SysV message queues.
- */
-- for (i = 2; i < reqargc; i++)
-+ for (i = 2; i < reqargc; i++) {
- msgstr = pstrcat(ctrl->ctrls_tmp_pool, msgstr, *msgstr ? " " : "",
- reqargv[i], NULL);
-+ }
-
- if (strlen(msgstr) >= MSGMAX) {
- pr_ctrls_add_response(ctrl, "message exceeds maximum length (%u). "
-@@ -645,7 +647,7 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
-
- /* Handle 'msg class' requests. */
- } else if (strcmp(reqargv[0], "class") == 0) {
-- register unsigned int i = 0;
-+ register int i = 0;
- pr_scoreboard_entry_t *score;
- const char *class = reqargv[1], *msgstr = "";
-
-@@ -663,9 +665,10 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
- * be a maximum length on this strength, depending on the maximum msg
- * size allowed for SysV message queues.
- */
-- for (i = 2; i < reqargc; i++)
-+ for (i = 2; i < reqargc; i++) {
- msgstr = pstrcat(ctrl->ctrls_tmp_pool, msgstr, *msgstr ? " " : "",
- reqargv[i], NULL);
-+ }
-
- if (strlen(msgstr) >= MSGMAX) {
- pr_ctrls_add_response(ctrl, "message exceeds maximum length (%u). "
-@@ -700,7 +703,7 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
-
- /* Handle 'msg all' requests. */
- } else if (strcmp(reqargv[0], "all") == 0) {
-- register unsigned int i = 0;
-+ register int i = 0;
- pr_scoreboard_entry_t *score;
- const char *msgstr = "";
-
-@@ -713,9 +716,10 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
- * be a maximum length on this strength, depending on the maximum msg
- * size allowed for SysV message queues.
- */
-- for (i = 1; i < reqargc; i++)
-+ for (i = 1; i < reqargc; i++) {
- msgstr = pstrcat(ctrl->ctrls_tmp_pool, msgstr, *msgstr ? " " : "",
- reqargv[i], NULL);
-+ }
-
- if (strlen(msgstr) >= MSGMAX) {
- pr_ctrls_add_response(ctrl, "message exceeds maximum length (%u). "
=====================================
debian/patches/error-format-security.patch deleted
=====================================
@@ -1,27 +0,0 @@
-Description: add format strings
-Origin: vendor
-Bug-Debian: http://bugs.debian.org/666283
-Forwarded: no
-Author: gregor herrmann <gregoa at debian.org>
-Last-Update: 2012-04-15
-
---- a/mod_msg.c
-+++ b/mod_msg.c
-@@ -311,7 +311,7 @@
- /* Tack on any messages to this command. */
- msgs = (char **) msg_pending_list->elts;
- for (i = 0; i < msg_pending_list->nelts; i++)
-- pr_response_add(R_DUP, msgs[i]);
-+ pr_response_add(R_DUP, "%s", msgs[i]);
-
- /* Clear the pending pool. */
- destroy_pool(msg_pending_pool);
-@@ -343,7 +343,7 @@
- /* Tack on any messages to this command. */
- msgs = (char **) msg_pending_list->elts;
- for (i = 0; i < msg_pending_list->nelts; i++)
-- pr_response_add_err(R_DUP, msgs[i]);
-+ pr_response_add_err(R_DUP, "%s", msgs[i]);
-
- /* Clear the pending pool. */
- destroy_pool(msg_pending_pool);
=====================================
debian/patches/proftpd-1.3.6_rc4-msg-refresh-api.patch deleted
=====================================
@@ -1,29 +0,0 @@
-diff --git a/mod_msg.c b/mod_msg.c
-index 70bce69..4ce6bd7 100644
---- a/mod_msg.c
-+++ b/mod_msg.c
-@@ -52,10 +52,14 @@ extern pid_t mpid;
-
- module msg_module;
-
--#ifndef USE_CTRLS
-+#ifndef PR_USE_CTRLS
- # error "mod_msg requires Controls support (--enable-ctrls)"
- #endif /* USE_CTRLS */
-
-+#define pr_scoreboard_read_entry pr_scoreboard_entry_read
-+#define DECLINED PR_DECLINED
-+#define HANDLED PR_HANDLED
-+
- static ctrls_acttab_t msg_acttab[];
-
- static int msg_engine = FALSE;
-@@ -709,7 +713,7 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
- if (msg_send_msg(score->sce_pid, msgstr) < 0) {
- msg_errno = errno;
- (void) pr_log_writefile(msg_logfd, MOD_MSG_VERSION,
-- "error sending message to all (pid %u): %s", reqargv[1],
-+ "error sending message to all (pid %u): %s",
- score->sce_pid, strerror(errno));
-
- } else
=====================================
debian/patches/series deleted
=====================================
@@ -1,3 +0,0 @@
-#error-format-security.patch
-#proftpd-1.3.6_rc4-msg-refresh-api.patch
-01c862d404df2e6c9c06c6229efc113a6623d215.patch
=====================================
debian/proftpd-mod-msg.dirs deleted
=====================================
@@ -1,2 +0,0 @@
-usr/lib/proftpd
-usr/share/proftpd/templates
=====================================
debian/proftpd-mod-msg.doc-base deleted
=====================================
@@ -1,9 +0,0 @@
-Document: proftpd-mod-msg
-Title: Documentation for the mod_msg ProFTPD
-Author:
-Abstract: Configuration reference, modules documentation, FAQs and HOWTOs
-Section: System/Administration
-
-Format: HTML
-Index: /usr/share/doc/proftpd-mod-msg/mod_msg.html
-Files: /usr/share/doc/proftpd-mod-msg/*.html
=====================================
debian/proftpd-mod-msg.docs deleted
=====================================
@@ -1,2 +0,0 @@
-mod_msg.html
-README.md
=====================================
debian/proftpd-mod-msg.install deleted
=====================================
@@ -1 +0,0 @@
-debian/templates/msg.conf usr/share/doc/proftpd-mod-msg/
=====================================
debian/proftpd-mod-msg.links deleted
=====================================
@@ -1 +0,0 @@
-usr/share/doc/proftpd-mod-msg/msg.conf usr/share/proftpd/templates/msg.conf
=====================================
debian/rules deleted
=====================================
@@ -1,25 +0,0 @@
-#!/usr/bin/make -f
-# -*- makefile -*-
-
-export DH_VERBOSE=1
-VERSION=$(shell grep PROFTPD_VERSION_TEXT /usr/include/proftpd/version.h|cut -d\" -f2)
-MODULE_NAME=mod_msg
-DEBNAME=proftpd-mod-msg
-
-%:
- dh $@ --without python-support
-
-override_dh_auto_build:
- DESTDIR=$(CURDIR)/debian/$(DEBNAME) prxs -c $(MODULE_NAME).c
-
-override_dh_auto_install:
- DESTDIR=$(CURDIR)/debian/$(DEBNAME) prxs -i -c $(MODULE_NAME).c
- rm -f $(CURDIR)/debian/$(DEBNAME)/usr/lib/proftpd/*.la \
- $(CURDIR)/debian/$(DEBNAME)/usr/lib/proftpd/*.a
-
-override_dh_gencontrol:
- cat /usr/share/proftpd/proftpd-substvars >>$(CURDIR)/debian/$(DEBNAME).substvars
- dh_gencontrol
-
-override_dh_auto_clean:
- DESTDIR=$(CURDIR)/debian/$(DEBNAME) prxs -d $(MODULE_NAME).c
=====================================
debian/source/format deleted
=====================================
@@ -1 +0,0 @@
-3.0 (quilt)
=====================================
debian/templates/msg.conf deleted
=====================================
@@ -1,73 +0,0 @@
-#
-# Proftpd sample configuration for mod_msg.
-#
-<IfModule mod_msg.c>
-
- MessageEngine on
-
- # MessageEngine
- # Syntax: MessageEngine on|off
- # Default: off
- # Context: server config, <VirtualHost>, <Global>
-
- # The MessageEngine directive enables or disables the module's runtime message queue.
- # If it is set to off this module does no passing of messages. Use this directive to
- # disable the module instead of commenting out all mod_msg directives.
-
- MessageLog /var/log/proftpd/msg.log
-
- # MessageLog
- # Syntax: MessageLog path|"none"
- # Default: None
- # Context: server config Module: mod_msg
-
- # The MessageLog directive is used to a specify a log file for mod_msg reporting and debugging.
- # The path parameter must be the full path to the file to use for logging. Note that this path
- # must not be to a world-writeable directory and, unless AllowLogSymlinks is explicitly set to
- # on (generally a bad idea), the path must not be a symbolic link.
-
- # If path is "none", no logging will be done at all.
-
- MessageQueue /var/log/proftpd/msg.queue
-
- # MessageQueue
- # Syntax: MessageQueue path
- # Default: None
- # Context: server config Module: mod_msg
-
- # The MessageQueue directive configures a path to a file that mod_msg will use when sending messages.
- # This file itself is not used for storing messages; it is necessary for obtaining a unique key to use
- # as the ID for the message queue.
-
- # Control Actions
-
- # msg
- # Syntax: ftpdctl msg [class|host|user name]|[all] message
- # Purpose: Send a message to a class, host, user, or all
-
- # The msg control action can be used to send messages to connected clients. Any words that follow the
- # given user or host name in the ftpdctl command will be sent to the connected session, and added to the
- # response to the session's next FTP command. Note, however, that some command responses cannot be altered,
- # such as EPSV, PASV, or STOU; mod_msg avoids these command responses. Note: some FTP clients may not display
- # the text messages of FTP responses to the user; there is nothing that mod_msg can do when such clients are used.
-
-
- # Examples:
-
-
- # ftpdctl msg user dave Dave, you need to delete some files
- # ftpdctl msg all This server will be going offline for maintenance soon
-
- MessageControlsACLs msg allow user *
-
- # MessageControlsACLs
- # Syntax: MessageControlsACLs actions|"all" "allow"|"deny" "user"|"group" list
- # Default: None
- # Context: server config Module: mod_msg
-
- # Example:
-
- # # Allow all users to send messages to connected clients
- # MessageControlsACLs msg allow user *
-
-</IfModule>
=====================================
debian/watch deleted
=====================================
@@ -1,2 +0,0 @@
-version=3
-http://www.castaglia.org/proftpd/modules/proftpd-mod-msg-([\d\.]+)\.tar\.gz
=====================================
mod_msg.c
=====================================
@@ -1,6 +1,6 @@
/*
* ProFTPD: mod_msg -- a module for sending messages to connected clients
- * Copyright (c) 2004-2018 TJ Saunders
+ * Copyright (c) 2004-2025 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
@@ -21,7 +21,7 @@
* resulting executable, without including the source code for OpenSSL in the
* source distribution.
*
- * This is mod_msg, contrib software for proftpd 1.2 and above.
+ * This is mod_msg, contrib software for proftpd 1.3.x and above.
* For more information contact TJ Saunders <tj at castaglia.org>.
*/
@@ -36,7 +36,7 @@
# define MSGMAX 8192
#endif /* MSGMAX */
-#define MOD_MSG_VERSION "mod_msg/0.5"
+#define MOD_MSG_VERSION "mod_msg/0.5.1"
/* Make sure the version of proftpd is as necessary. */
#if PROFTPD_VERSION_NUMBER < 0x0001030604
@@ -50,7 +50,7 @@ extern pid_t mpid;
module msg_module;
-#ifndef PR_USE_CTRLS
+#if !defined(PR_USE_CTRLS)
# error "mod_msg requires Controls support (--enable-ctrls)"
#endif /* PR_USE_CTRLS */
@@ -136,8 +136,9 @@ static int msg_recv_msg(void) {
}
msg = malloc(sizeof(struct mq_msg) + MSGMAX - sizeof(msg->mtext));
- if (!msg)
- end_login(1);
+ if (msg == NULL) {
+ pr_session_end(0);
+ }
msglen = msgrcv(msg_qid, msg, sizeof(buf), getpid(),
IPC_NOWAIT|MSG_NOERROR);
@@ -164,8 +165,9 @@ static int msg_recv_msg(void) {
#ifdef ENOMSG
errno != ENOMSG &&
#endif /* ENOMSG */
- errno != EAGAIN)
+ errno != EAGAIN) {
return -1;
+ }
return nmsgs;
}
@@ -178,8 +180,9 @@ static int msg_send_msg(pid_t dst_pid, const char *msgstr) {
size_t msglen = strlen(msgstr) + 1;
msg = malloc(sizeof(struct mq_msg) + MSGMAX - sizeof(msg->mtext));
- if (!msg)
- end_login(1);
+ if (msg == NULL) {
+ pr_session_end(0);
+ }
msg->mtype = dst_pid;
sstrncpy(msg->mtext, msgstr, msglen);
@@ -201,9 +204,10 @@ static int msg_send_msg(pid_t dst_pid, const char *msgstr) {
res = kill(dst_pid, SIGUSR2);
PRIVS_RELINQUISH
- if (res < 0)
+ if (res < 0) {
(void) pr_log_writefile(msg_logfd, MOD_MSG_VERSION,
"error sending notice: %s", strerror(errno));
+ }
return 0;
}
@@ -221,22 +225,26 @@ MODRET set_msgctrlsacls(cmd_rec *cmd) {
/* We can cheat here, and use the ctrls_parse_acl() routine to
* separate the given string...
*/
- actions = ctrls_parse_acl(cmd->tmp_pool, cmd->argv[1]);
+ actions = pr_ctrls_parse_acl(cmd->tmp_pool, cmd->argv[1]);
/* Check the second parameter to make sure it is "allow" or "deny" */
if (strcmp(cmd->argv[2], "allow") != 0 &&
- strcmp(cmd->argv[2], "deny") != 0)
+ strcmp(cmd->argv[2], "deny") != 0) {
CONF_ERROR(cmd, "second parameter must be 'allow' or 'deny'");
+ }
/* Check the third parameter to make sure it is "user" or "group" */
if (strcmp(cmd->argv[3], "user") != 0 &&
- strcmp(cmd->argv[3], "group") != 0)
+ strcmp(cmd->argv[3], "group") != 0) {
CONF_ERROR(cmd, "third parameter must be 'user' or 'group'");
+ }
- if ((bad_action = ctrls_set_module_acls(msg_acttab, msg_pool,
- actions, cmd->argv[2], cmd->argv[3], cmd->argv[4])) != NULL)
+ bad_action = pr_ctrls_set_module_acls(msg_acttab, msg_pool, actions,
+ cmd->argv[2], cmd->argv[3], cmd->argv[4]);
+ if (bad_action != NULL) {
CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, ": unknown action: '",
bad_action, "'", NULL));
+ }
return PR_HANDLED(cmd);
}
@@ -299,7 +307,7 @@ MODRET msg_post_any(cmd_rec *cmd) {
}
/* If there are no messages pending for this process, be done now. */
- if (!msg_pending_list ||
+ if (msg_pending_list == NULL ||
msg_pending_list->nelts == 0) {
return PR_DECLINED(cmd);
}
@@ -336,7 +344,7 @@ MODRET msg_post_err_any(cmd_rec *cmd) {
}
/* If there are no messages pending for this process, be done now. */
- if (!msg_pending_list ||
+ if (msg_pending_list == NULL ||
msg_pending_list->nelts == 0) {
return PR_DECLINED(cmd);
}
@@ -377,9 +385,11 @@ static void msg_exit_ev(const void *event_data, void *user_data) {
ServerType == SERVER_STANDALONE) {
struct msqid_ds ds;
- if (msgctl(msg_qid, IPC_RMID, &ds) < 0 && errno != EINVAL)
+ if (msgctl(msg_qid, IPC_RMID, &ds) < 0 &&
+ errno != EINVAL) {
pr_log_debug(DEBUG1, MOD_MSG_VERSION ": error removing queue %d: %s",
msg_qid, strerror(errno));
+ }
}
}
@@ -391,7 +401,7 @@ static void msg_postparse_ev(const void *event_data, void *user_data) {
*/
c = find_config(main_server->conf, CONF_PARAM, "MessageLog", FALSE);
- if (c) {
+ if (c != NULL) {
const char *path = c->argv[0];
if (strcasecmp(path, "none") != 0 &&
@@ -402,43 +412,46 @@ static void msg_postparse_ev(const void *event_data, void *user_data) {
}
}
- if (msg_queue_path)
+ if (msg_queue_path != NULL) {
msg_queue_fh = pr_fsio_open(msg_queue_path, O_RDWR|O_CREAT);
- else
+ } else {
errno = EINVAL;
+ }
- if (!msg_queue_fh) {
+ if (msg_queue_fh == NULL) {
(void) pr_log_writefile(msg_logfd, MOD_MSG_VERSION,
"error opening MessageQueue: %s", strerror(errno));
} else {
msg_qid = msg_get_queue(msg_queue_path);
- if (msg_qid < 0)
+ if (msg_qid < 0) {
(void) pr_log_writefile(msg_logfd, MOD_MSG_VERSION,
"error obtaining queue ID: %s", strerror(errno));
-else
-pr_log_debug(DEBUG0, MOD_MSG_VERSION ": obtained queue ID %d", msg_qid);
+
+ } else {
+ pr_log_debug(DEBUG0, MOD_MSG_VERSION ": obtained queue ID %d", msg_qid);
+ }
}
}
static void msg_restart_ev(const void *event_data, void *user_data) {
register unsigned int i;
- if (msg_pool)
+ if (msg_pool != NULL) {
destroy_pool(msg_pool);
+ }
msg_pool = make_sub_pool(permanent_pool);
pr_pool_tag(msg_pool, MOD_MSG_VERSION);
for (i = 0; msg_acttab[i].act_action; i++) {
msg_acttab[i].act_acl = pcalloc(msg_pool, sizeof(ctrls_acl_t));
- ctrls_init_acl(msg_acttab[i].act_acl);
+ pr_ctrls_init_acl(msg_acttab[i].act_acl);
}
}
static void msg_sigusr2_ev(const void *event_data, void *user_data) {
-
/* Check the queue for any messages for us. */
int res = msg_recv_msg();
@@ -461,11 +474,12 @@ static void msg_sigusr2_ev(const void *event_data, void *user_data) {
}
static void msg_startup_ev(const void *event_data, void *user_data) {
- int res;
+ int res, xerrno;
/* Make sure the process has an fd to the scoreboard. */
PRIVS_ROOT
res = pr_open_scoreboard(O_RDWR);
+ xerrno = errno;
PRIVS_RELINQUISH
if (res < 0) {
@@ -483,7 +497,7 @@ static void msg_startup_ev(const void *event_data, void *user_data) {
break;
default:
- pr_log_debug(DEBUG0, "error opening scoreboard: %s", strerror(errno));
+ pr_log_debug(DEBUG0, "error opening scoreboard: %s", strerror(xerrno));
break;
}
}
@@ -496,20 +510,21 @@ static void msg_startup_ev(const void *event_data, void *user_data) {
static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
int res = 0, msg_errno = 0, msg_know_dst = FALSE, msg_sent = FALSE;
- if (!ctrls_check_acl(ctrl, msg_acttab, "msg")) {
+ if (!pr_ctrls_check_acl(ctrl, msg_acttab, "msg")) {
pr_ctrls_add_response(ctrl, "access denied");
return -1;
}
/* Sanity check */
- if (reqargc == 0 || reqargv == NULL) {
+ if (reqargc == 0 ||
+ reqargv == NULL) {
pr_ctrls_add_response(ctrl, "missing required parameters");
return -1;
}
/* Handle 'msg user' requests. */
if (strcmp(reqargv[0], "user") == 0) {
- register unsigned int i = 0;
+ register int i = 0;
pr_scoreboard_entry_t *score = NULL;
const char *user, *msgstr = "";
size_t msglen;
@@ -530,9 +545,10 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
* be a maximum length on this strength, depending on the maximum msg
* size allowed for SysV message queues.
*/
- for (i = 2; i < reqargc; i++)
+ for (i = 2; i < reqargc; i++) {
msgstr = pstrcat(ctrl->ctrls_tmp_pool, msgstr, *msgstr ? " " : "",
reqargv[i], NULL);
+ }
msglen = strlen(msgstr) + 1;
@@ -577,7 +593,7 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
/* Handle 'msg host' requests. */
} else if (strcmp(reqargv[0], "host") == 0) {
- register unsigned int i = 0;
+ register int i = 0;
pr_scoreboard_entry_t *score = NULL;
const char *addr, *msgstr = "";
const pr_netaddr_t *na;
@@ -596,9 +612,10 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
* be a maximum length on this strength, depending on the maximum msg
* size allowed for SysV message queues.
*/
- for (i = 2; i < reqargc; i++)
+ for (i = 2; i < reqargc; i++) {
msgstr = pstrcat(ctrl->ctrls_tmp_pool, msgstr, *msgstr ? " " : "",
reqargv[i], NULL);
+ }
if (strlen(msgstr) >= MSGMAX) {
pr_ctrls_add_response(ctrl, "message exceeds maximum length (%u). "
@@ -607,7 +624,7 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
}
na = pr_netaddr_get_addr(ctrl->ctrls_tmp_pool, reqargv[1], NULL);
- if (!na) {
+ if (na == NULL) {
pr_ctrls_add_response(ctrl, "msg host: error resolving '%s': %s",
reqargv[1], strerror(errno));
return -1;
@@ -645,7 +662,7 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
/* Handle 'msg class' requests. */
} else if (strcmp(reqargv[0], "class") == 0) {
- register unsigned int i = 0;
+ register int i = 0;
pr_scoreboard_entry_t *score;
const char *class = reqargv[1], *msgstr = "";
@@ -663,9 +680,10 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
* be a maximum length on this strength, depending on the maximum msg
* size allowed for SysV message queues.
*/
- for (i = 2; i < reqargc; i++)
+ for (i = 2; i < reqargc; i++) {
msgstr = pstrcat(ctrl->ctrls_tmp_pool, msgstr, *msgstr ? " " : "",
reqargv[i], NULL);
+ }
if (strlen(msgstr) >= MSGMAX) {
pr_ctrls_add_response(ctrl, "message exceeds maximum length (%u). "
@@ -700,7 +718,7 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
/* Handle 'msg all' requests. */
} else if (strcmp(reqargv[0], "all") == 0) {
- register unsigned int i = 0;
+ register int i = 0;
pr_scoreboard_entry_t *score;
const char *msgstr = "";
@@ -713,9 +731,10 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
* be a maximum length on this strength, depending on the maximum msg
* size allowed for SysV message queues.
*/
- for (i = 1; i < reqargc; i++)
+ for (i = 1; i < reqargc; i++) {
msgstr = pstrcat(ctrl->ctrls_tmp_pool, msgstr, *msgstr ? " " : "",
reqargv[i], NULL);
+ }
if (strlen(msgstr) >= MSGMAX) {
pr_ctrls_add_response(ctrl, "message exceeds maximum length (%u). "
@@ -751,16 +770,17 @@ static int msg_handle_msg(pr_ctrls_t *ctrl, int reqargc, char **reqargv) {
return -1;
}
- if (msg_sent)
+ if (msg_sent == TRUE) {
pr_ctrls_add_response(ctrl, "message sent");
- else if (!msg_know_dst)
+ } else if (msg_know_dst == FALSE) {
pr_ctrls_add_response(ctrl, "unable to send message: "
"no such client connected");
- else
+ } else {
pr_ctrls_add_response(ctrl, "error sending message: %s",
strerror(msg_errno));
+ }
return res;
}
@@ -776,13 +796,14 @@ static int msg_init(void) {
for (i = 0; msg_acttab[i].act_action; i++) {
msg_acttab[i].act_acl = pcalloc(msg_pool, sizeof(ctrls_acl_t));
- ctrls_init_acl(msg_acttab[i].act_acl);
+ pr_ctrls_init_acl(msg_acttab[i].act_acl);
if (pr_ctrls_register(&msg_module, msg_acttab[i].act_action,
- msg_acttab[i].act_desc, msg_acttab[i].act_cb) < 0)
+ msg_acttab[i].act_desc, msg_acttab[i].act_cb) < 0) {
pr_log_pri(PR_LOG_INFO, MOD_MSG_VERSION
": error registering '%s' control: %s",
msg_acttab[i].act_action, strerror(errno));
+ }
}
pr_event_register(&msg_module, "core.exit", msg_exit_ev, NULL);
@@ -799,7 +820,7 @@ static int msg_sess_init(void) {
/* If there was an error opening the MessageQueue, force the module to
* be inoperative. We'd much rather not operate without the MessageQueue.
*/
- if (!msg_queue_fh) {
+ if (msg_queue_fh == NULL) {
msg_engine = FALSE;
(void) pr_log_writefile(msg_logfd, MOD_MSG_VERSION,
"missing required MessageQueue, disabling module");
@@ -814,12 +835,16 @@ static int msg_sess_init(void) {
}
c = find_config(main_server->conf, CONF_PARAM, "MessageEngine", FALSE);
- if (c &&
- *((unsigned char *) c->argv[0]) == TRUE)
- msg_engine = TRUE;
+ if (c != NULL) {
+ unsigned char engine;
+
+ engine = *((unsigned char *) c->argv[0]);
+ msg_engine = engine;
+ }
- if (!msg_engine)
+ if (msg_engine == FALSE) {
return 0;
+ }
pr_event_register(&msg_module, "core.signal.USR2", msg_sigusr2_ev, NULL);
pr_event_unregister(&msg_module, "core.exit", msg_exit_ev);
View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd-mod-msg/-/commit/eeec58e0ca9b2488984bd2cc34c811cc32efe1e1
--
View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd-mod-msg/-/commit/eeec58e0ca9b2488984bd2cc34c811cc32efe1e1
You're receiving this email because of your account on salsa.debian.org.
More information about the Pkg-proftpd-maintainers
mailing list