1 .\" Copyright (c) 2003 - 2006 Kungliga Tekniska Högskolan
2 .\" (Royal Institute of Technology, Stockholm, Sweden).
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the Institute nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" $Heimdal: krb5_storage.3 17884 2006-08-18 08:41:09Z lha $
40 .Nm krb5_storage_emem ,
41 .Nm krb5_storage_from_data ,
42 .Nm krb5_storage_from_fd ,
43 .Nm krb5_storage_from_mem ,
44 .Nm krb5_storage_set_flags ,
45 .Nm krb5_storage_clear_flags ,
46 .Nm krb5_storage_is_flags ,
47 .Nm krb5_storage_set_byteorder ,
48 .Nm krb5_storage_get_byteorder ,
49 .Nm krb5_storage_set_eof_code ,
50 .Nm krb5_storage_seek ,
51 .Nm krb5_storage_read ,
52 .Nm krb5_storage_write ,
53 .Nm krb5_storage_free ,
54 .Nm krb5_storage_to_data ,
55 .Nm krb5_store_int32 ,
57 .Nm krb5_store_uint32 ,
59 .Nm krb5_store_int16 ,
61 .Nm krb5_store_uint16 ,
65 .Nm krb5_store_uint8 ,
69 .Nm krb5_store_string ,
71 .Nm krb5_store_stringnl ,
72 .Nm krb5_ret_stringnl ,
73 .Nm krb5_store_stringz ,
74 .Nm krb5_ret_stringz ,
75 .Nm krb5_store_principal ,
76 .Nm krb5_ret_principal ,
77 .Nm krb5_store_keyblock ,
78 .Nm krb5_ret_keyblock ,
79 .Nm krb5_store_times ,
81 .Nm krb5_store_address ,
82 .Nm krb5_ret_address ,
83 .Nm krb5_store_addrs ,
85 .Nm krb5_store_authdata ,
86 .Nm krb5_ret_authdata ,
87 .Nm krb5_store_creds ,
89 .Nd operates on the Kerberos datatype krb5_storage
91 Kerberos 5 Library (libkrb5, -lkrb5)
95 .Li "struct krb5_storage;"
98 .Fn krb5_storage_from_fd "int fd"
100 .Fn krb5_storage_emem "void"
102 .Fn krb5_storage_from_mem "void *buf" "size_t len"
104 .Fn krb5_storage_from_data "krb5_data *data"
106 .Fn krb5_storage_set_flags "krb5_storage *sp" "krb5_flags flags"
108 .Fn krb5_storage_clear_flags "krb5_storage *sp" "krb5_flags flags"
110 .Fn krb5_storage_is_flags "krb5_storage *sp" "krb5_flags flags"
112 .Fn krb5_storage_set_byteorder "krb5_storage *sp" "krb5_flags byteorder"
114 .Fn krb5_storage_get_byteorder "krb5_storage *sp" "krb5_flags byteorder"
116 .Fn krb5_storage_set_eof_code "krb5_storage *sp" "int code"
118 .Fn krb5_storage_seek "krb5_storage *sp" "off_t offset" "int whence"
120 .Fn krb5_storage_read "krb5_storage *sp" "void *buf" "size_t len"
122 .Fn krb5_storage_write "krb5_storage *sp" "const void *buf" "size_t len"
124 .Fn krb5_storage_free "krb5_storage *sp"
126 .Fn krb5_storage_to_data "krb5_storage *sp" "krb5_data *data"
128 .Fn krb5_store_int32 "krb5_storage *sp" "int32_t value"
130 .Fn krb5_ret_int32 "krb5_storage *sp" "int32_t *value"
132 .Fn krb5_ret_uint32 "krb5_storage *sp" "uint32_t *value"
134 .Fn krb5_store_uint32 "krb5_storage *sp" "uint32_t value"
136 .Fn krb5_store_int16 "krb5_storage *sp" "int16_t value"
138 .Fn krb5_ret_int16 "krb5_storage *sp" "int16_t *value"
140 .Fn krb5_store_uint16 "krb5_storage *sp" "uint16_t value"
142 .Fn krb5_ret_uint16 "krb5_storage *sp" "u_int16_t *value"
144 .Fn krb5_store_int8 "krb5_storage *sp" "int8_t value"
146 .Fn krb5_ret_int8 "krb5_storage *sp" "int8_t *value"
148 .Fn krb5_store_uint8 "krb5_storage *sp" "u_int8_t value"
150 .Fn krb5_ret_uint8 "krb5_storage *sp" "u_int8_t *value"
152 .Fn krb5_store_data "krb5_storage *sp" "krb5_data data"
154 .Fn krb5_ret_data "krb5_storage *sp" "krb5_data *data"
156 .Fn krb5_store_string "krb5_storage *sp" "const char *s"
158 .Fn krb5_ret_string "krb5_storage *sp" "char **string"
160 .Fn krb5_store_stringnl "krb5_storage *sp" "const char *s"
162 .Fn krb5_ret_stringnl "krb5_storage *sp" "char **string"
164 .Fn krb5_store_stringz "krb5_storage *sp" "const char *s"
166 .Fn krb5_ret_stringz "krb5_storage *sp" "char **string"
168 .Fn krb5_store_principal "krb5_storage *sp" "krb5_const_principal p"
170 .Fn krb5_ret_principal "krb5_storage *sp" "krb5_principal *princ"
172 .Fn krb5_store_keyblock "krb5_storage *sp" "krb5_keyblock p"
174 .Fn krb5_ret_keyblock "krb5_storage *sp" "krb5_keyblock *p"
176 .Fn krb5_store_times "krb5_storage *sp" "krb5_times times"
178 .Fn krb5_ret_times "krb5_storage *sp" "krb5_times *times"
180 .Fn krb5_store_address "krb5_storage *sp" "krb5_address p"
182 .Fn krb5_ret_address "krb5_storage *sp" "krb5_address *adr"
184 .Fn krb5_store_addrs "krb5_storage *sp" "krb5_addresses p"
186 .Fn krb5_ret_addrs "krb5_storage *sp" "krb5_addresses *adr"
188 .Fn krb5_store_authdata "krb5_storage *sp" "krb5_authdata auth"
190 .Fn krb5_ret_authdata "krb5_storage *sp" "krb5_authdata *auth"
192 .Fn krb5_store_creds "krb5_storage *sp" "krb5_creds *creds"
194 .Fn krb5_ret_creds "krb5_storage *sp" "krb5_creds *creds"
198 structure holds a storage element that is used for data manipulation.
199 The structure contains no public accessible elements.
201 .Fn krb5_storage_emem
202 create a memory based krb5 storage unit that dynamicly resized to the
203 ammount of data stored in.
204 The storage never returns errors, on memory allocation errors
208 .Fn krb5_storage_from_data
209 create a krb5 storage unit that will read is data from a
211 There is no copy made of the
213 so the caller must not free
215 until the storage is freed.
217 .Fn krb5_storage_from_fd
218 create a krb5 storage unit that will read is data from a
220 The descriptor must be seekable if
221 .Fn krb5_storage_seek
223 Caller must not free the file descriptor before the storage is freed.
225 .Fn krb5_storage_from_mem
226 create a krb5 storage unit that will read is data from a
228 There is no copy made of the
230 so the caller must not free
232 until the storage is freed.
234 .Fn krb5_storage_set_flags
236 .Fn krb5_storage_clear_flags
237 modifies the behavior of the storage functions.
238 .Fn krb5_storage_is_flags
243 Valid flags to set, is and clear is are:
245 .Bl -tag -width "Fan vet..." -compact -offset indent
246 .It KRB5_STORAGE_PRINCIPAL_WRONG_NUM_COMPONENTS
247 Stores the number of principal componets one too many when storing
248 principal namees, used for compatibility with version 1 of file
249 keytabs and version 1 of file credential caches.
250 .It KRB5_STORAGE_PRINCIPAL_NO_NAME_TYPE
251 Doesn't store the name type in when storing a principal name, used for
252 compatibility with version 1 of file keytabs and version 1 of file
254 .It KRB5_STORAGE_KEYBLOCK_KEYTYPE_TWICE
255 Stores the keyblock type twice storing a keyblock, used for
256 compatibility version 3 of file credential caches.
257 .It KRB5_STORAGE_BYTEORDER_MASK
258 bitmask that can be used to and out what type of byte order order is used.
259 .It KRB5_STORAGE_BYTEORDER_BE
260 Store integers in in big endian byte order, this is the default mode.
261 .It KRB5_STORAGE_BYTEORDER_LE
262 Store integers in in little endian byte order.
263 .It KRB5_STORAGE_BYTEORDER_HOST
264 Stores the integers in host byte order, used for compatibility with
265 version 1 of file keytabs and version 1 and 2 of file credential
267 .It KRB5_STORAGE_CREDS_FLAGS_WRONG_BITORDER
268 Store the credential flags in a krb5_creds in the reverse bit order.
271 .Fn krb5_storage_set_byteorder
273 .Fn krb5_storage_get_byteorder
274 modifies the byte order used in the storage for integers.
275 The flags used is same as above.
277 .Dv KRB5_STORAGE_BYTEORDER_BE ,
278 .Dv KRB5_STORAGE_BYTEORDER_LE
280 .Dv KRB5_STORAGE_BYTEORDER_HOST .
282 .Fn krb5_storage_set_eof_code
283 sets the error code that will be returned on end of file condition to
286 .Fn krb5_storage_seek
294 .Bl -tag -width SEEK_SET -compact -offset indent
296 offset is from begining of storage.
298 offset is relative from current offset.
300 offset is from end of storage.
303 .Fn krb5_storage_read
306 (or less bytes in case of end of file) into
308 from the current offset in the storage
311 .Fn krb5_storage_write
314 or (less bytes in case of end of file) from
316 from the current offset in the storage
319 .Fn krb5_storage_free
323 .Fn krb5_storage_to_data
324 converts the data in storage
332 by the caller when done with the
339 functions move the current offset forward when the functions returns.
341 .Fn krb5_store_int32 ,
343 .Fn krb5_store_uint32 ,
344 .Fn krb5_ret_uint32 ,
345 .Fn krb5_store_int16 ,
347 .Fn krb5_store_uint16 ,
348 .Fn krb5_ret_uint16 ,
349 .Fn krb5_store_int8 ,
351 .Fn krb5_store_uint8 ,
354 stores and reads an integer from
356 in the byte order specified by the flags set on the
362 store and reads a krb5_data.
363 The length of the data is stored with
364 .Fn krb5_store_int32 .
366 .Fn krb5_store_string
369 store and reads a string by storing the length of the string with
371 followed by the string itself.
373 .Fn krb5_store_stringnl
375 .Fn krb5_ret_stringnl
376 store and reads a string by storing string followed by a
379 .Fn krb5_store_stringz
382 store and reads a string by storing string followed by a
385 .Fn krb5_store_principal
387 .Fn krb5_ret_principal
388 store and reads a principal.
390 .Fn krb5_store_keyblock
392 .Fn krb5_ret_keyblock
402 .Fn krb5_store_address
414 .Fn krb5_store_authdata
416 .Fn krb5_ret_authdata