File: proftpd_api_1.3.6_1

package info (click to toggle)
proftpd-mod-vroot 0.9.4-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 616 kB
  • sloc: perl: 11,003; ansic: 1,234; makefile: 17
file content (92 lines) | stat: -rw-r--r-- 2,946 bytes parent folder | download
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
From 8e25cca6cbd04c8c3816e1d426621a215fcea55b Mon Sep 17 00:00:00 2001
From: TJ Saunders <tj@castaglia.org>
Date: Tue, 8 Sep 2015 13:25:52 -0700
Subject: [PATCH] Fix compiling with the latest proftpd source, which uses void
 * pointers rather than char * pointers in cmd_recs.

---
 mod_vroot.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/mod_vroot.c b/mod_vroot.c
index b0ce59a..f99a7bf 100644
--- a/mod_vroot.c
+++ b/mod_vroot.c
@@ -2,7 +2,7 @@
  * ProFTPD: mod_vroot -- a module implementing a virtual chroot capability
  *                       via the FSIO API
  *
- * Copyright (c) 2002-2014 TJ Saunders
+ * Copyright (c) 2002-2015 TJ Saunders
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,8 +25,6 @@
  *
  * This is mod_vroot, contrib software for proftpd 1.2 and above.
  * For more information contact TJ Saunders <tj@castaglia.org>.
- *
- * $Id: mod_vroot.c,v 1.24 2011/01/11 02:41:10 tj Exp tj $
  */
 
 #include "conf.h"
@@ -35,8 +33,8 @@
 #define MOD_VROOT_VERSION 	"mod_vroot/0.9.4"
 
 /* Make sure the version of proftpd is as necessary. */
-#if PROFTPD_VERSION_NUMBER < 0x0001030406
-# error "ProFTPD 1.3.4b or later required"
+#if PROFTPD_VERSION_NUMBER < 0x0001030602
+# error "ProFTPD 1.3.6rc2 or later required"
 #endif
 
 static const char *vroot_log = NULL;
@@ -1490,22 +1488,25 @@ MODRET set_vrootoptions(cmd_rec *cmd) {
 MODRET set_vrootserverroot(cmd_rec *cmd) {
   struct stat st;
   config_rec *c;
+  char *path;
   size_t pathlen;
 
   CHECK_ARGS(cmd, 1);
   CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL);
 
-  if (pr_fs_valid_path(cmd->argv[1]) < 0)
+  path = cmd->argv[1];
+
+  if (pr_fs_valid_path(path) < 0)
     CONF_ERROR(cmd, "must be an absolute path");
 
-  if (stat(cmd->argv[1], &st) < 0) {
-    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "error checking '", cmd->argv[1],
-      "': ", strerror(errno), NULL));
+  if (stat(path, &st) < 0) {
+    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "error checking '", path, "': ",
+      strerror(errno), NULL));
   }
 
   if (!S_ISDIR(st.st_mode)) {
-    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "'", cmd->argv[1],
-      "' is not a directory", NULL));
+    CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "'", path, "' is not a directory",
+      NULL));
   }
 
   c = add_config_param(cmd->argv[0], 1, NULL);
@@ -1514,12 +1515,12 @@ MODRET set_vrootserverroot(cmd_rec *cmd) {
    * This is important.
    */
  
-  pathlen = strlen(cmd->argv[1]);
-  if (cmd->argv[1][pathlen - 1] != '/') {
-    c->argv[0] = pstrcat(c->pool, cmd->argv[1], "/", NULL);
+  pathlen = strlen(path);
+  if (path[pathlen - 1] != '/') {
+    c->argv[0] = pstrcat(c->pool, path, "/", NULL);
 
   } else {
-    c->argv[0] = pstrdup(c->pool, cmd->argv[1]);
+    c->argv[0] = pstrdup(c->pool, path);
   }
 
   return PR_HANDLED(cmd);