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