Check that digest type is actually supported before enabling it
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 2 Jun 2008 09:20:22 +0000 (12:20 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 2 Jun 2008 09:20:22 +0000 (12:20 +0300)
- we don't necessarily support all types listed in pgpHashAlgo_e, it
  depends on what NSS happens to support

lib/rpmfi.c

index 8c08e64..8461136 100644 (file)
@@ -1282,7 +1282,7 @@ if (fi->actions == NULL)
     if (headerGet(h, RPMTAG_FILEDIGESTALGO, &digalgo, HEADERGET_MINMEM)) {
        pgpHashAlgo *algo = rpmtdGetUint32(&digalgo);
        /* Hmm, what to do with unknown digest algorithms? */
-       if (algo && *algo >= PGPHASHALGO_MD5 && *algo <= PGPHASHALGO_SHA512) {
+       if (algo && rpmDigestLength(*algo) != 0) {
            fi->digestalgo = *algo;
        }
     }