| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>ProFTPD module mod_ifversion</title> |
| 5 | </head> |
| 6 | |
| 7 | <body bgcolor=white> |
| 8 | |
| 9 | <hr> |
| 10 | <center> |
| 11 | <h2><b>ProFTPD module <code>mod_ifversion</code></b></h2> |
| 12 | </center> |
| 13 | <hr><br> |
| 14 | |
| 15 | <p> |
| 16 | The <code>mod_ifversion</code> module is designed for use in testsuites and |
| 17 | production deployments of <code>proftpd</code>, which may have to deal with |
| 18 | different ProFTPD versions and different configurations. The |
| 19 | <code><IfVersion></code> sections supported by <code>mod_ifversion</code> |
| 20 | allow flexible version checking, including numeric and regular expression |
| 21 | comparisons. |
| 22 | |
| 23 | <p> |
| 24 | This module is contained in the <code>mod_ifversion.c</code> file for |
| 25 | ProFTPD 1.3.<i>x</i>, and is not compiled by default. Installation |
| 26 | instructions are discussed <a href="#Installation">here</a>; a discussion |
| 27 | on <a href="#Usage">usage</a> is also available. |
| 28 | |
| 29 | <p> |
| 30 | The most current version of <code>mod_ifversion</code> is distributed with |
| 31 | the <code>proftpd</code> source code. |
| 32 | |
| 33 | <h2>Author</h2> |
| 34 | <p> |
| 35 | Please contact TJ Saunders <tj <i>at</i> castaglia.org> with any |
| 36 | questions, concerns, or suggestions regarding this module. |
| 37 | |
| 38 | <h2>Directives</h2> |
| 39 | <ul> |
| 40 | <li><a href="#IfVersion"><IfVersion></a> |
| 41 | </ul> |
| 42 | |
| 43 | <hr> |
| 44 | <h3><a name="IfVersion"><IfVersion></a></h3> |
| 45 | <strong>Syntax:</strong> <IfVersion <em>[[!]operator] version</em>><br> |
| 46 | <strong>Default:</strong> None<br> |
| 47 | <strong>Context:</strong> <em>All</em><br> |
| 48 | <strong>Module:</strong> mod_ifversion<br> |
| 49 | <strong>Compatibility:</strong> 1.3.1rc1 and later |
| 50 | |
| 51 | <p> |
| 52 | The <code><IfVersion></code> section encloses configuration directives |
| 53 | which will be used only if the proftpd version matches the configured criteria. |
| 54 | For normal (numeric) comparisons the version argument has the following |
| 55 | syntax: |
| 56 | <pre> |
| 57 | <i>major[.minor[.revision[suffix]]]</i> |
| 58 | </pre> |
| 59 | <i>e.g.</i> 1.3.1, 1.3.2a, or 1.3.3rc1. If the <em>minor</em> or |
| 60 | <em>revision</em> fields are omitted, they are assumed to be zero. An |
| 61 | omitted suffix is assumed to be a stable release, instead of a release |
| 62 | candidate (RC) or maintenance release. |
| 63 | |
| 64 | <p> |
| 65 | The following numerical comparison operators are supported: |
| 66 | <p> |
| 67 | <table border=1 summary="Numeric Comparators"> |
| 68 | <tr> |
| 69 | <td><em>operator</em></td> |
| 70 | <td>Description</td> |
| 71 | </tr> |
| 72 | |
| 73 | <tr> |
| 74 | <td><code>=</code> or <code>==</code></td> |
| 75 | <td>proftpd version is equal</td> |
| 76 | </tr> |
| 77 | |
| 78 | <tr> |
| 79 | <td><code>></code></td> |
| 80 | <td>proftpd version is greater than</td> |
| 81 | </tr> |
| 82 | |
| 83 | <tr> |
| 84 | <td><code>>=</code></td> |
| 85 | <td>proftpd version is greater or equal</td> |
| 86 | </tr> |
| 87 | |
| 88 | <tr> |
| 89 | <td><code><</code></td> |
| 90 | <td>proftpd version is less than</td> |
| 91 | </tr> |
| 92 | |
| 93 | <tr> |
| 94 | <td><code><=</code></td> |
| 95 | <td>proftpd version is less or equal</td> |
| 96 | </tr> |
| 97 | </table> |
| 98 | |
| 99 | <p> |
| 100 | It is also possible to use regular expressions to match the ProFTPD version. |
| 101 | To use a regular expression, the <em>operators</em> are: |
| 102 | <p> |
| 103 | <table border=1 summary="Regex Operators"> |
| 104 | <tr> |
| 105 | <td><em>operator</em></td> |
| 106 | <td>Description</td> |
| 107 | </tr> |
| 108 | |
| 109 | <tr> |
| 110 | <td><code>=</code> or <code>==</code></td> |
| 111 | <td><em>version</em> has the form <code>/<em>regex</em>/</code></td> |
| 112 | </tr> |
| 113 | |
| 114 | <tr> |
| 115 | <td><code>~</code></td> |
| 116 | <td><em>version</em> has the form <code><em>regex</em></code></td> |
| 117 | </tr> |
| 118 | </table> |
| 119 | |
| 120 | <p> |
| 121 | If you wish to reverse the meaning of the operator, prefix the <em>operator</em> |
| 122 | with an exclamation mark (!), <i>e.g.</i>: |
| 123 | <pre> |
| 124 | <IfVersion != 1.3.1> |
| 125 | # Do not use these directives if the version is 1.3.1 |
| 126 | </IfVersion> |
| 127 | </pre> |
| 128 | |
| 129 | <p> |
| 130 | If <em>operator</em> is omitted, it is assumed to be <code>=</code>. |
| 131 | |
| 132 | <hr> |
| 133 | <h2><a name="Installation">Installation</a></h2> |
| 134 | The <code>mod_ifversion</code> module is distributed with ProFTPD. For |
| 135 | including <code>mod_ifversion</code> as a statically linked module: |
| 136 | <pre> |
| 137 | $ ./configure --with-modules=mod_ifversion |
| 138 | </pre> |
| 139 | To build <code>mod_ifversion</code> as a DSO module: |
| 140 | <pre> |
| 141 | $ ./configure --enable-dso --with-shared=mod_ifversion |
| 142 | </pre> |
| 143 | Then follow the usual steps: |
| 144 | <pre> |
| 145 | $ make |
| 146 | $ make install |
| 147 | </pre> |
| 148 | |
| 149 | <p> |
| 150 | For those with an existing ProFTPD installation, you can use the |
| 151 | <code>prxs</code> tool to add <code>mod_ifversion</code>, as a DSO module, to |
| 152 | your existing server: |
| 153 | <pre> |
| 154 | $ prxs -c -i -d mod_ifversion.c |
| 155 | </pre> |
| 156 | |
| 157 | <hr> |
| 158 | <h2><a name="Usage">Usage</a></h2> |
| 159 | |
| 160 | <p> |
| 161 | The following examples demonstrate how the <code>mod_ifversion</code> can |
| 162 | be used. |
| 163 | |
| 164 | <p> |
| 165 | Using a simple numeric comparison: |
| 166 | <pre> |
| 167 | <IfVersion >= 1.3.1rc1> |
| 168 | # Only use these directives for versions greater or equal 1.3.1rc1 |
| 169 | </IfVersion> |
| 170 | </pre> |
| 171 | |
| 172 | <p> |
| 173 | Using a regular expression: |
| 174 | <pre> |
| 175 | <IfVersion = /^rc[[:digit:]]$/> |
| 176 | # Only use these directives for RC (release candidate) versions |
| 177 | </IfVersion> |
| 178 | </pre> |
| 179 | |
| 180 | <p> |
| 181 | Using a reversed regular expression (<i>i.e.</i> in this case, meaning |
| 182 | "proftpd version does not match this pattern"): |
| 183 | <pre> |
| 184 | <IfVersion !~ ^1.3.[012]$> |
| 185 | # These directives are not for those versions |
| 186 | </IfVersion> |
| 187 | </pre> |
| 188 | |
| 189 | <p> |
| 190 | <hr> |
| 191 | <font size=2><b><i> |
| 192 | © Copyright 2009-2017 TJ Saunders<br> |
| 193 | All Rights Reserved<br> |
| 194 | </i></b></font> |
| 195 | <hr> |
| 196 | |
| 197 | </body> |
| 198 | </html> |