- (djm) Teach fake-getaddrinfo to use getservbyname() when provided a
string service name. Suggested by markus@, review by itojun@
This commit is contained in:
parent
4b0f1ad4db
commit
850b942037
|
@ -1,3 +1,7 @@
|
||||||
|
20030206
|
||||||
|
- (djm) Teach fake-getaddrinfo to use getservbyname() when provided a
|
||||||
|
string service name. Suggested by markus@, review by itojun@
|
||||||
|
|
||||||
20030131
|
20030131
|
||||||
- (bal) AIX 4.2.1 lacks nanosleep(). Patch to use nsleep() provided by
|
- (bal) AIX 4.2.1 lacks nanosleep(). Patch to use nsleep() provided by
|
||||||
dtucker@zip.com.au
|
dtucker@zip.com.au
|
||||||
|
@ -1090,4 +1094,4 @@
|
||||||
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
||||||
ok provos@
|
ok provos@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.2591 2003/02/01 04:43:34 mouring Exp $
|
$Id: ChangeLog,v 1.2592 2003/02/05 23:51:06 djm Exp $
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
|
|
||||||
RCSID("$Id: fake-getaddrinfo.c,v 1.2 2001/02/09 01:55:36 djm Exp $");
|
RCSID("$Id: fake-getaddrinfo.c,v 1.3 2003/02/05 23:50:42 djm Exp $");
|
||||||
|
|
||||||
#ifndef HAVE_GAI_STRERROR
|
#ifndef HAVE_GAI_STRERROR
|
||||||
char *gai_strerror(int ecode)
|
const char *gai_strerror(int ecode)
|
||||||
{
|
{
|
||||||
switch (ecode) {
|
switch (ecode) {
|
||||||
case EAI_NODATA:
|
case EAI_NODATA:
|
||||||
|
@ -67,13 +67,23 @@ int getaddrinfo(const char *hostname, const char *servname,
|
||||||
{
|
{
|
||||||
struct addrinfo *cur, *prev = NULL;
|
struct addrinfo *cur, *prev = NULL;
|
||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
|
struct servent *sp;
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
int i, port;
|
int i;
|
||||||
|
long int port;
|
||||||
|
|
||||||
if (servname)
|
port = 0;
|
||||||
port = htons(atoi(servname));
|
if (servname != NULL) {
|
||||||
else
|
char *cp;
|
||||||
port = 0;
|
|
||||||
|
port = strtol(servname, &cp, 10);
|
||||||
|
if (port > 0 && port <= 65535 && *cp == '\0')
|
||||||
|
port = htons(port);
|
||||||
|
else if ((sp = getservbyname(servname, NULL)) != NULL)
|
||||||
|
port = sp->s_port;
|
||||||
|
else
|
||||||
|
port = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (hints && hints->ai_flags & AI_PASSIVE) {
|
if (hints && hints->ai_flags & AI_PASSIVE) {
|
||||||
if (NULL != (*res = malloc_ai(port, htonl(0x00000000))))
|
if (NULL != (*res = malloc_ai(port, htonl(0x00000000))))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: fake-getaddrinfo.h,v 1.2 2001/02/09 01:55:36 djm Exp $ */
|
/* $Id: fake-getaddrinfo.h,v 1.3 2003/02/05 23:50:43 djm Exp $ */
|
||||||
|
|
||||||
#ifndef _FAKE_GETADDRINFO_H
|
#ifndef _FAKE_GETADDRINFO_H
|
||||||
#define _FAKE_GETADDRINFO_H
|
#define _FAKE_GETADDRINFO_H
|
||||||
|
@ -37,7 +37,7 @@ int getaddrinfo(const char *hostname, const char *servname,
|
||||||
#endif /* !HAVE_GETADDRINFO */
|
#endif /* !HAVE_GETADDRINFO */
|
||||||
|
|
||||||
#ifndef HAVE_GAI_STRERROR
|
#ifndef HAVE_GAI_STRERROR
|
||||||
char *gai_strerror(int ecode);
|
const char *gai_strerror(int ecode);
|
||||||
#endif /* !HAVE_GAI_STRERROR */
|
#endif /* !HAVE_GAI_STRERROR */
|
||||||
|
|
||||||
#ifndef HAVE_FREEADDRINFO
|
#ifndef HAVE_FREEADDRINFO
|
||||||
|
|
Loading…
Reference in New Issue