Move confirmation of suspicious filenames from remglob to mget.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3813 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -661,6 +661,12 @@ getit(int argc, char **argv, int restartit, char *mode)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
suspicious_filename(const char *fn)
|
||||
{
|
||||
return stncmp(fn, "../", 3) == 0 || *fn == '/';
|
||||
}
|
||||
|
||||
/*
|
||||
* Get multiple files.
|
||||
*/
|
||||
@@ -685,6 +691,8 @@ mget(int argc, char **argv)
|
||||
mflag = 0;
|
||||
continue;
|
||||
}
|
||||
if (mflag && suspicious_filename(cp))
|
||||
printf("*** Suspicious filename: %s\n", cp);
|
||||
if (mflag && confirm(argv[0], cp)) {
|
||||
tp = cp;
|
||||
if (mcase) {
|
||||
@@ -774,16 +782,10 @@ remglob(char **argv, int doswitch)
|
||||
while(fgets(buf, sizeof (buf), ftemp)) {
|
||||
if ((cp = strchr(buf, '\n')) != NULL)
|
||||
*cp = '\0';
|
||||
if(strncmp(buf, "../", 3) == 0 || *buf == '/'){
|
||||
if(interactive == 0){
|
||||
if(!interactive && suspicious_filename(buf)){
|
||||
printf("Ignoring remote globbed file `%s'\n", buf);
|
||||
continue;
|
||||
}
|
||||
if(!confirm(buf, *buf == '/' ?
|
||||
" - retrieve file starting with `/'" :
|
||||
" - retrieve file starting with `..'"))
|
||||
continue;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
fclose(ftemp);
|
||||
|
Reference in New Issue
Block a user