aboutsummaryrefslogtreecommitdiffstats
path: root/src/package.c
diff options
context:
space:
mode:
authorLuiz Ramos2012-07-22 22:05:16 -0300
committerJason Woodward2012-08-02 13:47:13 +0000
commitea329d741a16e11515e9936ca5adcea4a57028da (patch)
treede7bee4362254cf86e001fdd18583af450d567eb /src/package.c
parentcab5cd008c766df8c3708745416491eb4888b749 (diff)
downloadslapt-get-ea329d741a16e11515e9936ca5adcea4a57028da.tar.gz
included option --allow-unauthenticated
This option permits installation of repositories whose signatures were not verified for some "acceptable" reason
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/package.c b/src/package.c
index e5d58cc..919c1e9 100644
--- a/src/package.c
+++ b/src/package.c
@@ -48,6 +48,11 @@ static slapt_pkg_info_t *find_or_requirement(slapt_pkg_list_t *avail_pkgs,
/* uncompress compressed package data */
static FILE *slapt_gunzip_file (const char *file_name,FILE *dest_file);
+#ifdef SLAPT_HAS_GPGME
+/* check if signature is unauthenticated by "acceptable" reasons */
+SLAPT_BOOL_T slapt_pkg_sign_is_unauthenticated(slapt_code_t code);
+#endif
+
/* parse the PACKAGES.TXT file */
slapt_pkg_list_t *slapt_get_available_pkgs(void)
{
@@ -2022,6 +2027,8 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
printf("%s\n",gettext("Verified"));
} else if (verified == SLAPT_CHECKSUMS_MISSING_KEY) {
printf("%s\n",gettext("No key for verification"));
+ } else if ((global_config->gpgme_allow_unauth == SLAPT_TRUE) && (slapt_pkg_sign_is_unauthenticated(verified) == SLAPT_TRUE)) {
+ printf("%s%s\n", slapt_strerror(verified), gettext(", but accepted as an exception"));
} else {
printf("%s\n",gettext(slapt_strerror(verified)));
source_dl_failed = 1;
@@ -2139,6 +2146,26 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
return source_dl_failed;
}
+#ifdef SLAPT_HAS_GPGME
+SLAPT_BOOL_T slapt_pkg_sign_is_unauthenticated(slapt_code_t code)
+{
+ switch (code)
+ {
+ case SLAPT_CHECKSUMS_NOT_VERIFIED_GPGME_KEY_REVOKED:
+ case SLAPT_CHECKSUMS_NOT_VERIFIED_GPGME_KEY_EXPIRED:
+ case SLAPT_CHECKSUMS_NOT_VERIFIED_GPGME_SIG_EXPIRED:
+ case SLAPT_CHECKSUMS_NOT_VERIFIED_GPGME_CRL_MISSING:
+ case SLAPT_CHECKSUMS_NOT_VERIFIED_GPGME_CRL_TOO_OLD:
+ case SLAPT_CHECKSUMS_NOT_VERIFIED_GPGME_BAD_POLICY:
+ return SLAPT_TRUE;
+ default:
+ break;
+ }
+
+ return SLAPT_FALSE;
+}
+#endif
+
slapt_pkg_list_t *slapt_init_pkg_list(void)
{
slapt_pkg_list_t *list = NULL;