Don't warn about "ignored setsockopt" failures unless debugging is

enabled.  Suggested by Todd Vierling.

Allow empty passwords in ftp://user:@host/file auto-fetch URLs,
per RFC 1738.  Requested by Simon Poole.

Update version.
This commit is contained in:
lukem 2003-12-10 12:34:28 +00:00
parent 7db1d33cba
commit d11f9c3d61
3 changed files with 18 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fetch.c,v 1.145 2003/12/04 12:51:18 lukem Exp $ */
/* $NetBSD: fetch.c,v 1.146 2003/12/10 12:34:28 lukem Exp $ */
/*-
* Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fetch.c,v 1.145 2003/12/04 12:51:18 lukem Exp $");
__RCSID("$NetBSD: fetch.c,v 1.146 2003/12/10 12:34:28 lukem Exp $");
#endif /* not lint */
/*
@ -1302,7 +1302,6 @@ fetch_ftp(const char *url)
if ((parse_url(url, "URL", &urltype, &user, &pass,
&host, &port, &portnum, &path) == -1) ||
(user != NULL && *user == '\0') ||
(pass != NULL && *pass == '\0') ||
EMPTYSTRING(host)) {
warnx("Invalid URL `%s'", url);
goto cleanup_fetch_ftp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ftp.c,v 1.122 2003/08/07 11:13:55 agc Exp $ */
/* $NetBSD: ftp.c,v 1.123 2003/12/10 12:34:28 lukem Exp $ */
/*-
* Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
@ -99,7 +99,7 @@
#if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else
__RCSID("$NetBSD: ftp.c,v 1.122 2003/08/07 11:13:55 agc Exp $");
__RCSID("$NetBSD: ftp.c,v 1.123 2003/12/10 12:34:28 lukem Exp $");
#endif
#endif /* not lint */
@ -276,7 +276,8 @@ hookup(char *host, char *port)
int tos = IPTOS_LOWDELAY;
if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos,
sizeof(int)) < 0)
warn("setsockopt TOS (ignored)");
if (debug)
warn("setsockopt TOS (ignored)");
}
#endif
cin = fdopen(s, "r");
@ -1325,7 +1326,8 @@ initconn(void)
if ((options & SO_DEBUG) &&
setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on,
sizeof(on)) < 0)
warn("setsockopt (ignored)");
if (debug)
warn("setsockopt (ignored)");
result = COMPLETE + 1;
switch (data_addr.su_family) {
case AF_INET:
@ -1563,7 +1565,8 @@ initconn(void)
on = IPTOS_THROUGHPUT;
if (setsockopt(data, IPPROTO_IP, IP_TOS, (char *)&on,
sizeof(int)) < 0)
warn("setsockopt TOS (ignored)");
if (debug)
warn("setsockopt TOS (ignored)");
}
#endif
return (0);
@ -1596,7 +1599,8 @@ initconn(void)
if (options & SO_DEBUG &&
setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on,
sizeof(on)) < 0)
warn("setsockopt (ignored)");
if (debug)
warn("setsockopt (ignored)");
len = sizeof(data_addr.si_su);
memset((char *)&data_addr, 0, sizeof (data_addr));
if (getsockname(data, (struct sockaddr *)&data_addr.si_su, &len) < 0) {
@ -1696,7 +1700,8 @@ initconn(void)
on = IPTOS_THROUGHPUT;
if (setsockopt(data, IPPROTO_IP, IP_TOS, (char *)&on,
sizeof(int)) < 0)
warn("setsockopt TOS (ignored)");
if (debug)
warn("setsockopt TOS (ignored)");
}
#endif
return (0);
@ -1729,7 +1734,8 @@ dataconn(const char *lmode)
int tos = IPTOS_THROUGHPUT;
if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos,
sizeof(int)) < 0) {
warn("setsockopt TOS (ignored)");
if (debug)
warn("setsockopt TOS (ignored)");
}
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: version.h,v 1.33 2003/07/31 07:13:01 lukem Exp $ */
/* $NetBSD: version.h,v 1.34 2003/12/10 12:34:29 lukem Exp $ */
/*-
* Copyright (c) 1999-2003 The NetBSD Foundation, Inc.
* All rights reserved.
@ -40,5 +40,5 @@
#endif
#ifndef FTP_VERSION
#define FTP_VERSION "20030731b"
#define FTP_VERSION "20031210"
#endif