| 1 |
/* |
| 2 |
* ProFTPD: mod_wrap2 -- tcpwrappers-like access control |
| 3 |
* Copyright (c) 2000-2016 TJ Saunders |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. |
| 18 |
* |
| 19 |
* As a special exemption, TJ Saunders and other respective copyright holders |
| 20 |
* give permission to link this program with OpenSSL, and distribute the |
| 21 |
* resulting executable, without including the source code for OpenSSL in the |
| 22 |
* source distribution. |
| 23 |
*/ |
| 24 |
|
| 25 |
#ifndef MOD_WRAP2_H |
| 26 |
#define MOD_WRAP2_H |
| 27 |
|
| 28 |
#include "conf.h" |
| 29 |
#include "privs.h" |
| 30 |
|
| 31 |
#define MOD_WRAP2_VERSION "mod_wrap2/2.0.7" |
| 32 |
|
| 33 |
/* Make sure the version of proftpd is as necessary. */ |
| 34 |
#if PROFTPD_VERSION_NUMBER < 0x0001030402 |
| 35 |
# error "ProFTPD 1.3.4rc2 or later required" |
| 36 |
#endif |
| 37 |
|
| 38 |
/* Define if using tcpwrapper options. */ |
| 39 |
#undef WRAP2_USE_OPTIONS |
| 40 |
|
| 41 |
/* Define if using NIS/YP. */ |
| 42 |
#undef WRAP2_USE_NIS |
| 43 |
|
| 44 |
#define WRAP2_BUFFER_SIZE 256 |
| 45 |
|
| 46 |
#define WRAP2_DEFAULT_SERVICE_NAME "proftpd" |
| 47 |
|
| 48 |
/* mod_wrap2 option flags */ |
| 49 |
#define WRAP_OPT_CHECK_ON_CONNECT 0x0001 |
| 50 |
#define WRAP_OPT_CHECK_ALL_NAMES 0x0002 |
| 51 |
|
| 52 |
/* Source abstraction object */ |
| 53 |
typedef struct table_obj { |
| 54 |
|
| 55 |
/* Memory pool for this object */ |
| 56 |
pool *tab_pool; |
| 57 |
|
| 58 |
/* Table handle */ |
| 59 |
void *tab_handle; |
| 60 |
|
| 61 |
/* Table name */ |
| 62 |
const char *tab_name; |
| 63 |
|
| 64 |
/* Arbitrary data pointer */ |
| 65 |
void *tab_data; |
| 66 |
|
| 67 |
/* Table I/O routines */ |
| 68 |
int (*tab_close)(struct table_obj *); |
| 69 |
array_header *(*tab_fetch_clients)(struct table_obj *, const char *); |
| 70 |
array_header *(*tab_fetch_daemons)(struct table_obj *, const char *); |
| 71 |
array_header *(*tab_fetch_options)(struct table_obj *, const char *); |
| 72 |
|
| 73 |
} wrap2_table_t; |
| 74 |
|
| 75 |
/* Function prototypes necessary for wrap sub-modules */ |
| 76 |
int wrap2_log(const char *, ...) |
| 77 |
#ifdef __GNUC__ |
| 78 |
__attribute__ ((format (printf, 1, 2))); |
| 79 |
#else |
| 80 |
; |
| 81 |
#endif |
| 82 |
|
| 83 |
int wrap2_register(const char *, |
| 84 |
wrap2_table_t *(*tab_open)(pool *, const char *)); |
| 85 |
int wrap2_unregister(const char *); |
| 86 |
|
| 87 |
char *wrap2_strsplit(char *, int); |
| 88 |
|
| 89 |
extern unsigned long wrap2_opts; |
| 90 |
|
| 91 |
#endif /* MOD_WRAP2_H */ |