@@ -86,6 +86,7 @@ unpack_archive(struct xbps_handle *xhp,
8686 const char * fname ,
8787 struct archive * ar )
8888{
89+ const struct xbps_file * file ;
8990 xbps_dictionary_t binpkg_filesd , pkg_filesd , obsd ;
9091 xbps_array_t array , obsoletes ;
9192 xbps_trans_type_t ttype ;
@@ -132,19 +133,19 @@ unpack_archive(struct xbps_handle *xhp,
132133 xbps_dictionary_get_dict (xhp -> transd , "obsolete_files" , & obsd ) &&
133134 (obsoletes = xbps_dictionary_get (obsd , pkgname ))) {
134135 for (unsigned int i = 0 ; i < xbps_array_count (obsoletes ); i ++ ) {
135- const char * file = NULL ;
136- xbps_array_get_cstring_nocopy (obsoletes , i , & file );
137- if (remove (file ) == -1 ) {
136+ const char * path = NULL ;
137+ xbps_array_get_cstring_nocopy (obsoletes , i , & path );
138+ if (remove (path ) == -1 ) {
138139 xbps_set_cb_state (xhp ,
139140 XBPS_STATE_REMOVE_FILE_OBSOLETE_FAIL ,
140141 errno , pkgver ,
141142 "%s: failed to remove obsolete entry `%s': %s" ,
142- pkgver , file , strerror (errno ));
143+ pkgver , path , strerror (errno ));
143144 continue ;
144145 }
145146 xbps_set_cb_state (xhp ,
146147 XBPS_STATE_REMOVE_FILE_OBSOLETE ,
147- 0 , pkgver , "%s: removed obsolete entry: %s" , pkgver , file );
148+ 0 , pkgver , "%s: removed obsolete entry: %s" , pkgver , path );
148149 }
149150 }
150151
@@ -291,6 +292,14 @@ unpack_archive(struct xbps_handle *xhp,
291292 continue ;
292293 }
293294
295+ file = xbps_transaction_file_get (xhp , entry_pname + 1 );
296+ if (!file ) {
297+ xbps_error_printf ("unknown file in binary package: %s: %s\n" ,
298+ pkgver , entry_pname + 1 );
299+ rv = EINVAL ;
300+ goto out ;
301+ }
302+
294303 /*
295304 * Check if current entry is a configuration file,
296305 * that should be kept.
@@ -336,8 +345,13 @@ unpack_archive(struct xbps_handle *xhp,
336345 }
337346 rv = 0 ;
338347 } else {
339- rv = xbps_file_hash_check_dictionary (
340- xhp , binpkg_filesd , "files" , buf );
348+ if (!file -> sha256 ) {
349+ xbps_error_printf ("missing checksum in binary package"
350+ ": %s: %s\n" , pkgver , entry_pname + 1 );
351+ rv = EINVAL ;
352+ goto out ;
353+ }
354+ rv = xbps_file_sha256_check (entry_pname , file -> sha256 );
341355 if (rv == -1 ) {
342356 /* error */
343357 xbps_dbg_printf (
0 commit comments