Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /usr/share/doc/proftpd-doc/howto/ drwxr-xr-x | |
| Viewing file: Select action/file-type: ProFTPD: Dynamic Shared Objects (DSOs)
What are DSOs? http://httpd.apache.org/docs/dso.html
DSOs and ProFTPD $ ./configure --enable-dso ...This causes the build system to build the libltdl supporting
library, which is used to handle OS-specific ways of loading and unloading
DSO files, and also to include the mod_dso module in the compiled proftpd. The
mod_dso module provides the LoadModule configuration
directive, for loading modules via the proftpd.conf configuration
file.
The $ ./configure --enable-dso --with-shared=mod_sql:mod_sql_mysql --with-includes=... --with-libraries=...These DSO modules will be installed under the libexec/ directory
of your ProFTPD install location. To control the location of this
libexec/ directory from which the mod_dso module
will load modules, you can use the --libexecdir configure
option, e.g.:
$ ./configure --libexecdir=/path/to/custom/libexec --enable-dso ...
Note that ProFTPD uses the GNU
Loading Modules
Loading a module using
LoadModule mod_sql.c
LoadModule mod_sql_mysql.c
...
<IfModule mod_sql.c>
...
</IfModule>
If a module fails to load properly, you might see messages like:
Fatal: unknown configuration directive 'SQLConnectInfo' on line 86 of '/usr/local/proftpd/etc/proftpd.conf'This can happen if you forget to use the LoadModule directive
in your proftpd.conf prior to using directives from the
module. If you are using LoadModule, the error message may
look like:
LoadModule: error loading module 'mod_sql_mysql.c': permission denied on line 65 of proftpd.confCheck the libexec/ directory where you installed
proftpd, to see if the appropriate .la and/or
.so files are present. Then check your dynamic loader
configuration file (e.g. /etc/ld.so.conf on Linux) and
make sure that the libexec/ directory is configured, so that the
dynamic loader knows to look in the correct locations. Note that the
LD_LIBRARY_PATH and/or LD_RUN_PATH environment
variables may also be used to inform the dynamic loader of
proftpd's libexec/ directory.
Using
Module Ordering
To achieve the necessary module order, you can make sure that your
Compiling Custom Modules as DSOs
Once you have your custom module written (e.g.
PROFTPD_INSTALL=/usr/local/proftpd
top_srcdir=$(PROFTPD_INSTALL)
srcdir=$(PROFTPD_INSTALL)
VPATH=$(PROFTPD_INSTALL)
MODULE_NAME=
MODULE_CFLAGS=
MODULE_DEFS=
MODULE_LDFLAGS=
MODULE_LIBS=
CC=gcc
DEFS=-DPR_SHARED_MODULE $(MODULE_DEFS)
CFLAGS=$(DEFS) -I. -I$(PROFTPD_INSTALL)/include/proftpd $(MODULE_CFLAGS)
LDFLAGS=-L$(PROFTPD_INSTALL)/lib $(MODULE_LDFLAGS)
LIBEXEC_DIR=$(PROFTPD_INSTALL)/libexec
LIBS=$(MODULE_LIBS)
INSTALL=/usr/bin/install -c
INSTALL_BIN=$(INSTALL) -s -m 0755
LIBTOOL=$(SHELL) /usr/bin/libtool
LTDL_FLAGS=-avoid-version -export-dynamic -module
# Targets
all: $(MODULE_NAME).la
$(MODULE_NAME).lo:
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $(MODULE_NAME).c
$(MODULE_NAME).la: $(MODULE_NAME).lo
$(LIBTOOL) --mode=link $(CC) -o $(MODULE_NAME).la -rpath $(LIBEXEC_DIR) $(LDFLAGS) $(LTDL_FLAGS) $(MODULE_NAME).lo $(LIBS)
install: $(MODULE_NAME).la
if [ -f $(MODULE_NAME).la ] ; then \
$(LIBTOOL) --mode=install $(INSTALL_BIN) $(MODULE_NAME).la $(DESTDIR)$(LIBEXEC_DIR) ; \
fi
clean:
$(LIBTOOL) --mode=clean $(RM) $(MODULE_NAME).la $(MODULE_NAME).lo config.*
distclean:
$(RM) Makefile config.*
$(RM) -r autom4te.cache
Fill in MODULE_NAME with the name of your module:
MODULE_NAME=mod_customThe remaining MODULE_ variables are used to specify additional
compiler and linker flags. If, for example, your mod_custom.c
module relied on a header file <custom.h> as well as
a library libcustom.so, you might have the following:
MODULE_CFLAGS=-I/path/to/custom/include MODULE_DEFS=-DUSE_LIBCUSTOM MODULE_LDFLAGS=-L/path/to/custom/lib MODULE_LIBS=-lcustomPlace the Makefile in a directory with your
mod_custom.c source file, then do:
$ make $ make installThe make install step will install the DSO module into the
libexec/ directory of your ProFTPD install location.
Once installed, update your LoadModule mod_custom.cThen restart proftpd, and your custom module will be in use.
Using
The answer is to use the
The
-c, --compile Compiles the listed
At least one of the above actions must be specified when using
prxs. More than one action can be specified at the same time.
To use $ prxs -c -i -d mod_custom.cwhich will do the compile, install, and clean actions in order. Once installed, update your proftpd.conf to make sure your module is
loaded:
LoadModule mod_custom.cThen restart proftpd, and your custom module will be in use.
For example, you might use $ prxs -c -i -d contrib/mod_sql_sqlite.c The following options are also supported:
-n, --name Tells prxs the name of the module being compiled.
By default, prxs determines the module name from
the list of .c files listed, expecting to see a
"mod_name.c" file.
-D key Passes these macros through to the compilation step.
-D key=value Note that the space before the key is important.
-I includedir Specify additional include file search directories.
Note that the space before the directory is important.
-L libdir Specify additional library file search directories.
Note that the space before the directory is important.
-l library Specify additional libraries for linking.
Note that the space before the library name is important.
Using $ cd /path/to/mod_custom/dir $ prxs -c -i -D USE_CUSTOM -I /path/to/custom/include -L /path/to/custom/lib -l custom mod_custom.cThat's it! No need for a special Makefile, and no need to edit/replace any variables.
The $ LIBTOOL=/path/to/custom/libtool prxs -c -i -d mod_custom.c
When should you use
Frequently Asked Questions
Second, you will need the source code for $ /usr/local/bin/prxs -c -i -d mod_sql_passwd.cIf the above fails with this error message: Your installed proftpd does not support shared modules/DSOs. Make sure the --enable-dso configure option is used when compiling proftpd.It means that your proftpd does not have DSO support -- and
that means that you will have to recompile proftpd to add the new module.
If, on the other hand, your LoadModule mod_sql_passwd.cand later in the config file, configure your newly added module:
<IfModule mod_sql_passwd.c>
SQLPasswordEngine on
...
</IfModule>
Last, restart proftpd, and enjoy your new module's functionality, all without
needing to recompile/reinstall proftpd itself.
© Copyright 2017 The ProFTPD Project All Rights Reserved |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0055 ]-- |