fixed deny_file, hide_file options - updated sqb patch

This commit is contained in:
Jiri Skala 2014-07-04 13:38:27 +02:00
parent 72b11624b3
commit afd5aab9bf
2 changed files with 76 additions and 72 deletions

View File

@ -1,7 +1,7 @@
diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
--- vsftpd-2.3.4/ls.c.sqb 2011-09-13 10:37:05.222089078 +0200
+++ vsftpd-2.3.4/ls.c 2011-09-13 10:59:19.550508941 +0200
@@ -245,7 +245,7 @@ vsf_filename_passes_filter(const struct
diff -up vsftpd-3.0.2/ls.c.sqb vsftpd-3.0.2/ls.c
--- vsftpd-3.0.2/ls.c.sqb 2014-07-04 09:55:57.899506894 +0200
+++ vsftpd-3.0.2/ls.c 2014-07-04 09:58:02.187569017 +0200
@@ -246,7 +246,7 @@ vsf_filename_passes_filter(const struct
int ret = 0;
char last_token = 0;
int must_match_at_current_pos = 1;
@ -10,7 +10,7 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
str_copy(&filter_remain_str, p_filter_str);
@@ -275,7 +275,7 @@ vsf_filename_passes_filter(const struct
@@ -276,7 +276,7 @@ vsf_filename_passes_filter(const struct
static struct mystr s_match_needed_str;
/* Locate next special token */
struct str_locate_result locate_result =
@ -19,7 +19,7 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
(*iters)++;
/* Isolate text leading up to token (if any) - needs to be matched */
if (locate_result.found)
@@ -293,94 +293,170 @@ vsf_filename_passes_filter(const struct
@@ -294,94 +294,172 @@ vsf_filename_passes_filter(const struct
str_empty(&filter_remain_str);
last_token = 0;
}
@ -31,28 +31,13 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
- unsigned int indexx;
- locate_result = str_locate_str(&name_remain_str, &s_match_needed_str);
- if (!locate_result.found)
- {
- /* Fail */
- goto out;
- }
- indexx = locate_result.index;
- if (must_match_at_current_pos && indexx > 0)
- {
- goto out;
- }
- if (!must_match_at_current_pos && last_token == 0)
- {
- struct mystr last_str = INIT_MYSTR;
- str_mid_to_end(&name_remain_str, &last_str,
- str_getlen(&name_remain_str) - str_getlen(&s_match_needed_str));
- locate_result = str_locate_str(&last_str, &s_match_needed_str);
- str_free(&last_str);
- if (locate_result.found)
+
+ matched = 0;
+ do {
+ if (!str_isempty(&s_match_needed_str))
+ {
{
- /* Fail */
- goto out;
+ if (!matched)
+ {
+ matched = 1;
@ -69,11 +54,9 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
+ }
+ indexx = locate_result.index;
+ if (must_match_at_current_pos && indexx > 0)
{
- ret = 1;
+ {
+ goto out;
}
- goto out;
+ }
+ if (!must_match_at_current_pos && last_token == 0)
+ {
+ struct mystr last_str = INIT_MYSTR;
@ -93,14 +76,8 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
+ indexx + str_getlen(&s_match_needed_str));
+ str_copy(&name_remain_str, &temp_str);
}
- /* Chop matched string out of remainder */
- str_mid_to_end(&name_remain_str, &temp_str,
- indexx + str_getlen(&s_match_needed_str));
- str_copy(&name_remain_str, &temp_str);
- }
- if (last_token == '?')
- {
- if (str_isempty(&name_remain_str))
- indexx = locate_result.index;
- if (must_match_at_current_pos && indexx > 0)
+ if (last_token == '?')
{
- goto out;
@ -112,43 +89,30 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
+ str_copy(&name_remain_str, &temp_str);
+ must_match_at_current_pos = 1;
}
- str_right(&name_remain_str, &temp_str, str_getlen(&name_remain_str) - 1);
- str_copy(&name_remain_str, &temp_str);
- must_match_at_current_pos = 1;
- }
- else if (last_token == '{')
- {
- struct str_locate_result end_brace =
- str_locate_char(&filter_remain_str, '}');
- must_match_at_current_pos = 1;
- if (end_brace.found)
- if (!must_match_at_current_pos && last_token == 0)
+ else if (last_token == '{')
{
- str_split_char(&filter_remain_str, &temp_str, '}');
- str_copy(&brace_list_str, &filter_remain_str);
- str_copy(&filter_remain_str, &temp_str);
- str_split_char(&brace_list_str, &temp_str, ',');
- while (!str_isempty(&brace_list_str))
- {
- str_copy(&new_filter_str, &brace_list_str);
- str_append_str(&new_filter_str, &filter_remain_str);
- if (vsf_filename_passes_filter(&name_remain_str, &new_filter_str,
- iters))
- struct mystr last_str = INIT_MYSTR;
- str_mid_to_end(&name_remain_str, &last_str,
- str_getlen(&name_remain_str) - str_getlen(&s_match_needed_str));
- locate_result = str_locate_str(&last_str, &s_match_needed_str);
- str_free(&last_str);
+ struct str_locate_result end_brace =
+ str_locate_char(&filter_remain_str, '}');
+ must_match_at_current_pos = 1;
+ if (end_brace.found)
+ {
+ int entire = (*iters == 1 && last_token == '{');
- if (locate_result.found)
+ str_split_char(&filter_remain_str, &temp_str, '}');
+ str_copy(&brace_list_str, &filter_remain_str);
+ str_copy(&filter_remain_str, &temp_str);
+ str_split_char(&brace_list_str, &temp_str, ',');
+ while (!str_isempty(&brace_list_str))
{
- ret = 1;
- goto out;
+ {
+ str_empty(&new_filter_str);
+ if (!matched)
+ if (!matched && !entire)
+ {
+ str_append_char(&new_filter_str, '*');
+ }
@ -162,14 +126,13 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
+ }
+ str_copy(&brace_list_str, &temp_str);
+ str_split_char(&brace_list_str, &temp_str, ',');
}
- str_copy(&brace_list_str, &temp_str);
- str_split_char(&brace_list_str, &temp_str, ',');
+ }
+ goto out;
+ }
+ else if (str_isempty(&name_remain_str) ||
+ str_get_char_at(&name_remain_str, 0) != '{')
+ {
{
- ret = 1;
+ goto out;
+ }
+ else
@ -178,13 +141,41 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
+ str_getlen(&name_remain_str) - 1);
+ str_copy(&name_remain_str, &temp_str);
}
- goto out;
- }
- /* Chop matched string out of remainder */
- str_mid_to_end(&name_remain_str, &temp_str,
- indexx + str_getlen(&s_match_needed_str));
- str_copy(&name_remain_str, &temp_str);
- }
- if (last_token == '?')
- {
- if (str_isempty(&name_remain_str))
- {
- goto out;
}
- else if (str_isempty(&name_remain_str) ||
- str_get_char_at(&name_remain_str, 0) != '{')
- str_right(&name_remain_str, &temp_str, str_getlen(&name_remain_str) - 1);
- str_copy(&name_remain_str, &temp_str);
- must_match_at_current_pos = 1;
- }
- else if (last_token == '{')
- {
- struct str_locate_result end_brace =
- str_locate_char(&filter_remain_str, '}');
- must_match_at_current_pos = 1;
- if (end_brace.found)
+ else if (last_token == '[')
{
- goto out;
- str_split_char(&filter_remain_str, &temp_str, '}');
- str_copy(&brace_list_str, &filter_remain_str);
- str_copy(&filter_remain_str, &temp_str);
- str_split_char(&brace_list_str, &temp_str, ',');
- while (!str_isempty(&brace_list_str))
- {
- str_copy(&new_filter_str, &brace_list_str);
- str_append_str(&new_filter_str, &filter_remain_str);
- if (vsf_filename_passes_filter(&name_remain_str, &new_filter_str,
- iters))
+ struct str_locate_result end_sqb =
+ str_locate_char(&filter_remain_str, ']');
+ must_match_at_current_pos = 1;
@ -199,7 +190,9 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
+ str_copy(&filter_remain_str, &temp_str);
+ p_brace = str_getbuf(&brace_list_str);
+ for (cur_pos = 0; cur_pos < str_getlen(&brace_list_str);)
+ {
{
- ret = 1;
- goto out;
+ stch = p_brace[cur_pos];
+ // char vers. range
+ if (cur_pos + 2 < str_getlen(&brace_list_str) &&
@ -230,7 +223,9 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
+ goto out;
+ }
+ }
+ }
}
- str_copy(&brace_list_str, &temp_str);
- str_split_char(&brace_list_str, &temp_str, ',');
+ goto out;
+ }
+ else if (str_isempty(&name_remain_str) ||
@ -243,7 +238,13 @@ diff -up vsftpd-2.3.4/ls.c.sqb vsftpd-2.3.4/ls.c
+ str_right(&name_remain_str, &temp_str,
+ str_getlen(&name_remain_str) - 1);
+ str_copy(&name_remain_str, &temp_str);
+ }
}
- goto out;
- }
- else if (str_isempty(&name_remain_str) ||
- str_get_char_at(&name_remain_str, 0) != '{')
- {
- goto out;
}
else
{

View File

@ -3,7 +3,7 @@
Name: vsftpd
Version: 3.0.2
Release: 10%{?dist}
Release: 11%{?dist}
Summary: Very Secure Ftp Daemon
Group: System Environment/Daemons
@ -167,6 +167,9 @@ rm -rf $RPM_BUILD_ROOT
%{_var}/ftp
%changelog
* Fri Jul 04 2014 Jiri Skala <jskala@redhat.com> - 3.0.2-11
- fixed deny_file, hide_file options - updated sqb patch
* Wed Jun 18 2014 Jiri Skala <jskala@redhat.com> - 3.0.2-10
- improves DH cipher
- implements ECDH cipher