summaryrefslogtreecommitdiff
path: root/rpmio
AgeCommit message (Collapse)AuthorFilesLines
2012-09-11Make rpmstrPoolUnfreeze() safe to call on unfrozen poolPanu Matilainen1-1/+1
2012-09-09And now, on to the embarrassing string-pool reimplementation bugs, take IPanu Matilainen1-4/+14
- String pool offset resize was off by one, oops - String pool data-area resize requires rehashing all the strings, as the key pointers change. Ouch. Should be avoidable by extending rpmhash to allow passing the pool itself around in comparisons as "self" and using offsets as keys, but for now working counts more than speed. - The unfreeze-sizehint calculation could be negative. Turn the initial size into constant and use that as a minimum, otherwise rehashing uses (more or less arbitrary) heuristics to come up with some number. Lots of fine-tuning ahead...
2012-09-07Move string pool typedefs to rpmtypes.hPanu Matilainen1-2/+1
- I suspect these will be used widely, to avoid having to include rpmstrpool.h all over in headers...
2012-09-07First cut of a libsolv-style string <-> id pool APIPanu Matilainen3-1/+198
- The pool stores "arbitrary" number of strings in a space-efficient manner, with near constant (hashed) string -> id lookup/store and constant time id -> string and id -> string length lookups. - Credits for the idea go to the Suse developers working on libsolv, the basic concept is directly lifted from there but details differ due to using rpm's own hash table implementation etc. Another minor difference is using size_t for offsets to permit over 4GB total data size on 64bit systems, the total number of id's in the pool is limited to uint32 max however (like in libsolv). - Any (re)implementation bugs by yours truly, this is almost certainly going to need further tuning and tweaking, API and otherwise.
2012-09-03Minor optimization to rnibble()Panu Matilainen1-2/+2
- Check for lowercase letters before uppercase. A very minor difference as such, but our file digests use lowercase hex and this gets called a lot from rpmfiNew().
2012-08-17Revert "Always return NULL from fdFree()"Panu Matilainen1-1/+1
- This reverts commit 4c1f7e335de1724661ce63c53186d161ab71a63f: various things inside and outside of rpm actually do still depend on the old behavior, and leak file descriptors otherwise. As an easy backportable band-aid, revert back to the previous behavior, to which various callers are tuned to fix the regression introduced in rpm 4.10.0. The real fix would be something more like "eliminate fdFree() and make Fclose() honor refcounts".
2012-07-02Dont use mmap() for anything, axe the code insteadPanu Matilainen1-38/+0
- Commit 4cb02aa928d3e41f636d0e01356c7a3cb51018ee asked to see what breaks when mmap() is used, now we know: large package support broke when enabling it. Could be fixed of course by eg adding a size cap to the fsm part as well, but just doesn't seem worth it: I fail to measure any meaningful performance improvement from mmap usage in either case, and added complexity for what is close to zero benefit just doesn't make sense... and various sources in fact note the rpm usage (read through the entire file sequentially) as one of the cases where mmap() is NOT beneficial due to mmap() high setup + teardown cost + page fault speed (or lack of thereof).
2012-05-31Only use local mempcpy() if system libraries dont provide onePanu Matilainen1-0/+2
- Obvious yes, but how come this didn't barf on my other rather identical system? Meh.
2012-05-31xmalloc() and xrealloc() never fail, remove redundant checksPanu Matilainen1-46/+1
2012-05-31Call alloca() and stat() by their own names...Panu Matilainen1-14/+12
2012-05-31Eliminate unnecessary glob portability fiddlesPanu Matilainen1-14/+0
- Flags available to our internal glob implementation do not depend on posix/gnu/bsd defines
2012-05-31Eliminate VMS, MS-DOS, Windows and Amiga compatibility hacks in rpmglobPanu Matilainen1-77/+4
- We'll never run on these platforms, we just dont care...
2012-05-31Eliminate shell interruptability hack in rpmglobPanu Matilainen1-16/+1
2012-05-31We always have xstrdup() available, eliminate redundant alternatvePanu Matilainen1-10/+0
2012-05-31Eliminate getpwnam_r() and getlogin_r() uses from rpmglobPanu Matilainen1-60/+0
- We dont particularly care if rpmGlob() is thread-safe or not, just use the simpler code-path
2012-05-31Eliminate mempcpy() related conditionals from rpmglobPanu Matilainen1-65/+4
- Provide a local copy of the trivial mempcpy() function so we can always use the shorter code-path, eliminate now unnecessary ifdef goo.
2012-05-31Remove __GNUC__ conditionals on variable sized local arraysPanu Matilainen1-22/+0
- We require a C99 compiler anyway so these conditionals are not needed
2012-05-31Eliminate unnecessary libc header typedeffery from rpmglobPanu Matilainen1-86/+25
- No doubt important bits in glibc but unnecessary goo for our internal implementation.
2012-05-31Run indent -kr on the glob implementationPanu Matilainen1-942/+847
- rpm style isn't exactly K&R but close enuf for goverment work and prevent sore eyes now that this is a "real" part of rpm.
2012-05-31Bury our glob() implementation entirely inside rpmglob.c (RhBug:819680)Panu Matilainen2-5/+1275
- Lump glob.h and glob.c into rpmglob.c in all their g(l)ory libc decorations and make everything static to stop overriding system library symbols with our own glob().
2012-05-31Export our own version of glob_pattern_p() as rpmIsGlob()Panu Matilainen2-1/+13
- Further preliminaries to hiding the glob() implementation
2012-05-31Split rpmGlob() to a separate source filePanu Matilainen3-141/+149
- As a preliminary step to hiding our internal glob implementation, split our only glob() user to a source of its own.
2012-05-22Add support for 7zip compressed tarballsChristophe Fergeau3-1/+9
Teach %prep and %uncompress how to handle 7zip tarballs, with the mingw toolchain landing in fedora, this may be useful when crossbuilding Windows sources compressed using 7zip (CxImage is one such project).
2012-05-21Split prelink checking into a helper functionPanu Matilainen1-42/+42
- No functional changes, just makes the thing a little bit more readable as the ELF details are buried out of sight in the helper
2012-05-10Keep the macro buffer terminated on appendPanu Matilainen1-1/+2
- This isn't strictly needed as we're terminating the buffers "just in case" all over the place but handling this centrally might allow some day eliminating the other fluff...
2012-05-10Fix off-by-ones in mbAppend() and mbAppendStr()Panu Matilainen1-2/+2
- Oops, remember to reserve space for the trailing \0 when appending. mb->nb holds the number of actual characters left in the buffer, not the terminator. Fixes a regression introduced in rpm 4.9.x dynamic macro realloction work (RhBug:431009 reprise)
2012-04-18Always return NULL from fdFree()Panu Matilainen1-1/+1
- Up to now, if the fd had remaining references fdFree() would return the supposedly free'd fd back to us, which is unlike anything else in rpm. Make this consistent with the rest of rpm finally as the last remaining caller requiring the old semantics is gone from the codebase (somewhere between 4.9 and 4.10): always return NULL, as the referenced instance is now gone as far as the caller is concerned.
2012-03-22Oops, "magic eight" is necessary here afterallPanu Matilainen1-2/+2
- Fix regression from commit 807b402d95702f3f91e9e2bfbd2b5ca8c9964ed9, the array gets passed as a pointer (how else would it work at all), so despite having seemingly correct type, sizeof(keyid) depends on the pointer size. This happens to be 8 on x86_64 and friends but breaks pgp fingerprint calculation on eg i386. - Also return the explicit size from pgpExtractPubkeyFingerprint(), this has been "broken" for much longer but then all callers should really care about is -1 for error.
2012-03-20Bump library sonames in preparation for new releasePanu Matilainen1-1/+1
- This is stupid... only librpm and librpmio actually need the bump due to ABI breakage, librpmbuild and librpmsign are unchanged and could use just a revision bump. But just incrementing the revision (or age) would set us on collision course with maintenance updates to 4.9.x. Then again its not like you can actually use librpmbuild or librpmsign without also linking to librpm(io) so from everything needs rebuilding anyway. This all also pretty much makes the whole libtool library versioning a bit moot. Bah.
2012-03-14Unbreak lua's base64 encode/decode extensionsPanu Matilainen1-4/+4
- Commit 70f063cb773bedb7d336429d9bc8ed1d4e5d18f4 accidentally changed lua's base64 encode/decode interface too, ugh. Dangers of search-and-replace... Only the function name string exported to lua matters but renaming the internal functions back as well for naming consistency.
2012-03-14Fix ufdCopy() for large (> 2GB) filesPanu Matilainen2-23/+17
- Files can be (much) larger than INT32_MAX, change the return type to off_t and fix + simplify the calculations. Fixes the other half of RhBug:790396 and makes ufdCopy() usable for other purposes too.
2011-11-10Doh, somehow managed to miss the warnings from these missing includes :(Panu Matilainen1-0/+1
- Should've been in commit 70f063cb773bedb7d336429d9bc8ed1d4e5d18f4
2011-11-09Make base64 encoding/decoding part of rpmio public APIPanu Matilainen7-26/+25
- Base64 is present in headers and all, it's only reasonable that our API users have access to this functionality without having to link to other libraries. Even if we didn't want to carry the implementation forever in our codebase, we should provide a wrapping for this (much like the other crypto stuff) for the reason stated above. - A bigger issue is that our dirty little (badly hidden) secret was using non-namespaced function names, clashing with at least beecrypt. And we couldn't have made these internal-only symbols even on platforms that support it, because they are used all over the place outside rpmio. So... rename the b64 functions to rpmLikeNamingStyle and make 'em public. No functional changes, just trivial renaming despite touching numerous places.
2011-11-09Add a signature verification method to keyringPanu Matilainen2-0/+27
- At least within rpm itself, callers aren't particularly interested in the actual key that matches a given signature, they just want simple good/bad/nokey answers. This makes life simple for them and avoids exposing further rpmPubkey internals through APIs.
2011-11-09Split keyring find-by-signature to helper function, document...Panu Matilainen1-16/+31
- Document the broken rpmKeyringLookup() behavior / side-effect, the new helper uses the values from our stored pgp parameters though. - Shouldn't make any difference functionality-wise, but we'll need the helper function shortly.
2011-11-09Parse pubkey parameters on rpmPubkeyNew() already and store resultsPanu Matilainen1-0/+7
- Yet more pre-requisites for separating key and signature management. In addition this gains us more thorough initial sanity checking and will allow reusing the parameters instead of having to parse the same packets over and over again on every single verification against this key. Unfortunately rpmKeyringLookup() is so braindead it prevents us from doing this right now, we'll need a better interface to take advantage of the stored pgp key parameters.
2011-11-09Add an alternative API for parsing PGP packetsPanu Matilainen2-6/+45
- pgpPrtParams() returns a pointer to an allocated pgpDigParams on success, eliminating the need for callers to worry about freeing "target buffer" on failure and bypassing the now rather useless pgpDig middleman. Also allows specifying the expected packet type so if we expect a key we'll error out if we get a signature instead. - pgpPrtPkts() is basically just a wrapper to pgpPrtParams() - Further pre-requisites for separating key and signature management. - Yes, pgpPrtParams() is a stupid name for this. However all the saner ones are already taken for other purposes (for which the names are just as bad/misleading, sigh)
2011-11-09Allocate signature and pubkey dynamically within pgpDig on PGP parsePanu Matilainen1-23/+35
- This way we can parse the whole thing into a private storage first and only if its actually successful we return anything through the pgpDig. Previously we would return partial garbage on failure and/or consecutive calls unless manually "cleaned" as we were parsing directly into the pgpDig. - Dynamic allocation is a pre-requirement separating management of keys and signatures: while they walk hand in hand much of the time, they come from different sources and have different lifetimes and should be managed separately. - Dynamic allocation of these is also a pre-requirement for handling more than one public key, ie mainly subkeys.
2011-11-09Use pgpDigGetParams() in pgpVerifySig() compat wrapper tooPanu Matilainen1-1/+2
- The fewer places that "know" about pgpDig allocation internals the better...
2011-11-08Revert "Take advantage of pgpDigParamsCmp() in rpmKeyringLookup()"Panu Matilainen1-1/+3
- This only "works" because of other brokenness in the sig/key parsing, revert while we can - This reverts commit 4c51eff3f0fa5e67494b6b192aa1c087f57abed6.
2011-11-08Tolerate NULL key in pgpVerifySignature()Panu Matilainen1-3/+3
2011-11-07Eliminate unused params member from pgpDigParamsPanu Matilainen2-4/+0
- Rpm has never used this for anything, amounting to helluva lot unnecessary free()'s over the years.
2011-11-07Take advantage of pgpDigParamsCmp() in rpmKeyringLookup()Panu Matilainen1-3/+1
- Besides eliminating a couple of direct struct accesses, pgpDigParamsCmp() does a much more thorough job of comparing the parameters than we ever did here (ie less chance for returning ok for for a wrong key, although because the interface is as braindead as it is, it doesn't make a whole lot of difference)
2011-11-07Add ad API for retrieving algorithm values from digest parameter containersPanu Matilainen2-0/+24
- Mildly annoying but necessary in order to make pgpDigParams properly opaque some day (and also allow sane access to this data)
2011-11-07Add an API for comparing two digest parameter containersPanu Matilainen2-0/+31
- Lift the digest parameter comparison from librpmsign to rpmpgp.c where it really belongs.
2011-11-07And finally, make pgpDig struct fully opaquePanu Matilainen2-8/+8
- As long as this was exposed and relied on, we couldn't really make any changes to how this stuff is stored. Now we have a chance...
2011-11-07Eliminate direct pgpDig accesses from keyringPanu Matilainen1-6/+6
2011-11-07Add a dumb API to retrieve pubkey / signature params from pgpDigPanu Matilainen2-0/+24
2011-11-07Process all keys and signatures we findPanu Matilainen1-37/+32
- We still can't store more than one signature / key at a time, but since we can easily *process* them without trashing already stored values, lets do so to avoid returning errors from legal packets. Also pay attention to only store data matching our expected type, ie dont store signature data into pubkey parameters and vice versa. - This mostly affects pubkey packets which can have more than one key present and which (can) also carry certification signature which we currently do not handle properly at all.
2011-11-07Make pgpPrtPubkeyParams() return an int like all the others do tooPanu Matilainen1-7/+7
- No functional changes, just making the interfaces consistent