components/proftpd/patches/008.19596338.patch
author Tomas Klacko <tomas.klacko@oracle.com>
Mon, 18 May 2015 01:59:30 -0700
branchs11-update
changeset 4303 fe962209b82f
parent 3444 components/proftpd/patches/19596338.patch@10e7519ee062
permissions -rw-r--r--
20553228 add proftpd dtrace provider from AK to Userland
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3444
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     1
diff --git a/include/glibc-glob.h b/include/glibc-glob.h
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     2
index 422089a..a55899a 100644
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     3
--- a/include/glibc-glob.h
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     4
+++ b/include/glibc-glob.h
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     5
@@ -85,6 +85,7 @@ extern "C" {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     6
 #define	GLOB_ABORTED	2	/* Read error.  */
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     7
 #define	GLOB_NOMATCH	3	/* No matches found.  */
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     8
 #define GLOB_NOSYS	4	/* Not implemented.  */
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
     9
+#define GLOB_LIMIT	5       /* MAX_RESULTS limit reached */
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    10
 #ifdef _GNU_SOURCE
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    11
 /* Previous versions of this file defined GLOB_ABEND instead of
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    12
    GLOB_ABORTED.  Provide a compatibility definition here.  */
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    13
diff --git a/lib/glibc-glob.c b/lib/glibc-glob.c
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    14
index 43b02bc..92c2b94 100644
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    15
--- a/lib/glibc-glob.c
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    16
+++ b/lib/glibc-glob.c
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    17
@@ -40,6 +40,15 @@ char *alloca ();
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    18
 #define MAX_RECURSION 	PR_TUNABLE_GLOBBING_MAX_RECURSION
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    19
 #define MAX_RESULTS	PR_TUNABLE_GLOBBING_MAX_MATCHES
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    20
 
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    21
+unsigned long GlobMaxResults = 0;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    22
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    23
+static unsigned long get_globmaxresults(void)
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    24
+{
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    25
+  if (GlobMaxResults > 0)
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    26
+    return GlobMaxResults;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    27
+  return MAX_RESULTS;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    28
+}
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    29
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    30
 /* Enable GNU extensions in glob.h.  */
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    31
 #ifndef _GNU_SOURCE
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    32
 # define _GNU_SOURCE	1
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    33
@@ -239,8 +248,6 @@ extern void bcopy ();
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    34
 # define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len)
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    35
 #endif
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    36
 
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    37
-static unsigned long nbresults;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    38
-
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    39
 #ifndef	__GNU_LIBRARY__
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    40
 # ifdef	__GNUC__
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    41
 __inline
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    42
@@ -1157,7 +1164,6 @@ int
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    43
 glob (const char *pattern, int flags, int (*errfunc) __P((const char *, int)),
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    44
     glob_t *pglob)
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    45
 {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    46
-	nbresults = 0UL;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    47
 	return glob_limited(0U, pattern, flags, errfunc, pglob);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    48
 }
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    49
 
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    50
@@ -1318,6 +1324,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    51
   size_t nfound;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    52
   int meta;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    53
   int save;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    54
+  int ret_glob_limit = 0;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    55
 
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    56
   meta = __glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE));
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    57
   if (meta == 0 && (flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    58
@@ -1428,10 +1435,6 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    59
 #endif
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    60
 		  if (d == NULL)
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    61
 		    break;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    62
-		  if (nbresults > MAX_RESULTS) {	
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    63
-			  break;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    64
-		  }
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    65
-		  nbresults++;	
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    66
 		  if (! REAL_DIR_ENTRY (d))
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    67
 		    continue;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    68
 
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    69
@@ -1463,6 +1466,14 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    70
 		      new->next = names;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    71
 		      names = new;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    72
 		      ++nfound;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    73
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    74
+		      if (nfound > get_globmaxresults()) {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    75
+                        for (; names != NULL; names = names->next)
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    76
+                          free(names->name);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    77
+                        nfound = 0;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    78
+		        ret_glob_limit = 1;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    79
+		        break;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    80
+		      }
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    81
 		    }
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    82
 		}
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    83
 	    }
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    84
@@ -1516,6 +1527,9 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    85
     }
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    86
   __set_errno (save);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    87
 
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    88
+  if (ret_glob_limit)
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    89
+    return GLOB_LIMIT;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    90
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    91
   return nfound == 0 ? GLOB_NOMATCH : 0;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    92
 
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    93
  memory_error:
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    94
diff --git a/modules/mod_core.c b/modules/mod_core.c
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    95
index e33ee11..1f6da19 100644
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    96
--- a/modules/mod_core.c
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    97
+++ b/modules/mod_core.c
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    98
@@ -973,6 +973,26 @@ MODRET set_maxconnrate(cmd_rec *cmd) {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
    99
   return PR_HANDLED(cmd);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   100
 }
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   101
 
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   102
+extern unsigned long GlobMaxResults;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   103
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   104
+MODRET set_globmaxresults(cmd_rec *cmd) {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   105
+  unsigned long max;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   106
+  char *endp;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   107
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   108
+  CHECK_ARGS(cmd,1);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   109
+  CHECK_CONF(cmd,CONF_ROOT);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   110
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   111
+  max = strtoul(cmd->argv[1], &endp, 10);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   112
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   113
+  if ((endp && *endp) || max == 0)
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   114
+    CONF_ERROR(cmd, "argument must be greater than 0");
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   115
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   116
+  pr_log_debug(DEBUG1, "setting GlobMaxResults to %lu", max);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   117
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   118
+  GlobMaxResults = max;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   119
+  return PR_HANDLED(cmd);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   120
+}
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   121
+
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   122
 MODRET set_timeoutidle(cmd_rec *cmd) {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   123
   int timeout = -1;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   124
   config_rec *c = NULL;
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   125
@@ -6108,6 +6128,7 @@ static conftable core_conftab[] = {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   126
   { "DisplayConnect",		set_displayconnect,		NULL },
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   127
   { "DisplayQuit",		set_displayquit,		NULL },
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   128
   { "From",			add_from,			NULL },
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   129
+  { "GlobMaxResults",		set_globmaxresults,	        NULL },
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   130
   { "Group",			set_group, 			NULL },
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   131
   { "GroupOwner",		add_groupowner,			NULL },
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   132
   { "HideFiles",		set_hidefiles,			NULL },
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   133
diff --git a/modules/mod_ls.c b/modules/mod_ls.c
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   134
index 5b95d2b..e8bbb74 100644
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   135
--- a/modules/mod_ls.c
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   136
+++ b/modules/mod_ls.c
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   137
@@ -2015,6 +2015,8 @@ static int dolist(cmd_rec *cmd, const char *opt, int clearflags) {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   138
         pr_response_add(R_226, _("Read error during globbing of %s"),
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   139
           pr_fs_encode_path(cmd->tmp_pool, arg));
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   140
 
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   141
+      } else if (a == GLOB_LIMIT) {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   142
+        pr_response_add(R_226, _("Too many files"));
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   143
       } else if (a != GLOB_NOMATCH) {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   144
         pr_response_add(R_226, _("Unknown error during globbing of %s"),
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   145
           pr_fs_encode_path(cmd->tmp_pool, arg));
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   146
@@ -2837,7 +2839,10 @@ MODRET ls_nlst(cmd_rec *cmd) {
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   147
           return PR_HANDLED(cmd);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   148
         }
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   149
 
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   150
-        pr_response_add_err(R_450, _("No files found"));
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   151
+        if (res == GLOB_LIMIT)
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   152
+          pr_response_add_err(R_451, _("Too many files"));
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   153
+        else
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   154
+          pr_response_add_err(R_450, _("No files found"));
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   155
         return PR_ERROR(cmd);
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   156
       }
10e7519ee062 19596338 proftpd fails to list files in a busy directory
Tomas Klacko <tomas.klacko@oracle.com>
parents:
diff changeset
   157
     }