index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-06-24 15:41:56 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-30 16:16:41 -0500 |
commit | 23a2d2c16a87dc8744b8307bded9fabb503dde13 (patch) | |
tree | 78137ad8dc1e68dfa7e8c37e006d53704d1af3b8 /lib/libalpm | |
parent | 68284da0d72bf27ac3dc5cfc1cd02d16f824130c (diff) |
-rw-r--r-- | lib/libalpm/alpm.h | 8 | ||||
-rw-r--r-- | lib/libalpm/be_sync.c | 4 | ||||
-rw-r--r-- | lib/libalpm/db.c | 11 | ||||
-rw-r--r-- | lib/libalpm/signing.c | 15 | ||||
-rw-r--r-- | lib/libalpm/signing.h | 1 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 2 |
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index b702c030..76564271 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -382,6 +382,14 @@ int alpm_db_unregister_all(alpm_handle_t *handle); */ const char *alpm_db_get_name(const alpm_db_t *db); +/** Get the signature verification level for a database. + * Will return the default verification level if this database is set up + * with PM_PGP_VERIFY_UNKNOWN. + * @param db pointer to the package database + * @return the signature verification level + */ +pgp_verify_t alpm_db_get_sigverify_level(alpm_db_t *db); + /** Check the validity of a database. * This is most useful for sync databases and verifying signature status. * If invalid, the handle error code will be set accordingly. diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index cf32257f..ce418d56 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -77,7 +77,7 @@ static int sync_db_validate(alpm_db_t *db) /* this takes into account the default verification level if UNKNOWN * was assigned to this db */ - check_sig = _alpm_db_get_sigverify_level(db); + check_sig = alpm_db_get_sigverify_level(db); if(check_sig != PM_PGP_VERIFY_NEVER) { int ret; @@ -166,7 +166,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) /* make sure we have a sane umask */ oldmask = umask(0022); - check_sig = _alpm_db_get_sigverify_level(db); + check_sig = alpm_db_get_sigverify_level(db); /* attempt to grab a lock */ if(_alpm_handle_lock(handle)) { diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index b6a436f1..6c1b95c0 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -219,6 +219,17 @@ const char SYMEXPORT *alpm_db_get_name(const alpm_db_t *db) return db->treename; } +/** Get the signature verification level for a database. */ +pgp_verify_t SYMEXPORT alpm_db_get_sigverify_level(alpm_db_t *db) +{ + ASSERT(db != NULL, return -1); + if(db->pgp_verify == PM_PGP_VERIFY_UNKNOWN) { + return alpm_option_get_default_sigverify(db->handle); + } else { + return db->pgp_verify; + } +} + /** Check the validity of a database. */ int SYMEXPORT alpm_db_get_valid(alpm_db_t *db) { diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index 35b352be..24ca4a0d 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -362,21 +362,6 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path, #endif /** - * Determines the necessity of checking for a valid PGP signature - * @param db the sync database to query - * - * @return signature verification level - */ -pgp_verify_t _alpm_db_get_sigverify_level(alpm_db_t *db) -{ - if(db->pgp_verify != PM_PGP_VERIFY_UNKNOWN) { - return db->pgp_verify; - } else { - return alpm_option_get_default_sigverify(db->handle); - } -} - -/** * Check the PGP signature for the given package file. * @param pkg the package to check * @return a int value : 0 (valid), 1 (invalid), -1 (an error occurred) diff --git a/lib/libalpm/signing.h b/lib/libalpm/signing.h index eb4cb18a..b1b90d77 100644 --- a/lib/libalpm/signing.h +++ b/lib/libalpm/signing.h @@ -23,7 +23,6 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path, const char *base64_sig); -pgp_verify_t _alpm_db_get_sigverify_level(alpm_db_t *db); #endif /* _ALPM_SIGNING_H */ diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index dcce18d3..8f038400 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -874,7 +874,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) filename = alpm_pkg_get_filename(spkg); filepath = _alpm_filecache_find(handle, filename); alpm_db_t *sdb = alpm_pkg_get_db(spkg); - check_sig = _alpm_db_get_sigverify_level(sdb); + check_sig = alpm_db_get_sigverify_level(sdb); /* load the package file and replace pkgcache entry with it in the target list */ /* TODO: alpm_pkg_get_db() will not work on this target anymore */ |