1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
From 4f46aacece981c3987f46557eec7501e9c6b2581 Mon Sep 17 00:00:00 2001
From: TJ Saunders <tj@castaglia.org>
Date: Tue, 10 May 2016 11:06:14 -0700
Subject: [PATCH] Update mod_vroot for the API changes in the latest ProFTPD.
---
mod_vroot.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
Index: proftpd-mod-vroot/mod_vroot.c
===================================================================
--- proftpd-mod-vroot.orig/mod_vroot.c 2018-03-09 23:33:10.000000000 +0100
+++ proftpd-mod-vroot/mod_vroot.c 2018-03-09 23:33:10.000000000 +0100
@@ -23,7 +23,7 @@
* resulting executable, without including the source code for OpenSSL in the
* source distribution.
*
- * This is mod_vroot, contrib software for proftpd 1.2 and above.
+ * This is mod_vroot, contrib software for proftpd 1.3.x and above.
* For more information contact TJ Saunders <tj@castaglia.org>.
*/
@@ -40,7 +40,6 @@
static const char *vroot_log = NULL;
static int vroot_logfd = -1;
-static char vroot_cwd[PR_TUNABLE_PATH_MAX + 1];
static char vroot_base[PR_TUNABLE_PATH_MAX + 1];
static size_t vroot_baselen = 0;
static unsigned char vroot_engine = FALSE;
@@ -336,7 +335,8 @@
if (!(flags & VROOT_LOOKUP_FL_NO_ALIASES)) {
/* Check to see if this path is an alias; if so, return the real path. */
if (vroot_aliastab != NULL) {
- char *start_ptr = NULL, *end_ptr = NULL, *src_path = NULL;
+ char *start_ptr = NULL, *end_ptr = NULL;
+ const char *src_path = NULL;
/* buf is used here for storing the "suffix", to be appended later when
* aliases are found.
@@ -426,8 +426,9 @@
tmp_pool = make_sub_pool(session.pool);
c = find_config(main_server->conf, CONF_PARAM, "VRootAlias", FALSE);
- while (c) {
- char src_path[PR_TUNABLE_PATH_MAX+1], dst_path[PR_TUNABLE_PATH_MAX+1], *ptr;
+ while (c != NULL) {
+ char src_path[PR_TUNABLE_PATH_MAX+1], dst_path[PR_TUNABLE_PATH_MAX+1];
+ const char *ptr;
pr_signals_handle();
@@ -656,6 +657,7 @@
return res;
}
+#if PROFTPD_VERSION_NUMBER < 0x0001030603
static int vroot_creat(pr_fh_t *fh, const char *path, mode_t mode) {
int res;
char vpath[PR_TUNABLE_PATH_MAX + 1];
@@ -677,6 +679,7 @@
res = creat(vpath, mode);
return res;
}
+#endif /* ProFTPD 1.3.6rc2 or earlier */
static int vroot_link(pr_fs_t *fs, const char *path1, const char *path2) {
int res;
@@ -955,7 +958,7 @@
}
vroot_baselen = strlen(vroot_base);
- if (vroot_baselen >= sizeof(vroot_cwd)) {
+ if (vroot_baselen >= PR_TUNABLE_PATH_MAX) {
errno = ENAMETOOLONG;
return -1;
}
@@ -1067,7 +1070,7 @@
static int vroot_dir_idx = -1;
static int vroot_alias_dirscan(const void *key_data, size_t key_datasz,
- void *value_data, size_t value_datasz, void *user_data) {
+ const void *value_data, size_t value_datasz, void *user_data) {
const char *alias_path = NULL, *dir_path = NULL, *real_path = NULL;
char *ptr = NULL;
size_t dir_pathlen;
@@ -1530,8 +1533,7 @@
*/
MODRET vroot_log_retr(cmd_rec *cmd) {
- const char *key;
- char *path;
+ const char *key, *path;
if (vroot_engine == FALSE ||
session.chroot_path == NULL) {
@@ -1559,8 +1561,7 @@
}
MODRET vroot_log_stor(cmd_rec *cmd) {
- const char *key;
- char *path;
+ const char *key, *path;
if (vroot_engine == FALSE ||
session.chroot_path == NULL) {
@@ -1649,7 +1650,9 @@
fs->rename = vroot_rename;
fs->unlink = vroot_unlink;
fs->open = vroot_open;
+#if PROFTPD_VERSION_NUMBER < 0x0001030603
fs->creat = vroot_creat;
+#endif /* ProFTPD 1.3.6rc2 or earlier */
fs->link = vroot_link;
fs->readlink = vroot_readlink;
fs->symlink = vroot_symlink;
|