[pacman-dev] [PATCH 1/3] Revise siglevel_t, adding PACKAGE_HASH_OK field

Kerrick Staley mail at kerrickstaley.com
Mon Jul 18 02:59:14 EDT 2011


And...
I didn't actually hit save, so this is missing the ALPM_SIG_ERROR
part. Here's the fixed version.

Revise siglevel_t, adding PACKAGE_HASH_OK field

The ALPM_SIG_PACKAGE_HASH_OK field indicates that secure hashes are to
be acceptable as signatures.

Also, having ALPM_SIG_USE_DEFAULT = (1 << 31) will cause alpm_siglevel_t
to be treated as an unsigned value on machines where int is 32 bits,
meaning negative numbers cannot be returned on error conditions. So,
make it (1 << 30). Still, there's no guarantee that signed
semantics will be used unless one of the enum values is negative. So,
supply ALPM_SIG_ERROR = -1 as a sort of dummy value (it can be used in
code, but "-1" is probably just as meaningful and is more consistent
with conventions used throughout the rest of the library).

Signed-off-by: Kerrick Staley <mail at kerrickstaley.com>
---
 lib/libalpm/alpm.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 6e1e4bc..93ffa89 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -90,17 +90,19 @@ typedef enum _alpm_fileconflicttype_t {
  * PGP signature verification options
  */
 typedef enum _alpm_siglevel_t {
+       ALPM_SIG_ERROR = -1,
        ALPM_SIG_PACKAGE = (1 << 0),
        ALPM_SIG_PACKAGE_OPTIONAL = (1 << 1),
        ALPM_SIG_PACKAGE_MARGINAL_OK = (1 << 2),
        ALPM_SIG_PACKAGE_UNKNOWN_OK = (1 << 3),
+       ALPM_SIG_PACKAGE_HASH_OK = (1 << 4),

        ALPM_SIG_DATABASE = (1 << 10),
        ALPM_SIG_DATABASE_OPTIONAL = (1 << 11),
        ALPM_SIG_DATABASE_MARGINAL_OK = (1 << 12),
        ALPM_SIG_DATABASE_UNKNOWN_OK = (1 << 13),

-       ALPM_SIG_USE_DEFAULT = (1 << 31)
+       ALPM_SIG_USE_DEFAULT = (1 << 30)
 } alpm_siglevel_t;

 /**


More information about the pacman-dev mailing list