[Git][debian-proftpd-team/proftpd-mod-case][upstream] New upstream version 0.7+git73896501cf
Hilmar Preuße
gitlab at salsa.debian.org
Thu Aug 20 10:46:39 BST 2020
Hilmar Preuße pushed to branch upstream at Debian ProFTPD Team / proftpd-mod-case
Commits:
25f40b82 by Hilmar Preuße at 2020-08-20T11:45:37+02:00
New upstream version 0.7+git73896501cf
- - - - -
7 changed files:
- + .gitattributes
- + .gitignore
- − README
- + README.md
- mod_case.c
- mod_case.html
- t/lib/ProFTPD/Tests/Modules/mod_case.pm
Changes:
=====================================
.gitattributes
=====================================
@@ -0,0 +1,2 @@
+*.pl linguist-language=C
+*.pm linguist-language=C
=====================================
.gitignore
=====================================
@@ -0,0 +1,4 @@
+*.lo
+*~
+*.swo
+*.swp
=====================================
README deleted
=====================================
@@ -1,4 +0,0 @@
-The mod_case module for ProFTPD provides case-insensitivity support
-to FTP commands; useful for dealing with Windows FTP clients.
-
-For further module documentation, see mod_case.html.
=====================================
README.md
=====================================
@@ -0,0 +1,4 @@
+The `mod_case` module for ProFTPD provides case-insensitivity support
+to FTP commands; useful for dealing with Windows FTP clients.
+
+For further module documentation, see the [mod_case.html](https://htmlpreview.github.io/?https://github.com/Castaglia/proftpd-mod_case/blob/master/mod_case.html) documentation.
=====================================
mod_case.c
=====================================
@@ -1,7 +1,6 @@
/*
* ProFTPD: mod_case -- provides case-insensivity
- *
- * Copyright (c) 2004-2012 TJ Saunders
+ * Copyright (c) 2004-2017 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
@@ -19,8 +18,6 @@
*
* This is mod_case, contrib software for proftpd 1.3.x and above.
* For more information contact TJ Saunders <tj at castaglia.org>.
- *
- * $Id: mod_case.c,v 1.9 2011/05/04 21:50:41 tj Exp tj $
*/
#include "conf.h"
@@ -170,7 +167,7 @@ static void case_replace_copy_paths(cmd_rec *cmd, const char *proto,
cmd->argc = argv->nelts;
*((char **) push_array(argv)) = NULL;
- cmd->argv = (char **) argv->elts;
+ cmd->argv = argv->elts;
cmd->arg = pstrcat(cmd->pool, cmd->argv[1], " ", src_path, " ", dst_path,
NULL);
@@ -277,7 +274,7 @@ static void case_replace_path(cmd_rec *cmd, const char *proto, const char *dir,
cmd->argc = argv->nelts;
*((char **) push_array(argv)) = NULL;
- cmd->argv = (char **) argv->elts;
+ cmd->argv = argv->elts;
pr_cmd_clear_cache(cmd);
@@ -338,16 +335,19 @@ static void case_replace_path(cmd_rec *cmd, const char *proto, const char *dir,
}
static int case_have_file(pool *p, const char *dir, const char *file,
- size_t file_len, char **matched_file) {
+ size_t file_len, const char **matched_file) {
DIR *dirh;
struct dirent *dent;
- char *file_match;
+ const char *file_match;
/* Open the directory. */
dirh = pr_fsio_opendir(dir);
if (dirh == NULL) {
+ int xerrno = errno;
+
(void) pr_log_writefile(case_logfd, MOD_CASE_VERSION,
- "error opening directory '%s': %s", dir, strerror(errno));
+ "error opening directory '%s': %s", dir, strerror(xerrno));
+ errno = xerrno;
return -1;
}
@@ -370,7 +370,7 @@ static int case_have_file(pool *p, const char *dir, const char *file,
* as an exact match and as a possible match.
*/
dent = pr_fsio_readdir(dirh);
- while (dent) {
+ while (dent != NULL) {
pr_signals_handle();
if (strncmp(dent->d_name, file, file_len + 1) == 0) {
@@ -408,10 +408,9 @@ static int case_have_file(pool *p, const char *dir, const char *file,
*/
MODRET case_pre_copy(cmd_rec *cmd) {
config_rec *c;
- const char *proto;
+ const char *proto, *file_match = NULL;
char *src_path, *src_dir = NULL, *src_file = NULL,
- *dst_path, *dst_dir = NULL, *dst_file = NULL, *file_match = NULL,
- *src_ptr, *dst_ptr;
+ *dst_path, *dst_dir = NULL, *dst_file = NULL, *src_ptr, *dst_ptr;
size_t file_len;
int modified_arg = FALSE, res;
@@ -557,9 +556,8 @@ MODRET case_pre_copy(cmd_rec *cmd) {
MODRET case_pre_cmd(cmd_rec *cmd) {
config_rec *c;
- char *path = NULL, *dir = NULL, *file = NULL, *file_match = NULL,
- *replace_path = NULL, *tmp;
- const char *proto = NULL;
+ char *path = NULL, *dir = NULL, *file = NULL, *replace_path = NULL, *tmp;
+ const char *proto = NULL, *file_match = NULL;
size_t file_len;
int path_index = -1, res;
@@ -721,9 +719,8 @@ MODRET case_pre_cmd(cmd_rec *cmd) {
MODRET case_pre_link(cmd_rec *cmd) {
config_rec *c;
char *arg = NULL, *src_path, *src_dir = NULL, *src_file = NULL,
- *dst_path, *dst_dir = NULL, *dst_file = NULL, *file_match = NULL,
- *src_ptr, *dst_ptr, *ptr;
- const char *proto = NULL;
+ *dst_path, *dst_dir = NULL, *dst_file = NULL, *src_ptr, *dst_ptr, *ptr;
+ const char *proto = NULL, *file_match = NULL;
size_t file_len;
int modified_arg = FALSE, res;
@@ -891,14 +888,15 @@ MODRET set_caseengine(cmd_rec *cmd) {
/* usage: CaseIgnore on|off|cmd-list */
MODRET set_caseignore(cmd_rec *cmd) {
- int bool, argc;
+ unsigned int argc;
+ int ignore = FALSE;
char **argv;
config_rec *c;
CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL|CONF_ANON|CONF_DIR);
CHECK_ARGS(cmd, 1);
- bool = get_boolean(cmd, 1);
+ ignore = get_boolean(cmd, 1);
c = add_config_param(cmd->argv[0], 2, NULL, NULL);
c->flags |= CF_MERGEDOWN_MULTI;
@@ -906,14 +904,14 @@ MODRET set_caseignore(cmd_rec *cmd) {
c->argv[0] = pcalloc(c->pool, sizeof(unsigned int));
*((unsigned int *) c->argv[0]) = 1;
- if (bool != -1) {
- *((unsigned int *) c->argv[0]) = bool;
+ if (ignore != -1) {
+ *((unsigned int *) c->argv[0]) = ignore;
return PR_HANDLED(cmd);
}
/* Parse the parameter as a command list. */
argc = cmd->argc-1;
- argv = cmd->argv;
+ argv = (char **) cmd->argv;
c->argv[1] = pcalloc(c->pool, sizeof(array_header *));
*((array_header **) c->argv[1]) = pr_expr_create(c->pool, &argc, argv);
=====================================
mod_case.html
=====================================
@@ -1,6 +1,3 @@
-<!-- $Id: mod_case.html,v 1.6 2011/04/19 16:09:58 tj Exp tj $ -->
-<!-- $Source: /home/tj/proftpd/modules/doc/RCS/mod_case.html,v $ -->
-
<html>
<head>
<title>ProFTPD module mod_case</title>
@@ -8,7 +5,7 @@
<body bgcolor=white>
-<hr><br>
+<hr>
<center>
<h2><b>ProFTPD module <code>mod_case</code></b></h2>
</center>
@@ -34,7 +31,7 @@ are discussed <a href="#Installation">here</a>.
<p>
The most current version of <code>mod_case</code> can be found at:
<pre>
- <a href="http://www.castaglia.org/proftpd/">http://www.castaglia.org/proftpd/</a>
+ <a href="https://github.com/Castaglia/proftpd-mod_case">https://github.com/Castaglia/proftpd-mod_case</a>
</pre>
<h2>Author</h2>
@@ -160,13 +157,8 @@ usual steps for using third-party modules in proftpd:
<p>
<hr><br>
-Author: <i>$Author: tj $</i><br>
-Last Updated: <i>$Date: 2011/04/19 16:09:58 $</i><br>
-
-<br><hr>
-
<font size=2><b><i>
-© Copyright 2004-2012 TJ Saunders<br>
+© Copyright 2004-2015 TJ Saunders<br>
All Rights Reserved<br>
</i></b></font>
=====================================
t/lib/ProFTPD/Tests/Modules/mod_case.pm
=====================================
@@ -151,6 +151,11 @@ my $TESTS = {
test_class => [qw(forking bug)],
},
+ caseignore_multi_cwds_to_dst => {
+ order => ++$order,
+ test_class => [qw(forking bug)],
+ },
+
};
sub new {
@@ -2291,15 +2296,15 @@ sub caseignore_stat {
defined(my $pid = fork()) or die("Can't fork: $!");
if ($pid) {
eval {
- my $client = ProFTPD::TestSuite::FTP->new('127.0.0.1', $port);
+ my $client = ProFTPD::TestSuite::FTP->new('127.0.0.1', $port, 0);
$client->login($user, $passwd);
my ($resp_code, $resp_msg) = $client->stat("TeSt.TxT");
my $expected;
- $expected = 211;
+ $expected = 213;
$self->assert($expected == $resp_code,
- test_msg("Expected $expected, got $resp_code"));
+ "Expected response code $expected, got $resp_code");
};
if ($@) {
@@ -4080,4 +4085,115 @@ sub caseignore_cmds_cwd {
unlink($log_file);
}
+sub caseignore_multi_cwds_to_dst {
+ my $self = shift;
+ my $tmpdir = $self->{tmpdir};
+ my $setup = test_setup($tmpdir, 'case');
+
+ my $dst_dir = File::Spec->rel2abs("$tmpdir/foo/bar/baz/quxx/quzz.d");
+ mkpath($dst_dir);
+
+ my $test_file = File::Spec->rel2abs("$dst_dir/test.txt");
+ if (open(my $fh, "> $test_file")) {
+ print $fh "Hello, World!\n";
+ unless (close($fh)) {
+ die("Can't write $test_file: $!");
+ }
+
+ } else {
+ die("Can't open $test_file: $!");
+ }
+
+ my $config = {
+ PidFile => $setup->{pid_file},
+ ScoreboardFile => $setup->{scoreboard_file},
+ SystemLog => $setup->{log_file},
+
+ AuthUserFile => $setup->{auth_user_file},
+ AuthGroupFile => $setup->{auth_group_file},
+
+ AllowOverwrite => 'on',
+ AllowStoreRestart => 'on',
+
+ IfModules => {
+ 'mod_case.c' => {
+ CaseEngine => 'on',
+ CaseIgnore => 'on',
+ CaseLog => $setup->{log_file},
+ },
+
+ 'mod_delay.c' => {
+ DelayEngine => 'off',
+ },
+ },
+ };
+
+ my ($port, $config_user, $config_group) = config_write($setup->{config_file},
+ $config);
+
+ # Open pipes, for use between the parent and child processes. Specifically,
+ # the child will indicate when it's done with its test by writing a message
+ # to the parent.
+ my ($rfh, $wfh);
+ unless (pipe($rfh, $wfh)) {
+ die("Can't open pipe: $!");
+ }
+
+ my $ex;
+
+ # Fork child
+ $self->handle_sigchld();
+ defined(my $pid = fork()) or die("Can't fork: $!");
+ if ($pid) {
+ eval {
+ my $client = ProFTPD::TestSuite::FTP->new('127.0.0.1', $port, 0);
+ $client->login($setup->{user}, $setup->{passwd});
+
+ $client->cwd("FOO");
+ $client->cwd("bAr");
+ $client->cwd("BaZ");
+ $client->cwd("quXX");
+ $client->cwd("QuZz.D");
+
+ my $conn = $client->appe_raw("TeSt.TxT");
+ unless ($conn) {
+ die("APPE TeSt.TxT failed: " . $client->response_code() . " " .
+ $client->response_msg());
+ }
+
+ my $buf = "Hello again!\n";
+ $conn->write($buf, length($buf), 25);
+ eval { $conn->close() };
+
+ my $resp_code = $client->response_code();
+ my $resp_msg = $client->response_msg();
+ $self->assert_transfer_ok($resp_code, $resp_msg);
+
+ $client->quit();
+ };
+
+ if ($@) {
+ $ex = $@;
+ }
+
+ $wfh->print("done\n");
+ $wfh->flush();
+
+ } else {
+ eval { server_wait($setup->{config_file}, $rfh) };
+ if ($@) {
+ warn($@);
+ exit 1;
+ }
+
+ exit 0;
+ }
+
+ # Stop server
+ server_stop($setup->{pid_file});
+ $self->assert_child_ok($pid);
+
+ test_cleanup($setup->{log_file}, $ex);
+}
+
1;
View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd-mod-case/-/commit/25f40b82ec9d957f8305ab4630900dee0589a8f8
--
View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd-mod-case/-/commit/25f40b82ec9d957f8305ab4630900dee0589a8f8
You're receiving this email because of your account on salsa.debian.org.
More information about the Pkg-proftpd-maintainers
mailing list