static void verify_package(struct pkginfo *pkg) { struct fsys_namenode_list *file; struct varbuf filename = VARBUF_INIT; ensure_packagefiles_available(pkg); parse_filehash(pkg, &pkg->installed); pkg_conffiles_mark_old(pkg); for (file = pkg->files; file; file = file->next) { struct verify_checks checks; struct fsys_namenode *fnn; char hash[MD5HASHLEN + 1]; int failures = 0; fnn = namenodetouse(file->namenode, pkg, &pkg->installed); if (strcmp(fnn->newhash, EMPTYHASHFLAG) == 0) { if (fnn->oldhash == NULL) continue; else fnn->newhash = fnn->oldhash; } varbuf_reset(&filename); varbuf_add_str(&filename, instdir); varbuf_add_str(&filename, fnn->name); varbuf_end_str(&filename); memset(&checks, 0, sizeof(checks)); md5hash(pkg, hash, filename.buf); if (strcmp(hash, fnn->newhash) != 0) { checks.md5sum = VERIFY_FAIL; failures++; } if (failures) verify_output(fnn, &checks); } varbuf_destroy(&filename); }
static void verify_package(struct pkginfo *pkg) { struct fileinlist *file; ensure_packagefiles_available(pkg); parse_filehash(pkg, &pkg->installed); pkg_conffiles_mark_old(pkg); for (file = pkg->clientdata->files; file; file = file->next) { struct verify_checks checks; struct filenamenode *fnn; char hash[MD5HASHLEN + 1]; int failures = 0; fnn = namenodetouse(file->namenode, pkg, &pkg->installed); if (strcmp(fnn->newhash, EMPTYHASHFLAG) == 0) { if (fnn->oldhash == NULL) continue; else fnn->newhash = fnn->oldhash; } memset(&checks, 0, sizeof(checks)); md5hash(pkg, hash, fnn->name); if (strcmp(hash, fnn->newhash) != 0) { checks.md5sum = VERIFY_FAIL; failures++; } if (failures) verify_output(fnn, &checks); } }