Commit Graph

873 Commits

Author SHA1 Message Date
Panu Matilainen d3956140c2 Handle hook unregistering itself 2009-06-26 16:24:55 +03:00
Panu Matilainen d1b399761f Fix rpm.unregister() Lua extension
- hook data is userdata, not light userdata
2009-06-26 16:07:50 +03:00
Panu Matilainen 02f9f3fbdd Add base64 encode and decode extensions to the lua interface 2009-06-26 15:39:20 +03:00
Panu Matilainen 8c5437b379 Kick out silly constfree() use 2009-06-25 17:17:16 +03:00
Panu Matilainen 271069f900 Simplify logging a bit
- precalculate the message length, relying on C99 vsnprintf() semantics
- generate the log message and rest of the record in rpmlog() already,
  and just pass the record to lower level to do actual logging
- also something was wrong in the old version as valgrind complained
  about illegal reads, that is also cured here
2009-06-24 15:16:25 +03:00
Jindrich Novy 194b6a5c2a Check arg in argvJoin() before dereferencing 2009-06-23 11:02:51 +02:00
Panu Matilainen 04ec8e9fca Couple of documentation typos 2009-05-22 13:54:08 +03:00
Panu Matilainen 03e36789b6 Include from src, not build dir 2009-05-22 09:56:43 +03:00
Panu Matilainen 44cd276bc2 Eliminate useless pgpDig nbytes counter
- nothing at all uses this, dont bother
- if plaintext size of digests is needed, the correct place to calculate
  it is in the digest routines, not manual beancounting all over the place
2009-05-20 17:22:51 +03:00
Panu Matilainen 5023d0a4e8 Fix parsing of pubkey signature packets. Ick.
- busted all the way from commit bcb226480d
2009-05-08 15:01:15 +03:00
Panu Matilainen 2ce7b56e62 Hide NSS peculiarities from API
- PKCS#11 standard requires modules to be re-initialized after fork(),
  arrange this to occur automatically.
- Most of the time child processes will exec() something else so dont
  bother shutting down NSS for every child, only lazily re-initialize
  as needed.
- This lets us initialize NSS early to force preloading of its dlopen()'ed
  libraries to avoid issues on chroot(), without causing problems to API
  users which fork() after initializing rpm (such as func, urpmi etc).
2009-04-23 15:54:09 +03:00
Panu Matilainen 4c39a9df93 Pad RSA signatures up to modulus size if necessary (rhbz#494049)
- unfortunately can't be detected at initial allocation so extra
  copy is needed at verification time
2009-04-16 11:03:29 +03:00
Panu Matilainen 7a8aecbc86 Fix PGP v4 fingerprint calculation (rhbz#493777)
- patch from openSUSE / Michael Schroeder
2009-04-09 13:05:00 +03:00
Panu Matilainen 3d63df6220 Handle XZ in %uncompress macro
- should've been in commit 8078d0ba24
2009-03-27 14:11:43 +02:00
Panu Matilainen 2d2bda29c1 Add built-in %getconfdir macro for getting rpmConfigDir() value
- define %_rpmconfigdir via %getconfdir in the main macro config, this
  avoids it getting lost on macro reloads as happens when building
  several packages at once
2009-03-27 14:01:47 +02:00
Jindrich Novy 4d31b0433f process the "./" in file paths correctly (rhbz#491388) 2009-03-25 17:28:55 +01:00
Panu Matilainen bdd73e4180 Push signature identification to librpmio / pgp handling
- retrieve names from pgp tables instead of manually duplicated strings
2009-03-25 16:30:20 +02:00
Panu Matilainen d65c178785 Push signature verification down to librpmio
- new pgpVerifySig() call to perform the lowlevel verify, use for
  verifying DSA/RSA signatures
- librpm is now free of NSS specifics (apart from what still leaks through
  including rpmio/digest.h), remove linkage
2009-03-25 15:16:59 +02:00
Panu Matilainen 1446825571 Eliminate header/payload digests from pgpDig_s, they dont belong
- allocate+free digests locally where needed, pass around in separate argument
- use digest bundles to handle rpmVerifySignatures() needs
- kill-kill-kill fdStealDigest(), dup the contexts from bundles as needed
2009-03-25 13:23:19 +02:00
Panu Matilainen 3f6b2f8c7b Implement fdUpdateDigests() and friends using digest bundle 2009-03-25 13:10:23 +02:00
Panu Matilainen c9146aa580 Add a type + basic api for bundle of digests (on same data)
- in various places we need to calculate different digests of the same
  data, having them stored in a single container makes managing easier
- can hold as many digest types as we support
- remembers how much input data it has handled
2009-03-25 13:08:09 +02:00
Panu Matilainen 1df4d34fb9 librpmio doesn't need libmagic for anything 2009-03-19 14:41:43 +02:00
Panu Matilainen fa0898552d Add support for "lzma alone" compression format (lzdio)
- "lzma alone" is superseeded by XZ but it's used by Suse and Mandriva
  distros so it's nice to have as it doesn't need much, only open differs
  from XZ
- rpmlib() dependency versions are an uuuuuuuugly mess here: Suse used
  "PayloadIsLzma = 4.4.2-1" so that's what we provide to be most compatible
  (hopefully). Built packages require "PayloadIsLzma <= 4.4.6-1" however
  to be compatible with Mandriva 2008.0. Did I already say it's ugly?
- Based on similar patch in Mandriva by Per Øyvind Karlsen, but avoiding
  unnecessary renames in rpmio
2009-03-18 11:24:52 +02:00
Panu Matilainen 8078d0ba24 LZMA -> XZ renaming
- what we support now in payloads is XZ, not the former LZMA format, rename
  user- and header-visible parts to match this
- rpmlib(PayloadIsXz) dependency versioned 5.2-1 to avoid unnecessary
  incompatibility with what rpm5 has and what Mandriva is already using
- only provide the rpmlib dependency if actually built with xz support
- rpmFileIsCompressed() attempts to guess the magicless old lzma format
  by file suffix, so it can handle both right now
2009-03-18 09:42:23 +02:00
Panu Matilainen 847c991b2b Proper error handling in rpmDigestDup()
- tolerate calling with NULL
- avoid allocations in case of failure
- return NULL instead of calling exit(), ick
2009-03-16 14:13:00 +02:00
Panu Matilainen ed342d7df6 Eliminate unnecessary pgpNewPublicKey() wrappers 2009-03-16 12:25:03 +02:00
Panu Matilainen f79353ea74 Eliminate unnecessary field from pgpDig_s
- key/signature can't be both DSA and RSA at the same time
2009-03-16 12:18:01 +02:00
Panu Matilainen 4cf26d30f8 NSS supports MD2, we might as well handle it too
- also getHashType() is a "pure" function, mark it as such
2009-03-11 21:41:57 +02:00
Panu Matilainen 15042bc909 Eliminate now unnecessary FDDIGEST_t
- contexts know their hash algorithm, this is not needed anymore
2009-03-11 18:10:19 +02:00
Panu Matilainen 7fc5e62eaa Remember hash algorithm in digest context
- alternatively we could reverse map NSS hash types (HASHContext
  knows its type) but shrug...
2009-03-11 18:07:22 +02:00
Panu Matilainen d05e4438a9 Streamline rpmDigestInit() a bit
- single point of exit, rearrange to avoid having to free if stuff fails
2009-03-11 18:06:33 +02:00
Jindrich Novy 74c9a96c3c Port XZ payload compression to xz-4.999.8 API
- use SHA256 digests for archive error detection
- use 100MiB peak memory usage for decoding
- use better XZ detection in configure.ac
2009-03-09 20:20:42 +01:00
Panu Matilainen 5cb107b843 Dont leak memory from hdrmd5ctx 2009-03-04 13:41:27 +02:00
Panu Matilainen 30f60665bb Eliminate unnecessary fields from pgpDig_s
- sha1(len) and md5(len) are only needed and used locally in
  verify[DR]SASignature(), no point carrying them around in pgpDig
- use wrapper function to hide type differences between rpm and NSS
2009-03-04 11:49:29 +02:00
Jindrich Novy 7acdfded4a Add md5->filedigest aliases (rhbz#487597)
- add %verify(nofiledigest) as %verify(nomd5) file attribute alias
- reference digests as digests not checksums
- make old md5 related symbols obsolete and use newer reference
- update man page accordingly
2009-02-27 14:34:39 +01:00
Panu Matilainen caf759f8ca Switch to libtool versioning, starting at 0:0:0 2009-02-26 16:09:51 +02:00
Panu Matilainen 947ad7acb3 Add getenv macro, use instead of $(echo $HOME) for defauls
- inspired by http://lists.rpm.org/pipermail/rpm-maint/2009-January/002332.html
2009-01-16 09:09:40 +02:00
Panu Matilainen 6d26397a61 Make sure global state gets NULLed on free
- otherwise repeated read config -> free config like rpmbuild does
  will crash and burn
- somewhat kludgy, figure a better way to do this
2009-01-15 09:22:58 +02:00
Panu Matilainen 2e0d5ef2d0 Add rpmluaGetGlobalState() to internal lua api
- retrieve global state, init if needed
- inspired by rpm5.org, details differ
- use it for initialisation in rpmrc instead of abusing rpmluaGetPrintBuffer
2009-01-14 15:08:59 +02:00
Panu Matilainen 6e816c44dc Don't try to create "" directories 2009-01-09 15:05:40 +02:00
Panu Matilainen 5ff05aec30 Delay NSS initialization until actually used
- since NSS is allergic (ie becomes non-functional) after forking, delay
  it's initialization until really needed, ie lazy init in rpmDigestInit()
- however as NSS init can fail if attempted in completely empty chroot,
  we force crypto init to happen at transaction set create time, forking
  past that is pretty much doomed anyway
- this is the other half of the fix for rhbz#476737, and similar case
  noticed by Pixel in Mandriva (due to urpm forking)
2009-01-08 13:17:22 +02:00
Panu Matilainen c895fb1541 Only touch _crypto_initialized if we actually change it 2009-01-08 13:03:55 +02:00
Panu Matilainen 882e8df3d0 Don't segfault in pgpPubkeyFingerprint() if rpmDigest* fails
- this can happen if NSS is not properly initialized, such as after
  forking
- partial fix to rhbz#476737 (as in "doesn't crash"), deeper issue is
  that NSS init needs to be done later than we do now
2009-01-08 10:38:29 +02:00
Jindrich Novy c9e46a7985 Increase XZ decompression memlimit 2008-12-23 09:48:16 +01:00
Panu Matilainen bafed0d85c Oops, missing wrappers for C++ in headers (ticket #12) 2008-12-09 09:51:17 +02:00
Panu Matilainen 9799e69263 Avoid "template" which is a reserved word in C++ 2008-12-05 21:17:16 +02:00
Jindrich Novy 0b80d38f32 Include rpmfileutil.h from rpmmacro.h so that
prototype for rpmGenPath() is included (rhbz#473420)
- unbreaks net-snmp
2008-12-01 12:16:56 +01:00
Jindrich Novy e56768c279 Increase memory limit for LZMA compression
so that everything up to level 9 gets safely
expanded
2008-11-26 16:44:53 +01:00
Jindrich Novy d6f6d2b565 Initialize the LZMA encoder/decoder on demand, not both 2008-11-26 16:44:53 +01:00
Jindrich Novy 93ca811b4f Port LZMA (XZ) support to the new API
- get rid of the obsolete "alone" LZMA file format
  and hacks around it
2008-11-25 14:25:31 +01:00