From 4b9926406370038b08ffcf4edfe05d7f0b9bf440 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 27 Oct 2009 15:25:04 +0100 Subject: [PATCH] xbps-repo: sanitize uri provided to the add target also for remote repositories. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091027142504-ezcqy2z7fuxz9j1z --- bin/xbps-repo/main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/xbps-repo/main.c b/bin/xbps-repo/main.c index 80dffe5e..01b26e22 100644 --- a/bin/xbps-repo/main.c +++ b/bin/xbps-repo/main.c @@ -143,13 +143,18 @@ add_repository(const char *uri, bool remote) int rv = 0; 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) return rv; - plist = xbps_get_pkg_index_plist(uri); + + plist = xbps_get_pkg_index_plist(idxstr); } else { if (!sanitize_localpath(idxstr, uri)) return errno; + plist = xbps_get_pkg_index_plist(idxstr); } @@ -176,19 +181,14 @@ add_repository(const char *uri, bool remote) goto out; } - if (remote) - rv = xbps_register_repository(uri); - else - rv = xbps_register_repository(idxstr); - - if (rv != 0) { + if ((rv = xbps_register_repository(idxstr)) != 0) { printf("ERROR: couldn't register repository (%s)\n", strerror(rv)); goto out; } 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: if (dict != NULL)