diff options
Diffstat (limited to 'contrib/lukemftp/src/util.c')
-rw-r--r-- | contrib/lukemftp/src/util.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/contrib/lukemftp/src/util.c b/contrib/lukemftp/src/util.c index 3f25d48..ebc75a4 100644 --- a/contrib/lukemftp/src/util.c +++ b/contrib/lukemftp/src/util.c @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.112 2003/06/15 13:49:46 lukem Exp $ */ +/* $NetBSD: util.c,v 1.114 2003/08/07 11:13:57 agc Exp $ */ /*- * Copyright (c) 1997-2003 The NetBSD Foundation, Inc. @@ -52,11 +52,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -75,7 +71,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: util.c,v 1.112 2003/06/15 13:49:46 lukem Exp $"); +__RCSID("$NetBSD: util.c,v 1.114 2003/08/07 11:13:57 agc Exp $"); #endif /* not lint */ /* @@ -177,15 +173,22 @@ static void parse_feat(const char *line) { - if (strcasecmp(line, " MDTM") == 0) + /* + * work-around broken ProFTPd servers that can't + * even obey RFC 2389. + */ + while (*line && isspace((int)*line)) + line++; + + if (strcasecmp(line, "MDTM") == 0) features[FEAT_MDTM] = 1; - else if (strncasecmp(line, " MLST", sizeof(" MLST") - 1) == 0) { + else if (strncasecmp(line, "MLST", sizeof("MLST") - 1) == 0) { features[FEAT_MLST] = 1; - } else if (strcasecmp(line, " REST STREAM") == 0) + } else if (strcasecmp(line, "REST STREAM") == 0) features[FEAT_REST_STREAM] = 1; - else if (strcasecmp(line, " SIZE") == 0) + else if (strcasecmp(line, "SIZE") == 0) features[FEAT_SIZE] = 1; - else if (strcasecmp(line, " TVFS") == 0) + else if (strcasecmp(line, "TVFS") == 0) features[FEAT_TVFS] = 1; } @@ -265,9 +268,16 @@ getremoteinfo(void) features[FEAT_FEAT] = 1; } else features[FEAT_FEAT] = 0; - if (debug) - for (i = 0; i < FEAT_max; i++) - printf("features[%d] = %d\n", i, features[i]); + if (debug) { +#define DEBUG_FEAT(x) fprintf(ttyout, "features[" #x "] = %d\n", features[(x)]) + DEBUG_FEAT(FEAT_FEAT); + DEBUG_FEAT(FEAT_MDTM); + DEBUG_FEAT(FEAT_MLST); + DEBUG_FEAT(FEAT_REST_STREAM); + DEBUG_FEAT(FEAT_SIZE); + DEBUG_FEAT(FEAT_TVFS); +#undef DEBUG_FEAT + } reply_callback = NULL; verbose = overbose; |