summaryrefslogtreecommitdiff
path: root/src/apk_io.h
AgeCommit message (Collapse)AuthorFilesLines
2021-06-21print: handle write() errors in apk_print_progress()Timo Teräs1-0/+2
2021-06-11extract: new applet to extract v2 packagesTimo Teräs1-8/+12
2021-06-11add basic abstraction for cryptographic operationsTimo Teräs1-6/+9
- basic digesting and signing apis (subject still to fine tuning) - update digest code, and adb signing for the thin wrapping layer - old v1 package and database handling not updated - default mkpkg file hash to sha256 ref #10744
2021-06-11mkpkg: new applet to create v2 packages with basic functionalityTimo Teräs1-6/+12
2021-06-02add adbgen applet to generate databases from it's text dumpTimo Teräs1-0/+1
2021-04-12io_archive: add bounds limit for uname and gname tar header fieldsTimo Teräs1-2/+2
Modify apk_resolve_[ug]id to take the user/groupname as a blob, so proper length checking is done and honored. ==31584== Conditional jump or move depends on uninitialised value(s) ==31584== at 0x5C8CA5: strlen (strlen.c:17) ==31584== by 0x432575: APK_BLOB_STR (apk_blob.h:79) ==31584== by 0x4350EB: apk_resolve_uid (io.c:1112) ==31584== by 0x43696C: apk_tar_parse (io_archive.c:152) ==31584== by 0x4271BC: apk_pkg_read (package.c:929) ==31584== by 0x402D75: add_main (app_add.c:163) ==31584== by 0x40D5FF: main (apk-static.c:516) Fixes a potential crash (DoS) on a crafted TAR file. CVE-2021-30139. Reported-by: Sören Tempel <soeren+git@soeren-tempel.net> Reviewed-by: Ariadne Conill <ariadne@dereferenced.org>
2021-01-11database: Propagate errors when loading an APKINDEXthibault.ferrante1-3/+3
In case of failure when loading an APKINDEX, no errors are propagated to the user which may uncorrectly interpret the current problem.
2020-10-09rename apk_db_options to apk_ctx, rework loggingTimo Teräs1-1/+1
makes apk_verbosity non-global fixes #10682
2020-10-09make apk_force non-global, remove left-over apk_archTimo Teräs1-9/+6
ref #10682
2020-10-09io: make ostream_file always use tmpnameTimo Teräs1-1/+1
2020-10-09adb: introduce apk-tools database format, and few appletsTimo Teräs1-1/+4
This is a flat buffers inspired format that allows fast mmaped access to the data with low overhead, signature support and relatively good forward support.
2020-05-19make the atom functions not use global stateTimo Teräs1-1/+2
This greatly helps with memory management on applications that may want to daemonize and open/close database several times. Also the lifetime and "owner" of memory for all data is now explicitly bound to owning struct apk_database, which might be helpful when writing language bindings. As side effect, the interned "atoms" are unique only within what apk_database, so comparing packages from different apk_database may not work as expected. Fixes #10697
2020-05-07use SPDX-License-Identifier in source filesTBK1-3/+1
2020-02-14io: add stream copy helperTimo Teräs1-3/+6
2020-01-11io: convert bstream mmap to istream, remove the now obsolete bstream machineryTimo Teräs1-47/+0
2020-01-11convert remaining locations to use istream instead of bstreamTimo Teräs1-16/+16
2020-01-11istream, archive, db: convert db and tar function to use istreamTimo Teräs1-0/+11
2020-01-11istream: add buffering capabilityTimo Teräs1-35/+40
Convert all implementations to do buffering. This is in preparation to remove bstream interface as redundant. istream_read() will return full reads unless end-of-file. The backends can return short reads to optimize buffering or due to other reasons like boundary change for gz.
2020-01-06io: remove the now unused pid association with istreamTimo Teräs1-11/+2
2020-01-06io: remove unused size parameter from bstream closeTimo Teräs1-3/+3
2019-12-18io: use proper base struct types for method implementationsTimo Teräs1-9/+13
2018-10-26add support for openssl 1.1Timo Teräs1-1/+0
2018-01-04enable automatic update of indexes controlled by --cache-max-ageTimo Teräs1-1/+1
This modifies apk cache for indexes to be automatically refreshed periodically without explicit 'update' or '--update-cache' usage. The default is to do if-modified-since request if the local copy is older than 4 hours. This age can be changed with --cache-max-age. Using --update-cache will change this age to 60 seconds to make sure the cached copy is relatively new. The small age is in order to try to avoid downloading indexes second time when apk-tools is upgraded and apk re-execs after self-upgrade. Accordingly using explicitly 'apk update' will now enforce --force-refresh and request the very latest index by requesting any potential http proxy to do refresh too.
2017-10-12io: fix skip and splice to detect unexpected end-of-fileTimo Teräs1-3/+3
2017-06-23io: make io vtables const struct, and add accessors for themTimo Teräs1-4/+48
This reduces function pointers in heap, and unifies how the io functions are called.
2015-11-09io, database: preserve [am]time for cached and fetched filesTimo Teräs1-0/+7
preserve [am]time for all packages and indexes. this fixes the caching error that 'apk update' is after new index is generated, but before the used mirror is synchronized. this caused local apkindex timestamp to be newer than file in mirror, when in fact it was outdated index. this also fixes fetched files to have build timestamp so that files going to .iso or custom images have proper timestamps (rsync with appropriate --modify-window now works)
2015-04-08audit xattrsTimo Teräs1-0/+2
ref #3027
2015-03-11calculate and store checksum of xattrsTimo Teräs1-0/+2
ref #3027
2015-03-10rename file info related functions for consistencyTimo Teräs1-3/+3
2015-03-10extract xattrs from packagesTimo Teräs1-0/+8
ref #3027
2015-01-30remove support for old database location in /varTimo Teräs1-1/+0
the location changed in apk-tools 2.1.0 (March 2011) which was used in Alpine Linux 2.2.
2014-10-08io,url,db: support for if-modified-sinceTimo Teräs1-4/+21
2013-06-18url: fix fetching from local repositoriesNatanael Copa1-2/+3
2013-06-17cache: implement progress bar (ref #1170)Timo Teräs1-1/+2
2013-06-17url: remove unused apk_url_downloadTimo Teräs1-1/+0
2013-06-17io: fix splice for copying unknown lengthsTimo Teräs1-2/+13
2013-06-12libapk, apk(8): fix header inclusion issues with musl's headersWilliam Pitcock1-0/+1
2012-02-23db: keep architecture in $ROOT/etc/apk/archTimo Teräs1-2/+5
This we use proper arch in case modifying chroot installation.
2012-02-22db, io: load repositories also from etc/apk/repositories.d/*.listTimo Teräs1-1/+1
Load additional repositories from $ROOT/etc/apk/repositories.d/*.list unless --repositories-file is given as parameter.
2012-02-22db, solver, io: scan cache items at startupTimo Teräs1-0/+3
It is faster to just scan the cache directory for existing packages at startup than trying to faccessat() them on demand. It also makes quite a few parts of the code more readable and simpler.
2011-09-13all: update copyright year statementTimo Teräs1-1/+1
2011-03-16db: relocate from /var/lib/apkTimo Teräs1-0/+1
move all files therein to other places. this allows /var to be mounted from harddisk, but rest of system be run from ramdisk. this also removes support for historical version of the scripts database which was obsoleted in 2.0_pre16 (in July 2009).
2010-12-09io: enhance istream/bstreams with pipe to forked childTimo Teräs1-2/+12
* prunes the child pid to avoid zombies * handles the errors so e.g. file-not-found is reported properly
2010-10-08io, db: id cache should be specific to database root, not system rootTimo Teräs1-5/+13
Otherwise we end up using wrong uid/gid mappings when doing install to alternate system root. Fixes #434.
2010-06-12archive: honor username/groupname instead of uid/gidTimo Teräs1-0/+6
Take the uid/gid from passwd and group.
2009-08-12io: better error handling when writing stuff outTimo Teras1-3/+3
also have the output stream support writing to temporary file and do renameat/unlinkat on close depending on if all writes succeeded or not.
2009-08-05io: flag for following symlinks on fstatTimo Teras1-1/+3
usually we are interested on the actual file's length. but audit is interested about the link. so add a flag for this and use it in audit.
2009-07-31apk: use *at instead of chdir+normal file syscallTimo Teras1-9/+10
this way we never change cwd, and relative filenames are always parsed consistently. this also helps filename construction in many places. this patch also changes '--root' to override location of all configuration to be in the new root. previously it depended on the file which one was used.
2009-07-22pkg: cleanup the signing codeTimo Teras1-0/+1
smaller callback and less cases to check. also reintroduce the oneshot digest flag, hopefully correct this time.
2009-07-22various: more informative error messagesTimo Teras1-2/+2