---
name: "krb5_addresses"
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_addresses"
---

# krb5\_addresses(3)

mange addresses in Kerberos

## NAME

**krb5\_address**, **krb5\_addresses**, **krb5\_sockaddr2address**, **krb5\_sockaddr2port**, **krb5\_addr2sockaddr**, **krb5\_max\_sockaddr\_size**, **krb5\_sockaddr\_uninteresting**, **krb5\_h\_addr2sockaddr**, **krb5\_h\_addr2addr**, **krb5\_anyaddr**, **krb5\_print\_address**, **krb5\_parse\_address**, **krb5\_address\_order**, **krb5\_address\_compare**, **krb5\_address\_search**, **krb5\_free\_address**, **krb5\_free\_addresses**, **krb5\_copy\_address**, **krb5\_copy\_addresses**, **krb5\_append\_addresses**, **krb5\_make\_addrport** – mange addresses in Kerberos

## LIBRARY

Kerberos 5 Library (libkrb5, -lkrb5)

## SYNOPSIS

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

*krb5\_error\_code*\

**krb5\_sockaddr2address**(*krb5\_context context*, *const struct sockaddr \*sa*, *krb5\_address \*addr*);

*krb5\_error\_code*\

**krb5\_sockaddr2port**(*krb5\_context context*, *const struct sockaddr \*sa*, *int16\_t \*port*);

*krb5\_error\_code*\

**krb5\_addr2sockaddr**(*krb5\_context context*, *const krb5\_address \*addr*, *struct sockaddr \*sa*, *krb5\_socklen\_t \*sa\_size*, *int port*);

*size\_t*\

**krb5\_max\_sockaddr\_size**(*void*);

*krb5\_boolean*\

**krb5\_sockaddr\_uninteresting**(*const struct sockaddr \*sa*);

*krb5\_error\_code*\

**krb5\_h\_addr2sockaddr**(*krb5\_context context*, *int af*, *const char \*addr*, *struct sockaddr \*sa*, *krb5\_socklen\_t \*sa\_size*, *int port*);

*krb5\_error\_code*\

**krb5\_h\_addr2addr**(*krb5\_context context*, *int af*, *const char \*haddr*, *krb5\_address \*addr*);

*krb5\_error\_code*\

**krb5\_anyaddr**(*krb5\_context context*, *int af*, *struct sockaddr \*sa*, *krb5\_socklen\_t \*sa\_size*, *int port*);

*krb5\_error\_code*\

**krb5\_print\_address**(*const krb5\_address \*addr*, *char \*str*, *size\_t len*, *size\_t \*ret\_len*);

*krb5\_error\_code*\

**krb5\_parse\_address**(*krb5\_context context*, *const char \*string*, *krb5\_addresses \*addresses*);

*int*\

**krb5\_address\_order**(*krb5\_context context*, *const krb5\_address \*addr1*, *const krb5\_address \*addr2*);

*krb5\_boolean*\

**krb5\_address\_compare**(*krb5\_context context*, *const krb5\_address \*addr1*, *const krb5\_address \*addr2*);

*krb5\_boolean*\

**krb5\_address\_search**(*krb5\_context context*, *const krb5\_address \*addr*, *const krb5\_addresses \*addrlist*);

*krb5\_error\_code*\

**krb5\_free\_address**(*krb5\_context context*, *krb5\_address \*address*);

*krb5\_error\_code*\

**krb5\_free\_addresses**(*krb5\_context context*, *krb5\_addresses \*addresses*);

*krb5\_error\_code*\

**krb5\_copy\_address**(*krb5\_context context*, *const krb5\_address \*inaddr*, *krb5\_address \*outaddr*);

*krb5\_error\_code*\

**krb5\_copy\_addresses**(*krb5\_context context*, *const krb5\_addresses \*inaddr*, *krb5\_addresses \*outaddr*);

*krb5\_error\_code*\

**krb5\_append\_addresses**(*krb5\_context context*, *krb5\_addresses \*dest*, *const krb5\_addresses \*source*);

*krb5\_error\_code*\

**krb5\_make\_addrport**(*krb5\_context context*, *krb5\_address \*\*res*, *const krb5\_address \*addr*, *int16\_t port*);

## DESCRIPTION

The 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.

The krb5\_addresses structure holds a set of krb5\_address:es.

**krb5\_sockaddr2address**() stores a address a struct sockaddr *sa* in the krb5\_address *addr*.

**krb5\_sockaddr2port**() extracts a *port* (if possible) from a struct sockaddr *sa*.

**krb5\_addr2sockaddr**() sets the struct sockaddr *sockaddr* from *addr* and *port*. The argument *sa\_size* should initially contain the size of the *sa*, and after the call, it will contain the actual length of the address.

**krb5\_max\_sockaddr\_size**() returns the max size of the struct sockaddr that the Kerberos library will return.

**krb5\_sockaddr\_uninteresting**() returns TRUE for all *sa* that the kerberos library thinks are uninteresting. One example are link local addresses.

**krb5\_h\_addr2sockaddr**() initializes a struct sockaddr *sa* from *af* and the struct hostent (see [gethostbyname(3)](/gethostbyname/3.md)) *h\_addr\_list* component. The argument *sa\_size* should initially contain the size of the *sa*, and after the call, it will contain the actual length of the address.

**krb5\_h\_addr2addr**() works like **krb5\_h\_addr2sockaddr**() with the exception that it operates on a krb5\_address instead of a struct sockaddr.

**krb5\_anyaddr**() fills in a struct sockaddr *sa* that can be used to [bind(2)](/bind/2.md) to. The argument *sa\_size* should initially contain the size of the *sa*, and after the call, it will contain the actual length of the address.

**krb5\_print\_address**() prints the address in *addr* to the string *string* that have the length *len*. If *ret\_len* is not NULL, it will be filled with the length of the string if size were unlimited (not including the final ‘\\0’).

**krb5\_parse\_address**() Returns the resolved hostname in *string* to the krb5\_addresses *addresses*.

**krb5\_address\_order**() compares the addresses *addr1* and *addr2* so that it can be used for sorting addresses. If the addresses are the same address *krb5\_address\_order* will return 0.

**krb5\_address\_compare**() compares the addresses *addr1* and *addr2*. Returns TRUE if the two addresses are the same.

**krb5\_address\_search**() checks if the address *addr* is a member of the address set list *addrlist*.

**krb5\_free\_address**() frees the data stored in the *address* that is alloced with any of the krb5\_address functions.

**krb5\_free\_addresses**() frees the data stored in the *addresses* that is alloced with any of the krb5\_address functions.

**krb5\_copy\_address**() copies the content of address *inaddr* to *outaddr*.

**krb5\_copy\_addresses**() copies the content of the address list *inaddr* to *outaddr*.

**krb5\_append\_addresses**() adds the set of addresses in *source* to *dest*. While copying the addresses, duplicates are also sorted out.

**krb5\_make\_addrport**() allocates and creates an krb5\_address in *res* of type KRB5\_ADDRESS\_ADDRPORT from *(*, *addr*, *port*,).

## SEE ALSO

[krb5(3)](/krb5/3.md), [krb5.conf(5)](/krb5.conf/5.md), [kerberos(8)](/kerberos/8.md)
