summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/lib/krb5/krb5_address.3
blob: 06f7fa5cd02c5628213ab1db62d8f30418c96f42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
.\" Copyright (c) 2003, 2005 - 2006 Kungliga Tekniska Högskolan
.\" (Royal Institute of Technology, Stockholm, Sweden).
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\"
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" 3. Neither the name of the Institute nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: krb5_address.3 17461 2006-05-05 13:13:18Z lha $
.\"
.Dd May  1, 2006
.Dt KRB5_ADDRESS 3
.Os HEIMDAL
.Sh NAME
.Nm krb5_address ,
.Nm krb5_addresses ,
.Nm krb5_sockaddr2address ,
.Nm krb5_sockaddr2port ,
.Nm krb5_addr2sockaddr ,
.Nm krb5_max_sockaddr_size ,
.Nm krb5_sockaddr_uninteresting ,
.Nm krb5_h_addr2sockaddr ,
.Nm krb5_h_addr2addr ,
.Nm krb5_anyaddr ,
.Nm krb5_print_address ,
.Nm krb5_parse_address ,
.Nm krb5_address_order ,
.Nm krb5_address_compare ,
.Nm krb5_address_search ,
.Nm krb5_free_address ,
.Nm krb5_free_addresses ,
.Nm krb5_copy_address ,
.Nm krb5_copy_addresses ,
.Nm krb5_append_addresses ,
.Nm krb5_make_addrport
.Nd mange addresses in Kerberos
.Sh LIBRARY
Kerberos 5 Library (libkrb5, -lkrb5)
.Sh SYNOPSIS
.In krb5.h
.Pp
.Ft krb5_error_code
.Fo krb5_sockaddr2address
.Fa "krb5_context context"
.Fa "const struct sockaddr *sa"
.Fa "krb5_address *addr"
.Fc
.Ft krb5_error_code
.Fo krb5_sockaddr2port
.Fa "krb5_context context"
.Fa "const struct sockaddr *sa"
.Fa "int16_t *port"
.Fc
.Ft krb5_error_code
.Fo krb5_addr2sockaddr
.Fa "krb5_context context"
.Fa "const krb5_address *addr"
.Fa "struct sockaddr *sa"
.Fa "krb5_socklen_t *sa_size"
.Fa "int port"
.Fc
.Ft size_t
.Fo krb5_max_sockaddr_size
.Fa "void"
.Fc
.Ft "krb5_boolean"
.Fo krb5_sockaddr_uninteresting
.Fa "const struct sockaddr *sa"
.Fc
.Ft krb5_error_code
.Fo krb5_h_addr2sockaddr
.Fa "krb5_context context"
.Fa "int af"
.Fa "const char *addr"
.Fa "struct sockaddr *sa"
.Fa "krb5_socklen_t *sa_size"
.Fa "int port"
.Fc
.Ft krb5_error_code
.Fo krb5_h_addr2addr
.Fa "krb5_context context"
.Fa "int af"
.Fa "const char *haddr"
.Fa "krb5_address *addr"
.Fc
.Ft krb5_error_code
.Fo krb5_anyaddr
.Fa "krb5_context context"
.Fa "int af"
.Fa "struct sockaddr *sa"
.Fa "krb5_socklen_t *sa_size"
.Fa "int port"
.Fc
.Ft krb5_error_code
.Fo krb5_print_address
.Fa "const krb5_address *addr"
.Fa "char *str"
.Fa "size_t len"
.Fa "size_t *ret_len"
.Fc
.Ft krb5_error_code
.Fo krb5_parse_address
.Fa "krb5_context context"
.Fa "const char *string"
.Fa "krb5_addresses *addresses"
.Fc
.Ft int
.Fo "krb5_address_order"
.Fa "krb5_context context"
.Fa "const krb5_address *addr1"
.Fa "const krb5_address *addr2"
.Fc
.Ft "krb5_boolean"
.Fo krb5_address_compare
.Fa "krb5_context context"
.Fa "const krb5_address *addr1"
.Fa "const krb5_address *addr2"
.Fc
.Ft "krb5_boolean"
.Fo krb5_address_search
.Fa "krb5_context context"
.Fa "const krb5_address *addr"
.Fa "const krb5_addresses *addrlist"
.Fc
.Ft krb5_error_code
.Fo krb5_free_address
.Fa "krb5_context context"
.Fa "krb5_address *address"
.Fc
.Ft krb5_error_code
.Fo krb5_free_addresses
.Fa "krb5_context context"
.Fa "krb5_addresses *addresses"
.Fc
.Ft krb5_error_code
.Fo krb5_copy_address
.Fa "krb5_context context"
.Fa "const krb5_address *inaddr"
.Fa "krb5_address *outaddr"
.Fc
.Ft krb5_error_code
.Fo krb5_copy_addresses
.Fa "krb5_context context"
.Fa "const krb5_addresses *inaddr"
.Fa "krb5_addresses *outaddr"
.Fc
.Ft krb5_error_code
.Fo krb5_append_addresses
.Fa "krb5_context context"
.Fa "krb5_addresses *dest"
.Fa "const krb5_addresses *source"
.Fc
.Ft krb5_error_code
.Fo krb5_make_addrport
.Fa "krb5_context context"
.Fa "krb5_address **res"
.Fa "const krb5_address *addr"
.Fa "int16_t port"
.Fc
.Sh DESCRIPTION
The
.Li krb5_address
structure holds a address that can be used in Kerberos API
calls. There are help functions to set and extract address information
of the address.
.Pp
The
.Li krb5_addresses
structure holds a set of krb5_address:es.
.Pp
.Fn krb5_sockaddr2address
stores a address a
.Li "struct sockaddr"
.Fa sa
in the krb5_address
.Fa addr .
.Pp
.Fn krb5_sockaddr2port
extracts a
.Fa port
(if possible) from a
.Li "struct sockaddr"
.Fa sa .
.Pp
.Fn krb5_addr2sockaddr
sets the
struct sockaddr
.Fa sockaddr
from
.Fa addr
and
.Fa port .
The argument
.Fa sa_size
should initially contain the size of the
.Fa sa ,
and after the call, it will contain the actual length of the address.
.Pp
.Fn krb5_max_sockaddr_size
returns the max size of the
.Li struct sockaddr
that the Kerberos library will return.
.Pp
.Fn krb5_sockaddr_uninteresting
returns
.Dv TRUE
for all
.Fa sa
that the kerberos library thinks are uninteresting.
One example are link local addresses.
.Pp
.Fn krb5_h_addr2sockaddr
initializes a
.Li "struct sockaddr"
.Fa sa
from
.Fa af
and the
.Li "struct hostent"
(see
.Xr gethostbyname 3 )
.Fa h_addr_list
component.
The argument
.Fa sa_size
should initially contain the size of the
.Fa sa ,
and after the call, it will contain the actual length of the address.
.Pp
.Fn krb5_h_addr2addr
works like
.Fn krb5_h_addr2sockaddr
with the exception that it operates on a
.Li krb5_address
instead of a
.Li struct sockaddr .
.Pp
.Fn krb5_anyaddr
fills in a
.Li "struct sockaddr"
.Fa sa
that can be used to
.Xr bind 2
to.
The argument
.Fa sa_size
should initially contain the size of the
.Fa sa ,
and after the call, it will contain the actual length of the address.
.Pp
.Fn krb5_print_address
prints the address in
.Fa addr
to the string
.Fa string
that have the length
.Fa len .
If
.Fa ret_len
is not
.Dv NULL ,
it will be filled with the length of the string if size were unlimited (not
including the final
.Ql \e0 ) .
.Pp
.Fn krb5_parse_address
Returns the resolved hostname in
.Fa string
to the
.Li krb5_addresses
.Fa addresses .
.Pp
.Fn krb5_address_order
compares the addresses
.Fa addr1
and
.Fa addr2
so that it can be used for sorting addresses. If the addresses are the
same address
.Fa krb5_address_order
will return 0.
.Pp
.Fn krb5_address_compare
compares the addresses
.Fa addr1
and
.Fa addr2 .
Returns
.Dv TRUE
if the two addresses are the same.
.Pp
.Fn krb5_address_search
checks if the address
.Fa addr
is a member of the address set list
.Fa addrlist .
.Pp
.Fn krb5_free_address
frees the data stored in the
.Fa address
that is alloced with any of the krb5_address functions.
.Pp
.Fn krb5_free_addresses
frees the data stored in the
.Fa addresses
that is alloced with any of the krb5_address functions.
.Pp
.Fn krb5_copy_address
copies the content of address
.Fa inaddr
to
.Fa outaddr .
.Pp
.Fn krb5_copy_addresses
copies the content of the address list
.Fa inaddr
to
.Fa outaddr .
.Pp
.Fn krb5_append_addresses
adds the set of addresses in
.Fa source
to
.Fa dest .
While copying the addresses, duplicates are also sorted out.
.Pp
.Fn krb5_make_addrport
allocates and creates an
krb5_address in
.Fa res
of type KRB5_ADDRESS_ADDRPORT from
.Fa ( addr , port ) .
.Sh SEE ALSO
.Xr krb5 3 ,
.Xr krb5.conf 5 ,
.Xr kerberos 8
OpenPOWER on IntegriCloud