xbps-repo: sanitize uri provided to the add target also for remote
repositories. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091027142504-ezcqy2z7fuxz9j1z
This commit is contained in:
parent
dc258f4e20
commit
4b99264063
@ -143,13 +143,18 @@ add_repository(const char *uri, bool remote)
|
|||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
if (remote) {
|
if (remote) {
|
||||||
rv = xbps_sync_repository_pkg_index(uri);
|
if (!sanitize_localpath(idxstr, uri))
|
||||||
|
return errno;
|
||||||
|
|
||||||
|
rv = xbps_sync_repository_pkg_index(idxstr);
|
||||||
if (rv != 0)
|
if (rv != 0)
|
||||||
return rv;
|
return rv;
|
||||||
plist = xbps_get_pkg_index_plist(uri);
|
|
||||||
|
plist = xbps_get_pkg_index_plist(idxstr);
|
||||||
} else {
|
} else {
|
||||||
if (!sanitize_localpath(idxstr, uri))
|
if (!sanitize_localpath(idxstr, uri))
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
plist = xbps_get_pkg_index_plist(idxstr);
|
plist = xbps_get_pkg_index_plist(idxstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,19 +181,14 @@ add_repository(const char *uri, bool remote)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remote)
|
if ((rv = xbps_register_repository(idxstr)) != 0) {
|
||||||
rv = xbps_register_repository(uri);
|
|
||||||
else
|
|
||||||
rv = xbps_register_repository(idxstr);
|
|
||||||
|
|
||||||
if (rv != 0) {
|
|
||||||
printf("ERROR: couldn't register repository (%s)\n",
|
printf("ERROR: couldn't register repository (%s)\n",
|
||||||
strerror(rv));
|
strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Added repository at %s (%s) with %ju packages.\n",
|
printf("Added repository at %s (%s) with %ju packages.\n",
|
||||||
uri, rinfo->index_version, rinfo->total_pkgs);
|
idxstr, rinfo->index_version, rinfo->total_pkgs);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (dict != NULL)
|
if (dict != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user