Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorAndrew Fyfe <andrew@neptune-one.net>2007-07-25 22:35:29 +0100
committerDan McGee <dan@archlinux.org>2007-08-16 11:30:38 -0400
commitba67fdae63122b40d8fb4abf9c1c7695999f143d (patch)
treea9dd1ef2aa84e9e60d17efb31f6c6b91af09e746 /lib/libalpm/sync.c
parentee977019e39fe33a508a60abe4a3ad7eff819b74 (diff)
Remove support for SHA1 from pacman.
There's no need for a second hashing algorithm. MD5 serves the purpose of verifying that a package file hasn't been corrupted during download. Signed-off-by: Andrew Fyfe <andrew@neptune-one.net> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 166dcee9..1a376d76 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -48,7 +48,6 @@
#include "handle.h"
#include "alpm.h"
#include "md5.h"
-#include "sha1.h"
#include "server.h"
pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data)
@@ -808,19 +807,18 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
char str[PATH_MAX];
struct stat buf;
const char *pkgname;
- char *md5sum1, *md5sum2, *sha1sum1, *sha1sum2;
+ char *md5sum1, *md5sum2;
char *ptr=NULL;
pkgname = alpm_pkg_get_filename(spkg);
md5sum1 = spkg->md5sum;
- sha1sum1 = spkg->sha1sum;
- if((md5sum1 == NULL) && (sha1sum1 == NULL)) {
+ if(md5sum1 == NULL) {
/* TODO wtf is this? malloc'd strings for error messages? */
if((ptr = calloc(512, sizeof(char))) == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
- snprintf(ptr, 512, _("can't get md5 or sha1 checksum for package %s\n"), pkgname);
+ snprintf(ptr, 512, _("can't get md5 checksum for package %s\n"), pkgname);
*data = alpm_list_add(*data, ptr);
retval = 1;
continue;
@@ -837,17 +835,16 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
}
md5sum2 = alpm_get_md5sum(str);
- sha1sum2 = alpm_get_sha1sum(str);
- if(md5sum2 == NULL && sha1sum2 == NULL) {
+ if(md5sum2 == NULL) {
if((ptr = calloc(512, sizeof(char))) == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
- snprintf(ptr, 512, _("can't get md5 or sha1 checksum for package %s\n"), pkgname);
+ snprintf(ptr, 512, _("can't get md5 checksum for package %s\n"), pkgname);
*data = alpm_list_add(*data, ptr);
retval = 1;
continue;
}
- if((strcmp(md5sum1, md5sum2) != 0) && (strcmp(sha1sum1, sha1sum2) != 0)) {
+ if(strcmp(md5sum1, md5sum2) != 0) {
int doremove=0;
if((ptr = calloc(512, sizeof(char))) == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
@@ -855,15 +852,14 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
QUESTION(trans, PM_TRANS_CONV_CORRUPTED_PKG, (char *)pkgname, NULL, NULL, &doremove);
if(doremove) {
unlink(str);
- snprintf(ptr, 512, _("archive %s was corrupted (bad MD5 or SHA1 checksum)\n"), pkgname);
+ snprintf(ptr, 512, _("archive %s was corrupted (bad MD5 checksum)\n"), pkgname);
} else {
- snprintf(ptr, 512, _("archive %s is corrupted (bad MD5 or SHA1 checksum)\n"), pkgname);
+ snprintf(ptr, 512, _("archive %s is corrupted (bad MD5 checksum)\n"), pkgname);
}
*data = alpm_list_add(*data, ptr);
retval = 1;
}
FREE(md5sum2);
- FREE(sha1sum2);
}
if(retval) {
pm_errno = PM_ERR_PKG_CORRUPTED;