Compare commits
5 Commits
803431d804
...
474d09d21a
Author | SHA1 | Date |
---|---|---|
Oskari Rauta | 474d09d21a | |
Josef Schlehofer | 9d49df0dab | |
Josef Schlehofer | 6d5e404a0c | |
Paul Spooren | 26c101edc3 | |
Oskari Rauta | 365e7063a3 |
|
@ -1,93 +0,0 @@
|
|||
FROM debian:10
|
||||
|
||||
|
||||
# Configuration version history
|
||||
# v1.0 - Initial version by Etienne Champetier
|
||||
# v1.0.1 - Run as non-root, add unzip, xz-utils
|
||||
# v1.0.2 - Add bzr
|
||||
# v1.0.3 - Verify usign signatures
|
||||
# v1.0.4 - Add support for Python3
|
||||
# v1.0.5 - Add 19.07 public keys, verify keys
|
||||
# v1.0.6 - Add 21.02 public keys, update Debian image to version 10, add rsync
|
||||
# v1.0.7 - Add 22.03 public keys, 18.06 v2 gpg key, 18.06 usign key
|
||||
|
||||
RUN apt update && apt install -y \
|
||||
build-essential \
|
||||
bzr \
|
||||
curl \
|
||||
jq \
|
||||
gawk \
|
||||
gettext \
|
||||
git \
|
||||
libncurses5-dev \
|
||||
libssl-dev \
|
||||
python \
|
||||
python3 \
|
||||
signify-openbsd \
|
||||
subversion \
|
||||
rsync \
|
||||
time \
|
||||
unzip \
|
||||
wget \
|
||||
xz-utils \
|
||||
zlib1g-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd -c "OpenWrt Builder" -m -d /home/build -s /bin/bash build
|
||||
USER build
|
||||
ENV HOME /home/build
|
||||
|
||||
# OpenWrt Build System (PGP key for unattended snapshot builds)
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/626471F1.asc' | gpg --import \
|
||||
&& gpg --fingerprint --with-colons '<pgpsign-snapshots@openwrt.org>' | grep '^fpr:::::::::54CC74307A2C6DC9CE618269CD84BCED626471F1:$' \
|
||||
&& echo '54CC74307A2C6DC9CE618269CD84BCED626471F1:6:' | gpg --import-ownertrust
|
||||
|
||||
# OpenWrt Build System (PGP key for 17.01 "Reboot" release builds)
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/D52BBB6B.asc' | gpg --import \
|
||||
&& gpg --fingerprint --with-colons '<pgpsign-17.01@openwrt.org>' | grep '^fpr:::::::::B09BE781AE8A0CD4702FDCD3833C6010D52BBB6B:$' \
|
||||
&& echo 'B09BE781AE8A0CD4702FDCD3833C6010D52BBB6B:6:' | gpg --import-ownertrust
|
||||
|
||||
# OpenWrt Release Builder (18.06 Signing Key)
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/17E1CE16.asc' | gpg --import \
|
||||
&& gpg --fingerprint --with-colons '<openwrt-devel@lists.openwrt.org>' | grep '^fpr:::::::::6768C55E79B032D77A28DA5F0F20257417E1CE16:$' \
|
||||
&& echo '6768C55E79B032D77A28DA5F0F20257417E1CE16:6:' | gpg --import-ownertrust
|
||||
|
||||
# OpenWrt Build System (PGP key for 18.06 release builds)
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/15807931.asc' | gpg --import \
|
||||
&& gpg --fingerprint --with-colons '<pgpsign-18.06@openwrt.org>' | grep '^fpr:::::::::AD0507363D2BCE9C9E36CEC4FBCB78F015807931:$' \
|
||||
&& echo 'AD0507363D2BCE9C9E36CEC4FBCB78F015807931:6:' | gpg --import-ownertrust
|
||||
|
||||
# OpenWrt Build System (PGP key for 19.07 release builds)
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/2074BE7A.asc' | gpg --import \
|
||||
&& gpg --fingerprint --with-colons '<pgpsign-19.07@openwrt.org>' | grep '^fpr:::::::::D9C6901F45C9B86858687DFF28A39BC32074BE7A:$' \
|
||||
&& echo 'D9C6901F45C9B86858687DFF28A39BC32074BE7A:6:' | gpg --import-ownertrust
|
||||
|
||||
# OpenWrt Build System (PGP key for 21.02 release builds)
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/88CA59E8.asc' | gpg --import \
|
||||
&& gpg --fingerprint --with-colons '<pgpsign-21.02@openwrt.org>' | grep '^fpr:::::::::667205E379BAF348863A5C6688CA59E88F681580:$' \
|
||||
&& echo '667205E379BAF348863A5C6688CA59E88F681580:6:' | gpg --import-ownertrust
|
||||
|
||||
# OpenWrt Build System (GnuPGP key for 22.03 release builds)
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/CD54E82DADB3684D.asc' | gpg --import \
|
||||
&& gpg --fingerprint --with-colons '<pgpsign-22.03@openwrt.org>' | grep '^fpr:::::::::BF856781A01293C8409ABE72CD54E82DADB3684D:$' \
|
||||
&& echo 'BF856781A01293C8409ABE72CD54E82DADB3684D:6:' | gpg --import-ownertrust
|
||||
|
||||
# untrusted comment: Public usign key for unattended snapshot builds
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=usign/b5043e70f9a75cde' --create-dirs -o /home/build/usign/b5043e70f9a75cde \
|
||||
&& echo 'd7ac10f9ed1b38033855f3d27c9327d558444fca804c685b17d9dcfb0648228f */home/build/usign/b5043e70f9a75cde' | sha256sum --check
|
||||
|
||||
# untrusted comment: Public usign key for 18.06 release builds
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=usign/1035ac73cc4e59e3' --create-dirs -o /home/build/usign/1035ac73cc4e59e3 \
|
||||
&& echo '8dc2e7f5c4e634437e6641f4df77a18bf59f0c8e9016c8ba4be5d4a0111e68c2 */home/build/usign/1035ac73cc4e59e3' | sha256sum --check
|
||||
|
||||
# untrusted comment: Public usign key for 19.07 release builds
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=usign/f94b9dd6febac963' --create-dirs -o /home/build/usign/f94b9dd6febac963 \
|
||||
&& echo 'b1d09457cfbc36fccfe18382d65c54a2ade3e7fd3902da490a53aa517b512755 */home/build/usign/f94b9dd6febac963' | sha256sum --check
|
||||
|
||||
# untrusted comment: Public usign key for 21.02 release builds
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=usign/2f8b0b98e08306bf' --create-dirs -o /home/build/usign/2f8b0b98e08306bf \
|
||||
&& echo 'd102bdd75421c62490b97f520f9db06aadb44ad408b244755d26e96ea5cd3b7f */home/build/usign/2f8b0b98e08306bf' | sha256sum --check
|
||||
|
||||
# untrusted comment: Public usign key for 22.03 release builds
|
||||
RUN curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=usign/4d017e6f1ed5d616' --create-dirs -o /home/build/usign/4d017e6f1ed5d616 \
|
||||
&& echo 'f3c5fdf447d7c2743442e68077d60acc7c3e91754849e1f4b6be837b4204b7e2 */home/build/usign/4d017e6f1ed5d616' | sha256sum --check
|
|
@ -1,6 +0,0 @@
|
|||
# Build/update the docker image
|
||||
|
||||
docker pull debian:10
|
||||
docker build --rm -t docker.io/openwrtorg/packages-cci:latest .
|
||||
docker tag <IMAGE ID> docker.io/openwrtorg/packages-cci:<VERSION-TAG>
|
||||
docker push docker.io/openwrtorg/packages-cci
|
|
@ -1,182 +0,0 @@
|
|||
version: 2.0
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: docker.io/openwrtorg/packages-cci:v1.0.7
|
||||
environment:
|
||||
- SDK_HOST: "downloads.openwrt.org"
|
||||
- SDK_PATH: "snapshots/targets/ath79/generic"
|
||||
- SDK_FILE: "openwrt-sdk-ath79-generic_*.Linux-x86_64.tar.xz"
|
||||
- BRANCH: "master"
|
||||
steps:
|
||||
- checkout:
|
||||
path: ~/openwrt_packages
|
||||
|
||||
- run:
|
||||
name: Check changes / verify commits
|
||||
working_directory: ~/openwrt_packages
|
||||
command: |
|
||||
cat >> $BASH_ENV <<EOF
|
||||
echo_red() { printf "\033[1;31m\$*\033[m\n"; }
|
||||
echo_green() { printf "\033[1;32m\$*\033[m\n"; }
|
||||
echo_blue() { printf "\033[1;34m\$*\033[m\n"; }
|
||||
EOF
|
||||
source $BASH_ENV
|
||||
|
||||
RET=0
|
||||
for commit in $(git rev-list HEAD ^origin/$BRANCH); do
|
||||
echo_blue "=== Checking commit '$commit'"
|
||||
if git show --format='%P' -s $commit | grep -qF ' '; then
|
||||
echo_red "Pull request should not include merge commits"
|
||||
RET=1
|
||||
fi
|
||||
|
||||
author="$(git show -s --format=%aN $commit)"
|
||||
if echo $author | grep -q '\S\+\s\+\S\+'; then
|
||||
echo_green "Author name ($author) seems ok"
|
||||
else
|
||||
echo_red "Author name ($author) need to be your real name 'firstname lastname'"
|
||||
RET=1
|
||||
fi
|
||||
|
||||
subject="$(git show -s --format=%s $commit)"
|
||||
if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_-]\+: ' -e '^Revert '; then
|
||||
echo_green "Commit subject line seems ok ($subject)"
|
||||
else
|
||||
echo_red "Commit subject line MUST start with '<package name>: ' ($subject)"
|
||||
RET=1
|
||||
fi
|
||||
|
||||
body="$(git show -s --format=%b $commit)"
|
||||
sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)"
|
||||
if echo "$body" | grep -qF "$sob"; then
|
||||
echo_green "Signed-off-by match author"
|
||||
else
|
||||
echo_red "Signed-off-by is missing or doesn't match author (should be '$sob')"
|
||||
RET=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RET
|
||||
|
||||
- run:
|
||||
name: Download the SDK
|
||||
working_directory: ~/sdk
|
||||
command: |
|
||||
curl "https://$SDK_HOST/$SDK_PATH/sha256sums" -sS -o sha256sums
|
||||
curl "https://$SDK_HOST/$SDK_PATH/sha256sums.asc" -fs -o sha256sums.asc || true
|
||||
curl "https://$SDK_HOST/$SDK_PATH/sha256sums.sig" -fs -o sha256sums.sig || true
|
||||
if [ ! -f sha256sums.asc ] && [ ! -f sha256sums.sig ]; then
|
||||
echo_red "Missing sha256sums signature files"
|
||||
exit 1
|
||||
fi
|
||||
[ ! -f sha256sums.asc ] || gpg --with-fingerprint --verify sha256sums.asc sha256sums
|
||||
if [ -f sha256sums.sig ]; then
|
||||
VERIFIED=
|
||||
for KEY in ~/usign/*; do
|
||||
echo "Trying $KEY..."
|
||||
if signify-openbsd -V -q -p "$KEY" -x sha256sums.sig -m sha256sums; then
|
||||
echo "...verified"
|
||||
VERIFIED=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$VERIFIED" ]; then
|
||||
echo_red "Could not verify usign signature"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
rsync -av "$SDK_HOST::downloads/$SDK_PATH/$SDK_FILE" .
|
||||
sha256sum -c --ignore-missing sha256sums
|
||||
|
||||
- run:
|
||||
name: Prepare build_dir
|
||||
working_directory: ~/build_dir
|
||||
command: |
|
||||
tar Jxf ~/sdk/$SDK_FILE --strip=1
|
||||
touch .config
|
||||
make prepare-tmpinfo scripts/config/conf
|
||||
./scripts/config/conf --defconfig=.config Config.in
|
||||
make prereq
|
||||
rm .config
|
||||
cat > feeds.conf <<EOF
|
||||
src-git base https://github.com/openwrt/openwrt.git;$BRANCH
|
||||
src-link packages $HOME/openwrt_packages
|
||||
src-git luci https://github.com/openwrt/luci.git;$BRANCH
|
||||
EOF
|
||||
cat feeds.conf
|
||||
./scripts/feeds update -a > /dev/null
|
||||
make defconfig > /dev/null
|
||||
# enable BUILD_LOG
|
||||
sed -i 's/# CONFIG_BUILD_LOG is not set/CONFIG_BUILD_LOG=y/' .config
|
||||
|
||||
- run:
|
||||
name: Install & download source, check package, compile
|
||||
working_directory: ~/build_dir
|
||||
command: |
|
||||
set +o pipefail
|
||||
PKGS=$(cd ~/openwrt_packages; git diff --diff-filter=d --name-only "origin/$BRANCH..." | grep 'Makefile$' | grep -Ev '/files/|/src/' | awk -F/ '{ print $(NF-1) }')
|
||||
if [ -z "$PKGS" ] ; then
|
||||
echo_blue "WARNING: No new or modified packages found!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo_blue "=== Found new/modified packages: $PKGS"
|
||||
for PKG in $PKGS ; do
|
||||
echo_blue "===+ Install: $PKG"
|
||||
./scripts/feeds install "$PKG"
|
||||
|
||||
echo_blue "===+ Download: $PKG"
|
||||
make "package/$PKG/download" V=s
|
||||
|
||||
echo_blue "===+ Check package: $PKG"
|
||||
make "package/$PKG/check" V=s 2>&1 | tee logtmp
|
||||
RET=${PIPESTATUS[0]}
|
||||
|
||||
if [ $RET -ne 0 ]; then
|
||||
echo_red "=> Package check failed: $RET)"
|
||||
exit $RET
|
||||
fi
|
||||
|
||||
badhash_msg="HASH does not match "
|
||||
badhash_msg+="|HASH uses deprecated hash,"
|
||||
badhash_msg+="|HASH is missing,"
|
||||
if grep -qE "$badhash_msg" logtmp; then
|
||||
echo_red "=> Package HASH check failed"
|
||||
exit 1
|
||||
fi
|
||||
echo_green "=> Package check OK"
|
||||
done
|
||||
|
||||
make \
|
||||
-f .config \
|
||||
-f tmp/.packagedeps \
|
||||
-f <(echo '$(info $(sort $(package-y) $(package-m)))'; echo -en 'a:\n\t@:') \
|
||||
| tr ' ' '\n' >enabled-package-subdirs.txt
|
||||
for PKG in $PKGS ; do
|
||||
if ! grep -m1 -qE "(^|/)$PKG$" enabled-package-subdirs.txt; then
|
||||
echo_red "===+ Building: $PKG skipped. It cannot be enabled with $SDK_FILE"
|
||||
continue
|
||||
fi
|
||||
echo_blue "===+ Building: $PKG"
|
||||
make "package/$PKG/compile" -j3 V=s || {
|
||||
RET=$?
|
||||
echo_red "===+ Building: $PKG failed, rebuilding with -j1 for human readable error log"
|
||||
make "package/$PKG/compile" -j1 V=s; exit $RET
|
||||
}
|
||||
done
|
||||
|
||||
- store_artifacts:
|
||||
path: ~/build_dir/logs
|
||||
|
||||
- store_artifacts:
|
||||
path: ~/build_dir/bin
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
buildpr:
|
||||
jobs:
|
||||
- build:
|
||||
filters:
|
||||
branches:
|
||||
ignore: master
|
|
@ -1,8 +1,8 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=syslog-ng
|
||||
PKG_VERSION:=4.6.0
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=4.7.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>
|
||||
PKG_LICENSE:=LGPL-2.1-or-later GPL-2.0-or-later
|
||||
|
@ -11,7 +11,7 @@ PKG_CPE_ID:=cpe:/a:balabit:syslog-ng
|
|||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/syslog-ng/syslog-ng/releases/download/$(PKG_NAME)-$(PKG_VERSION)/
|
||||
PKG_HASH:=b69e3360dfb96a754a4e1cbead4daef37128b1152a23572356db4ab64a475d4f
|
||||
PKG_HASH:=5477189a2d12325aa4faebfcf59f5bdd9084234732f0c3ec16dd253847dacf1c
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Collect all local logs into a single file /var/log/messages.
|
||||
# See https://www.syslog-ng.com/technical-documents/list/syslog-ng-open-source-edition
|
||||
|
||||
@version: 4.6
|
||||
@version: 4.7
|
||||
@include "scl.conf"
|
||||
|
||||
options {
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sftp-server
|
||||
PKG_VERSION:=2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/ewxrjk/sftpserver.git
|
||||
PKG_SOURCE_DATE:=2024-04-17
|
||||
PKG_SOURCE_VERSION:=454309adcd99e3253f106f1f634e800e4d098b18
|
||||
PKG_MIRROR_HASH:=9590f6c0d4defe820eed8f359f5f782cd87801ca40c2c2f0d160e521bc80dc3b
|
||||
|
||||
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/sftp-server
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=SSH
|
||||
TITLE:=Green End SFTP Server
|
||||
CONFLICTS:=openssh-sftp-server
|
||||
URL:=http://www.greenend.org.uk/rjk/sftpserver/
|
||||
endef
|
||||
|
||||
define Package/sftp-server/description
|
||||
This is an SFTP server supporting up to protocol version 6.
|
||||
It is possible to use it as a drop-in replacement
|
||||
for the OpenSSH server.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += --libexecdir=/usr/libexec
|
||||
|
||||
define Package/sftp-server/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/libexec/gesftpserver $(1)/usr/libexec/sftp-server
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sftp-server))
|
|
@ -0,0 +1,83 @@
|
|||
From 234709884c84896511d5d5d52f5f7926b44ca6ad Mon Sep 17 00:00:00 2001
|
||||
From: Andy Pan <andypan@ntuosc.org>
|
||||
Date: Wed, 6 Sep 2023 14:12:03 +0800
|
||||
Subject: [PATCH] Eliminate autoconf warnings
|
||||
|
||||
---
|
||||
acinclude.m4 | 20 ++++++++++----------
|
||||
configure.ac | 6 +++---
|
||||
2 files changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
--- a/acinclude.m4
|
||||
+++ b/acinclude.m4
|
||||
@@ -120,10 +120,10 @@ $suppress \
|
||||
fi
|
||||
AC_CACHE_CHECK([whether <inttypes.h> macros produce warnings],
|
||||
[rjk_cv_inttypeswarnings],[
|
||||
- AC_TRY_COMPILE([#include <stddef.h>
|
||||
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
-#include <inttypes.h>],
|
||||
- [uint64_t x=0;size_t sz=0;printf("%"PRIu64" %zu\n", x, sz);],
|
||||
+#include <inttypes.h>]],[
|
||||
+ [uint64_t x=0;size_t sz=0;printf("%"PRIu64" %zu\n", x, sz);]])],
|
||||
[rjk_cv_inttypeswarnings=no],
|
||||
[rjk_cv_inttypeswarnings=yes])
|
||||
])
|
||||
@@ -144,16 +144,16 @@ AC_DEFUN([RJK_GTKFLAGS],[
|
||||
AC_DEFUN([RJK_STAT_TIMESPEC],[
|
||||
AC_CACHE_CHECK([for timespec style in struct stat],[rjk_cv_stat_timespec],[
|
||||
rjk_cv_stat_timespec=none
|
||||
- AC_TRY_COMPILE([#include <sys/stat.h>],[
|
||||
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]],[[
|
||||
struct stat sb;
|
||||
sb.st_atim.tv_sec = 0;
|
||||
(void)sb;
|
||||
- ],[rjk_cv_stat_timespec=POSIX])
|
||||
- AC_TRY_COMPILE([#include <sys/stat.h>],[
|
||||
+ ]])],[rjk_cv_stat_timespec=POSIX],[])
|
||||
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]],[[
|
||||
struct stat sb;
|
||||
sb.st_atimespec.tv_sec = 0;
|
||||
(void)sb;
|
||||
- ],[rjk_cv_stat_timespec=BSD])
|
||||
+ ]])],[rjk_cv_stat_timespec=BSD],[])
|
||||
])
|
||||
case "$rjk_cv_stat_timespec" in
|
||||
BSD )
|
||||
@@ -243,12 +243,12 @@ AC_DEFUN([RJK_SIZE_MAX],[
|
||||
AC_CHECK_SIZEOF([size_t])
|
||||
AC_CHECK_HEADERS([stdint.h])
|
||||
AC_CACHE_CHECK([for SIZE_MAX],[rjk_cv_size_max],[
|
||||
- AC_TRY_COMPILE([#include <limits.h>
|
||||
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#if HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
- #endif],
|
||||
- [size_t x = SIZE_MAX;++x;],
|
||||
+ #endif]],
|
||||
+ [[size_t x = SIZE_MAX;++x;]])],
|
||||
[rjk_cv_size_max=yes],
|
||||
[rjk_cv_size_max=no])
|
||||
])
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -17,14 +17,14 @@
|
||||
# USA
|
||||
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
-AC_INIT(sftpserver, 2, rjk@greenend.org.uk)
|
||||
+AC_INIT([sftpserver],[2],[rjk@greenend.org.uk])
|
||||
AC_CONFIG_AUX_DIR([config.aux])
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
AC_CONFIG_SRCDIR([alloc.c])
|
||||
-AM_CONFIG_HEADER([config.h])
|
||||
+AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
AC_PROG_CC
|
||||
-AC_SET_MAKE
|
||||
+AC_PROG_MAKE_SET
|
||||
|
||||
#AC_PROG_LIBTOOL
|
||||
#AC_LIBTOOL_DLOPEN
|
|
@ -0,0 +1,21 @@
|
|||
From b5113a1a3fd72dca5d358ce8c8c7f387f7f9356b Mon Sep 17 00:00:00 2001
|
||||
From: Andy Pan <andy0130tw@yahoo.com.tw>
|
||||
Date: Mon, 13 Nov 2023 01:09:56 +0800
|
||||
Subject: [PATCH] Fix config script where rl_copy_text is not found in old
|
||||
libedit.
|
||||
|
||||
ref. https://github.com/gphoto/gphoto2/issues/381
|
||||
---
|
||||
configure.ac | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -41,6 +41,7 @@ AC_CHECK_LIB([socket],[socket])
|
||||
AC_CHECK_LIB([readline],[readline],
|
||||
[AC_SUBST([LIBREADLINE],[-lreadline])
|
||||
AC_DEFINE([HAVE_READLINE],[1],[define if you have a readline library])])
|
||||
+AC_CHECK_LIB([readline],[rl_copy_text])
|
||||
RJK_ICONV
|
||||
AC_DEFINE([_GNU_SOURCE], [1], [required for e.g. strsignal])
|
||||
AC_C_INLINE
|
|
@ -0,0 +1,21 @@
|
|||
From 5b944c94527555457ee76815351d50a662892929 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Pan <andy0130tw@yahoo.com.tw>
|
||||
Date: Mon, 13 Nov 2023 01:13:35 +0800
|
||||
Subject: [PATCH] Do not print char >= 0x7f even if isprint returns nonzero
|
||||
|
||||
... which is seemingly caused by `setlocale(LC_CTYPE, "");`
|
||||
---
|
||||
debug.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/debug.c
|
||||
+++ b/debug.c
|
||||
@@ -75,7 +75,7 @@ void sftp_debug_hexdump(const void *ptr,
|
||||
output += 2;
|
||||
for(j = 0; j < 16; ++j)
|
||||
if(i + j < n)
|
||||
- *output++ = isprint(p[i + j]) ? p[i + j] : '.';
|
||||
+ *output++ = (isprint(p[i + j]) && p[i + j] < 0x7f) ? p[i + j] : '.';
|
||||
*output++ = '\n';
|
||||
*output = 0;
|
||||
fputs(buffer, debugfp);
|
|
@ -0,0 +1,127 @@
|
|||
From 1c589910e6726bfc2d01ec01092ae744174f7219 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Pan <andy0130tw@yahoo.com.tw>
|
||||
Date: Thu, 16 Nov 2023 03:25:04 +0800
|
||||
Subject: [PATCH] Add an option --websocat in SFTP server
|
||||
|
||||
---
|
||||
configure.ac | 2 +-
|
||||
send.c | 8 ++++++++
|
||||
sftpclient.c | 3 +++
|
||||
sftpserver.c | 19 +++++++++++++++++++
|
||||
sftpserver.h | 7 +++++++
|
||||
5 files changed, 38 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -41,7 +41,7 @@ AC_CHECK_LIB([socket],[socket])
|
||||
AC_CHECK_LIB([readline],[readline],
|
||||
[AC_SUBST([LIBREADLINE],[-lreadline])
|
||||
AC_DEFINE([HAVE_READLINE],[1],[define if you have a readline library])])
|
||||
-AC_CHECK_LIB([readline],[rl_copy_text])
|
||||
+AC_CHECK_LIB([readline],[rl_copy_text],[true])
|
||||
RJK_ICONV
|
||||
AC_DEFINE([_GNU_SOURCE], [1], [required for e.g. strsignal])
|
||||
AC_C_INLINE
|
||||
--- a/send.c
|
||||
+++ b/send.c
|
||||
@@ -93,6 +93,14 @@ void sftp_send_end(struct worker *w) {
|
||||
D(("%s:", sendtype));
|
||||
sftp_debug_hexdump(w->buffer + 4, w->bufused - 4);
|
||||
}
|
||||
+
|
||||
+ if (websocat_compatible) {
|
||||
+ uint32_t buf_prefix = htonl(w->bufused);
|
||||
+ if ((n = write(sftpout, &buf_prefix, 4)) != 4) {
|
||||
+ sftp_fatal("error sending response prefix: %s", strerror(errno));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Write the whole buffer, coping with short writes */
|
||||
written = 0;
|
||||
while((size_t)written < w->bufused)
|
||||
--- a/sftpclient.c
|
||||
+++ b/sftpclient.c
|
||||
@@ -132,6 +132,9 @@ static int forceversion;
|
||||
|
||||
static char *sftp_realpath(const char *path);
|
||||
|
||||
+/* used in server; unused in client. */
|
||||
+int websocat_compatible;
|
||||
+
|
||||
enum {
|
||||
OPT_QUIRK_REVERSE_SYMLINK = 256,
|
||||
OPT_STOP_ON_ERROR,
|
||||
--- a/sftpserver.c
|
||||
+++ b/sftpserver.c
|
||||
@@ -82,8 +82,14 @@ static const struct queuedetails workque
|
||||
const struct sftpprotocol *protocol = &sftp_preinit;
|
||||
const char sendtype[] = "response";
|
||||
|
||||
+int websocat_compatible;
|
||||
+
|
||||
/* Options */
|
||||
|
||||
+enum {
|
||||
+ OPT_WEBSOCAT_COMPATIBLE = 256,
|
||||
+};
|
||||
+
|
||||
static const struct option options[] = {
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
@@ -99,6 +105,7 @@ static const struct option options[] = {
|
||||
{"ipv4", no_argument, 0, '4'},
|
||||
{"ipv6", no_argument, 0, '6'},
|
||||
#endif
|
||||
+ {"websocat", no_argument, 0, OPT_WEBSOCAT_COMPATIBLE},
|
||||
{"readonly", no_argument, 0, 'R'},
|
||||
{0, 0, 0, 0}};
|
||||
|
||||
@@ -121,6 +128,7 @@ static void attribute((noreturn)) help(v
|
||||
" -4|-6 Force IPv4 or IPv6 for --listen\n"
|
||||
" --background, -b Daemonize\n"
|
||||
#endif
|
||||
+ " --websocat Transmit length-prefixed messages\n"
|
||||
" --readonly, -R Read-only mode\n");
|
||||
exit(0);
|
||||
}
|
||||
@@ -498,6 +506,9 @@ int main(int argc, char **argv) {
|
||||
case 'C':
|
||||
config = optarg;
|
||||
break;
|
||||
+ case OPT_WEBSOCAT_COMPATIBLE:
|
||||
+ websocat_compatible = 1;
|
||||
+ break;
|
||||
default:
|
||||
exit(1);
|
||||
}
|
||||
@@ -664,6 +675,14 @@ static void sftp_service(void) {
|
||||
umask(0);
|
||||
while(sftp_state_get() != sftp_state_stop &&
|
||||
!sftp_xread(0, &len, sizeof len)) {
|
||||
+
|
||||
+ if (websocat_compatible) {
|
||||
+ /* discard the prefix and read again */
|
||||
+ if (sftp_xread(0, &len, sizeof len)) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
job = sftp_xmalloc(sizeof *job);
|
||||
job->len = ntohl(len);
|
||||
if(!job->len || job->len > MAXREQUEST)
|
||||
--- a/sftpserver.h
|
||||
+++ b/sftpserver.h
|
||||
@@ -57,6 +57,13 @@
|
||||
# define NTHREADS 4
|
||||
# endif
|
||||
|
||||
+/* If true, operate in websocat-compatible mode.
|
||||
+ For use in conjunction with "lengthprefix:" overlay in websocat.
|
||||
+ See websocat's doc for detail.
|
||||
+ Prefix all outgoing messages with their length in uint32BE.
|
||||
+ Also expect incoming messages to be formatted in the same way. */
|
||||
+extern int websocat_compatible;
|
||||
+
|
||||
/** @brief Send an @ref SSH_FXP_STATUS message
|
||||
* @param job Job
|
||||
* @param status Status code
|
Loading…
Reference in New Issue