Commit Graph

83 Commits

Author SHA1 Message Date
Panu Matilainen 05b233ddbe Plug the last data "leak" from rpmlead
Up to commit 45c2f3ffa6 we were still
using the lead to confirm source vs binary package, but now we dont
need even that. Means the zombie data structure that's supposedly been
dead for the last 20+ years is truly gone now. We still dutifully
read/write and validate it, but no actual data from it is used.
2018-04-18 14:36:01 +03:00
Panu Matilainen 4c53e5755e Ensure rpmlead is fully initialized
Fix sneaky regression from commit 83a8640b47,
the lead used to be calloc()'ed so it was guaranteed all zeros, now its not.
Bulldoze to zero with memset() instead.
2016-11-30 09:17:53 +02:00
Panu Matilainen 83a8640b47 ...and finally bury the rpmlead datatype entirely inside rpmlead.c
Since rpmLeadWrite() takes a header there's no more need for
rpmLeadFromHeader() to be "public" and since nothing returns
leads there's no need to free them either, make static + adjust
to eliminate the need for ever allocating a lead so the free func
can go too. Whee. the remaining rpmlead.h is something we could
actually consider making public.
2016-10-27 11:08:25 +03:00
Panu Matilainen c873837925 Drop unused lead return argument from rpmLeadRead()
Nothing uses this anymore so we can just drop it. Whee.
2016-10-27 10:56:34 +03:00
Panu Matilainen 3255273ae0 Change rpmLeadWrite() to take header as its arg instead of a lead
The only "user" of the lead data structure is the signing code
which just wants to copy it over to the signed package. We can
just as well regenerate it from the header. Even if it doesn't
end up identical (which it should), it doesn't make a damnest
difference because nothing that matters looks at the lead anyway.
2016-10-27 10:48:26 +03:00
Panu Matilainen 0cc5ee83f1 Bury the last remains of non-header signatures into lead
Header signatures were the new hot almost exactly twenty years ago, we
haven't supported anything else in a very, very, very, very very long time.
Drop the useless argument to rpmReadSignature() and bury the last remaining
related constant into rpmlead.c which is the only place that "needs" it.
No functional changes.
2016-10-24 08:41:32 +03:00
Panu Matilainen cbd6ef58bb Handle partial reads and errors in package IO (RhBug:802839, RhBug:580974)
- There are no guarantees Fread() will return all of the requested size:
  it can return partial data eg on signals and pipe descriptors. Introduce
  a helper function to handle this centrally for all package read IO,
  effectively reintroducing timedRead() but without the caveats:
  timedRead() did not work on compressed streams, did not handle
  eg EINTR correctly and while really being an internal helper,
  was exported in the API.
2012-10-30 11:36:56 +02:00
Panu Matilainen 78c95448a1 Further streamline & sanitize lead handling
- Never log anything from rpmLeadRead(), instead return an error message
  the callers can log if they see fit
- Add a return value for the lead type (which is the only bit of
  info from the lead we sometimes resort to using)
- Permit NULL pointers on all return values
- Eliminate rpmLeadCheck() and rpmLeadType() from the internal API,
  these are now combined into rpmLeadRead().
- Fix up the callers: only (re)signing needs the actual lead,
  signature verification only cares if its valid or not and
  package reading only wants the type from the lead (annoying but...)
2011-07-07 11:55:28 +03:00
Panu Matilainen e156eac1c8 Only bother mallocing lead for return if read actually succeeded
- Doesn't make much of a difference now, just paving way for next steps
2011-07-07 11:17:29 +03:00
Panu Matilainen 645c09034c Eliminate remaining assert()'s in rpmlead.c
- Blowing up with assert() on freeing NULL is just dumb...
- rpmLeadWrite() can easily be made to handle NULL lead gracefully
2011-07-06 12:53:59 +03:00
Panu Matilainen da53e0d66e Make rpmLeadRead() return an allocated lead, fixup callers
- Requiring callers to allocate a lead "buffer" for reading into
  is just DUMB (greetings to self back in 2008, sigh). This avoids
  having to deal with freeing the lead in case the read failed, and
  allows getting rid of rpmLeadNew() completely.
2011-07-06 12:42:56 +03:00
Panu Matilainen 2a2979db51 Start beating a little bit of sense into the braindamaged rpmlead API
- rpmLeadNew() should not populate the struct, only allocate it
- The only case where we're creating new lead data is
  rpmLeadFromHeader(), move all initialization there, and add a comment
  for RhBug:717898. Also eliminate the stupid assert, we can
  easily handle NULL header here.
2011-07-06 12:09:21 +03:00
Jindrich Novy 3ab3a931b4 Avoid timedRead() usage
- it is to be removed in the next soname bump
2011-03-23 11:25:06 +01:00
Panu Matilainen 05dd62aba9 Lift remaining build-related stuff out of librpm over to build-side
- none of this belongs to librpm headers and ABI
2010-09-01 12:34:33 +03:00
Panu Matilainen dd58384ede Move <errno.h> include out of system.h to the places that need it 2010-01-05 15:25:31 +02:00
Panu Matilainen 0bac1d421c Hardwire lead major version to 3 (RhBug:546663)
- besides the logic being backwards wrt intended --nodirtokens linkage,
  LSB wants this to be 3 and .. it just makes no difference whatsover
  anyway
2009-12-17 11:35:11 +02:00
Panu Matilainen b5bc388ee3 Eliminate uses of headerNVR() and friends in librpm (and python) code 2009-09-02 12:06:34 +03:00
Panu Matilainen d8071161f9 Log an error on short lead (RhBug:511101)
- if lead read returns short without it being an IO error, treat it
  as a case of "not an rpm package"
2009-07-14 14:25:58 +03:00
Panu Matilainen 826969f2c7 Add function to retrieve type from rpmlead
- for some messed up packages there's no other reliable way to determine
  source vs binary than looking at the lead :-/
2008-12-08 19:50:07 +02:00
Panu Matilainen 504e8231cb Yank out legacy.h, make the conversion functions static 2008-10-10 15:59:38 +03:00
Jindrich Novy 1dd1d68afe Avoid segfault in rpmLeadNew() if calloc() fails 2008-09-25 20:03:50 +02:00
Panu Matilainen 834d2d2691 Add missing include 2008-04-17 18:15:34 +03:00
Panu Matilainen 805e294fd6 Make sure lead->name is zero-terminated 2008-04-17 17:35:57 +03:00
Panu Matilainen dccc08ab66 Make rpmLeadCheck() return error msg instead of direct logging
- allows silent checking of lead and differentiating between
  non-rpm files and incompatible rpms, avoiding bogus "not an rpm package"
  message on manifests
2008-03-31 12:07:37 +03:00
Panu Matilainen 2e3972aebf Mark another pile of header_magic duplicates as read-only 2008-03-07 08:15:03 +02:00
Panu Matilainen 82b547aa26 Oops, package type in lead was reversed... 2008-02-08 13:45:56 +02:00
Panu Matilainen eb5dc35c19 Include spring-cleaning
- put some consistency into include ordering
- everything (apart from bits missed ;) is now ordered like this
  1. "system.h"
  2. other system includes
  3. rpm public headers
  4. rpm private headers
  5. "debug.h"
2008-01-30 17:05:29 +02:00
Panu Matilainen 87e01f3362 Use headerIsSource() instead of doing it manually 2008-01-30 14:27:41 +02:00
Panu Matilainen 99faa2735b rpmlib.h mass eviction
- explicitly include what's really needed instead
- document remaining uses
2008-01-30 13:53:51 +02:00
Panu Matilainen 9ce13e09ef Switch to <rpm/foo.h> style for public headers
- adjust include paths accordingly
2007-12-08 14:02:32 +02:00
Panu Matilainen 92698df723 Make rpmlead opaque, add methods to deal with it
- rename methods to rpmLead*() for easy grepping
- populate lead from header where necessary
- add rpmLeadCheck() method for minimal compatibility checking to get
  rid of duplicate code in several places
- conditionalize lead version on dirtokens
2007-12-01 18:31:09 +02:00
Ralf Corsépius 60939d6985 Expand private include file names to be relative to $(top_srcdir) 2007-11-23 11:39:29 +01:00
Ralf Corsépius abeea80a38 Use #include <x.h> syntax to include public headers. 2007-11-23 06:46:19 +01:00
Panu Matilainen 17ef8a3082 Lose rpmerr.h for good 2007-11-19 16:32:15 +02:00
Panu Matilainen 43c5de66fb Replace all RPMERR_* etc uses with corresponding RPMLOG_* levels 2007-11-19 16:25:24 +02:00
Ralf Corsépius f25c04c1e4 Include "rpmlib.h" instead of <rpmlib.h>. 2007-10-28 06:47:31 +01:00
Panu Matilainen 01d5c13a42 Make rpmerr.h private, include directly where needed. 2007-10-09 15:33:49 +03:00
Panu Matilainen d709195c3a Replace all rpmError() uses with rpmlog() 2007-10-09 14:06:06 +03:00
Ralf Corsépius 9cf8f9c31a Stop checking for machine/types.h (Private header of some OSes not supposed to be used). 2007-10-04 08:55:07 +02:00
Ralf Corsépius ebef4f211c Remove splint tags. 2007-09-11 19:07:39 +02:00
jbj c243ab099b - resurrect manifests, RPMRC_NOTFOUND returned by readLead().
CVS patchset: 6752
CVS date: 2003/04/16 17:48:04
2003-04-16 17:48:04 +00:00
jbj cc5d229b0e Sync with rpm-4.1.
CVS patchset: 5695
CVS date: 2002/08/31 22:39:34
2002-08-31 22:39:34 +00:00
jbj f5a546f580 - merge signature returns into rpmRC.
- python: exceptions on NOKEY/NOTTRUSTED.

CVS patchset: 5667
CVS date: 2002/08/23 21:01:59
2002-08-23 21:01:59 +00:00
jbj 6106bdb359 lclint fiddles.
CVS patchset: 5615
CVS date: 2002/08/08 16:06:13
2002-08-08 16:06:13 +00:00
jbj bd5ee7affa - fix: check for lead magic, better error message on failure (#69751).
CVS patchset: 5602
CVS date: 2002/08/05 19:45:52
2002-08-05 19:45:52 +00:00
jbj af3c677f06 - use rpmfi in showQueryPackage(), eliminating headerGetEntry().
CVS patchset: 5538
CVS date: 2002/07/03 14:01:49
2002-07-03 14:01:49 +00:00
jbj 05cb73a7ee Factor bounds checking annotations into source code.
CVS patchset: 5521
CVS date: 2002/06/22 18:51:56
2002-06-22 18:51:56 +00:00
jbj 46bbc20b32 - use rpmdb-redhat to suggest dependency resolution(s).
CVS patchset: 5401
CVS date: 2002/04/13 01:28:20
2002-04-13 01:28:20 +00:00
jbj 96a3f7a55d Factor -type problems into explicit code annotations.
CVS patchset: 5117
CVS date: 2001/10/16 17:42:18
2001-10-16 17:42:18 +00:00
jbj 9f45bcd3ec More lclint annotations.
CVS patchset: 5116
CVS date: 2001/10/16 14:58:57
2001-10-16 14:58:57 +00:00