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

# hesiod\_free\_passwd(3)

Hesiod functions for retrieving passwd information

Part of [hesiod\_getpwnam(3)](/hesiod_getpwnam/3.md).

## NAME

hesiod\_getpwnam, hesiod\_getpwuid, hesiod\_free\_passwd - Hesiod functions for retrieving passwd information

## SYNOPSIS

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

**struct passwd \*hesiod\_getpwnam(void \**context*, const char \**name*)** **struct passwd \*hesiod\_getpwuid(void \**context*, uid\_t *uid*)** **void hesiod\_free\_passwd(void \**context*, struct passwd \**pw*)**

**cc file.c -lhesiod**

## DESCRIPTION

This family of functions allows you to retrieve passwd database information using Hesiod.  To perform lookups, you need an initialized Hesiod context; see [hesiod(3)](/hesiod/3.md) for details.  You may look up passwd information by name or by uid; information is returned in the same format as by *getpwnam* or *getpwuid*. It is the caller's responsibility to call *hesiod\_free\_passwd* with the returned passwd entry to free the resources used by the passwd entry.

Hesiod queries for passwd information are made using the \`\`passwd'' or \`\`uid'' Hesiod type, using either the username or the decimal representation of the uid as the Hesiod name.  The corresponding records should be a colon-separated list of fields giving the username, encrypted password, uid, gid, GECOS information, home directory, and shell of the user.

## RETURN VALUES

On failure, *hesiod\_getpwnam* and *hesiod\_getpwuid* return NULL and set the global variable *errno* to indicate the error.

## ERRORS

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

## SEE ALSO

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