From 578035075108a90d20f084f077badf05d1c8527c Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 4 Jul 2015 18:39:42 +0200 Subject: libalpm: Force update when database is marked as corrupted. When a database and its signature is updated non-atomically on a server, there is a window where a user may update the database but grab the old signature. The database is marked as invalid by libalpm, which can be fixed by forcing a refresh (assuming the server has caught up and the user realizes what has happened) or with a future update of the repo. Work around this by forcing a repository refresh whenever a database is invalid. Signed-off-by: Sebastian Lackner Signed-off-by: Allan McRae --- lib/libalpm/be_sync.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/libalpm/be_sync.c') diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index 621321d1..25c8cbec 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -198,6 +198,11 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) return -1; } + /* force update of invalid databases to fix potential mismatched database/signature */ + if(db->status & DB_STATUS_INVALID) { + force = 1; + } + /* make sure we have a sane umask */ oldmask = umask(0022); -- cgit v1.2.3-24-g4f1b