---
name: "krb5_store_stringz"
section: "3"
platform: "linux"
package: "heimdal-dev"
version: "1.2.dfsg.1-2.1+lenny1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/krb5_store_stringz"
---

# krb5\_store\_stringz(3)

operates on the Kerberos datatype krb5\_storage

## NAME

**krb5\_storage**, **krb5\_storage\_emem**, **krb5\_storage\_from\_data**, **krb5\_storage\_from\_fd**, **krb5\_storage\_from\_mem**, **krb5\_storage\_set\_flags**, **krb5\_storage\_clear\_flags**, **krb5\_storage\_is\_flags**, **krb5\_storage\_set\_byteorder**, **krb5\_storage\_get\_byteorder**, **krb5\_storage\_set\_eof\_code**, **krb5\_storage\_seek**, **krb5\_storage\_read**, **krb5\_storage\_write**, **krb5\_storage\_free**, **krb5\_storage\_to\_data**, **krb5\_store\_int32**, **krb5\_ret\_int32**, **krb5\_store\_uint32**, **krb5\_ret\_uint32**, **krb5\_store\_int16**, **krb5\_ret\_int16**, **krb5\_store\_uint16**, **krb5\_ret\_uint16**, **krb5\_store\_int8**, **krb5\_ret\_int8**, **krb5\_store\_uint8**, **krb5\_ret\_uint8**, **krb5\_store\_data**, **krb5\_ret\_data**, **krb5\_store\_string**, **krb5\_ret\_string**, **krb5\_store\_stringnl**, **krb5\_ret\_stringnl**, **krb5\_store\_stringz**, **krb5\_ret\_stringz**, **krb5\_store\_principal**, **krb5\_ret\_principal**, **krb5\_store\_keyblock**, **krb5\_ret\_keyblock**, **krb5\_store\_times**, **krb5\_ret\_times**, **krb5\_store\_address**, **krb5\_ret\_address**, **krb5\_store\_addrs**, **krb5\_ret\_addrs**, **krb5\_store\_authdata**, **krb5\_ret\_authdata**, **krb5\_store\_creds**, **krb5\_ret\_creds** – operates on the Kerberos datatype krb5\_storage

## LIBRARY

Kerberos 5 Library (libkrb5, -lkrb5)

## SYNOPSIS

**#include \<krb5.h\>**

struct krb5\_storage;

*krb5\_storage \**\

**krb5\_storage\_from\_fd**(*int fd*);

*krb5\_storage \**\

**krb5\_storage\_emem**(*void*);

*krb5\_storage \**\

**krb5\_storage\_from\_mem**(*void \*buf*, *size\_t len*);

*krb5\_storage \**\

**krb5\_storage\_from\_data**(*krb5\_data \*data*);

*void*\

**krb5\_storage\_set\_flags**(*krb5\_storage \*sp*, *krb5\_flags flags*);

*void*\

**krb5\_storage\_clear\_flags**(*krb5\_storage \*sp*, *krb5\_flags flags*);

*krb5\_boolean*\

**krb5\_storage\_is\_flags**(*krb5\_storage \*sp*, *krb5\_flags flags*);

*void*\

**krb5\_storage\_set\_byteorder**(*krb5\_storage \*sp*, *krb5\_flags byteorder*);

*krb5\_flags*\

**krb5\_storage\_get\_byteorder**(*krb5\_storage \*sp*, *krb5\_flags byteorder*);

*void*\

**krb5\_storage\_set\_eof\_code**(*krb5\_storage \*sp*, *int code*);

*off\_t*\

**krb5\_storage\_seek**(*krb5\_storage \*sp*, *off\_t offset*, *int whence*);

*krb5\_ssize\_t*\

**krb5\_storage\_read**(*krb5\_storage \*sp*, *void \*buf*, *size\_t len*);

*krb5\_ssize\_t*\

**krb5\_storage\_write**(*krb5\_storage \*sp*, *const void \*buf*, *size\_t len*);

*krb5\_error\_code*\

**krb5\_storage\_free**(*krb5\_storage \*sp*);

*krb5\_error\_code*\

**krb5\_storage\_to\_data**(*krb5\_storage \*sp*, *krb5\_data \*data*);

*krb5\_error\_code*\

**krb5\_store\_int32**(*krb5\_storage \*sp*, *int32\_t value*);

*krb5\_error\_code*\

**krb5\_ret\_int32**(*krb5\_storage \*sp*, *int32\_t \*value*);

*krb5\_error\_code*\

**krb5\_ret\_uint32**(*krb5\_storage \*sp*, *uint32\_t \*value*);

*krb5\_error\_code*\

**krb5\_store\_uint32**(*krb5\_storage \*sp*, *uint32\_t value*);

*krb5\_error\_code*\

**krb5\_store\_int16**(*krb5\_storage \*sp*, *int16\_t value*);

*krb5\_error\_code*\

**krb5\_ret\_int16**(*krb5\_storage \*sp*, *int16\_t \*value*);

*krb5\_error\_code*\

**krb5\_store\_uint16**(*krb5\_storage \*sp*, *uint16\_t value*);

*krb5\_error\_code*\

**krb5\_ret\_uint16**(*krb5\_storage \*sp*, *u\_int16\_t \*value*);

*krb5\_error\_code*\

**krb5\_store\_int8**(*krb5\_storage \*sp*, *int8\_t value*);

*krb5\_error\_code*\

**krb5\_ret\_int8**(*krb5\_storage \*sp*, *int8\_t \*value*);

*krb5\_error\_code*\

**krb5\_store\_uint8**(*krb5\_storage \*sp*, *u\_int8\_t value*);

*krb5\_error\_code*\

**krb5\_ret\_uint8**(*krb5\_storage \*sp*, *u\_int8\_t \*value*);

*krb5\_error\_code*\

**krb5\_store\_data**(*krb5\_storage \*sp*, *krb5\_data data*);

*krb5\_error\_code*\

**krb5\_ret\_data**(*krb5\_storage \*sp*, *krb5\_data \*data*);

*krb5\_error\_code*\

**krb5\_store\_string**(*krb5\_storage \*sp*, *const char \*s*);

*krb5\_error\_code*\

**krb5\_ret\_string**(*krb5\_storage \*sp*, *char \*\*string*);

*krb5\_error\_code*\

**krb5\_store\_stringnl**(*krb5\_storage \*sp*, *const char \*s*);

*krb5\_error\_code*\

**krb5\_ret\_stringnl**(*krb5\_storage \*sp*, *char \*\*string*);

*krb5\_error\_code*\

**krb5\_store\_stringz**(*krb5\_storage \*sp*, *const char \*s*);

*krb5\_error\_code*\

**krb5\_ret\_stringz**(*krb5\_storage \*sp*, *char \*\*string*);

*krb5\_error\_code*\

**krb5\_store\_principal**(*krb5\_storage \*sp*, *krb5\_const\_principal p*);

*krb5\_error\_code*\

**krb5\_ret\_principal**(*krb5\_storage \*sp*, *krb5\_principal \*princ*);

*krb5\_error\_code*\

**krb5\_store\_keyblock**(*krb5\_storage \*sp*, *krb5\_keyblock p*);

*krb5\_error\_code*\

**krb5\_ret\_keyblock**(*krb5\_storage \*sp*, *krb5\_keyblock \*p*);

*krb5\_error\_code*\

**krb5\_store\_times**(*krb5\_storage \*sp*, *krb5\_times times*);

*krb5\_error\_code*\

**krb5\_ret\_times**(*krb5\_storage \*sp*, *krb5\_times \*times*);

*krb5\_error\_code*\

**krb5\_store\_address**(*krb5\_storage \*sp*, *krb5\_address p*);

*krb5\_error\_code*\

**krb5\_ret\_address**(*krb5\_storage \*sp*, *krb5\_address \*adr*);

*krb5\_error\_code*\

**krb5\_store\_addrs**(*krb5\_storage \*sp*, *krb5\_addresses p*);

*krb5\_error\_code*\

**krb5\_ret\_addrs**(*krb5\_storage \*sp*, *krb5\_addresses \*adr*);

*krb5\_error\_code*\

**krb5\_store\_authdata**(*krb5\_storage \*sp*, *krb5\_authdata auth*);

*krb5\_error\_code*\

**krb5\_ret\_authdata**(*krb5\_storage \*sp*, *krb5\_authdata \*auth*);

*krb5\_error\_code*\

**krb5\_store\_creds**(*krb5\_storage \*sp*, *krb5\_creds \*creds*);

*krb5\_error\_code*\

**krb5\_ret\_creds**(*krb5\_storage \*sp*, *krb5\_creds \*creds*);

## DESCRIPTION

The krb5\_storage structure holds a storage element that is used for data manipulation. The structure contains no public accessible elements.

**krb5\_storage\_emem**() create a memory based krb5 storage unit that dynamicly resized to the ammount of data stored in. The storage never returns errors, on memory allocation errors [exit(3)](/exit/3.md) will be called.

**krb5\_storage\_from\_data**() create a krb5 storage unit that will read is data from a krb5\_data. There is no copy made of the *data*, so the caller must not free *data* until the storage is freed.

**krb5\_storage\_from\_fd**() create a krb5 storage unit that will read is data from a file descriptor. The descriptor must be seekable if **krb5\_storage\_seek**() is used. Caller must not free the file descriptor before the storage is freed.

**krb5\_storage\_from\_mem**() create a krb5 storage unit that will read is data from a memory region. There is no copy made of the *data*, so the caller must not free *data* until the storage is freed.

**krb5\_storage\_set\_flags**() and **krb5\_storage\_clear\_flags**() modifies the behavior of the storage functions. **krb5\_storage\_is\_flags**() tests if the *flags* are set on the krb5\_storage. Valid flags to set, is and clear is are:

- KRB5\_STORAGE\_PRINCIPAL\_WRONG\_NUM\_COMPONENTS

  Stores the number of principal componets one too many when storing principal namees, used for compatibility with version 1 of file keytabs and version 1 of file credential caches.

- KRB5\_STORAGE\_PRINCIPAL\_NO\_NAME\_TYPE

  Doesn't store the name type in when storing a principal name, used for compatibility with version 1 of file keytabs and version 1 of file credential caches.

- KRB5\_STORAGE\_KEYBLOCK\_KEYTYPE\_TWICE

  Stores the keyblock type twice storing a keyblock, used for compatibility version 3 of file credential caches.

- KRB5\_STORAGE\_BYTEORDER\_MASK

  bitmask that can be used to and out what type of byte order order is used.

- KRB5\_STORAGE\_BYTEORDER\_BE

  Store integers in in big endian byte order, this is the default mode.

- KRB5\_STORAGE\_BYTEORDER\_LE

  Store integers in in little endian byte order.

- KRB5\_STORAGE\_BYTEORDER\_HOST

  Stores the integers in host byte order, used for compatibility with version 1 of file keytabs and version 1 and 2 of file credential caches.

- KRB5\_STORAGE\_CREDS\_FLAGS\_WRONG\_BITORDER

  Store the credential flags in a krb5\_creds in the reverse bit order.

**krb5\_storage\_set\_byteorder**() and **krb5\_storage\_get\_byteorder**() modifies the byte order used in the storage for integers. The flags used is same as above. The valid flags are KRB5\_STORAGE\_BYTEORDER\_BE, KRB5\_STORAGE\_BYTEORDER\_LE and KRB5\_STORAGE\_BYTEORDER\_HOST.

**krb5\_storage\_set\_eof\_code**() sets the error code that will be returned on end of file condition to *code*.

**krb5\_storage\_seek**() seeks *offset* bytes in the storage *sp*. The *whence* argument is one of

- SEEK\_SET

  offset is from begining of storage.

- SEEK\_CUR

  offset is relative from current offset.

- SEEK\_END

  offset is from end of storage.

**krb5\_storage\_read**() reads *len* (or less bytes in case of end of file) into *buf* from the current offset in the storage *sp*.

**krb5\_storage\_write**() writes *len* or (less bytes in case of end of file) from *buf* from the current offset in the storage *sp*.

**krb5\_storage\_free**() frees the storage *sp*.

**krb5\_storage\_to\_data**() converts the data in storage *sp* into a krb5\_data structure. *data* must be freed with **krb5\_data\_free**() by the caller when done with the *data*.

All krb5\_store and krb5\_ret functions move the current offset forward when the functions returns.

**krb5\_store\_int32**(), **krb5\_ret\_int32**(), **krb5\_store\_uint32**(), **krb5\_ret\_uint32**(), **krb5\_store\_int16**(), **krb5\_ret\_int16**(), **krb5\_store\_uint16**(), **krb5\_ret\_uint16**(), **krb5\_store\_int8**(), **krb5\_ret\_int8**() **krb5\_store\_uint8**(), and **krb5\_ret\_uint8**() stores and reads an integer from *sp* in the byte order specified by the flags set on the *sp*.

**krb5\_store\_data**() and **krb5\_ret\_data**() store and reads a krb5\_data. The length of the data is stored with **krb5\_store\_int32**().

**krb5\_store\_string**() and **krb5\_ret\_string**() store and reads a string by storing the length of the string with **krb5\_store\_int32**() followed by the string itself.

**krb5\_store\_stringnl**() and  **krb5\_ret\_stringnl**() store and reads a string by storing string followed by a '0.

**krb5\_store\_stringz**() and  **krb5\_ret\_stringz**() store and reads a string by storing string followed by a NUL.

**krb5\_store\_principal**() and **krb5\_ret\_principal**() store and reads a principal.

**krb5\_store\_keyblock**() and **krb5\_ret\_keyblock**() store and reads a krb5\_keyblock.

**krb5\_store\_times**() **krb5\_ret\_times**() store and reads krb5\_times structure .

**krb5\_store\_address**() and **krb5\_ret\_address**() store and reads a  krb5\_address.

**krb5\_store\_addrs**() and **krb5\_ret\_addrs**() store and reads a  krb5\_addresses.

**krb5\_store\_authdata**() and **krb5\_ret\_authdata**() store and reads a krb5\_authdata.

**krb5\_store\_creds**() and **krb5\_ret\_creds**() store and reads a krb5\_creds.

## SEE ALSO

[krb5(3)](/krb5/3.md), [krb5\_data(3)](/krb5_data/3.md), [kerberos(8)](/kerberos/8.md)
