diff options
author | Matt Johnston <matt@ucc.asn.au> | 2010-07-21 13:53:23 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2010-07-21 13:53:23 +0000 |
commit | aabe0677c006d3832cee8a9e9e4c1c170b4c17d3 (patch) | |
tree | 2b109090060332611432c7969c72d7ca044e0e5e /fake-rfc2553.c | |
parent | 27fddd2c355b32c5bc304a026f3ceae86433c34c (diff) |
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
--HG--
extra : convert_revision : 4b90e96a8a8afcc9feafc59cb47592a4a6d1cc30
Diffstat (limited to 'fake-rfc2553.c')
-rw-r--r-- | fake-rfc2553.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/fake-rfc2553.c b/fake-rfc2553.c index afbea88..395cfcc 100644 --- a/fake-rfc2553.c +++ b/fake-rfc2553.c @@ -1,7 +1,6 @@ +/* Taken for Dropbear from OpenSSH 5.5p1 */ + /* - * - * Taken from OpenSSH 3.8.1p1 - * * Copyright (C) 2000-2003 Damien Miller. All rights reserved. * Copyright (C) 1999 WIDE Project. All rights reserved. * @@ -40,7 +39,11 @@ #include "includes.h" -/* RCSID("$.Id: fake-rfc2553.c,v 1.5 2003/09/22 02:08:23 dtucker Exp $");*/ +#include <stdlib.h> +#include <string.h> + +#include <netinet/in.h> +#include <arpa/inet.h> #ifndef HAVE_GETNAMEINFO int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, @@ -50,6 +53,8 @@ int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, struct hostent *hp; char tmpserv[16]; + if (sa->sa_family != AF_UNSPEC && sa->sa_family != AF_INET) + return (EAI_FAMILY); if (serv != NULL) { snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin->sin_port)); if (strlcpy(serv, tmpserv, servlen) >= servlen) @@ -94,6 +99,8 @@ gai_strerror(int err) return ("memory allocation failure."); case EAI_NONAME: return ("nodename nor servname provided, or not known"); + case EAI_FAMILY: + return ("ai_family not supported"); default: return ("unknown/invalid error."); } @@ -158,6 +165,9 @@ getaddrinfo(const char *hostname, const char *servname, u_long addr; port = 0; + if (hints && hints->ai_family != AF_UNSPEC && + hints->ai_family != AF_INET) + return (EAI_FAMILY); if (servname != NULL) { char *cp; |