1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

Make alpm_db_get_sigverify_level() public

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-06-24 15:41:56 -05:00
parent 68284da0d7
commit 23a2d2c16a
6 changed files with 22 additions and 19 deletions

View File

@ -382,6 +382,14 @@ int alpm_db_unregister_all(alpm_handle_t *handle);
*/ */
const char *alpm_db_get_name(const alpm_db_t *db); 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. /** Check the validity of a database.
* This is most useful for sync databases and verifying signature status. * This is most useful for sync databases and verifying signature status.
* If invalid, the handle error code will be set accordingly. * If invalid, the handle error code will be set accordingly.

View File

@ -77,7 +77,7 @@ static int sync_db_validate(alpm_db_t *db)
/* this takes into account the default verification level if UNKNOWN /* this takes into account the default verification level if UNKNOWN
* was assigned to this db */ * 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) { if(check_sig != PM_PGP_VERIFY_NEVER) {
int ret; int ret;
@ -166,7 +166,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
/* make sure we have a sane umask */ /* make sure we have a sane umask */
oldmask = umask(0022); oldmask = umask(0022);
check_sig = _alpm_db_get_sigverify_level(db); check_sig = alpm_db_get_sigverify_level(db);
/* attempt to grab a lock */ /* attempt to grab a lock */
if(_alpm_handle_lock(handle)) { if(_alpm_handle_lock(handle)) {

View File

@ -219,6 +219,17 @@ const char SYMEXPORT *alpm_db_get_name(const alpm_db_t *db)
return db->treename; 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. */ /** Check the validity of a database. */
int SYMEXPORT alpm_db_get_valid(alpm_db_t *db) int SYMEXPORT alpm_db_get_valid(alpm_db_t *db)
{ {

View File

@ -361,21 +361,6 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
} }
#endif #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. * Check the PGP signature for the given package file.
* @param pkg the package to check * @param pkg the package to check

View File

@ -23,7 +23,6 @@
int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path, int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
const char *base64_sig); const char *base64_sig);
pgp_verify_t _alpm_db_get_sigverify_level(alpm_db_t *db);
#endif /* _ALPM_SIGNING_H */ #endif /* _ALPM_SIGNING_H */

View File

@ -874,7 +874,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
filename = alpm_pkg_get_filename(spkg); filename = alpm_pkg_get_filename(spkg);
filepath = _alpm_filecache_find(handle, filename); filepath = _alpm_filecache_find(handle, filename);
alpm_db_t *sdb = alpm_pkg_get_db(spkg); 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 */ /* 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 */ /* TODO: alpm_pkg_get_db() will not work on this target anymore */