add patch to make smarter filname filter

This commit is contained in:
Maros Barabas 2006-08-28 15:46:01 +00:00
parent ef1e63d12e
commit 8e24fc924f
2 changed files with 70 additions and 1 deletions

64
vsftpd-2.0.4-filter.patch Normal file
View File

@ -0,0 +1,64 @@
--- vsftpd-2.0.4/ls.c.orig 2005-05-23 23:55:00.000000000 +0200
+++ vsftpd-2.0.4/ls.c 2006-07-11 01:02:21.000000000 +0200
@@ -239,9 +239,31 @@
int ret = 0;
char last_token = 0;
int must_match_at_current_pos = 1;
+
+
str_copy(&filter_remain_str, p_filter_str);
- str_copy(&name_remain_str, p_filename_str);
-
+
+ if (!str_isempty (&filter_remain_str) && !str_isempty(p_filename_str)) {
+ if (str_get_char_at(p_filter_str, 0) == '/') {
+ if (str_get_char_at(p_filename_str, 0) != '/') {
+ str_getcwd (&name_remain_str);
+
+ if (str_getlen(&name_remain_str) > 1) /* cwd != root dir */
+ str_append_char (&name_remain_str, '/');
+
+ str_append_str (&name_remain_str, p_filename_str);
+ }
+ else
+ str_copy (&name_remain_str, p_filename_str);
+ } else {
+ if (str_get_char_at(p_filter_str, 0) != '{')
+ str_basename (&name_remain_str, p_filename_str);
+ else
+ str_copy (&name_remain_str, p_filename_str);
+ }
+ } else
+ str_copy(&name_remain_str, p_filename_str);
+
while (!str_isempty(&filter_remain_str))
{
static struct mystr s_match_needed_str;
--- vsftpd-2.0.4/str.h.orig 2004-06-04 18:35:00.000000000 +0200
+++ vsftpd-2.0.4/str.h 2006-07-11 00:59:59.000000000 +0200
@@ -96,6 +96,8 @@
int str_contains_space(const struct mystr* p_str);
int str_contains_unprintable(const struct mystr* p_str);
void str_replace_unprintable(struct mystr* p_str, char new_char);
+void str_basename (struct mystr* d_str, const struct mystr* path);
+
int str_atoi(const struct mystr* p_str);
filesize_t str_a_to_filesize_t(const struct mystr* p_str);
unsigned int str_octal_to_uint(const struct mystr* p_str);
--- vsftpd-2.0.4/str.c.orig 2004-07-12 19:58:39.000000000 +0200
+++ vsftpd-2.0.4/str.c 2006-07-11 00:59:59.000000000 +0200
@@ -662,3 +662,14 @@
}
}
+void
+str_basename (struct mystr* d_str, const struct mystr* path)
+{
+ struct mystr tmp = INIT_MYSTR;
+
+ str_copy (&tmp, path);
+ str_split_char_reverse(&tmp, d_str, '/');
+
+ if (str_isempty(d_str))
+ str_copy (d_str, path);
+}

View File

@ -3,7 +3,7 @@
Summary: vsftpd - Very Secure Ftp Daemon Summary: vsftpd - Very Secure Ftp Daemon
Name: vsftpd Name: vsftpd
Version: 2.0.5 Version: 2.0.5
Release: 7 Release: 8
License: GPL License: GPL
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://vsftpd.beasts.org/ URL: http://vsftpd.beasts.org/
@ -35,6 +35,7 @@ Patch19: vsftpd-2.0.5-default_ipv6.patch
Patch20: vsftpd-2.0.5-add_ipv6_option.patch Patch20: vsftpd-2.0.5-add_ipv6_option.patch
Patch21: vsftpd-2.0.5-correct_comments.patch Patch21: vsftpd-2.0.5-correct_comments.patch
Patch22: vsftpd-2.0.5-man.patch Patch22: vsftpd-2.0.5-man.patch
Patch23: vsftpd-2.0.4-filter.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%if %{tcp_wrappers} %if %{tcp_wrappers}
@ -84,6 +85,7 @@ cp %{SOURCE1} .
%patch20 -p1 -b .ipv6opt %patch20 -p1 -b .ipv6opt
%patch21 -p1 -b .comments %patch21 -p1 -b .comments
%patch22 -p1 -b .manp %patch22 -p1 -b .manp
%patch23 -p1 -b .filter
%build %build
%ifarch s390x %ifarch s390x
@ -142,6 +144,9 @@ fi
/var/ftp /var/ftp
%changelog %changelog
* Mon Aug 28 2006 Maros Barabas <mbarabas@redhat.com> - 2.0.5-8
- added forgotten patch to make filename filter (#174764)
* Tue Aug 22 2006 Maros Barabas <mbarabas@redhat.com> - 2.0.5-7 * Tue Aug 22 2006 Maros Barabas <mbarabas@redhat.com> - 2.0.5-7
- correct paths of configuration files on man pages - correct paths of configuration files on man pages