summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/alpm.h8
-rw-r--r--lib/libalpm/be_sync.c4
-rw-r--r--lib/libalpm/db.c11
-rw-r--r--lib/libalpm/signing.c15
-rw-r--r--lib/libalpm/signing.h1
-rw-r--r--lib/libalpm/sync.c2
6 files changed, 22 insertions, 19 deletions
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 */