[pacman-dev] [PATCH 1/3] Changed all references to signature verification level in libalpm symbols to 'verifysig'. Removed references to PGP in libalpm symbols. Signed-off-by: Kerrick Staley <mail at kerrickstaley.com>

Kerrick Staley mail at kerrickstaley.com
Wed Jun 1 16:03:17 EDT 2011


---
 lib/libalpm/alpm.h       |   24 ++++++++++++------------
 lib/libalpm/be_package.c |   10 +++++-----
 lib/libalpm/be_sync.c    |   10 +++++-----
 lib/libalpm/db.c         |    6 +++---
 lib/libalpm/db.h         |    2 +-
 lib/libalpm/dload.c      |    6 +++---
 lib/libalpm/handle.c     |   14 +++++++-------
 lib/libalpm/handle.h     |    2 +-
 lib/libalpm/package.h    |    2 +-
 lib/libalpm/signing.c    |   14 +++++++-------
 lib/libalpm/signing.h    |    2 +-
 lib/libalpm/sync.c       |    4 ++--
 src/pacman/conf.c        |   24 ++++++++++++------------
 src/pacman/query.c       |    2 +-
 src/pacman/sync.c        |    2 +-
 src/pacman/upgrade.c     |    2 +-
 src/util/testpkg.c       |    2 +-
 17 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 5af843c..c779a06 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -63,12 +63,12 @@ typedef enum _pmpkgreason_t {
 /**
  * GPG signature verification options
  */
-typedef enum _pgp_verify_t {
-	PM_PGP_VERIFY_UNKNOWN,
-	PM_PGP_VERIFY_NEVER,
-	PM_PGP_VERIFY_OPTIONAL,
-	PM_PGP_VERIFY_ALWAYS
-} pgp_verify_t;
+typedef enum pmverifysig_t {
+	PM_VERIFYSIG_UNKNOWN,
+	PM_VERIFYSIG_NEVER,
+	PM_VERIFYSIG_OPTIONAL,
+	PM_VERIFYSIG_ALWAYS
+} pmverifysig_t;
 
 /*
  * Structures
@@ -263,8 +263,8 @@ int alpm_option_set_usedelta(int usedelta);
 int alpm_option_get_checkspace(void);
 int alpm_option_set_checkspace(int checkspace);
 
-pgp_verify_t alpm_option_get_default_sigverify(void);
-int alpm_option_set_default_sigverify(pgp_verify_t level);
+pmverifysig_t alpm_option_get_default_verifysig(void);
+int alpm_option_set_default_verifysig(pmverifysig_t level);
 
 /** @} */
 
@@ -389,7 +389,7 @@ int alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason);
  * @param pkg address of the package pointer
  * @return 0 on success, -1 on error (pm_errno is set accordingly)
  */
-int alpm_pkg_load(const char *filename, int full, pgp_verify_t check_sig,
+int alpm_pkg_load(const char *filename, int full, pmverifysig_t check_sig,
 		pmpkg_t **pkg);
 
 /** Free a package.
@@ -626,10 +626,10 @@ alpm_list_t *alpm_pkg_unused_deltas(pmpkg_t *pkg);
  * Signatures
  */
 
-int alpm_pkg_check_pgp_signature(pmpkg_t *pkg);
+int alpm_pkg_check_signature(pmpkg_t *pkg);
 
-int alpm_db_check_pgp_signature(pmdb_t *db);
-int alpm_db_set_pgp_verify(pmdb_t *db, pgp_verify_t verify);
+int alpm_db_check_signature(pmdb_t *db);
+int alpm_db_set_verifysig(pmdb_t *db, pmverifysig_t verify);
 
 /*
  * Deltas
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 9e59d69..173bd4b 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -227,7 +227,7 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
  * @return An information filled pmpkg_t struct
  */
 pmpkg_t *_alpm_pkg_load_internal(const char *pkgfile, int full,
-		const char *md5sum, const char *base64_sig, pgp_verify_t check_sig)
+		const char *md5sum, const char *base64_sig, pmverifysig_t check_sig)
 {
 	int ret;
 	int config = 0;
@@ -266,11 +266,11 @@ pmpkg_t *_alpm_pkg_load_internal(const char *pkgfile, int full,
 	}
 
 	_alpm_log(PM_LOG_DEBUG, "base64_sig: %s\n", base64_sig);
-	if(check_sig != PM_PGP_VERIFY_NEVER) {
+	if(check_sig != PM_VERIFYSIG_NEVER) {
 		_alpm_log(PM_LOG_DEBUG, "checking signature for %s\n", pkgfile);
 		ret = _alpm_gpgme_checksig(pkgfile, base64_sig);
-		if((check_sig == PM_PGP_VERIFY_ALWAYS && ret != 0) ||
-				(check_sig == PM_PGP_VERIFY_OPTIONAL && ret == 1)) {
+		if((check_sig == PM_VERIFYSIG_ALWAYS && ret != 0) ||
+				(check_sig == PM_VERIFYSIG_OPTIONAL && ret == 1)) {
 			RET_ERR(PM_ERR_SIG_INVALID, NULL);
 		}
 	}
@@ -381,7 +381,7 @@ error:
 }
 
 int SYMEXPORT alpm_pkg_load(const char *filename, int full,
-		pgp_verify_t check_sig, pmpkg_t **pkg)
+		pmverifysig_t check_sig, pmpkg_t **pkg)
 {
 	ALPM_LOG_FUNC;
 
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 9d85a45..3294f45 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -85,7 +85,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
 	size_t len;
 	int ret = -1;
 	mode_t oldmask;
-	pgp_verify_t check_sig;
+	pmverifysig_t check_sig;
 
 	ALPM_LOG_FUNC;
 
@@ -117,7 +117,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
 		}
 	}
 
-	check_sig = _alpm_db_get_sigverify_level(db);
+	check_sig = _alpm_db_get_verifysig(db);
 
 	for(i = db->servers; i; i = i->next) {
 		const char *server = i->data;
@@ -132,9 +132,9 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
 
 		ret = _alpm_download(fileurl, syncpath, force, 0, 0);
 
-		if(ret == 0 && (check_sig == PM_PGP_VERIFY_ALWAYS ||
-					check_sig == PM_PGP_VERIFY_OPTIONAL)) {
-			int errors_ok = (check_sig == PM_PGP_VERIFY_OPTIONAL);
+		if(ret == 0 && (check_sig == PM_VERIFYSIG_ALWAYS ||
+					check_sig == PM_VERIFYSIG_OPTIONAL)) {
+			int errors_ok = (check_sig == PM_VERIFYSIG_OPTIONAL);
 			/* if we downloaded a DB, we want the .sig from the same server */
 			snprintf(fileurl, len, "%s/%s.db.sig", server, db->treename);
 
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 3133614..d062a92 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -225,17 +225,17 @@ int SYMEXPORT alpm_db_remove_server(pmdb_t *db, const char *url)
 }
 /** Set the verify gpg signature option for a database.
  * @param db database pointer
- * @param verify enum pgp_verify_t
+ * @param verify enum pmverifysig_t
  * @return 0 on success, -1 on error (pm_errno is set accordingly)
  */
-int SYMEXPORT alpm_db_set_pgp_verify(pmdb_t *db, pgp_verify_t verify)
+int SYMEXPORT alpm_db_set_verifysig(pmdb_t *db, pmverifysig_t verify)
 {
 	ALPM_LOG_FUNC;
 
 	/* Sanity checks */
 	ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
 
-	db->pgp_verify = verify;
+	db->verifysig = verify;
 	_alpm_log(PM_LOG_DEBUG, "adding VerifySig option to database '%s': %d\n",
 			db->treename, verify);
 
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index 399e2d5..23dffb7 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -63,7 +63,7 @@ struct __pmdb_t {
 	pmpkghash_t *pkgcache;
 	alpm_list_t *grpcache;
 	alpm_list_t *servers;
-	pgp_verify_t pgp_verify;
+	pmverifysig_t verifysig;
 
 	struct db_operations *ops;
 };
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index d024c73..9d44ce7 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -351,11 +351,11 @@ char SYMEXPORT *alpm_fetch_pkgurl(const char *url)
 	_alpm_log(PM_LOG_DEBUG, "successfully downloaded %s\n", url);
 
 	/* attempt to download the signature */
-	if(ret == 0 && (handle->sigverify == PM_PGP_VERIFY_ALWAYS ||
-				handle->sigverify == PM_PGP_VERIFY_OPTIONAL)) {
+	if(ret == 0 && (handle->verifysig == PM_VERIFYSIG_ALWAYS ||
+				handle->verifysig == PM_VERIFYSIG_OPTIONAL)) {
 		char *sig_url;
 		size_t len;
-		int errors_ok = (handle->sigverify == PM_PGP_VERIFY_OPTIONAL);
+		int errors_ok = (handle->verifysig == PM_VERIFYSIG_OPTIONAL);
 
 		len = strlen(url) + 5;
 		CALLOC(sig_url, len, sizeof(char), RET_ERR(PM_ERR_MEMORY, NULL));
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 39b3b60..4999244 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -46,7 +46,7 @@ pmhandle_t *_alpm_handle_new()
 
 	CALLOC(handle, 1, sizeof(pmhandle_t), RET_ERR(PM_ERR_MEMORY, NULL));
 
-	handle->sigverify = PM_PGP_VERIFY_OPTIONAL;
+	handle->verifysig = PM_VERIFYSIG_OPTIONAL;
 
 	return handle;
 }
@@ -627,18 +627,18 @@ int SYMEXPORT alpm_option_set_checkspace(int checkspace)
 	return 0;
 }
 
-int SYMEXPORT alpm_option_set_default_sigverify(pgp_verify_t level)
+int SYMEXPORT alpm_option_set_default_verifysig(pmverifysig_t level)
 {
 	ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
-	ASSERT(level != PM_PGP_VERIFY_UNKNOWN, RET_ERR(PM_ERR_WRONG_ARGS, -1));
-	handle->sigverify = level;
+	ASSERT(level != PM_VERIFYSIG_UNKNOWN, RET_ERR(PM_ERR_WRONG_ARGS, -1));
+	handle->verifysig = level;
 	return 0;
 }
 
-pgp_verify_t SYMEXPORT alpm_option_get_default_sigverify()
+pmverifysig_t SYMEXPORT alpm_option_get_default_verifysig()
 {
-	ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, PM_PGP_VERIFY_UNKNOWN));
-	return handle->sigverify;
+	ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, PM_VERIFYSIG_UNKNOWN));
+	return handle->verifysig;
 }
 
 /* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index aa00b6f..5bd41f1 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -72,7 +72,7 @@ typedef struct _pmhandle_t {
 	char *arch;              /* Architecture of packages we should allow */
 	int usedelta;            /* Download deltas if possible */
 	int checkspace;          /* Check disk space before installing */
-	pgp_verify_t sigverify;  /* Default signature verification level */
+	pmverifysig_t verifysig;  /* Default signature verification level */
 } pmhandle_t;
 
 /* global handle variable */
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index debb239..f3b3d26 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -141,7 +141,7 @@ void _alpm_pkg_free(pmpkg_t *pkg);
 void _alpm_pkg_free_trans(pmpkg_t *pkg);
 
 pmpkg_t *_alpm_pkg_load_internal(const char *filename, int full,
-		const char *md5sum, const char *base64_sig, pgp_verify_t check_sig);
+		const char *md5sum, const char *base64_sig, pmverifysig_t check_sig);
 
 int _alpm_pkg_cmp(const void *p1, const void *p2);
 int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index 9bb9d0a..1a99c8f 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -369,15 +369,15 @@ int _alpm_gpgme_checksig(const char *path, const char *base64_sig)
  *
  * @return signature verification level
  */
-pgp_verify_t _alpm_db_get_sigverify_level(pmdb_t *db)
+pmverifysig_t _alpm_db_get_verifysig(pmdb_t *db)
 {
 	ALPM_LOG_FUNC;
-	ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, PM_PGP_VERIFY_UNKNOWN));
+	ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, PM_VERIFYSIG_UNKNOWN));
 
-	if(db->pgp_verify != PM_PGP_VERIFY_UNKNOWN) {
-		return db->pgp_verify;
+	if(db->verifysig != PM_VERIFYSIG_UNKNOWN) {
+		return db->verifysig;
 	} else {
-		return alpm_option_get_default_sigverify();
+		return alpm_option_get_default_verifysig();
 	}
 }
 
@@ -386,7 +386,7 @@ pgp_verify_t _alpm_db_get_sigverify_level(pmdb_t *db)
  * @param pkg the package to check
  * @return a int value : 0 (valid), 1 (invalid), -1 (an error occurred)
  */
-int SYMEXPORT alpm_pkg_check_pgp_signature(pmpkg_t *pkg)
+int SYMEXPORT alpm_pkg_check_signature(pmpkg_t *pkg)
 {
 	ALPM_LOG_FUNC;
 	ASSERT(pkg != NULL, return 0);
@@ -399,7 +399,7 @@ int SYMEXPORT alpm_pkg_check_pgp_signature(pmpkg_t *pkg)
  * @param db the database to check
  * @return a int value : 0 (valid), 1 (invalid), -1 (an error occurred)
  */
-int SYMEXPORT alpm_db_check_pgp_signature(pmdb_t *db)
+int SYMEXPORT alpm_db_check_signature(pmdb_t *db)
 {
 	ALPM_LOG_FUNC;
 	ASSERT(db != NULL, return 0);
diff --git a/lib/libalpm/signing.h b/lib/libalpm/signing.h
index 8d8c164..253a919 100644
--- a/lib/libalpm/signing.h
+++ b/lib/libalpm/signing.h
@@ -22,7 +22,7 @@
 #include "alpm.h"
 
 int _alpm_gpgme_checksig(const char *path, const char *base64_sig);
-pgp_verify_t _alpm_db_get_sigverify_level(pmdb_t *db);
+pmverifysig_t _alpm_db_get_verifysig(pmdb_t *db);
 
 #endif /* _ALPM_SIGNING_H */
 
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 8dd51aa..6b99e08 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -866,7 +866,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
 		int percent = (current * 100) / numtargs;
 		const char *filename;
 		char *filepath;
-		pgp_verify_t check_sig;
+		pmverifysig_t check_sig;
 
 		PROGRESS(trans, PM_TRANS_PROGRESS_INTEGRITY_START, "", percent,
 				numtargs, current);
@@ -877,7 +877,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
 		filename = alpm_pkg_get_filename(spkg);
 		filepath = _alpm_filecache_find(filename);
 		pmdb_t *sdb = alpm_pkg_get_db(spkg);
-		check_sig = _alpm_db_get_sigverify_level(sdb);
+		check_sig = _alpm_db_get_verifysig(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 */
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 370ec51..a872d3f 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -214,17 +214,17 @@ int config_set_arch(const char *arch)
 	}
 }
 
-static pgp_verify_t option_verifysig(const char *value)
+static pmverifysig_t option_verifysig(const char *value)
 {
-	pgp_verify_t level;
+	pmverifysig_t level;
 	if(strcmp(value, "Always") == 0) {
-		level = PM_PGP_VERIFY_ALWAYS;
+		level = PM_VERIFYSIG_ALWAYS;
 	} else if(strcmp(value, "Optional") == 0) {
-		level = PM_PGP_VERIFY_OPTIONAL;
+		level = PM_VERIFYSIG_OPTIONAL;
 	} else if(strcmp(value, "Never") == 0) {
-		level = PM_PGP_VERIFY_NEVER;
+		level = PM_VERIFYSIG_NEVER;
 	} else {
-		level = PM_PGP_VERIFY_UNKNOWN;
+		level = PM_VERIFYSIG_UNKNOWN;
 	}
 	pm_printf(PM_LOG_DEBUG, "config: VerifySig = %s (%d)\n", value, level);
 	return level;
@@ -359,9 +359,9 @@ static int _parse_options(const char *key, char *value,
 		} else if(strcmp(key, "CleanMethod") == 0) {
 			setrepeatingoption(value, "CleanMethod", option_add_cleanmethod);
 		} else if(strcmp(key, "VerifySig") == 0) {
-			pgp_verify_t level = option_verifysig(value);
-			if(level != PM_PGP_VERIFY_UNKNOWN) {
-				alpm_option_set_default_sigverify(level);
+			pmverifysig_t level = option_verifysig(value);
+			if(level != PM_VERIFYSIG_UNKNOWN) {
+				alpm_option_set_default_verifysig(level);
 			} else {
 				pm_printf(PM_LOG_ERROR,
 						_("config file %s, line %d: directive '%s' has invalid value '%s'\n"),
@@ -634,9 +634,9 @@ static int _parseconfig(const char *file, int parse_options,
 					goto cleanup;
 				}
 			} else if(strcmp(key, "VerifySig") == 0) {
-				pgp_verify_t level = option_verifysig(value);
-				if(level != PM_PGP_VERIFY_UNKNOWN) {
-					ret = alpm_db_set_pgp_verify(db, level);
+				pmverifysig_t level = option_verifysig(value);
+				if(level != PM_VERIFYSIG_UNKNOWN) {
+					ret = alpm_db_set_verifysig(db, level);
 					if(ret != 0) {
 						pm_printf(PM_LOG_ERROR, _("could not add set verify option for database '%s': %s (%s)\n"),
 								alpm_db_get_name(db), value, alpm_strerrorlast());
diff --git a/src/pacman/query.c b/src/pacman/query.c
index d1105b4..87f06c4 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -551,7 +551,7 @@ int pacman_query(alpm_list_t *targets)
 		char *strname = alpm_list_getdata(i);
 
 		if(config->op_q_isfile) {
-			alpm_pkg_load(strname, 1, PM_PGP_VERIFY_OPTIONAL, &pkg);
+			alpm_pkg_load(strname, 1, PM_VERIFYSIG_OPTIONAL, &pkg);
 		} else {
 			pkg = alpm_db_get_pkg(db_local, strname);
 		}
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 884504f..8e2c236 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -219,7 +219,7 @@ static int sync_cleancache(int level)
 			/* attempt to load the package, prompt removal on failures as we may have
 			 * files here that aren't valid packages. we also don't need a full
 			 * load of the package, just the metadata. */
-			if(alpm_pkg_load(path, 0, PM_PGP_VERIFY_NEVER, &localpkg) != 0
+			if(alpm_pkg_load(path, 0, PM_VERIFYSIG_NEVER, &localpkg) != 0
 					|| localpkg == NULL) {
 				if(yesno(_("File %s does not seem to be a valid package, remove it?"),
 							path)) {
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 0ffc94c..7a955e2 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -42,7 +42,7 @@
 int pacman_upgrade(alpm_list_t *targets)
 {
 	alpm_list_t *i, *data = NULL;
-	pgp_verify_t check_sig = alpm_option_get_default_sigverify();
+	pmverifysig_t check_sig = alpm_option_get_default_verifysig();
 	int retval = 0;
 
 	if(targets == NULL) {
diff --git a/src/util/testpkg.c b/src/util/testpkg.c
index ad6ec30..4568262 100644
--- a/src/util/testpkg.c
+++ b/src/util/testpkg.c
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
 	/* let us get log messages from libalpm */
 	alpm_option_set_logcb(output_cb);
 
-	if(alpm_pkg_load(argv[1], 1, PM_PGP_VERIFY_OPTIONAL, &pkg) == -1
+	if(alpm_pkg_load(argv[1], 1, PM_VERIFYSIG_OPTIONAL, &pkg) == -1
 			|| pkg == NULL) {
 		switch(pm_errno) {
 			case PM_ERR_PKG_OPEN:
-- 
1.7.5.2



More information about the pacman-dev mailing list