]> git.ipfire.org Git - pakfire.git/commitdiff
repos: Be more tolerant when keys are being used twice
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 1 Nov 2022 13:07:25 +0000 (13:07 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 1 Nov 2022 13:07:25 +0000 (13:07 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/repo.c

index 53f0c9999c63d51930ad68693b2caa5e5483f872..c5276f845f4b0e531d74ecedfb6a86fa2b9d1111 100644 (file)
@@ -127,7 +127,6 @@ static int pakfire_repo_retrieve(
 
 static int pakfire_repo_import_key(struct pakfire_repo* repo, FILE* f) {
        struct pakfire_key** keys = NULL;
-       size_t counter = 0;
        int r;
 
        // Import any keys from the file descriptor
@@ -135,16 +134,11 @@ static int pakfire_repo_import_key(struct pakfire_repo* repo, FILE* f) {
        if (r)
                return r;
 
-       // Count how many keys were imported
-       for (struct pakfire_key** key = keys; *key; key++)
-               counter++;
-
-       // We should only import one key
-       if (counter != 1) {
-               ERROR(repo->pakfire, "Imported %zu key(s) but expected one\n", counter);
-               r = 1;
-               goto ERROR;
-       }
+       /*
+               XXX It can happen, that more than one repository are using the same
+               key which can only be imported once. The second time, the key won't
+               be returned which lets us end up with that repository having no key.
+       */
 
        for (struct pakfire_key** key = keys; *key; key++) {
                char* dump = pakfire_key_dump(*key);