Make sure that downloaded pkg-index.plist is really a plist file.

This commit is contained in:
Juan RP
2011-10-28 09:29:37 +02:00
parent 8bc705ea63
commit dbd5e05280
2 changed files with 19 additions and 0 deletions

View File

@@ -89,6 +89,7 @@ xbps_get_remote_repo_string(const char *uri)
int
xbps_repository_sync_pkg_index(const char *uri)
{
prop_dictionary_t tmpd;
struct xbps_handle *xhp;
struct url *url = NULL;
struct utsname un;
@@ -198,6 +199,20 @@ xbps_repository_sync_pkg_index(const char *uri)
}
if (only_sync)
goto out;
/*
* Make sure that downloaded plist file can be internalized, i.e
* some HTTP servers don't return proper errors and sometimes
* you get an HTML ASCII file :-)
*/
tmpd = prop_dictionary_internalize_from_zfile(tmp_metafile);
if (tmpd == NULL) {
xbps_error_printf("[rsyncidx] downloaded pkg-index.plist "
"file cannot be read! removing...\n");
(void)unlink(tmp_metafile);
rv = -1;
goto out;
}
prop_object_release(tmpd);
lrepofile = xbps_xasprintf("%s/%s", lrepodir, XBPS_PKGINDEX);
if (lrepofile == NULL) {