---
name: "hesiod_free_postoffice"
section: "3"
platform: "linux"
package: "libhesiod-dev"
version: "3.2.1-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/hesiod_getmailhost"
---

# hesiod\_free\_postoffice(3)

Hesiod functions for retrieving user to postoffice mappings

Part of [hesiod\_getmailhost(3)](/hesiod_getmailhost/3.md).

## NAME

hesiod\_getmailhost, hesiod\_free\_postoffice - Hesiod functions for retrieving user to postoffice mappings

## SYNOPSIS

```
#include <hesiod.h>
```

**struct hesiod\_postoffice \*hesiod\_getmailhost(void \**context*,** **const char \**user*)** **void hesiod\_free\_postoffice(void \**context*,** **struct hesiod\_postoffice \**po*)**

**cc file.c -lhesiod**

## DESCRIPTION

This family of functions allows you to retrieve user to postoffice mappings using Hesiod.  To perform lookups, you need an initialized Hesiod context; see [hesiod(3)](/hesiod/3.md) for details.  Information is returned in a *hesiod\_postoffice* structure, which has the following fields:

- hesiod\_po\_type

  The type of postoffice box, typically \`\`POP''.

- hesiod\_po\_host

  The hostname where the postoffice box resides.

- hesiod\_po\_name

  The account name on the given postoffice server.

It is the caller's responsibility to call *hesiod\_free\_postoffice* with the returned postoffice entry to free the resources used by the postoffice entry.

Hesiod queries for postoffice information are made using the \`\`pobox'' Hesiod type, using the username as the Hesiod name.  The corresponding entries should be space-separated lists of strings giving the type of postoffice box, the hostname, and the account name.

## RETURN VALUES

On failure, *hesiod\_getservbyname* returns NULL and sets the global variable *errno* to indicate the error.

## ERRORS

*hesiod\_getmailhost* may fail for any of the reasons the routine *hesiod\_resolve* may fail.

## SEE ALSO

[hesiod(3)](/hesiod/3.md)
