summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/signing.c
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-05-11 20:28:22 +0200
committerFlorian Pritz <bluewind@xinu.at>2017-05-11 20:28:22 +0200
commit599d91629e8d8df8fe63dd81d8a492ab293adac2 (patch)
tree061c215c583f9e6cf1b5f9c3123557a32943aee0 /lib/libalpm/signing.c
parent799238d0416549dd0d59b4efde30fe518d67e0d0 (diff)
downloadpacman-599d91629e8d8df8fe63dd81d8a492ab293adac2.tar.gz
pacman-599d91629e8d8df8fe63dd81d8a492ab293adac2.tar.xz
wip
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/libalpm/signing.c')
-rw-r--r--lib/libalpm/signing.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index b7587d1c..cf93fa2b 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -543,11 +543,30 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
memset(&sigdata, 0, sizeof(sigdata));
memset(&filedata, 0, sizeof(filedata));
+ char* filecontent;
+ struct stat statbuf;
+
+ // TODO check return code
+ stat(path, &statbuf);
+
+ size_t filesize = statbuf.st_size;
+
+ filecontent = malloc(filesize);
+ if (filecontent == NULL) {
+ printf("Failed to allocate memory\n");
+ goto error;
+ }
+
+ if (fread(filecontent, filesize, 1, file) != 1) {
+ // TODO error handling
+ }
+
gpg_err = gpgme_new(&ctx);
CHECK_ERR();
/* create our necessary data objects to verify the signature */
- gpg_err = gpgme_data_new_from_stream(&filedata, file);
+ //gpg_err = gpgme_data_new_from_stream(&filedata, file);
+ gpg_err = gpgme_data_new_from_mem(&filedata, filecontent, filesize, 1);
CHECK_ERR();
/* next create data object for the signature */