summaryrefslogtreecommitdiff
path: root/dpkg-deb/extract.c
AgeCommit message (Collapse)AuthorFilesLines
2017-05-06doc: Spelling fixesJosh Soref1-1/+1
Signed-off-by: Guillem Jover <guillem@debian.org>
2016-10-30libdpkg: Use our own dpkg_ar_hdr instead of relying on the system oneGuillem Jover1-1/+1
The ar format is not standardized and some systems might provide a different format than the one used by dpkg. For example on AIX.
2016-10-30Cast off_t variables to intmax_t when printing them with %jdGuillem Jover1-1/+1
Warned-by: clang
2016-07-03libdpkg: Add new struct dpkg_ar and basic operationsGuillem Jover1-28/+20
Switch current code to use dpkg_ar instead of taking a filename and a file descriptor arguments.
2015-12-19dpkg-deb: Fix off-by-one write access on ctrllenbuf variableHanno Böck1-1/+1
This affects old format .deb packages. Fixes: CVE-2015-0860 Warned-by: afl Signed-off-by: Guillem Jover <guillem@debian.org> Stable-Candidate: 1.16.x 1.17.x
2015-12-12Use new str_fmt() instead of m_asprintf()Guillem Jover1-1/+1
It should make the code more clear, and in many cases it avoids having to use a temporary variable.
2015-10-18Update Ian Jackson's email addressGuillem Jover1-1/+1
2015-09-14dpkg-deb: Fix off-by-one write access on versionbuf variableGuillem Jover1-1/+1
Closes: #798324 Warned-by: afl Reported-by: Jacek Wielemborek <d33tah@gmail.com> Stable-Candidate: 1.16.x 1.17.x
2015-04-21Remove some unnecessary includes of assert.hNiels Thykier1-1/+0
Signed-off-by: Niels Thykier <niels@thykier.net>
2015-04-10Consistently use proper quotation marks all over the placeGuillem Jover1-3/+4
That is "" or '', and not the unbalanced `' pair.
2015-02-11dpkg-deb: Add support for reading the archive from standard inputGuillem Jover1-1/+7
All commands reading archives support this, except for --raw-extract that does not. Closes: #616614 Based-on-patch-by: Johannes Schauer <j.schauer@email.de>
2015-01-26Remove unused <ctype.h> includesGuillem Jover1-1/+0
2014-10-06libdpkg: Namespace and reword subproc flagsGuillem Jover1-1/+1
2014-10-06libdpkg: Rename subproc_wait_check() to subproc_reap()Guillem Jover1-4/+4
2014-10-06dpkg-deb: Add new --ctrl-tarfile commandGuillem Jover1-0/+17
This allows to easily extract the entire control member in tar format, for further processing.
2014-05-28libdpkg: Uppercase compressor enum valuesGuillem Jover1-6/+6
2014-01-15dpkg-deb: Accept other compressions for control.tar .deb memberGuillem Jover1-2/+11
This includes no compression (control.tar) or xz compression (control.tar.xz). There's really no point allowing the deprecated lzma, or the inferior bzip2 at this time, when gzip and xz are superior in either speed or compression ratio.
2013-12-07Use https:// URLs instead of http:// when possibleGuillem Jover1-1/+1
2013-08-10dpkg-deb: Clarify --extract bad usage error message on missing argumentsGuillem Jover1-2/+4
Make clear that the command requires two arguments, instead of suggesting only a deb filename is needed, to then requesting a directory name on a second invocation. Closes: #718899
2013-08-10dpkg-deb: Inline controlextractvextract() into call sitesGuillem Jover1-27/+33
Although the two call sites are doing almost the same, they need different argument parsing logic, and inlining the code will allow to print more meaningful bad usage messages.
2013-08-10dpkg-deb: Use badusage() instead of ohshit() for usage errorsGuillem Jover1-2/+4
2013-08-10dpkg-deb: Do not accept deb packages with data and control members swappedGuillem Jover1-1/+6
This is not allowed by the format defined in deb(5), but dpkg-deb has been very lenient all this time. Enforce the correct format by erroring out in case of misplaced members.
2013-08-10dpkg-deb: Be more precise on deb member errorsGuillem Jover1-7/+9
Print a message when we've found the data member but do not know the compression, and another one when there's an unknown member before the data member. This also stops resetting adminmember to -1 as a temporary sentinel, so that we don't lose previous state.
2013-04-14Avoid assignments in C conditionalsGuillem Jover1-2/+4
2013-04-14dpkg-deb: Use an enum instead of a literal string to pass tar optionsGuillem Jover1-13/+29
This clarifies the call sites as to what they want from the extractor, and abstracts the code to allow for a future switch to an internal tar extractor instead of requiring an external tar program.
2013-04-14dpkg-deb: Switch extracthalf() to use struct commandGuillem Jover1-7/+12
2013-03-19dpkg-deb: Do not initialize variable that gets a subsequent valueGuillem Jover1-1/+1
2012-06-30Switch to new notice() output functionGuillem Jover1-3/+2
This switches all ad-hoc stderr printing for error notices to the notice() function.
2012-06-30libdpkg: Switch buffer I/O code to use struct dpkg_errorGuillem Jover1-9/+14
As a side effect this mkes the messages more clear as the caller has more context to describe the error conditions. Closes: #621763
2012-06-30dpkg-deb: Rename string variable from err to errstrGuillem Jover1-7/+7
2012-04-09Switch deb format version handling to use the new deb-version moduleGuillem Jover1-32/+39
This simplifies the parsing and checking and avoids having to treat the format versions as floats, which can cause parse errors depending on the locale (this only affected the old deb format).
2012-04-01Use cmp() == 0 instead of !cmp()Guillem Jover1-3/+3
2012-03-27libdpkg: Refactor ar member check into new dpkg_ar_member_is_illegal()Guillem Jover1-1/+1
2012-03-27dpkg-deb: Do not look for newline beyond the buffer in read_line()Guillem Jover1-1/+1
Depending on how the stack grows read_line() could go beyond the end of the buffer when looking for a newline.
2011-11-23libdpkg: Do not expose the compression structsGuillem Jover1-2/+2
This reduces the amount of relocations on the future shared libdpkg library. It also makes it easier to refactor the code.
2011-09-09dpkg-deb: Do not warn on strange timestampsGuillem Jover1-1/+1
The external extractor is only used on dpkg-deb -x (and friends), which is only used by dpkg when extracting the control member. The internal dpkg tar extractor never warns on timestamps, and there's no point for dpkg to induce those warnings on the control extraction either. Closes: #640298
2011-09-09libdpkg: Rename fd_null_copy() to fd_skip()Guillem Jover1-6/+6
2011-08-02dpkg-deb: Add --raw-extract option combining --control and --extractGuillem Jover1-0/+32
This allows to extract the control and file system members of a .deb into a single directory using the same layout dpkg-deb -b expects for building a package. Closes: #552123
2011-08-02dpkg-deb: Add new -v, --verbose optionGuillem Jover1-2/+7
Change --extract to honour --verbose and behave as --vextract. Closes: #293280
2011-07-07libdpkg: Rename myopt module to optionsGuillem Jover1-1/+1
2011-07-07dpkg-deb: Always chdir(2) in the childs to not change the global stateGuillem Jover1-13/+12
To not disturb the global program state we should always chdir(2) in the childs that actually need it. This will allow in the future to switch this code to be part of a library.
2011-05-11libdpkg: Switch the compression filter functions to always returnGuillem Jover1-0/+1
This makes the compression and decompression functions be closer to the buffer api, which always return. For non-blocking I/O, the caller has to setup a child process. When using external binaries, we make the filter functions setup that child process transparently so that the API is uniform.
2011-05-11dpkg-deb: Pass the real file descriptors to compression functionsGuillem Jover1-5/+10
Instead of duping them to the stdin and stdout file descriptors, pass them directly. If the compression functions need the file descriptors on stdin and stdout, then they will take care of setting them up. This is only the case when using the external compression binaries.
2011-04-09dpkg-deb: fix error message output by read_fail()Raphaël Hertzog1-1/+1
read_fail() should only assume a system error if rc < 0. Any positive value means that we did not manage to read as much data as we wanted and should result in the "unexpected end of file" message.
2011-04-02Make all command line action functions return intGuillem Jover1-7/+28
This will allow using type-safe function pointers instead of casting them around. Replace all exit(3) calls with return statements. Remove DPKG_ATTR_NORET from function declarations, all functions are expected to return now.
2011-03-14Use off_t and %jd or %jx to handle file sizes and offsetsGuillem Jover1-8/+10
This allows to support large files on 32-bit systems were a ‘long int’ type might not be of at least 64-bits. For printing %jd or %jx is used, and the value is cast to intmax_t.
2011-01-31Use pid instead of c1 for variable nameGuillem Jover1-4/+4
2011-01-08dpkg-deb: Fix corrupt archive header magic error stringGuillem Jover1-1/+1
The string was referring to the first header when the string refers to any header parsed.
2011-01-08Use fdio functions instead of raw read()/write() callsGuillem Jover1-3/+4
This makes the call sites safe against interrupted I/O.
2011-01-08Use dpkg_ar_member_get_size() instead of duplicated codeGuillem Jover1-24/+1