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);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
suspicious_filename(const char *fn)
|
||||||
|
{
|
||||||
|
return stncmp(fn, "../", 3) == 0 || *fn == '/';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get multiple files.
|
* Get multiple files.
|
||||||
*/
|
*/
|
||||||
@@ -685,6 +691,8 @@ mget(int argc, char **argv)
|
|||||||
mflag = 0;
|
mflag = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (mflag && suspicious_filename(cp))
|
||||||
|
printf("*** Suspicious filename: %s\n", cp);
|
||||||
if (mflag && confirm(argv[0], cp)) {
|
if (mflag && confirm(argv[0], cp)) {
|
||||||
tp = cp;
|
tp = cp;
|
||||||
if (mcase) {
|
if (mcase) {
|
||||||
@@ -774,16 +782,10 @@ remglob(char **argv, int doswitch)
|
|||||||
while(fgets(buf, sizeof (buf), ftemp)) {
|
while(fgets(buf, sizeof (buf), ftemp)) {
|
||||||
if ((cp = strchr(buf, '\n')) != NULL)
|
if ((cp = strchr(buf, '\n')) != NULL)
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
if(strncmp(buf, "../", 3) == 0 || *buf == '/'){
|
if(!interactive && suspicious_filename(buf)){
|
||||||
if(interactive == 0){
|
|
||||||
printf("Ignoring remote globbed file `%s'\n", buf);
|
printf("Ignoring remote globbed file `%s'\n", buf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!confirm(buf, *buf == '/' ?
|
|
||||||
" - retrieve file starting with `/'" :
|
|
||||||
" - retrieve file starting with `..'"))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
fclose(ftemp);
|
fclose(ftemp);
|
||||||
|
Reference in New Issue
Block a user