History log of /src/usr.bin/ftp/ruserpass.c |
Revision | | Date | Author | Comments |
1.35 |
| 04-Oct-2024 |
christos | extract duplicate code into a function.
|
1.34 |
| 19-Jul-2024 |
lukem | ftp: improve units used in comments and errors
Use "KiB" instead of "K" in errors. Clarify related comments.
|
1.33 |
| 17-Apr-2007 |
lukem | branches: 1.33.86; * Implement -s srcaddr; uses srcaddr as the local IP address for all connections. Based on code in the version of ftp that FreeBSD had before they replaced it with lukemftp. * Move error message handling into ftp_connect() rather than in the caller, so that more specific error reporting can occur. * Improve consistency of various warning and error messages.
|
1.32 |
| 12-Apr-2007 |
lukem | Various fixes from Nicholas Marriott sent to openbsd-tech and in private email: * Prevent segfault if a .netrc token is too long. * Prevent segfault when using a macro from an empty macdef. * Check more return values.
|
1.31 |
| 31-Jan-2006 |
christos | Rename xfoo() to ftp_foo() to avoid collisions with libssh. Don't ask.
|
1.30 |
| 10-Jun-2005 |
lukem | Implement: int getline(FILE *stream, char *buf, size_t buflen, const char **errormsg) Read a line from the FILE stream into buf/buflen using fgets(), so up to buflen-1 chars will be read and the result will be NUL terminated. If the line has a trailing newline it will be removed. If the line is too long, excess characters will be read until newline/EOF/error. Various -ve return values indicate different errors, and errormsg will be changed to an error description if it's not NULL.
Convert to use getline() instead of fgets() whenever reading user input to ensure that an overly long input line doesn't leave excess characters for the next input operation to accidentally use as input.
Zero out the password & account after we've finished with it.
Consistently use getpass(3) (i.e, character echo suppressed) when reading the account data. For some reason, historically the "login" code suppressed echo for Account: yet the "user" command did not!
Display the hostname in the "getaddrinfo failed" warning.
Appease some -Wcast-qual warnings. Fixing all of these requires significant code refactoring. (mmm, legacy code).
|
1.29 |
| 07-Aug-2003 |
agc | branches: 1.29.6; Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
|
1.28 |
| 15-Nov-2000 |
lukem | - implement "mreget"; as per "mget" but uses "reget" instead of "get" - add -N netrc and $NETRC, as methods to select an alternative .netrc file - cache local user name and home directory for further use - in mget(), use docase() instead of a local version to do the case conversion.
|
1.27 |
| 18-Jul-2000 |
lukem | convert to new knf
|
1.26 |
| 01-May-2000 |
lukem | convert to ANSI KNF
|
1.25 |
| 24-Oct-1999 |
lukem | new features: - add `usage'; displays the usage of a command. implemented by calling the c_handler() with argc = 0, argv = "funcname". - add `passive auto'; does the same as $FTPMODE=auto. - add `set [option value]'; display all options, or set an option to a value. - add `unset option'; unset an option. - add getoptionvalue() to retrieve an option's value, and replace a few global variables with calls to this. - implement cleanuppeer(), which resets various bits of state back to `disconnected'. call in disconnect() and lostpeer(). - support completing on `options'. - improve recovery after a SIGINT may have closed the connection. XXX: there's still a couple to fix
other stuff: - various consistency fixes in the man page. - ensure that the command usage strings in the code and man page match reality. - mput/mget: check that the connection still exists before each xfer. - minor cosmetic changes in confirm(). - set code correctly in sizecmd() and modtime() - don't need \n in err() strings. - change lostpeer to take an argument (rather than casting (sig_t)lostpeer in signal handlers) - knf and whitespace police.
|
1.24 |
| 27-Sep-1999 |
lukem | * idle(): rename to idlecmd(). certain linux distributions have an incompatible prototype for idle() in <unistd.h> (which i thought was against namespace and sensibility guidelines, but...) * consistently use xsignal() instead of signal(). we get known behaviour in all cases (SA_RESTART), which is good for some borken foreign systems. * remove signal.h from most files; it's unnecessary now * fetch_url(): use `long chunksize' instead of ssize_t; it's more portable, and we're setting chunksize with strtol() anyway * xsignal(): only use SA_RESTART if it exists. SunOS 4.x doesn't have it but has the inverse (SA_INTERRUPT). the original function i was inspired from had this support (lib/signal.c, W. Richard Stevens' `UNP 2nd ed Vol 1'). * remove <termios.h> from util.c; it should be unnecessary now
|
1.23 |
| 22-Sep-1999 |
lukem | branches: 1.23.2; replace snprintf() with strlcpy(), strlcat(), or direct assignment where appropriate. (strlc*() are easier to port to foriegn systems).
XXX; there's still a few snprintf's in the progress meter stuff to convert
|
1.22 |
| 24-Jun-1999 |
christos | include <signal.h> explicitly! we use sig_t extern.h, and we cannot depend on other headers fetching it on other OS's.
|
1.21 |
| 08-Aug-1998 |
lukem | include <netbsd.h> for MAXHOSTNAMELEN on borken systems
|
1.20 |
| 03-Aug-1998 |
lukem | features: * support $no_proxy, which is a comma or space separated list of host[:port] elements for which proxying is to be disabled. (asked for by cgd in [bin/5027]) * if $FTPANONPASS is defined, use that as the anon ftp password (instead of "`whoami`@") * allow http URL's without a filename as long as an output file is specified.
other stuff: * implement parse_url(), which breaks up a URL into its bits, and use. * simplify url_get() and auto_fetch() to use parse_url() and to not modify the supplied URL or a copy of it. * implement xmalloc() and xstrdup(); error-checked malloc()/strdup() * add more consistency to messages, quoting strings in output as `%s'
|
1.19 |
| 26-Jul-1998 |
mycroft | const poisoning.
|
1.18 |
| 06-Jul-1998 |
mrg | - use an array MAXHOSTNAMELEN+1 size to hold hostnames - ensure hostname from gethostname() is nul-terminated in all cases - minor KNF - use MAXHOSTNAMELEN over various other values/defines - be safe will buffers that hold hostnames
|
1.17 |
| 04-Jun-1998 |
lukem | some fixes & enhancements from openbsd's ftp, with extra fixes by me: * default to passive with active fallback. $FTPMODE modifies this behaviour. -A forces active connection. * support '-o outfile' for auto-fetched files. outfile can be a file, `-' (for stdout), or '|command' (to output each file through command). * support '-r waittime', which retries the connection after waittime seconds if it fails. * fix 'page file' when restart is non-zero. * try all ip-addresses of a host in a http fetch (as the normal ftp fetch does).
XXX: a ``broken pipe'' error sometimes occurs with -o '|command'; i haven't tracked this down yet.
|
1.16 |
| 20-May-1998 |
christos | - clarify dangling else
|
1.15 |
| 01-Nov-1997 |
lukem | * in recvrequest(), ignore restart_point unless "RETR"ieving. fixes problems where a remote completion or `mget' would confuse the client a `restart' had been issued beforehand. now, `restart' is remembered until an operation that can actually use it is invoked. * in sendrequest(), don't reset restart_point upon entry. fixes `restart' for `put' operations. * if `restart' is invoked with no arguments, print current setting instead of displaying a usage * consistently use printf("%qd", (long long)restart_point) when displaying restart_point * use strto[lq]() instead of atol() when parsing `mark' and `restart' values * remove unnecessary strlen()s when result of previous snprintf() will do * replace a few malloc()/strcpy()s with strdup()s * use SECSPERHOUR instead of '3600'
|
1.14 |
| 20-Jul-1997 |
lukem | branches: 1.14.2; * use RCSID() && COPYRIGHT() macros * cleanup for WARNS=1 (including some ugly '(void)&var' bits wrapped in #ifdef __GNUC__ to shut up gcc warnings WRT setjmp/longjmp) * use strtol() instead of atoi(), and more extensively check result of conversion * use u_int16_t instead of short or int for TCP port addresses
|
1.13 |
| 01-Apr-1997 |
mrg | fix buffer overrun; from bostic (via perry (via freebsd))
|
1.12 |
| 13-Mar-1997 |
lukem | Features: * support remglobbing of auto_fetch arguments * new flag - '-e'; disable editing * "page file" == "get file |${PAGER-less}"
Bugfixes/cleanup: * consistently use a trailing '.' on messages * code cleanup, including buffer overrun fixes, use puts and putchar in places, etc (inspired by OpenBSD mods) * disable progress bar when local-file is a pipe or '-' * skip \r in http headers * fix remote ftpd slash bug more elegantly (so it works with ////) * abort_remote(): check if cout==NULL before using it. should fix [bin/3273] * fixed up cosmetic problems when complete_remote() generated errors from the remote server (such as "no files found", "login with user and pass", ...) done by adding extra argument to remglob(), which is a pointer to an error buffer to put messages in rather than printing to stdout.
|
1.11 |
| 19-Jan-1997 |
lukem | New features: * Command line editing via editline(3) library. * Context sensitive command and file completion, including remote files.
Enhancements to auto-fetch feature: * Support for http:// URLs using the http protocol, including proxy HTTP support via $htty_proxy if it's defined. * The connection is kept open between successive files on the same host. (obviously, this does not count for http requests.) * Return value of ftp is 0 on no error, or the offset in argv[] of the file which failed (i.e., argv[x] failed, ftp returns x). * If the path in an ftp URL or classic format line has a trailing '/', cd to the path and enter interactive mode. Fixes [bin/3011], albiet requiring the user to help ftp in determining the operation.
Other changes: * '-P port' works for normal ftp, and is the default for all classic style auto-fetch transfers and for ftp URLs that don't specify the port. (previously it would just work for the first xfer.) * Some code moved into separated files along logical divisions. * Editing and completion can be compiled out with -DSMALLFTP.
|
1.10 |
| 09-Jan-1997 |
tls | RCS ID police
|
1.9 |
| 06-Dec-1996 |
lukem | functionality mods: * implement 'progress bar/meter' (inspired by ncftp). use 'progress' to toggle on. it will display current file size to 5 digits, automatically determining suffix (up to 16384 P (petabytes) == 2^64). * 'ls' now uses NLST (unadorned listing), a la older ftp clients. 'dir' still does LIST (long listing). idea from John Nemeth <jnemeth@cue.bc.ca>
bug fixes: * return first line of reply in reply_string[] from getreply(), instead of last line. This fixes [bin/741] (parsing of SYST), and also means that SIZE and MDTM messages will be parsed correctly if they're longer than 1 line. * parse URL-style auto-ftps that have no filename correctly (e.g, ftp://host, ftp://host/, ftp://host/dir/). pointed out by Jaromir Dolecek <dolecek@saruman.ics.muni.cz> * pass the correct size array in 2nd arg of utimes() when setting the modification time
|
1.8 |
| 28-Nov-1996 |
lukem | More features, some of which were inspired by changes that friedman@gnu.ai.mit.edu (Noah Friedman) made to his modified ftp: - implement "lpwd" - local pwd - implement "preserve" - toggle preserving of file modification times on retrieved files - allow for explicit "on" or "off" arg to toggle commands - "exit" synonym for "quit", "msend" synonym for "mput" - in confirmation mode, allow 'a' (yes to rest of current command), and 'p' (turn off prompt mode, as if 'prompt off' was done, effective immediately) - "modtime" returns time formatted as localtime, not GMT
Bug fixes: - check for extraneous args on commands - cleanup const usage, line formatting - create 0 length temporary file in remglob() to prevent symlink games (from OpenBSD) - check length of filename of ~/.netrc (from OpenBSD)
|
1.7 |
| 25-Nov-1996 |
lukem | cleanups/bugfixes: - don't echo 'ACCT' parameter when debugging (a la 'PASS') - Fix checking of directory access for "/foo", the parent directory is "/", not "" (from FreeBSD) - remove trailing whitespace on lines - add any missing NetBSD tags - cleanups to man page, includinging sorting options description
feature additions: - variable sized hash marks (from [bin/683], but done in the hash command as an optional arg) - more user-friendly transfer time printing (from FreeBSD, with mods) - '-p' command line option to jump into PASV mode (closes [bin/2857], but with an option rather than checking argv[0]) - SIGINFO support for printing xfer stats when sending/receiving requests - '-P port' for changing the port to connect to (from thorpej@netbsd.org) - '-a': bypass normal login, and try anonymous login (from OpenBSD via thorpej) - autofetch files via url (ftp://...) or "classic" (host:/file) (from OpenBSD via thorpej) - 'ftp' synonymous with 'open' (from FreeBSD)
|
1.6 |
| 08-Sep-1995 |
tls | Sync with 4.4lite2
|
1.5 |
| 17-Sep-1994 |
mycroft | Fix null pointer dereference.
|
1.4 |
| 29-Aug-1994 |
mycroft | branches: 1.4.2; Add RCS ids.
|
1.3 |
| 25-Aug-1994 |
cgd | clean up import, no local changes.
|
1.2 |
| 01-Aug-1993 |
mycroft | Add RCS identifiers.
|
1.1 |
| 21-Mar-1993 |
cgd | branches: 1.1.1; 1.1.2; Initial revision
|
1.1.2.1 |
| 25-Aug-1994 |
cgd | import from 4.4-Lite
|
1.1.1.2 |
| 05-Sep-1995 |
tls | imported from 44lite2
|
1.1.1.1 |
| 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.4.2.2 |
| 29-Aug-1994 |
mycroft | Add RCS ids.
|
1.4.2.1 |
| 29-Aug-1994 |
mycroft | file ruserpass.c was added on branch netbsd-1-0 on 1994-08-29 03:09:22 +0000
|
1.14.2.2 |
| 10-Nov-1998 |
cgd | pull up rev(s) 1.16-1.21 from trunk. (feyrer)
|
1.14.2.1 |
| 18-Nov-1997 |
mellon | Pull rev 1.15 up from trunk (lukem)
|
1.23.2.1 |
| 27-Dec-1999 |
wrstuden | Pull up to last week's -current.
|
1.29.6.1 |
| 24-Jul-2005 |
tron | Pull up revision 1.30 (requested by lukem in ticket #606): Implement: int getline(FILE *stream, char *buf, size_t buflen, const char **errormsg) Read a line from the FILE stream into buf/buflen using fgets(), so up to buflen-1 chars will be read and the result will be NUL terminated. If the line has a trailing newline it will be removed. If the line is too long, excess characters will be read until newline/EOF/error. Various -ve return values indicate different errors, and errormsg will be changed to an error description if it's not NULL. Convert to use getline() instead of fgets() whenever reading user input to ensure that an overly long input line doesn't leave excess characters for the next input operation to accidentally use as input. Zero out the password & account after we've finished with it. Consistently use getpass(3) (i.e, character echo suppressed) when reading the account data. For some reason, historically the "login" code suppressed echo for Account: yet the "user" command did not! Display the hostname in the "getaddrinfo failed" warning. Appease some -Wcast-qual warnings. Fixing all of these requires significant code refactoring. (mmm, legacy code).
|
1.33.86.2 |
| 02-Dec-2024 |
martin | Pull up following revision(s) (requested by lukem in ticket #1021):
usr.bin/ftp/ftp.c: revision 1.178 usr.bin/ftp/version.h: revision 1.99 usr.bin/ftp/ruserpass.c: revision 1.35 usr.bin/ftp/main.c: revision 1.134 usr.bin/ftp/main.c: revision 1.135 usr.bin/ftp/progressbar.c: revision 1.27 usr.bin/ftp/util.c: revision 1.165 usr.bin/ftp/cmds.c: revision 1.144 usr.bin/ftp/extern.h: revision 1.84 usr.bin/ftp/fetch.c: revision 1.242 usr.bin/ftp/ftp.1: revision 1.160
s/bninary/binary/ in comment.
extract duplicate code into a function.
Check bounds when copying to destination.
Remove const where the const string ended up being overwritten.
use unsigned when doing shifts.
remove const when string gets overwritten.
ftp: exit non-zero if short http transfer when filesize is known If a http file size is known and the fetch finishes with less bytes transferred, exit non-zero. Bump version to 20241129. PR bin/54713 PR bin/58281
ftp: help improvements Document -? as a separate mode. Document -H HEADER in the usage. Clarify units for -b and -x. Consistent argument names between ftp -? and ftp(1).
ftp: order getopt Upper before lower Consistently order options in getopt and the switch with the upper case option before the lower case option. This makes it easier to cross-reference with -? and ftp(1). No functional change.
|
1.33.86.1 |
| 13-Oct-2024 |
martin | Pull up following revision(s) (requested by riastradh in ticket #970):
tests/usr.bin/Makefile: revision 1.42 usr.bin/ftp/ruserpass.c: revision 1.34 usr.bin/ftp/main.c: revision 1.130 usr.bin/ftp/ssl.c: revision 1.17 usr.bin/ftp/main.c: revision 1.131 usr.bin/ftp/ssl.c: revision 1.18 usr.bin/ftp/main.c: revision 1.132 usr.bin/ftp/ssl.c: revision 1.19 usr.bin/ftp/main.c: revision 1.133 distrib/sets/lists/tests/mi: revision 1.1342 usr.bin/ftp/ftp.1: revision 1.151 usr.bin/ftp/ftp.1: revision 1.152 usr.bin/ftp/progressbar.c: revision 1.25 usr.bin/ftp/ftp.1: revision 1.153 usr.bin/ftp/progressbar.c: revision 1.26 usr.bin/ftp/ftp.1: revision 1.155 usr.bin/ftp/ftp.1: revision 1.156 usr.bin/ftp/fetch.c: revision 1.239 usr.bin/ftp/ftp.1: revision 1.157 usr.bin/ftp/ftp.1: revision 1.158 usr.bin/ftp/ftp.1: revision 1.159 usr.bin/ftp/ftp_var.h: revision 1.87 etc/mtree/NetBSD.dist.tests: revision 1.208 usr.bin/ftp/ftp_var.h: revision 1.88 usr.bin/ftp/ftp_var.h: revision 1.89 usr.bin/ftp/cmds.c: revision 1.142 usr.bin/ftp/util.c: revision 1.168 usr.bin/ftp/cmds.c: revision 1.143 tests/usr.bin/ftp/custom_headers.sh: revision 1.1 usr.bin/ftp/ssl.c: revision 1.20 usr.bin/ftp/complete.c: revision 1.48 tests/usr.bin/ftp/Makefile: revision 1.1 tests/usr.bin/ftp/t_custom_headers.sh: revision 1.1 usr.bin/ftp/fetch.c: revision 1.240 usr.bin/ftp/fetch.c: revision 1.241 usr.bin/ftp/ftp.c: revision 1.176 usr.bin/ftp/ftp.c: revision 1.177 (all via patch)
ftp(1): wording and formatting improvements
Fix grammar issue with "Support values" reported in private mail. Document all file transfer types in "type" and cross-reference that. Consistency fixes in describing file transfer parameters and types.
Fix some mandoc -Tlint issues (except "useless macro: Tn").
Add -b <buflen> to specify the buffer size.
ftp: bump FTPBUFLEN from 4kB to 16kB sourceforge.net returns a 5kB content-security-policy. Analyzed by mlelstv@ who reports usual limits are between 4kB and 48kB. default is now 16K
ftp: improve -b documentation
Order -b bufsize in the synopsis.
Document the actual default value.
ftp: improve units used in comments and errors Use "KiB" instead of "K" in errors. Clarify related comments.
pass some lint.
PR/58581: Sunil Nimmagadda: Add flag to allow specifying extra http header fields.
ftp(1): Nix trailing whitespace in man page. No functional change intended.
PR bin/58581: ftp(1) should allow specifying header fields in http requests fix markup (h -> H), explain about multiple headers, fix usage (from RVP)
Don't forget the dot, use the intended macro name (I think), and improve the wording a little. (All related to the -H option.) ftp(1): Add test for custom HTTP header fields.
Based on a patch from Sunil Nimmagadda.
PR bin/58581: ftp(1) should allow specifying header fields in http requests
|