---
name: "krb5_pwcheck"
section: "3"
platform: "linux"
package: "heimdal-dev"
version: "7.8.git20221117.28daf24+dfsg-9+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/krb5_pwcheck"
---

# krb5\_pwcheck(3)

Heimdal warning and error functions

## NAME

**krb5\_pwcheck**, **kadm5\_setup\_passwd\_quality\_check**, **kadm5\_add\_passwd\_quality\_verifier**, **kadm5\_check\_password\_quality** – Heimdal warning and error functions

## LIBRARY

Kerberos 5 Library (libkadm5srv, -lkadm5srv)

## SYNOPSIS

**#include \<kadm5-protos.h\>**

**#include \<kadm5-pwcheck.h\>**

*void*\

**kadm5\_setup\_passwd\_quality\_check**(*krb5\_context context*, *const char \*check\_library*, *const char \*check\_function*);

*krb5\_error\_code*\

**kadm5\_add\_passwd\_quality\_verifier**(*krb5\_context context*, *const char \*check\_library*);

*const char \**\

**kadm5\_check\_password\_quality**(*krb5\_context context*, *krb5\_principal principal*, *krb5\_data \*pwd\_data*);

*int*\

**(\*kadm5\_passwd\_quality\_check\_func)**(*krb5\_context context*, *krb5\_principal principal*, *krb5\_data \*password*, *const char \*tuning*, *char \*message*, *size\_t length*);

## DESCRIPTION

These functions perform the quality check for the heimdal database library.

There are two versions of the shared object API; the old version (0) is deprecated, but still supported.  The new version (1) supports multiple password quality checking policies in the same shared object. See below for details.

The password quality checker will run all policies that are configured by the user.  If any policy rejects the password, the password will be rejected.

Policy names are of the form ‘module-name:policy-name’ or, if the the policy name is unique enough, just ‘policy-name’.

## IMPLEMENTING A PASSWORD QUALITY CHECKING SHARED OBJECT

(This refers to the version 1 API only.)

Module shared objects may conveniently be compiled and linked with [libtool(1)](/libtool/1.md). An object needs to export a symbol called ‘kadm5\_password\_verifier’ of the type *struct kadm5\_pw\_policy\_verifier*.

Its *name* and *vendor* fields should contain the obvious information. *name* must match the ‘module-name’ portion of the policy name (the part before the colon), if the policy name contains a colon, or the policy will not be run. *version* should be KADM5\_PASSWD\_VERSION\_V1.

*funcs* contains an array of *struct kadm5\_pw\_policy\_check\_func* structures that is terminated with an entry whose *name* component is NULL. The *name* field of the array must match the ‘policy-name’ portion of a policy name (the part after the colon, or the complete policy name if there is no colon) specified by the user or the policy will not be run.  The *func* fields of the array elements are functions that are exported by the module to be called to check the password.  They get the following arguments:  the Kerberos context, principal, password, a tuning parameter, and a pointer to a message buffer and its length.  The tuning parameter for the quality check function is currently always NULL. If the password is acceptable, the function returns zero.  Otherwise it returns non-zero and fills in the message buffer with an appropriate explanation.

## RUNNING THE CHECKS

**kadm5\_setup\_passwd\_quality\_check** sets up type 0 checks.  It sets up all type 0 checks defined in [krb5.conf(5)](/krb5.conf/5.md) if called with the last two arguments null.

**kadm5\_add\_passwd\_quality\_verifier** sets up type 1 checks.  It sets up all type 1 tests defined in [krb5.conf(5)](/krb5.conf/5.md) if called with a null second argument. **kadm5\_check\_password\_quality** runs the checks in the order in which they are defined in [krb5.conf(5)](/krb5.conf/5.md) and the order in which they occur in a module's *funcs* array until one returns non-zero.

## SEE ALSO

[libtool(1)](/libtool/1.md), [krb5(3)](/krb5/3.md), [krb5.conf(5)](/krb5.conf/5.md)
