[pacman-dev] [PATCH 3/4] pacman: add a configuration key for signature checking command

Rémy Oudompheng remyoudompheng at gmail.com
Sun Apr 10 07:39:25 EDT 2011


Signed-off-by: Rémy Oudompheng <remy at archlinux.org>
---
 etc/pacman.conf.in    |    1 +
 src/pacman/callback.c |    5 +++++
 src/pacman/callback.h |    3 +++
 src/pacman/conf.h     |    1 +
 src/pacman/pacman.c   |    4 ++++
 5 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/etc/pacman.conf.in b/etc/pacman.conf.in
index 1105db9..3b92351 100644
--- a/etc/pacman.conf.in
+++ b/etc/pacman.conf.in
@@ -18,6 +18,7 @@ HoldPkg     = pacman glibc
 SyncFirst   = pacman
 #XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
 #XferCommand = /usr/bin/curl -C - -f %u > %o
+#ChecksigCommand = /usr/bin/gpg --verify - %f
 #CleanMethod = KeepInstalled
 Architecture = auto
 
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 08c1cf3..1ff9a47 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -687,4 +687,9 @@ void cb_log(pmloglevel_t level, const char *fmt, va_list args)
 	}
 }
 
+/* Callback to check signatures with an external command */
+int cb_checksig(const char *path, const pmpgpsig_t *sig) {
+	return 0;
+}
+
 /* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/callback.h b/src/pacman/callback.h
index 1109a3b..3e2cfb1 100644
--- a/src/pacman/callback.h
+++ b/src/pacman/callback.h
@@ -43,6 +43,9 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total);
 /* callback to handle messages/notifications from pacman library */
 void cb_log(pmloglevel_t level, const char *fmt, va_list args);
 
+/* callback to check signatures with an external command */
+int cb_checksig(const char *path, const pmpgpsig_t *sig);
+
 #endif /* _PM_CALLBACK_H */
 
 /* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index bb11bab..9aa8492 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -78,6 +78,7 @@ typedef struct __config_t {
 	alpm_list_t *holdpkg;
 	alpm_list_t *syncfirst;
 	char *xfercommand;
+	char *checksigcommand;
 } config_t;
 
 /* Operations */
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 74659c5..9aad3a3 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -1052,6 +1052,10 @@ static int _parse_options(const char *key, char *value,
 			config->xfercommand = strdup(value);
 			alpm_option_set_fetchcb(download_with_xfercommand);
 			pm_printf(PM_LOG_DEBUG, "config: xfercommand: %s\n", value);
+		} else if (strcmp(key, "ChecksigCommand") == 0) {
+			config->checksigcommand = strdup(value);
+			alpm_option_set_checksigcb(cb_checksig);
+			pm_printf(PM_LOG_DEBUG, "config: checksigcommand: %s\n", value);
 		} else if (strcmp(key, "CleanMethod") == 0) {
 			setrepeatingoption(value, "CleanMethod", option_add_cleanmethod);
 		} else {
-- 
1.7.4.4



More information about the pacman-dev mailing list