Teach ftpd about the new GLOB_MAXPATH flag.

This commit is contained in:
Jonathan Lemon 2001-03-19 19:11:00 +00:00
parent bae8632f82
commit 6d10cb2f6f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74470
2 changed files with 11 additions and 0 deletions

View File

@ -188,6 +188,13 @@ static int auth_pam __P((struct passwd**, const char*));
char *pid_file = NULL;
/*
* Limit number of pathnames that glob can return.
* A limit of 0 indicates the number of pathnames is unlimited.
*/
#define MAXGLOBARGS 16384
#
/*
* Timeout intervals for retrying connections
* to hosts that don't accept PORT cmds. This
@ -2621,6 +2628,8 @@ send_file_list(whichf)
int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
memset(&gl, 0, sizeof(gl));
gl.gl_matchc = MAXGLOBARGS;
flags |= GLOB_MAXPATH;
freeglob = 1;
if (glob(whichf, flags, 0, &gl)) {
reply(550, "not found");

View File

@ -107,6 +107,8 @@ ftpd_popen(program, type)
int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
memset(&gl, 0, sizeof(gl));
gl.gl_matchc = MAXGLOBARGS;
flags |= GLOB_MAXPATH;
if (glob(argv[argc], flags, NULL, &gl))
gargv[gargc++] = strdup(argv[argc]);
else