Home | History | Annotate | Download | only in rcp
History log of /src/bin/rcp/rcp.c
RevisionDateAuthorComments
 1.53  01-Aug-2023  mrg convert explicit length check before unchecked snprintf() with just a
overflow checked snprintf(). for res_debug.c and res_query.c, convert
from sprintf() to snprintf().

tested scp and rcp fail properly with too-long paths.
tested getaddrinfo fails as expected for too-long domains.
tested dig and ping for similar (res_debug.c/res_query.c).
created a temporary fs with quotas to test edquota with a long EDITOR.
did not test ypserv directly, but it's the same pattern.

avoids GCC 12 snprintf() warnings, and reduces total code size.
 1.52  18-Jul-2022  rin Fix bug revealed by SIGINFO support; Do not treat short read(2)/write(2)
as error (*). This occurs typically when signal is received.

(*) For older version, we already deal with short read(2) from remote
host in sink(). But for other cases, i.e., write(2) to local file in
sink(), read(2)/write(2) in source(), error was raised.

This version of rcp(1) can successfully send/receive files with older
version, even if short read(2)/write(2) occurs by SIGINFO.

Also, when real error occurs, give up immediately instead of continue to
send/receive wrong data.

Clean up the mess a little bit as well...
 1.51  26-Jun-2022  rin Add SIGINFO support. Mostly stolen from scan_ffs(8).
 1.50  06-May-2020  aymeric In sink(), upon error, avoid multiple replies to the source as this
would lead to a desynchronization of the protocol and further files or
directories to be ignored or corrupted.

Reported by Daniel Goujot, Georges-Axel Jaloyan, Ryan Lahfa, and David Naccache.
 1.49  07-May-2012  chs branches: 1.49.12; 1.49.14; 1.49.22; 1.49.26; 1.49.34; 1.49.36;
allocate a separate buffer in each call to sink().
reusing the buffer across recursive calls just doesn't work right.
 1.48  31-Aug-2009  dholland branches: 1.48.6; 1.48.8;
Fix up seriously borked mallocing of a static buffer, which seems to
have been this way since at least 4.4. This will still dump core if
malloc fails on the first trip through, instead of on any malloc
failure, but should otherwise behave much more reasonably.
 1.47  20-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
 1.46  26-May-2008  christos PR/38755: murray armfield: /bin posix programs missing setprogname and/or
setlocale
 1.45  24-Feb-2008  dholland branches: 1.45.2; 1.45.4;
Print time_t as long long, not long.
 1.44  15-Dec-2006  christos branches: 1.44.4; 1.44.8;
pass lint; from Anon Ymous
 1.43  15-Dec-2006  christos remove two (void)&foo; which are ot needed. From Anon Ymous
 1.42  20-Mar-2006  christos Goodbye KerberosIV
 1.41  18-Mar-2006  ginsbach Fix Coverity CID 1863, 1864; resource leak, bp not freed when !okname()
before function return and/or bp overwritten by malloc().
 1.40  26-Jun-2005  christos sprinkle a little const, and now everything compiles with WARNS=3
 1.39  11-Mar-2005  ginsbach Add mechanism for escaping IPv6 address strings, since they already
contain colons. Idea from Solaris rcp(1).
 1.38  09-Mar-2005  wiz Add -4 and -6 to usage.
 1.37  09-Mar-2005  ginsbach - Support -4 and -6. Approved by christos.
 1.36  17-Feb-2005  xtraeme Kill __P(), use ANSI function declarations.
 1.35  02-Apr-2004  martin Remove duplicate include, fixes PR bin/25018 from Jeff Ito.
 1.34  28-Mar-2004  jdolecek IPv6 support, based on src/usr.bin/rsh/rsh.c rev. 1.13
fixes PR bin/24940 by Manuel Bouyer
 1.33  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.32  23-Jul-2003  itojun include des.h, not kerberosIV/des.h
 1.31  16-Apr-2003  itojun misuse of strncpy. PR 21201 from Christian Biere.
 1.30  22-Nov-2002  ragge It's a very bad habit to store file sizes in int's, so change it to off_t
instead. Obviously noone has tried to rcp files larger than 2GB.
 1.29  25-May-2002  wiz __STDC__ is always defined on NetBSD.
 1.28  24-Sep-2001  wiz branches: 1.28.2;
va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
 1.27  04-Jan-2001  lukem use more standard %ll_ in favour of %q_
 1.26  09-Nov-1999  drochner Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.
 1.25  17-Feb-1999  scottr branches: 1.25.6;
Make this compile ifdef KERBEROS.
 1.24  05-Nov-1998  christos s/MODEMASK/RCPMODEMASK/
From Darrin Jewell.
 1.23  04-Nov-1998  christos char -> unsigned char
work around missing futimes.
 1.22  28-Jul-1998  mycroft Be more retentive about use of NOTREACHED and noreturn.
 1.21  28-Jul-1998  mycroft Delint.
 1.20  03-Feb-1998  mycroft Deal with GCC warnings.
 1.19  21-Oct-1997  christos PR/4284: Tatoku Ogaito: rcmd(3) get be called with getpwent(3) results as
arguments, leading to memory corruption.
 1.18  19-Oct-1997  mycroft Use futimes(2).
Send microseconds over the wire, rather than just 0.
 1.17  14-Sep-1997  lukem - cleanup use of .Nm in man page
- getopt returns -1 not EOF
 1.16  30-Jul-1997  thorpej Cast some printf arguments to keep the compiler happy on the Alpha.
 1.15  20-Jul-1997  christos Fix compiler warnings
Add WARNS=1
 1.14  07-Jun-1997  jeremy Fix incorrect use of name vs. pwd->pw_name and wrong logic in strdup() test.
[PR/3718]
 1.13  05-Jun-1997  mrg fix PR#3710, reported by Tatoku Ogaito <tacha@trap.fukui-med.ac.jp>.
- don't pass pw->pw_name into functions; make a copy.
 1.12  27-May-1997  mrg use rcmd(); garbage collect junk.
 1.11  26-May-1997  mrg use orcmd() for now.
 1.10  01-Feb-1996  jtc Rename struct timespec fields to conform to POSIX.1b
 1.9  21-Mar-1995  cgd actually do the import. rcp appears to have been previously imported
but not merged(?!?!?).
 1.8  30-Jan-1995  mycroft Use S_IS*().
 1.7  30-Jan-1995  mycroft Use S_IS*().
 1.6  04-Dec-1994  cgd from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch
some of the worst style errors.
 1.5  27-Mar-1994  cgd more off_t
 1.4  01-Aug-1993  mycroft Add RCS identifiers.
 1.3  23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2  22-Mar-1993  cgd added rcs ids to all files
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.25.6.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.28.2.1  22-Nov-2002  tron Pull up revision 1.30 (requested by ragge in ticket #1008):
It's a very bad habit to store file sizes in int's, so change it to off_t
instead. Obviously noone has tried to rcp files larger than 2GB.
 1.44.8.1  24-Mar-2008  keiichi sync with head.
 1.44.4.1  23-Mar-2008  matt sync with HEAD
 1.45.4.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.45.4.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.45.2.1  04-Jun-2008  yamt sync with head
 1.48.8.1  09-May-2012  riz Pull up following revision(s) (requested by chs in ticket #230):
bin/rcp/rcp.c: revision 1.49
allocate a separate buffer in each call to sink().
reusing the buffer across recursive calls just doesn't work right.
 1.48.6.1  23-May-2012  yamt sync with head.
 1.49.36.1  07-May-2020  martin Pull up following revision(s) (requested by aymeric in ticket #890):

bin/rcp/rcp.c: revision 1.50

In sink(), upon error, avoid multiple replies to the source as this
would lead to a desynchronization of the protocol and further files or
directories to be ignored or corrupted.

Reported by Daniel Goujot, Georges-Axel Jaloyan, Ryan Lahfa, and David Naccache.
 1.49.34.2  21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.49.34.1  21-Apr-2020  martin Sync with HEAD
 1.49.26.1  07-May-2020  martin Pull up following revision(s) (requested by aymeric in ticket #1546):

bin/rcp/rcp.c: revision 1.50

In sink(), upon error, avoid multiple replies to the source as this
would lead to a desynchronization of the protocol and further files or
directories to be ignored or corrupted.

Reported by Daniel Goujot, Georges-Axel Jaloyan, Ryan Lahfa, and David Naccache.
 1.49.22.1  07-May-2020  sborrill Pull up the following revisions(s) (requested by aymeric in ticket #1731):
bin/rcp/rcp.c: revision 1.50

In sink(), upon error, avoid multiple replies to the source as this
would lead to a desynchronization of the protocol and further files or
directories to be ignored or corrupted.
 1.49.14.1  07-May-2020  sborrill Pull up the following revisions(s) (requested by aymeric in ticket #1731):
bin/rcp/rcp.c: revision 1.50

In sink(), upon error, avoid multiple replies to the source as this
would lead to a desynchronization of the protocol and further files or
directories to be ignored or corrupted.
 1.49.12.1  07-May-2020  sborrill Pull up the following revisions(s) (requested by aymeric in ticket #1731):
bin/rcp/rcp.c: revision 1.50

In sink(), upon error, avoid multiple replies to the source as this
would lead to a desynchronization of the protocol and further files or
directories to be ignored or corrupted.

RSS XML Feed