mod_ifversion
The mod_ifversion module is designed for use in testsuites and production deployments of proftpd, which may have to deal with different ProFTPD versions and different configurations. The <IfVersion> sections supported by mod_ifversion allow flexible version checking, including numeric and regular expression comparisons.
proftpd
<IfVersion>
This module is contained in the mod_ifversion.c file for ProFTPD 1.3.x, and is not compiled by default. Installation instructions are discussed here; a discussion on usage is also available.
mod_ifversion.c
The most current version of mod_ifversion is distributed with the proftpd source code.
Please contact TJ Saunders <tj at castaglia.org> with any questions, concerns, or suggestions regarding this module.
The <IfVersion> section encloses configuration directives which will be used only if the proftpd version matches the configured criteria. For normal (numeric) comparisons the version argument has the following syntax:
major[.minor[.revision[suffix]]]
The following numerical comparison operators are supported:
=
==
>
>=
<
<=
It is also possible to use regular expressions to match the ProFTPD version. To use a regular expression, the operators are:
/regex/
~
regex
If you wish to reverse the meaning of the operator, prefix the operator with an exclamation mark (!), e.g.:
<IfVersion != 1.3.1> # Do not use these directives if the version is 1.3.1 </IfVersion>
If operator is omitted, it is assumed to be =.
$ ./configure --with-modules=mod_ifversion
$ ./configure --enable-dso --with-shared=mod_ifversion
$ make $ make install
For those with an existing ProFTPD installation, you can use the prxs tool to add mod_ifversion, as a DSO module, to your existing server:
prxs
$ prxs -c -i -d mod_ifversion.c
The following examples demonstrate how the mod_ifversion can be used.
Using a simple numeric comparison:
<IfVersion >= 1.3.1rc1> # Only use these directives for versions greater or equal 1.3.1rc1 </IfVersion>
Using a regular expression:
<IfVersion = /^rc[[:digit:]]$/> # Only use these directives for RC (release candidate) versions </IfVersion>
Using a reversed regular expression (i.e. in this case, meaning "proftpd version does not match this pattern"):
<IfVersion !~ ^1.3.[012]$> # These directives are not for those versions </IfVersion>