Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-04-21 19:25:44 -0500
committerDan McGee <dan@archlinux.org>2011-04-24 10:48:33 -0500
commit225acbbff176e52a88eb6b8030d331a599a7ef06 (patch)
treed6785a982dbdf022c7bd54d0993e385267e20cfd /lib/libalpm/package.c
parent31e55b8049ed001a993441f3efc8ffebdf360061 (diff)
Rein in the complexity of the signature type
Given that we offer no transparency into the pmpgpsig_t type, we don't really need to expose it outside of the library, and at this point, we don't need it at all. Don't decode anything except when checking signatures. For packages/files not from a sync database, we now just read the signature file directly anyway. Also push the decoding logic down further into the check method so we don't need this hanging out in a less than ideal place. This will make it easier to conditionally compile things down the road. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 8c927c11..393dae00 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -36,7 +36,6 @@
#include "delta.h"
#include "handle.h"
#include "deps.h"
-#include "base64.h"
/** \addtogroup alpm_packages Package Functions
* @brief Functions to manipulate libalpm packages
@@ -197,43 +196,6 @@ const char SYMEXPORT *alpm_pkg_get_md5sum(pmpkg_t *pkg)
return pkg->ops->get_md5sum(pkg);
}
-static int decode_pgpsig(pmpkg_t *pkg) {
- const int len = strlen(pkg->pgpsig.base64_data);
- const unsigned char *usline = (const unsigned char *)pkg->pgpsig.base64_data;
- int ret, destlen = 0;
- /* get the necessary size for the buffer by passing 0 */
- ret = base64_decode(NULL, &destlen, usline, len);
- /* alloc our memory and repeat the call to decode */
- MALLOC(pkg->pgpsig.data, (size_t)destlen, goto error);
- ret = base64_decode(pkg->pgpsig.data, &destlen, usline, len);
- pkg->pgpsig.len = destlen;
- if(ret != 0) {
- goto error;
- }
-
- /* we no longer have a need for this */
- FREE(pkg->pgpsig.base64_data);
- return 0;
-
-error:
- FREE(pkg->pgpsig.data);
- pkg->pgpsig.len = 0;
- return 1;
-}
-
-const pmpgpsig_t SYMEXPORT *alpm_pkg_get_pgpsig(pmpkg_t *pkg)
-{
- ALPM_LOG_FUNC;
-
- /* Sanity checks */
- ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, NULL));
-
- if(pkg->pgpsig.data == NULL && pkg->pgpsig.base64_data != NULL) {
- decode_pgpsig(pkg);
- }
- return &(pkg->pgpsig);
-}
-
const char SYMEXPORT *alpm_pkg_get_arch(pmpkg_t *pkg)
{
return pkg->ops->get_arch(pkg);
@@ -468,8 +430,7 @@ void _alpm_pkg_free(pmpkg_t *pkg)
FREE(pkg->url);
FREE(pkg->packager);
FREE(pkg->md5sum);
- FREE(pkg->pgpsig.base64_data);
- FREE(pkg->pgpsig.data);
+ FREE(pkg->base64_sig);
FREE(pkg->arch);
FREELIST(pkg->licenses);
FREELIST(pkg->replaces);