Files
ftpsrv/Makefile.linux
Roman Tarasov 09d62fc6b5 Configure and verify socket buffers before connection setup
Apply data socket options before connect and passive listen, and configure control listener buffers before the handshake. Verify effective buffer sizes, log rejected tuning requests, and propagate mandatory setup failures while preserving errno.

Prevent PASV and EPSV from reporting success after listener setup fails. Add regression checks for setup ordering, buffer fallback, and error handling, plus optional buffer diagnostics.
2026-09-23 21:36:06 +03:00

55 lines
1.8 KiB
Makefile

# Copyright (C) 2025 John Törnblom
#
# This file 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 3 of the License, or
# (at your option) any later version.
#
# 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; see the file COPYING. If not see
# <http://www.gnu.org/licenses/>.
ELF := ftpsrv-posix.elf
VERSION_TAG := $(shell git describe --abbrev=6 --dirty --always --tags)
CFLAGS := -Wall -Werror -DVERSION_TAG=\"$(VERSION_TAG)\" -I. -pthread
CFLAGS += -O2
SOURCE := srv.c cmd.c notify.c io.c self.c sha256.c
SOURCE += main-linux.c cmd-linux.c self-linux.c
SOURCE += io-linux.c
HEADERS := $(wildcard *.h)
.PHONY: all clean test check
all: $(ELF)
$(ELF): $(SOURCE) $(HEADERS) Makefile.linux
$(CC) $(CFLAGS) -o $@ $(SOURCE)
.build/test-control: test/test-control.c $(filter-out main-linux.c,$(SOURCE)) $(HEADERS) Makefile.linux
@mkdir -p .build
$(CC) $(CFLAGS) -o $@ test/test-control.c $(filter-out main-linux.c,$(SOURCE))
.build/test-sockets: test/test-sockets.c $(filter-out main-linux.c,$(SOURCE)) $(HEADERS) Makefile.linux
@mkdir -p .build
$(CC) $(CFLAGS) -o $@ test/test-sockets.c $(filter-out main-linux.c,$(SOURCE)) \
-Wl,--wrap=socket,--wrap=accept,--wrap=connect,--wrap=listen \
-Wl,--wrap=setsockopt,--wrap=getsockopt,--wrap=close
check: $(ELF) .build/test-control .build/test-sockets
./.build/test-control
./.build/test-sockets
python3 test/test-transfers.py ./$(ELF)
clean:
rm -f $(ELF)
test: $(ELF)
./$^