diff options
author | ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2008-12-28 02:53:44 (EST) |
---|---|---|
committer | ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2008-12-28 02:53:44 (EST) |
commit | fb70577757cf49404fc6e837bd94d4f7d1f81f61 (patch) | |
tree | 3b5a9d6380b0cb4d3f5fe9de0791cc004001f875 /libopkg/opkg.c | |
parent | 2c6f8eda7145ce3e8645567aa930b16853770f94 (diff) |
adding check_signature config
default if off
you can turn that on via adding one line in /etc/opkg/opkg.conf file
+ option check_signature 1
git-svn-id: http://opkg.googlecode.com/svn/trunk@193 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/opkg.c')
-rw-r--r-- | libopkg/opkg.c | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/libopkg/opkg.c b/libopkg/opkg.c index d69721b..11b5ee7 100644 --- a/libopkg/opkg.c +++ b/libopkg/opkg.c @@ -850,42 +850,44 @@ opkg_update_package_lists (opkg_t *opkg, opkg_progress_callback_t progress_callb free (url); #ifdef HAVE_GPGME - char *sig_file_name; - /* download detached signitures to verify the package lists */ - /* get the url for the sig file */ - if (src->extra_data) /* debian style? */ - sprintf_alloc (&url, "%s/%s/%s", src->value, src->extra_data, - "Packages.sig"); - else - sprintf_alloc (&url, "%s/%s", src->value, "Packages.sig"); + if ( opkg->conf->check_signature ) { + char *sig_file_name; + /* download detached signitures to verify the package lists */ + /* get the url for the sig file */ + if (src->extra_data) /* debian style? */ + sprintf_alloc (&url, "%s/%s/%s", src->value, src->extra_data, + "Packages.sig"); + else + sprintf_alloc (&url, "%s/%s", src->value, "Packages.sig"); - /* create filename for signature */ - sprintf_alloc (&sig_file_name, "%s/%s.sig", lists_dir, src->name); + /* create filename for signature */ + sprintf_alloc (&sig_file_name, "%s/%s.sig", lists_dir, src->name); - /* make sure there is no existing signature file */ - unlink (sig_file_name); + /* make sure there is no existing signature file */ + unlink (sig_file_name); - err = opkg_download (opkg->conf, url, sig_file_name, NULL, NULL); - if (err) - { - /* XXX: Warning: Download failed */ - } - else - { - int err; - err = opkg_verify_file (opkg->conf, list_file_name, sig_file_name); - if (err == 0) - { - /* XXX: Notice: Signature check passed */ - } - else - { - /* XXX: Warning: Signature check failed */ - } + err = opkg_download (opkg->conf, url, sig_file_name, NULL, NULL); + if (err) + { + /* XXX: Warning: Download failed */ + } + else + { + int err; + err = opkg_verify_file (opkg->conf, list_file_name, sig_file_name); + if (err == 0) + { + /* XXX: Notice: Signature check passed */ + } + else + { + /* XXX: Warning: Signature check failed */ + } + } + free (sig_file_name); + free (list_file_name); + free (url); } - free (sig_file_name); - free (list_file_name); - free (url); #else /* XXX: Note: Signature check for %s skipped because GPG support was not * enabled in this build |