Revert back to DSA-1 only support for NSS

- This essentially reverts commit fe5a1e5dfa93f15b7beda59e193832577143a4d9
  which apparently causes intermittent failures with DSA-1. Look at
  DSA-2 again on some sunnier day...
Plug ages old memleak on package signing
Removed historical leftover.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
There is no need to recalculate digests during signing.

Digests are not signatures even if they reside in "signature" header,
and signing a package must not affect the digests. So recalculating
digests on signing is not just wasteful, but also conceptually plain
wrong.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Removed now unused internal helper functions.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Passing data to sign to the gpg program by a pipe.

- This change shorten signing time beacause it is not necessary to
write data that should be signed, into a temporary file and then pass
this file to gpg program.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Function manageFile was modified to support also "r+.ufdio" mode.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Reserve space for gpg signature during building of package.

- During building of a package a dummy tag is added to the signature
header. This tag reserves some space for gpg signatures. So during
signing of the package the gpg signatures can be put in this reserved
space and it is not necessary to rewrite the whole package to make some
space for gpg signatures.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
l10n: vi.po (759t): Init Vietnamese translation

  * Init then translate all strings
  * Add vi to LINGUAS

Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
rpmSign() returned value 0 (success) in case of failure

- Fixes regression from commit c0aad81e9b17afcbea4008485d354673495eb148.
- That commit added line "res = replaceSignature(...)" that sets variable
  "res" to value 0. But error handling code following this line expects
  this variable set to -1. So in case of error value 0 (success) was
  returned but value -1 (failure) should have been returned.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
rpmSign() always returned -1 if signatures was inserted into original rpm

- This was caused by commit 90833a57c523c1a5a074cae81c0c84fb3726fb6d but
  because of another problem fixed in previous commit it didn't exhibit.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Error message with wrong filename was showed in case of error.

This was caused by commit 90833a57c523c1a5a074cae81c0c84fb3726fb6d.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
"rpmkey -K" didn't show error message in case of malformed signature

- Fixes regression from commit 8cbc1bd92990b2351856a038d44d804c8ab46bd9

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Export header magic in python module as rpm.header_magic bytes object
Try to cope with duplicate id's and names in verification (ticket #872)

- When duplicate user/groupnames or UID/GIDs are present, data can be
  inconsistent depending on which way the id/name lookup is done.
  Reporting an error when neither the file ownership or the related
  user/group entry was changed on the system seems wrong, so try
  to do better... Look up the data both ways and only fail the
  verification if data from both is wrong, but warn about duplicates
  on inconsistent results.
Fix ancient buffer overflows on macro define and undefine (RhBug:1087000)

- Both doDefine() and doUndefine() assumed the macro string would
  always fit into MACROBUFSIZ, which of course is true for any
  normal use but we cant make such assumptions.
- In the case of %define/%global there are various other overrun-issues
  that need further changes to fix.
Avoid pointless large stack alloction (RhBug:1106594)

- Within rpm itself, this allocation from 12 years ago doesn't come anywhere
  close to stack limits on Linux at least, but since we're a library
  we should be considerate to API users stack needs as well. Allocate
  the buffer from heap instead, its not performance critical either
  since this will always be limited by physical IO and digest calculation
  speed rather than a single malloc.
Fix ancient buffer overflow on unterminated macro options

- Test for terminating ')' existence before copying, otherwise we'll
  end up walking over the edge of the world.
- Return address from doDefine() on error will likely differ after
  this, whether that actually affects anything remains to be seen...
Fix libtool dependency generation with libtool >= 2.4.2

- libtool string change broke our scripts and nobody noticed for
  a long time... Related to RhBug:1061619.
Drop the experimental collection support

- The basic concept is not without merit but what was implemented here
  has been stuck in experimental state in middle of two sorta conflicting
  goals for four years now, and world has moved onward in the meanwhile.
  The sepolicy part is better handled in the new selinux plugin, and other
  action business belongs to packages (in the form of some trigger-like
  scripts or such) rather than rpm plugins.
- Deleted here, but the sepolicy plugin functionality still needs
  merging into the new selinux plugin...
- RPMTAG_COLLECTIONS left in place but tagged unimplemented as per policy
  to never actually remove tags