Skip to content
Commits on Source (2)
*.pl linguist-language=C
*.pm linguist-language=C
configure
Makefile
config.status
autom4te.cache
mod_vroot.h
.libs
.*.swp
*.la
*.lo
*.log
*Tests*.log
*.o
*~
env: TRAVIS_CI=true
language: c
compiler:
- gcc
- clang
install:
- sudo apt-get update -qq
# 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
- mkdir -p proftpd/contrib/mod_vroot/
- cp *.[ch] proftpd/contrib/mod_vroot/
- cp mod_vroot.* proftpd/contrib/mod_vroot/
- cp Makefile.in proftpd/contrib/mod_vroot/
- cp config* proftpd/contrib/mod_vroot/
- cp install-sh proftpd/contrib/mod_vroot/
- cp -R t/ proftpd/contrib/mod_vroot/t/
- cd proftpd
- ./configure LIBS='-lm -lrt -pthread' --enable-devel=coverage --enable-dso --enable-tests --with-shared=mod_vroot
- make
- make clean
- ./configure LIBS='-lm -lrt -pthread' --enable-devel=coverage --enable-tests --with-modules=mod_vroot
- make
- cd contrib/mod_vroot && make TEST_VERBOSE=1 check && cd ../../
top_builddir=../..
top_srcdir=../..
srcdir=@srcdir@
include $(top_srcdir)/Make.rules
.SUFFIXES: .la .lo
SHARED_CFLAGS=-DPR_SHARED_MODULE
SHARED_LDFLAGS=-avoid-version -export-dynamic -module
VPATH=@srcdir@
MODULE_NAME=mod_vroot
MODULE_OBJS=mod_vroot.o \
alias.o \
path.o \
fsio.o
SHARED_MODULE_OBJS=mod_vroot.lo \
alias.lo \
path.lo \
fsio.lo
# Necessary redefinitions
INCLUDES=-I. -I./include -I../.. -I../../include @INCLUDES@
CPPFLAGS= $(ADDL_CPPFLAGS) -DHAVE_CONFIG_H $(DEFAULT_PATHS) $(PLATFORM) $(INCLUDES)
LDFLAGS=-L../../lib @LIBDIRS@
.c.o:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
.c.lo:
$(LIBTOOL) --mode=compile --tag=CC $(CC) $(CPPFLAGS) $(CFLAGS) $(SHARED_CFLAGS) -c $< -o $@
shared: $(SHARED_MODULE_OBJS)
$(LIBTOOL) --mode=link --tag=CC $(CC) -o $(MODULE_NAME).la $(SHARED_MODULE_OBJS) -rpath $(LIBEXECDIR) $(LDFLAGS) $(SHARED_LDFLAGS) $(SHARED_MODULE_LIBS) `cat $(MODULE_NAME).c | grep '$$Libraries:' | sed -e 's/^.*\$$Libraries: \(.*\)\\$$/\1/'`
static: $(MODULE_OBJS)
$(AR) rc $(MODULE_NAME).a $(MODULE_OBJS)
$(RANLIB) $(MODULE_NAME).a
install:
if [ -f $(MODULE_NAME).la ] ; then \
$(LIBTOOL) --mode=install --tag=CC $(INSTALL_BIN) $(MODULE_NAME).la $(DESTDIR)$(LIBEXECDIR) ; \
fi
clean:
$(LIBTOOL) --mode=clean $(RM) $(MODULE_NAME).a $(MODULE_NAME).la *.o *.gcno *.lo .libs/*.o
dist: clean
$(RM) Makefile $(MODULE_NAME).h config.status config.cache config.log *.gcda *.gcno
-$(RM) -r .libs/ .git/ CVS/ RCS/
# Run the API unit tests
check:
test -z "$(ENABLE_TESTS)" || (cd t/ && $(MAKE) api-tests)
proftpd-mod_vroot
=================
ProFTPD module that creates "virtual" chroots
\ No newline at end of file
Status
------
[![Build Status](https://travis-ci.org/Castaglia/proftpd-mod_vroot.svg?branch=master)](https://travis-ci.org/Castaglia/proftpd-mod_vroot)
[![License](https://img.shields.io/badge/license-GPL-brightgreen.svg)](https://img.shields.io/badge/license-GPL-brightgreen.svg)
Synopsis
--------
The `mod_vroot` module for ProFTPD creates "virtual" chroots, _i.e._ chroot-like
functionality, from the perspective of the client, without requiring root
privileges and without using the `chroot(2)` system call.
See the [mod_vroot.html](https://htmlpreview.github.io/?https://github.com/Castaglia/proftpd-mod_vroot/blob/master/mod_vroot.html) documentation for more details.
/*
* ProFTPD: mod_vroot Alias API
* Copyright (c) 2002-2016 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
* the Free Software Foundation; either version 2 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; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*
* As a special exemption, TJ Saunders and other respective copyright holders
* give permission to link this program with OpenSSL, and distribute the
* resulting executable, without including the source code for OpenSSL in the
* source distribution.
*/
#include "alias.h"
static pool *alias_pool = NULL;
static pr_table_t *alias_tab = NULL;
unsigned int vroot_alias_count(void) {
int count;
count = pr_table_count(alias_tab);
if (count < 0) {
return 0;
}
return count;
}
int vroot_alias_do(int cb(const void *key_data, size_t key_datasz,
const void *value_data, size_t value_datasz, void *user_data),
void *user_data) {
int res;
if (cb == NULL) {
errno = EINVAL;
return -1;
}
res = pr_table_do(alias_tab, cb, user_data, PR_TABLE_DO_FL_ALL);
return res;
}
int vroot_alias_exists(const char *path) {
if (path == NULL) {
return FALSE;
}
if (pr_table_get(alias_tab, path, 0) != NULL) {
return TRUE;
}
return FALSE;
}
const char *vroot_alias_get(const char *path) {
const void *v;
if (path == NULL) {
errno = EINVAL;
return NULL;
}
v = pr_table_get(alias_tab, path, NULL);
return v;
}
int vroot_alias_add(const char *dst_path, const char *src_path) {
int res;
if (dst_path == NULL ||
src_path == NULL) {
errno = EINVAL;
return -1;
}
res = pr_table_add(alias_tab, pstrdup(alias_pool, dst_path),
pstrdup(alias_pool, src_path), 0);
return res;
}
int vroot_alias_init(pool *p) {
if (p == NULL) {
errno = EINVAL;
return -1;
}
if (alias_pool == NULL) {
alias_pool = make_sub_pool(p);
pr_pool_tag(alias_pool, "VRoot Alias Pool");
alias_tab = pr_table_alloc(alias_pool, 0);
}
return 0;
}
int vroot_alias_free(void) {
if (alias_pool != NULL) {
pr_table_empty(alias_tab);
destroy_pool(alias_pool);
alias_pool = NULL;
alias_tab = NULL;
}
return 0;
}
/*
* ProFTPD - mod_vroot Alias API
* Copyright (c) 2016 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
* the Free Software Foundation; either version 2 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; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*
* As a special exemption, TJ Saunders and other respective copyright holders
* give permission to link this program with OpenSSL, and distribute the
* resulting executable, without including the source code for OpenSSL in the
* source distribution.
*/
#ifndef MOD_VROOT_ALIAS_H
#define MOD_VROOT_ALIAS_H
#include "mod_vroot.h"
unsigned int vroot_alias_count(void);
int vroot_alias_do(int cb(const void *key_data, size_t key_datasz,
const void *value_data, size_t value_datasz, void *user_data),
void *user_data);
int vroot_alias_exists(const char *path);
const char *vroot_alias_get(const char *dst_path);
int vroot_alias_add(const char *dst_path, const char *src_path);
/* Internal use only. */
int vroot_alias_init(pool *p);
int vroot_alias_free(void);
#endif /* MOD_VROOT_ALIAS_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
dnl ProFTPD - mod_vroot
dnl Copyright (c) 2016 TJ Saunders <tj@castaglia.org>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
dnl
dnl Process this file with autoconf to produce a configure script.
AC_INIT(./mod_vroot.c)
AC_CANONICAL_SYSTEM
ostype=`echo $build_os | sed 's/\..*$//g' | sed 's/-.*//g' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
AC_PROG_CC
AC_PROG_CPP
AC_AIX
AC_ISC_POSIX
AC_MINIX
AC_PROG_MAKE_SET
dnl Need to support/handle the --enable-devel option, to see if coverage
dnl is being used
AC_ARG_ENABLE(devel,
[AC_HELP_STRING(
[--enable-devel],
[enable developer-only code (default=no)])
],
[
if test x"$enableval" != xno ; then
if test `echo $enableval | grep -c coverage` = "1" ; then
UTILS_LIBS="--coverage $UTILS_LIBS"
fi
fi
])
dnl Need to support/handle the --with-includes and --with-libraries options
AC_ARG_WITH(includes,
[AC_HELP_STRING(
[--with-includes=LIST],
[add additional include paths to proftpd. LIST is a colon-separated list of include paths to add e.g. --with-includes=/some/mysql/include:/my/include])
],
[ ac_addl_includes=`echo "$withval" | sed -e 's/:/ /g'` ;
for ainclude in $ac_addl_includes; do
if test x"$ac_build_addl_includes" = x ; then
ac_build_addl_includes="-I$ainclude"
else
ac_build_addl_includes="-I$ainclude $ac_build_addl_includes"
fi
done
CPPFLAGS="$CPPFLAGS $ac_build_addl_includes"
])
AC_ARG_WITH(libraries,
[AC_HELP_STRING(
[--with-libraries=LIST],
[add additional library paths to proftpd. LIST is a colon-separated list of include paths to add e.g. --with-libraries=/some/mysql/libdir:/my/libs])
],
[ ac_addl_libdirs=`echo "$withval" | sed -e 's/:/ /g'` ;
for alibdir in $ac_addl_libdirs; do
if test x"$ac_build_addl_libdirs" = x ; then
ac_build_addl_libdirs="-L$alibdir"
else
ac_build_addl_libdirs="-L$alibdir $ac_build_addl_libdirs"
fi
done
LDFLAGS="$LDFLAGS $ac_build_addl_libdirs"
])
AC_HEADER_STDC
AC_CHECK_HEADERS(stdlib.h unistd.h)
INCLUDES="$ac_build_addl_includes"
LIBDIRS="$ac_build_addl_libdirs"
AC_SUBST(INCLUDES)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBDIRS)
AC_CONFIG_HEADER(mod_vroot.h)
AC_OUTPUT(
t/Makefile
Makefile
)
proftpd-mod-vroot (0.9.7-1) UNRELEASED; urgency=medium
* New upstream release
-- Francesco Paolo Lovergine <frankie@debian.org> Thu, 05 Apr 2018 22:21:53 +0200
proftpd-mod-vroot (0.9.4-2) unstable; urgency=medium
[Hilmar Preuße]
......
t/Makefile
config.log
config.status
Makefile
mod_vroot.h
......@@ -6,9 +6,8 @@ Uploaders: Fabrizio Regalli <fabreg@fabreg.it>, Francesco Paolo Lovergine <frank
Build-Depends: debhelper (>= 9), proftpd-dev (>= 1.3.3d-5~), libacl1-dev
Standards-Version: 3.9.8
Homepage: http://www.castaglia.org/proftpd/modules/mod_vroot.html
Vcs-Git: git://git.debian.org/pkg-proftpd/proftpd-mod-vroot.git
Vcs-Browser: http://git.debian.org/?p=pkg-proftpd/proftpd-mod-vroot.git;a=summary
Vcs-Git: https://salsa.debian.org/debian-proftpd-team/proftpd-mod-vroot.git
Vcs-Browser: https://salsa.debian.org/debian-proftpd-team/proftpd-mod-vroot
Package: proftpd-mod-vroot
Architecture: any
......
proftpd_api_1.3.6_1
proftpd_api_1.3.6_2
#proftpd_api_1.3.6_1
#proftpd_api_1.3.6_2
mod_vroot.html
README.md
\ No newline at end of file
......@@ -23,3 +23,5 @@ override_dh_gencontrol:
override_dh_auto_clean:
DESTDIR=$(CURDIR)/debian/$(DEBNAME) prxs -d $(MODULE_NAME).c
override_dh_auto_test:
\ No newline at end of file
This diff is collapsed.
/*
* ProFTPD - mod_vroot FSIO API
* Copyright (c) 2016 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
* the Free Software Foundation; either version 2 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; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*
* As a special exemption, TJ Saunders and other respective copyright holders
* give permission to link this program with OpenSSL, and distribute the
* resulting executable, without including the source code for OpenSSL in the
* source distribution.
*/
#ifndef MOD_VROOT_FSIO_H
#define MOD_VROOT_FSIO_H
#include "mod_vroot.h"
int vroot_fsio_stat(pr_fs_t *fs, const char *path, struct stat *st);
int vroot_fsio_lstat(pr_fs_t *fs, const char *path, struct stat *st);
int vroot_fsio_rename(pr_fs_t *fs, const char *from, const char *to);
int vroot_fsio_unlink(pr_fs_t *fs, const char *path);
int vroot_fsio_open(pr_fh_t *fh, const char *path, int flags);
int vroot_fsio_creat(pr_fh_t *fh, const char *path, mode_t mode);
int vroot_fsio_link(pr_fs_t *fs, const char *dst_path, const char *src_path);
int vroot_fsio_symlink(pr_fs_t *fs, const char *dst_path, const char *src_path);
int vroot_fsio_readlink(pr_fs_t *fs, const char *path, char *buf, size_t bufsz);
int vroot_fsio_truncate(pr_fs_t *fs, const char *path, off_t len);
int vroot_fsio_chmod(pr_fs_t *fs, const char *path, mode_t mode);
int vroot_fsio_chown(pr_fs_t *fs, const char *path, uid_t uid, gid_t gid);
int vroot_fsio_lchown(pr_fs_t *fs, const char *path, uid_t uid, gid_t gid);
int vroot_fsio_chroot(pr_fs_t *fs, const char *path);
int vroot_fsio_chdir(pr_fs_t *fs, const char *path);
int vroot_fsio_utimes(pr_fs_t *fs, const char *path, struct timeval *tvs);
void *vroot_fsio_opendir(pr_fs_t *fs, const char *path);
struct dirent *vroot_fsio_readdir(pr_fs_t *fs, void *dirh);
int vroot_fsio_closedir(pr_fs_t *fs, void *dirh);
int vroot_fsio_mkdir(pr_fs_t *fs, const char *path, mode_t mode);
int vroot_fsio_rmdir(pr_fs_t *fs, const char *path);
/* Internal use only. */
int vroot_fsio_init(pool *p);
int vroot_fsio_free(void);
#endif /* MOD_VROOT_FSIO_H */
This diff is collapsed.