From c5e89e6e735fe7c5ab1685b4b0ed145cffbd7d87 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sat, 26 Aug 2000 11:46:16 +0000 Subject: [PATCH] (send_via_proxy): handle `http://' at the beginning of the proxy specification. use getaddrinfo correctly (krb5_sendto): always return a return code git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8996 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/send_to_kdc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c index f3d4d88a2..a0d62bddb 100644 --- a/lib/krb5/send_to_kdc.c +++ b/lib/krb5/send_to_kdc.c @@ -237,7 +237,8 @@ send_via_proxy (krb5_context context, const krb5_data *send, krb5_data *receive) { - char *proxy = strdup(context->http_proxy); + char *proxy2 = strdup(context->http_proxy); + char *proxy = proxy2; char *prefix; char *colon; struct addrinfo hints; @@ -246,6 +247,11 @@ send_via_proxy (krb5_context context, int s; char portstr[NI_MAXSERV]; + if (proxy == NULL) + return ENOMEM; + if (strncmp (proxy, "http://", 7) == 0) + proxy += 7; + colon = strchr(proxy, ':'); if(colon != NULL) *colon++ = '\0'; @@ -254,8 +260,8 @@ send_via_proxy (krb5_context context, hints.ai_socktype = SOCK_STREAM; snprintf (portstr, sizeof(portstr), "%d", ntohs(init_port (colon, htons(80)))); - ret = getaddrinfo (proxy, portstr, NULL, &ai); - free (proxy); + ret = getaddrinfo (proxy, portstr, &hints, &ai); + free (proxy2); if (ret) return krb5_eai_to_heim_errno(ret); @@ -301,7 +307,7 @@ krb5_sendto (krb5_context context, int port, krb5_data *receive) { - krb5_error_code ret; + krb5_error_code ret = 0; char **hp, *p; int fd; int i;