|
|
4f574c |
diff -up netkit-ftp-0.17/ftp/cmds.c.old netkit-ftp-0.17/ftp/cmds.c
|
|
|
4f574c |
--- netkit-ftp-0.17/ftp/cmds.c.old 2007-11-15 13:34:31.000000000 +0100
|
|
|
4f574c |
+++ netkit-ftp-0.17/ftp/cmds.c 2007-11-15 13:44:44.000000000 +0100
|
|
|
4f574c |
@@ -137,7 +137,7 @@ static char *pathprotect(char *name)
|
|
|
4f574c |
if (name[i]=='.' && gotdots>=0) gotdots++;
|
|
|
4f574c |
else if (name[i]=='/' && gotdots<0) gotdots=0;
|
|
|
4f574c |
else if (name[i]=='/' && gotdots==2) {
|
|
|
4f574c |
- printf("Warning: embedded .. in %.*s (changing to !!)\n",
|
|
|
4f574c |
+ fprintf(stderr, "Warning: embedded .. in %.*s (changing to !!)\n",
|
|
|
4f574c |
len-1, name);
|
|
|
4f574c |
name[i-1] = '!';
|
|
|
4f574c |
name[i-2] = '!';
|
|
|
4f574c |
@@ -167,7 +167,7 @@ another(int *pargc, char ***pargv, const
|
|
|
4f574c |
int ret;
|
|
|
4f574c |
|
|
|
4f574c |
if (len >= sizeof(line) - 3) {
|
|
|
4f574c |
- printf("sorry, arguments too long\n");
|
|
|
4f574c |
+ fprintf(stderr, "sorry, arguments too long\n");
|
|
|
4f574c |
intr(0);
|
|
|
4f574c |
}
|
|
|
4f574c |
printf("(%s) ", prompt);
|
|
|
4f574c |
@@ -195,7 +195,7 @@ setpeer(int argc, char *argv[])
|
|
|
4f574c |
char *port;
|
|
|
4f574c |
|
|
|
4f574c |
if (connected) {
|
|
|
4f574c |
- printf("Already connected to %s, use close first.\n",
|
|
|
4f574c |
+ fprintf(stderr, "Already connected to %s, use close first.\n",
|
|
|
4f574c |
hostname);
|
|
|
4f574c |
code = -1;
|
|
|
4f574c |
return;
|
|
|
4f574c |
@@ -278,7 +278,7 @@ setpeer(int argc, char *argv[])
|
|
|
4f574c |
unix_server = 0;
|
|
|
4f574c |
if (overbose &&
|
|
|
4f574c |
!strncmp(reply_string, "215 TOPS20", 10))
|
|
|
4f574c |
- printf(
|
|
|
4f574c |
+ fprintf(stderr,
|
|
|
4f574c |
"Remember to set tenex mode when transfering binary files from this machine.\n");
|
|
|
4f574c |
}
|
|
|
4f574c |
verbose = overbose;
|
|
|
4f574c |
@@ -316,7 +316,7 @@ do_settype(const char *thetype)
|
|
|
4f574c |
if (strcmp(thetype, p->t_name) == 0)
|
|
|
4f574c |
break;
|
|
|
4f574c |
if (p->t_name == 0) {
|
|
|
4f574c |
- printf("%s: unknown mode\n", thetype);
|
|
|
4f574c |
+ fprintf(stderr, "%s: unknown mode\n", thetype);
|
|
|
4f574c |
code = -1;
|
|
|
4f574c |
return;
|
|
|
4f574c |
}
|
|
|
4f574c |
@@ -378,7 +378,7 @@ changetype(int newtype, int show)
|
|
|
4f574c |
if (newtype == p->t_type)
|
|
|
4f574c |
break;
|
|
|
4f574c |
if (p->t_name == 0) {
|
|
|
4f574c |
- printf("ftp: internal error: unknown type %d\n", newtype);
|
|
|
4f574c |
+ fprintf(stderr, "ftp: internal error: unknown type %d\n", newtype);
|
|
|
4f574c |
return;
|
|
|
4f574c |
}
|
|
|
4f574c |
if (newtype == TYPE_L && bytename[0] != '\0')
|
|
|
4f574c |
@@ -428,7 +428,7 @@ settenex(void)
|
|
|
4f574c |
void
|
|
|
4f574c |
setmode(void)
|
|
|
4f574c |
{
|
|
|
4f574c |
- printf("We only support %s mode, sorry.\n", modename);
|
|
|
4f574c |
+ fprintf(stderr, "We only support %s mode, sorry.\n", modename);
|
|
|
4f574c |
code = -1;
|
|
|
4f574c |
}
|
|
|
4f574c |
|
|
|
4f574c |
@@ -439,7 +439,7 @@ setmode(void)
|
|
|
4f574c |
void
|
|
|
4f574c |
setform(void)
|
|
|
4f574c |
{
|
|
|
4f574c |
- printf("We only support %s format, sorry.\n", formname);
|
|
|
4f574c |
+ fprintf(stderr, "We only support %s format, sorry.\n", formname);
|
|
|
4f574c |
code = -1;
|
|
|
4f574c |
}
|
|
|
4f574c |
|
|
|
4f574c |
@@ -449,7 +449,7 @@ setform(void)
|
|
|
4f574c |
void
|
|
|
4f574c |
setstruct(void)
|
|
|
4f574c |
{
|
|
|
4f574c |
- printf("We only support %s structure, sorry.\n", structname);
|
|
|
4f574c |
+ fprintf(stderr, "We only support %s structure, sorry.\n", structname);
|
|
|
4f574c |
code = -1;
|
|
|
4f574c |
}
|
|
|
4f574c |
|
|
|
4f574c |
@@ -594,7 +594,7 @@ mput(int argc, char *argv[])
|
|
|
4f574c |
}
|
|
|
4f574c |
gargs = ftpglob(argv[i]);
|
|
|
4f574c |
if (globerr != NULL) {
|
|
|
4f574c |
- printf("%s\n", globerr);
|
|
|
4f574c |
+ fprintf(stderr, "%s\n", globerr);
|
|
|
4f574c |
if (gargs) {
|
|
|
4f574c |
blkfree(gargs);
|
|
|
4f574c |
free((char *)gargs);
|
|
|
4f574c |
@@ -906,7 +906,7 @@ remglob(char *argv[], int doswitch)
|
|
|
4f574c |
umask(oldumask);
|
|
|
4f574c |
|
|
|
4f574c |
if (fd<0) {
|
|
|
4f574c |
- printf("Error creating temporary file, oops\n");
|
|
|
4f574c |
+ fprintf(stderr, "Error creating temporary file, oops\n");
|
|
|
4f574c |
return NULL;
|
|
|
4f574c |
}
|
|
|
4f574c |
|
|
|
4f574c |
@@ -931,13 +931,13 @@ remglob(char *argv[], int doswitch)
|
|
|
4f574c |
}
|
|
|
4f574c |
verbose = oldverbose; hash = oldhash;
|
|
|
4f574c |
if (badglob) {
|
|
|
4f574c |
- printf("Refusing to handle insecure file list\n");
|
|
|
4f574c |
+ fprintf(stderr, "Refusing to handle insecure file list\n");
|
|
|
4f574c |
close(fd);
|
|
|
4f574c |
return NULL;
|
|
|
4f574c |
}
|
|
|
4f574c |
ftemp = fdopen(fd, "r");
|
|
|
4f574c |
if (ftemp == NULL) {
|
|
|
4f574c |
- printf("fdopen failed, oops\n");
|
|
|
4f574c |
+ fprintf(stderr, "fdopen failed, oops\n");
|
|
|
4f574c |
return NULL;
|
|
|
4f574c |
}
|
|
|
4f574c |
rewind(ftemp);
|
|
|
4f574c |
@@ -1006,7 +1006,7 @@ checkglob(int fd, const char *pattern)
|
|
|
4f574c |
while (*sp == '/')
|
|
|
4f574c |
sp++;
|
|
|
4f574c |
if (nrslash >= MAXPATHLEN) {
|
|
|
4f574c |
- printf("Incredible pattern: %s\n", pattern);
|
|
|
4f574c |
+ fprintf(stderr, "Incredible pattern: %s\n", pattern);
|
|
|
4f574c |
return 0;
|
|
|
4f574c |
}
|
|
|
4f574c |
dotdot[nrslash++] = isdotdotglob(sp);
|
|
|
4f574c |
@@ -1019,7 +1019,7 @@ checkglob(int fd, const char *pattern)
|
|
|
4f574c |
if ((sp = strchr(buffer, '\n')) != 0) {
|
|
|
4f574c |
*sp = '\0';
|
|
|
4f574c |
} else {
|
|
|
4f574c |
- printf("Extremely long filename from server: %s",
|
|
|
4f574c |
+ fprintf(stderr, "Extremely long filename from server: %s",
|
|
|
4f574c |
buffer);
|
|
|
4f574c |
okay = 0;
|
|
|
4f574c |
break;
|
|
|
4f574c |
@@ -1038,7 +1038,7 @@ checkglob(int fd, const char *pattern)
|
|
|
4f574c |
}
|
|
|
4f574c |
|
|
|
4f574c |
if (!okay)
|
|
|
4f574c |
- printf("Filename provided by server "
|
|
|
4f574c |
+ fprintf(stderr, "Filename provided by server "
|
|
|
4f574c |
"doesn't match pattern `%s': %s\n", pattern, buffer);
|
|
|
4f574c |
|
|
|
4f574c |
fclose(fp);
|
|
|
4f574c |
@@ -1061,14 +1061,14 @@ status(void)
|
|
|
4f574c |
if (connected)
|
|
|
4f574c |
printf("Connected to %s.\n", hostname);
|
|
|
4f574c |
else
|
|
|
4f574c |
- printf("Not connected.\n");
|
|
|
4f574c |
+ fprintf(stderr, "Not connected.\n");
|
|
|
4f574c |
if (!proxy) {
|
|
|
4f574c |
pswitch(1);
|
|
|
4f574c |
if (connected) {
|
|
|
4f574c |
printf("Connected for proxy commands to %s.\n", hostname);
|
|
|
4f574c |
}
|
|
|
4f574c |
else {
|
|
|
4f574c |
- printf("No proxy connection.\n");
|
|
|
4f574c |
+ fprintf(stderr, "No proxy connection.\n");
|
|
|
4f574c |
}
|
|
|
4f574c |
pswitch(0);
|
|
|
4f574c |
}
|
|
|
4f574c |
@@ -1218,7 +1218,7 @@ setdebug(int argc, char *argv[])
|
|
|
4f574c |
if (argc > 1) {
|
|
|
4f574c |
val = atoi(argv[1]);
|
|
|
4f574c |
if (val < 0) {
|
|
|
4f574c |
- printf("%s: bad debugging value.\n", argv[1]);
|
|
|
4f574c |
+ fprintf(stderr, "%s: bad debugging value.\n", argv[1]);
|
|
|
4f574c |
code = -1;
|
|
|
4f574c |
return;
|
|
|
4f574c |
}
|
|
|
4f574c |
@@ -1248,7 +1248,7 @@ cd(int argc, char *argv[])
|
|
|
4f574c |
}
|
|
|
4f574c |
if (command("CWD %s", argv[1]) == ERROR && code == 500) {
|
|
|
4f574c |
if (verbose)
|
|
|
4f574c |
- printf("CWD command not recognized, trying XCWD\n");
|
|
|
4f574c |
+ fprintf(stderr, "CWD command not recognized, trying XCWD\n");
|
|
|
4f574c |
(void) command("XCWD %s", argv[1]);
|
|
|
4f574c |
}
|
|
|
4f574c |
}
|
|
|
4f574c |
@@ -1546,7 +1546,7 @@ user(int argc, char *argv[])
|
|
|
4f574c |
aflag++;
|
|
|
4f574c |
}
|
|
|
4f574c |
if (n != COMPLETE) {
|
|
|
4f574c |
- fprintf(stdout, "Login failed.\n");
|
|
|
4f574c |
+ fprintf(stderr, "Login failed.\n");
|
|
|
4f574c |
return;
|
|
|
4f574c |
}
|
|
|
4f574c |
if (!aflag && argc == 4) {
|
|
|
4f574c |
@@ -1567,7 +1567,7 @@ pwd(void)
|
|
|
4f574c |
*/
|
|
|
4f574c |
verbose = 1;
|
|
|
4f574c |
if (command("PWD") == ERROR && code == 500) {
|
|
|
4f574c |
- printf("PWD command not recognized, trying XPWD\n");
|
|
|
4f574c |
+ fprintf(stderr, "PWD command not recognized, trying XPWD\n");
|
|
|
4f574c |
(void) command("XPWD");
|
|
|
4f574c |
}
|
|
|
4f574c |
verbose = oldverbose;
|
|
|
4f574c |
@@ -1587,7 +1587,7 @@ makedir(int argc, char *argv[])
|
|
|
4f574c |
}
|
|
|
4f574c |
if (command("MKD %s", argv[1]) == ERROR && code == 500) {
|
|
|
4f574c |
if (verbose)
|
|
|
4f574c |
- printf("MKD command not recognized, trying XMKD\n");
|
|
|
4f574c |
+ fprintf(stderr, "MKD command not recognized, trying XMKD\n");
|
|
|
4f574c |
(void) command("XMKD %s", argv[1]);
|
|
|
4f574c |
}
|
|
|
4f574c |
}
|
|
|
4f574c |
@@ -1606,7 +1606,7 @@ removedir(int argc, char *argv[])
|
|
|
4f574c |
}
|
|
|
4f574c |
if (command("RMD %s", argv[1]) == ERROR && code == 500) {
|
|
|
4f574c |
if (verbose)
|
|
|
4f574c |
- printf("RMD command not recognized, trying XRMD\n");
|
|
|
4f574c |
+ fprintf(stderr, "RMD command not recognized, trying XRMD\n");
|
|
|
4f574c |
(void) command("XRMD %s", argv[1]);
|
|
|
4f574c |
}
|
|
|
4f574c |
}
|
|
|
4f574c |
@@ -2212,7 +2212,7 @@ cdup(void)
|
|
|
4f574c |
{
|
|
|
4f574c |
if (command("CDUP") == ERROR && code == 500) {
|
|
|
4f574c |
if (verbose)
|
|
|
4f574c |
- printf("CDUP command not recognized, trying XCUP\n");
|
|
|
4f574c |
+ fprintf(stderr, "CDUP command not recognized, trying XCUP\n");
|
|
|
4f574c |
(void) command("XCUP");
|
|
|
4f574c |
}
|
|
|
4f574c |
}
|