summaryrefslogtreecommitdiff
path: root/rpmio/url.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2004-11-28 21:14:41 +0000
committerjbj <devnull@localhost>2004-11-28 21:14:41 +0000
commitf5203aea8bd83dc18e48dda4a564429c0e48bab4 (patch)
tree4bce5bf39fdfcf1014141d30989e3272a92b4ea0 /rpmio/url.c
parent88ace07349542e10a3834814372807e2eca30f42 (diff)
downloadlibrpm-tizen-f5203aea8bd83dc18e48dda4a564429c0e48bab4.tar.gz
librpm-tizen-f5203aea8bd83dc18e48dda4a564429c0e48bab4.tar.bz2
librpm-tizen-f5203aea8bd83dc18e48dda4a564429c0e48bab4.zip
- add support for automagic pubkey retrieval using HKP.
CVS patchset: 7617 CVS date: 2004/11/28 21:14:41
Diffstat (limited to 'rpmio/url.c')
-rw-r--r--rpmio/url.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/rpmio/url.c b/rpmio/url.c
index 1f63b4ceb..fe446e73b 100644
--- a/rpmio/url.c
+++ b/rpmio/url.c
@@ -24,6 +24,9 @@
#ifndef IPPORT_HTTPS
#define IPPORT_HTTPS 443
#endif
+#ifndef IPPORT_PGPKEYSERVER
+#define IPPORT_PGPKEYSERVER 11371
+#endif
/**
*/
@@ -280,7 +283,8 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
if (u->proxyh == NULL) {
const char *proxy = rpmExpand("%{_ftpproxy}", NULL);
if (proxy && *proxy != '%') {
- /*@observer@*/ const char * host = (u->host ? u->host : "");
+/*@observer@*/
+ const char * host = (u->host ? u->host : "");
const char *uu = (u->user ? u->user : "anonymous");
char *nu = xmalloc(strlen(uu) + sizeof("@") + strlen(host));
(void) stpcpy( stpcpy( stpcpy(nu, uu), "@"), host);
@@ -293,7 +297,7 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
if (u->proxyp < 0) {
const char *proxy = rpmExpand("%{_ftpport}", NULL);
if (proxy && *proxy != '%') {
- char *end;
+ char *end = NULL;
int port = strtol(proxy, &end, 0);
if (!(end && *end == '\0')) {
fprintf(stderr, _("error: %sport must be a number\n"),
@@ -307,7 +311,7 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
}
/* Perform one-time HTTP initialization */
- if (u->urltype == URL_IS_HTTP || u->urltype == URL_IS_HTTPS) {
+ if (u->urltype == URL_IS_HTTP || u->urltype == URL_IS_HTTPS || u->urltype == URL_IS_HKP) {
if (u->proxyh == NULL) {
const char *proxy = rpmExpand("%{_httpproxy}", NULL);
@@ -348,6 +352,7 @@ static struct urlstring {
} urlstrings[] = {
{ "file://", URL_IS_PATH },
{ "ftp://", URL_IS_FTP },
+ { "hkp://", URL_IS_HKP },
{ "http://", URL_IS_HTTP },
{ "https://", URL_IS_HTTPS },
{ "-", URL_IS_DASH },
@@ -392,6 +397,11 @@ urltype urlPath(const char * url, const char ** pathp)
path = strchr(url, '/');
if (path == NULL) path = url + strlen(url);
break;
+ case URL_IS_HKP:
+ url += sizeof("hkp://") - 1;
+ path = strchr(url, '/');
+ if (path == NULL) path = url + strlen(url);
+ break;
case URL_IS_HTTP:
url += sizeof("http://") - 1;
path = strchr(url, '/');
@@ -498,13 +508,16 @@ int urlSplit(const char * url, urlinfo *uret)
if (u->port < 0 && u->scheme != NULL) {
struct servent *serv;
- /*@-multithreaded -moduncon @*/
+/*@-multithreaded -moduncon @*/
+ /* HACK hkp:// might lookup "pgpkeyserver" */
serv = getservbyname(u->scheme, "tcp");
- /*@=multithreaded =moduncon @*/
+/*@=multithreaded =moduncon @*/
if (serv != NULL)
u->port = ntohs(serv->s_port);
else if (u->urltype == URL_IS_FTP)
u->port = IPPORT_FTP;
+ else if (u->urltype == URL_IS_HKP)
+ u->port = IPPORT_PGPKEYSERVER;
else if (u->urltype == URL_IS_HTTP)
u->port = IPPORT_HTTP;
else if (u->urltype == URL_IS_HTTPS)
@@ -564,6 +577,7 @@ fprintf(stderr, "*** urlGetFile sfd %p %s tfd %p %s\n", sfd, url, (tfd ? tfd : N
switch (urlType) {
case URL_IS_HTTPS:
case URL_IS_HTTP:
+ case URL_IS_HKP:
case URL_IS_FTP:
case URL_IS_PATH:
case URL_IS_DASH: