Mercurial > dropbear
annotate fake-rfc2553.h @ 750:a813e2752fdb
fix leftover kexguess debugging
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 03 Apr 2013 07:34:18 +0800 |
parents | 9fd27bc37807 |
children | deed0571cacc |
rev | line source |
---|---|
589
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
1 /* Taken for Dropbear from OpenSSH 5.5p1 */ |
67 | 2 |
589
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
3 /* $Id: fake-rfc2553.h,v 1.16 2008/07/14 11:37:37 djm Exp $ */ |
64 | 4 |
5 /* | |
6 * Copyright (C) 2000-2003 Damien Miller. All rights reserved. | |
7 * Copyright (C) 1999 WIDE Project. All rights reserved. | |
8 * | |
9 * Redistribution and use in source and binary forms, with or without | |
10 * modification, are permitted provided that the following conditions | |
11 * are met: | |
12 * 1. Redistributions of source code must retain the above copyright | |
13 * notice, this list of conditions and the following disclaimer. | |
14 * 2. Redistributions in binary form must reproduce the above copyright | |
15 * notice, this list of conditions and the following disclaimer in the | |
16 * documentation and/or other materials provided with the distribution. | |
17 * 3. Neither the name of the project nor the names of its contributors | |
18 * may be used to endorse or promote products derived from this software | |
19 * without specific prior written permission. | |
20 * | |
21 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND | |
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
31 * SUCH DAMAGE. | |
32 */ | |
33 | |
34 /* | |
35 * Pseudo-implementation of RFC2553 name / address resolution functions | |
36 * | |
37 * But these functions are not implemented correctly. The minimum subset | |
38 * is implemented for ssh use only. For example, this routine assumes | |
39 * that ai_family is AF_INET. Don't use it for another purpose. | |
40 */ | |
41 | |
42 #ifndef _FAKE_RFC2553_H | |
43 #define _FAKE_RFC2553_H | |
44 | |
45 #include "includes.h" | |
589
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
46 #include <sys/types.h> |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
47 #if defined(HAVE_NETDB_H) |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
48 # include <netdb.h> |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
49 #endif |
64 | 50 |
51 /* | |
52 * First, socket and INET6 related definitions | |
53 */ | |
54 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE | |
55 # define _SS_MAXSIZE 128 /* Implementation specific max size */ | |
56 # define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) | |
57 struct sockaddr_storage { | |
58 struct sockaddr ss_sa; | |
59 char __ss_pad2[_SS_PADSIZE]; | |
60 }; | |
61 # define ss_family ss_sa.sa_family | |
62 #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ | |
63 | |
64 #ifndef IN6_IS_ADDR_LOOPBACK | |
65 # define IN6_IS_ADDR_LOOPBACK(a) \ | |
66 (((u_int32_t *)(a))[0] == 0 && ((u_int32_t *)(a))[1] == 0 && \ | |
67 ((u_int32_t *)(a))[2] == 0 && ((u_int32_t *)(a))[3] == htonl(1)) | |
68 #endif /* !IN6_IS_ADDR_LOOPBACK */ | |
69 | |
70 #ifndef HAVE_STRUCT_IN6_ADDR | |
71 struct in6_addr { | |
72 u_int8_t s6_addr[16]; | |
73 }; | |
74 #endif /* !HAVE_STRUCT_IN6_ADDR */ | |
75 | |
76 #ifndef HAVE_STRUCT_SOCKADDR_IN6 | |
77 struct sockaddr_in6 { | |
78 unsigned short sin6_family; | |
79 u_int16_t sin6_port; | |
80 u_int32_t sin6_flowinfo; | |
81 struct in6_addr sin6_addr; | |
589
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
82 u_int32_t sin6_scope_id; |
64 | 83 }; |
84 #endif /* !HAVE_STRUCT_SOCKADDR_IN6 */ | |
85 | |
86 #ifndef AF_INET6 | |
87 /* Define it to something that should never appear */ | |
88 #define AF_INET6 AF_MAX | |
89 #endif | |
90 | |
91 /* | |
92 * Next, RFC2553 name / address resolution API | |
93 */ | |
94 | |
95 #ifndef NI_NUMERICHOST | |
96 # define NI_NUMERICHOST (1) | |
97 #endif | |
98 #ifndef NI_NAMEREQD | |
99 # define NI_NAMEREQD (1<<1) | |
100 #endif | |
101 #ifndef NI_NUMERICSERV | |
102 # define NI_NUMERICSERV (1<<2) | |
103 #endif | |
104 | |
105 #ifndef AI_PASSIVE | |
106 # define AI_PASSIVE (1) | |
107 #endif | |
108 #ifndef AI_CANONNAME | |
109 # define AI_CANONNAME (1<<1) | |
110 #endif | |
111 #ifndef AI_NUMERICHOST | |
112 # define AI_NUMERICHOST (1<<2) | |
113 #endif | |
114 | |
115 #ifndef NI_MAXSERV | |
116 # define NI_MAXSERV 32 | |
117 #endif /* !NI_MAXSERV */ | |
118 #ifndef NI_MAXHOST | |
119 # define NI_MAXHOST 1025 | |
120 #endif /* !NI_MAXHOST */ | |
121 | |
122 #ifndef EAI_NODATA | |
589
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
123 # define EAI_NODATA (INT_MAX - 1) |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
124 #endif |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
125 #ifndef EAI_MEMORY |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
126 # define EAI_MEMORY (INT_MAX - 2) |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
127 #endif |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
128 #ifndef EAI_NONAME |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
129 # define EAI_NONAME (INT_MAX - 3) |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
130 #endif |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
131 #ifndef EAI_SYSTEM |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
132 # define EAI_SYSTEM (INT_MAX - 4) |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
133 #endif |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
134 #ifndef EAI_FAMILY |
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
135 # define EAI_FAMILY (INT_MAX - 5) |
64 | 136 #endif |
137 | |
138 #ifndef HAVE_STRUCT_ADDRINFO | |
139 struct addrinfo { | |
140 int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ | |
141 int ai_family; /* PF_xxx */ | |
142 int ai_socktype; /* SOCK_xxx */ | |
143 int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ | |
144 size_t ai_addrlen; /* length of ai_addr */ | |
145 char *ai_canonname; /* canonical name for hostname */ | |
146 struct sockaddr *ai_addr; /* binary address */ | |
147 struct addrinfo *ai_next; /* next structure in linked list */ | |
148 }; | |
149 #endif /* !HAVE_STRUCT_ADDRINFO */ | |
150 | |
151 #ifndef HAVE_GETADDRINFO | |
152 #ifdef getaddrinfo | |
153 # undef getaddrinfo | |
154 #endif | |
155 #define getaddrinfo(a,b,c,d) (ssh_getaddrinfo(a,b,c,d)) | |
156 int getaddrinfo(const char *, const char *, | |
157 const struct addrinfo *, struct addrinfo **); | |
158 #endif /* !HAVE_GETADDRINFO */ | |
159 | |
160 #if !defined(HAVE_GAI_STRERROR) && !defined(HAVE_CONST_GAI_STRERROR_PROTO) | |
589
9fd27bc37807
- Update fake-rfc2553.{c,h} from OpenSSH 5.5p1
Matt Johnston <matt@ucc.asn.au>
parents:
67
diff
changeset
|
161 #define gai_strerror(a) (_ssh_compat_gai_strerror(a)) |
64 | 162 char *gai_strerror(int); |
163 #endif /* !HAVE_GAI_STRERROR */ | |
164 | |
165 #ifndef HAVE_FREEADDRINFO | |
166 #define freeaddrinfo(a) (ssh_freeaddrinfo(a)) | |
167 void freeaddrinfo(struct addrinfo *); | |
168 #endif /* !HAVE_FREEADDRINFO */ | |
169 | |
170 #ifndef HAVE_GETNAMEINFO | |
171 #define getnameinfo(a,b,c,d,e,f,g) (ssh_getnameinfo(a,b,c,d,e,f,g)) | |
172 int getnameinfo(const struct sockaddr *, size_t, char *, size_t, | |
173 char *, size_t, int); | |
174 #endif /* !HAVE_GETNAMEINFO */ | |
175 | |
176 #endif /* !_FAKE_RFC2553_H */ | |
177 |