Deleted Added
full compact
sm_gethost.c (182352) sm_gethost.c (223067)
1/*
1/*
2 * Copyright (c) 1999-2001, 2004 Sendmail, Inc. and its suppliers.
2 * Copyright (c) 1999-2001, 2004, 2010 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 */
10
11#include <sm/gen.h>
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 */
10
11#include <sm/gen.h>
12SM_RCSID("@(#)$Id: sm_gethost.c,v 8.27 2004/08/20 21:12:37 ca Exp $")
12SM_RCSID("@(#)$Id: sm_gethost.c,v 8.29 2010/07/27 01:09:31 ca Exp $")
13
14#include <sendmail.h>
15#if NETINET || NETINET6
16# include <arpa/inet.h>
17#endif /* NETINET || NETINET6 */
18#include "libmilter.h"
19
20/*

--- 4 unchanged lines hidden (view full) ---

25** don't properly deliver a canonical h_name field. This tries to
26** work around these problems.
27**
28** Support IPv6 as well as IPv4.
29*/
30
31#if NETINET6 && NEEDSGETIPNODE
32
13
14#include <sendmail.h>
15#if NETINET || NETINET6
16# include <arpa/inet.h>
17#endif /* NETINET || NETINET6 */
18#include "libmilter.h"
19
20/*

--- 4 unchanged lines hidden (view full) ---

25** don't properly deliver a canonical h_name field. This tries to
26** work around these problems.
27**
28** Support IPv6 as well as IPv4.
29*/
30
31#if NETINET6 && NEEDSGETIPNODE
32
33static struct hostent *getipnodebyname __P((char *, int, int, int *));
33static struct hostent *sm_getipnodebyname __P((const char *, int, int, int *));
34
35# ifndef AI_ADDRCONFIG
36# define AI_ADDRCONFIG 0 /* dummy */
37# endif /* ! AI_ADDRCONFIG */
38# ifndef AI_ALL
39# define AI_ALL 0 /* dummy */
40# endif /* ! AI_ALL */
41# ifndef AI_DEFAULT
42# define AI_DEFAULT 0 /* dummy */
43# endif /* ! AI_DEFAULT */
44
45static struct hostent *
34
35# ifndef AI_ADDRCONFIG
36# define AI_ADDRCONFIG 0 /* dummy */
37# endif /* ! AI_ADDRCONFIG */
38# ifndef AI_ALL
39# define AI_ALL 0 /* dummy */
40# endif /* ! AI_ALL */
41# ifndef AI_DEFAULT
42# define AI_DEFAULT 0 /* dummy */
43# endif /* ! AI_DEFAULT */
44
45static struct hostent *
46getipnodebyname(name, family, flags, err)
47 char *name;
46sm_getipnodebyname(name, family, flags, err)
47 const char *name;
48 int family;
49 int flags;
50 int *err;
51{
52 bool resv6 = true;
53 struct hostent *h;
54
55 if (family == AF_INET6)

--- 16 unchanged lines hidden (view full) ---

72{
73 /*
74 ** Stub routine -- if they don't have getipnodeby*(),
75 ** they probably don't have the free routine either.
76 */
77
78 return;
79}
48 int family;
49 int flags;
50 int *err;
51{
52 bool resv6 = true;
53 struct hostent *h;
54
55 if (family == AF_INET6)

--- 16 unchanged lines hidden (view full) ---

72{
73 /*
74 ** Stub routine -- if they don't have getipnodeby*(),
75 ** they probably don't have the free routine either.
76 */
77
78 return;
79}
80#else /* NEEDSGETIPNODE && NETINET6 */
81#define sm_getipnodebyname getipnodebyname
80#endif /* NEEDSGETIPNODE && NETINET6 */
81
82struct hostent *
83mi_gethostbyname(name, family)
84 char *name;
85 int family;
86{
87 struct hostent *h = NULL;

--- 14 unchanged lines hidden (view full) ---

102 int flags = AI_DEFAULT|AI_ALL;
103 int err;
104# endif /* NETINET6 */
105
106# if NETINET6
107# if ADDRCONFIG_IS_BROKEN
108 flags &= ~AI_ADDRCONFIG;
109# endif /* ADDRCONFIG_IS_BROKEN */
82#endif /* NEEDSGETIPNODE && NETINET6 */
83
84struct hostent *
85mi_gethostbyname(name, family)
86 char *name;
87 int family;
88{
89 struct hostent *h = NULL;

--- 14 unchanged lines hidden (view full) ---

104 int flags = AI_DEFAULT|AI_ALL;
105 int err;
106# endif /* NETINET6 */
107
108# if NETINET6
109# if ADDRCONFIG_IS_BROKEN
110 flags &= ~AI_ADDRCONFIG;
111# endif /* ADDRCONFIG_IS_BROKEN */
110 h = getipnodebyname(name, family, flags, &err);
112 h = sm_getipnodebyname(name, family, flags, &err);
111 SM_SET_H_ERRNO(err);
112# else /* NETINET6 */
113 h = gethostbyname(name);
114# endif /* NETINET6 */
115
116#endif /* (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) || (defined(sony_news) && defined(__svr4)) */
117 return h;
118}

--- 30 unchanged lines hidden ---
113 SM_SET_H_ERRNO(err);
114# else /* NETINET6 */
115 h = gethostbyname(name);
116# endif /* NETINET6 */
117
118#endif /* (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) || (defined(sony_news) && defined(__svr4)) */
119 return h;
120}

--- 30 unchanged lines hidden ---