summaryrefslogtreecommitdiffstats
path: root/bin/pax/tar.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* uid_from_user() and gid_from_user() return -1 when indicating error,deraadt2019-06-241-3/+3
| | | | not arbitrary values < 0.
* Use the new libc uid_from_user() and gid_from_group() instead ofmillert2018-09-131-22/+7
| | | | the pax-specific functions in cache.c. OK guenther@
* Carefully add casts to silence clang sign-compare warnings. ok millert@otto2017-09-161-4/+5
|
* there is no offical way to get the max value of time_t, but this one worksotto2017-09-121-3/+3
| | | | | on any sensible posix system (in which time_t must be an integer type) ok deraadt@ millert@
* Avoid clang warning and make code better by using a signed long;otto2017-09-081-4/+4
| | | | with hint from millert@; ok millert@ guenther@
* Don't need <sys/time.h> or "options.h" hereguenther2016-08-261-2/+1
|
* Replace name_{uid,gid}() with the libc routines user_from_uid() andguenther2016-08-251-24/+11
| | | | | | group_from_gid(). Eliminate some superfluous strncpy() calls. ok millert@
* Remove many unnecessary casts. Verified by comparing generated code onguenther2016-08-141-23/+23
| | | | | | both ILP32 and LP64. ok millert@
* Replace u_quad_t with unsigned long long and replace "uqd" with "ull" inguenther2016-08-141-27/+29
| | | | | | | function names to match. Pull some tangled assignments out of conditions and use >>= where possible. ok millert@
* To archive a 101 character absolute path in ustar format we mustguenther2016-02-151-7/+14
| | | | | | | split it on a slash other than the leading one. Fix based on patches from Peter Fokker (openbsd (at) berestijn.nl) and Peter Bisroev (peter (at) int19h.net)
* Add PAX_IS_{REG,HARDLINK,LINK} macros to simply many file type testsguenther2015-03-171-6/+5
| | | | ok millert@
* Handle tar -o by setting the tar_nodir directly instead of faking up aguenther2015-03-151-2/+2
| | | | | | pax-like -o write_opt=nodir. ok millert@ otto@
* Unrevert post-unlock:guenther2015-03-091-36/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Prevent an archive from esacaping the current directory by itself: when extracting a symlink whose value is absolute or contains ".." components, just create a zero-length normal file (with additional tracking of the mode and hardlinks to the symlink) until everything else is extracted, then go back and replace it with the requested link (if it's still that zero-length placeholder). * For tar without -P, if a path in the archive has any ".." components then strip everything up to and including the last of them (if it ends in ".." then it becomes ".") This mostly follows GNU tar's behavior, except for 'tar tf' and 'tar xvf' we report the modified path that would be/was actually created instead of the raw path from the archive Above two fixes prompted by a report from Daniel Cegielka (daniel.cegielka (at) gmail.com) * For directories whose times or mode will be fixed up in the clean-up pass, record their dev+ino and then use open(O_DIRECTORY)+fstat() to verify that we're updating the correct directory before using futimens() and fchmod(). * Correct buffer overflow in handling of pax extension headers, caught by the memcpy() overlap check. previously ok millert@ deraadt@
* Recent changes haven't been completely stable, so revert for the 5.7 releaseguenther2015-02-211-81/+36
| | | | requested by deraadt@
* Correct buffer overflow in handling of pax extension headers, caughtguenther2015-01-291-36/+81
| | | | | | by the memcpy() overlap check. ok millert@ deraadt@
* Map negative mtimes to zero instead of skipping the affected files.guenther2014-02-191-5/+7
| | | | | problem noted by miod@ ok krw@ millert@
* Zap trailing whitespaceguenther2014-01-081-2/+2
|
* Eliminate poisonous LONG_OFF_T conditionalguenther2014-01-081-19/+1
| | | | adjective suggested by deraadt@
* Mark some functions as printf-like and fix a bogus format stringguenther2014-01-081-3/+3
| | | | ok fgsch@
* add unsigned char casts for specific calls to ctype.h macros.deraadt2013-11-211-2/+2
| | | | ok guenther step
* cpio and ustar formats store times in octal fields that are 11 charactersguenther2013-07-031-9/+15
| | | | | | | | wide, so they support up to 33bits. Take advantage of the extra bits by no longer forcing them into 32bit ints before the time_t conversion. This gets us another 204 years of range once time_t changes type ok deraadt@ tedu@
* The tweaks I suggested to the previous diff resulted in the typeflagguenther2013-04-111-8/+8
| | | | | | | | being checked after it was overwritten by the next block read in. Eliminate the argument aliasing that led to this being overlooked by passing rd_xheader() the size and typeflag directly. problem discovery and ok fgsch@
* Add extended header support for ustar. Currently only path and linkpath arefgsch2013-04-091-17/+105
| | | | | | handled. input from zhuk and guenther. tested by zhuk and sthen on a bulk. ok guenther.
* Enable support for write_opt=nodir for ustar archives which helps to fixzhuk2013-03-271-1/+7
| | | | | | | issues with some crappy tar archive readers out there that rely on the fact that directory entries ends up with "/" when created by GNU Tar, and now I'm finishing this commit message by mentioning people who gave input and okays: deraadt@ millert@ jmc@
* remove some unnecessary sys/param.h inclusionsderaadt2012-12-041-2/+1
|
* a -N option for tar that uses numeric only IDs, useful for cross systemtedu2010-12-021-5/+10
| | | | tar file manipulation. with advice from guenther and jmc.
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-9/+1
| | | | | | | unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
* Properly take into account that the name and prefix field in the tarotto2006-03-041-8/+11
| | | | | | header are not always NUL-terminated. This means there's room for 1 more byte in those field. This effectively reverts revs 1.13 and 1.14; ok jaredy@ millert@
* Avoid sign extend when writing time stamps; fixes "tar: Ustar headerotto2005-12-171-4/+4
| | | | | | field is too small for foo" error messages when writing files with negative time stamps on 64 bit archs. ok millert@ deraadt@
* Fix writing of old-style tar headers. Filenames and linknames actuallyotto2005-06-131-10/+16
| | | | | are not NUL terminated if the fill the whole field. ok millert@ jaredy@
* Use a special crafted string copy function to copy data from ustarotto2005-04-281-13/+8
| | | | | | headers to the generic pax structs. ustar is "funny" since some fields are not always NUL terminated. Old-style tar headers and ustar creation remains to be done. ok millert@ beck@
* fix strlcpy abuse in pax - this commit turns potential overflows intobeck2005-04-211-2/+4
| | | | | | potential non-spec compliance - the use of these fields as strings needs to be revisited more thouroughly. ok millert@ otto@
* add the prefix length to nlen for ustar; ok otto millertmarkus2005-04-141-3/+3
|
* Handle path names of exactly 100 chars correctly. Based on a diffotto2005-04-101-8/+12
| | | | from espie@. ok espie@ deraadt@
* If a uid or gid does not fit into into the tar header, issue a warningotto2004-10-231-4/+35
| | | | and use the uid/gid of nobody. Spotted by and ok drahn@, ok millert@
* spacingderaadt2004-04-161-8/+8
|
* Add support for expanding GNU long links from NetBSD. I've had thismillert2004-03-301-41/+39
| | | | | in my tree for ages but didn't have a proper test case. Thanks to otto@ for providing one.
* protos. this requires changing the api for the *trail() functions a bitderaadt2003-06-261-3/+3
|
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-7/+3
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* Pull in some changes from NetBSDmillert2002-10-181-4/+48
| | | | | | o When extracting GNU tar archives, honor @LongLink long links/files o Add an option to prevent pax from prompting for the next volume upon premature end of archive.
* sprinkle const; mostly from NetBSDmillert2002-10-161-3/+3
|
* Fix comment typos; most from NetBSD and FreeBSDmillert2002-10-161-5/+5
|
* kill registermillert2002-10-161-33/+33
|
* We live in an ANSI C world. Remove lots of gratuitous #ifdef __STDC__ cruft.millert2002-02-191-107/+2
|
* Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.millert2002-02-161-6/+6
|
* When writing tar and ustar archives, zero out the header before wemillert2001-12-191-36/+20
| | | | | | do anything else to it. This lets us restore the strlcpy() calls and remove a buch of memset()s that were zeroing out individual fields of the header.
* More strlcpy() backout. Various tar programs require ustar headermillert2001-12-191-7/+13
| | | | elements to be zero padded too.
* Back out a strncpy -> strlcpy conversion. When writing old stylemillert2001-12-191-6/+7
| | | | | | | | tar files we need to zero-pad the file name or many tars will get a directory checksum error trying to unpack the archive. This does not affect ustar archives (pax's default) though whether or not padding matters there still needs to be determined.
* really use strlcpy.lebel2001-06-261-5/+5
|
* use strlcpy vs strncpy+a[len-1]='\0'lebel2001-06-261-8/+5
|