openpam_readline(3)

openpam_readline3

Read a line from a file

Usage

#include <sys/types.h>

#include <stdio.h>

#include <security/pam_appl.h>

#include <security/openpam.h>

char *

openpam_readline(FILE *f, int *lineno, size_t *lenp);

Overview

This function is deprecated and may be removed in a future release without further warning. The openpam_readlinev() function may be used to achieve similar results.

The openpam_readline() function reads a line from a file, and returns it in a NUL-terminated buffer allocated with malloc(3).

The openpam_readline() function performs a certain amount of processing on the data it reads:

  • Comments (introduced by a hash sign) are stripped.

  • Blank lines are ignored.

  • If a line ends in a backslash, the backslash is stripped and the next line is appended.

If lineno is not NULL, the integer variable it points to is incremented every time a newline character is read.

If lenp is not NULL, the length of the line (not including the terminating NUL character) is stored in the variable it points to.

The caller is responsible for releasing the returned buffer by passing it to free(3).

Return values

The openpam_readline() function returns NULL on failure.

Releases

54 releases since FreeBSD 5.2-RELEASE; the text changed 13 times.

  1. 5.2–5.2.1
  2. 5.3–5.5
  3. 6.0–6.3
  4. 6.4
  5. 7.0
  6. 7.1–9.1
  7. 9.2
  8. 9.3–10.0
  9. 10.1–11.2
  10. 11.3–11.4
  11. 12.0–12.2
  12. 12.3–13.2
  13. 13.3–14.5
  14. 15.0–16.0

Standards

The openpam_readline() function is an OpenPAM extension.

Authors

The openpam_readline() function and this manual page were developed for the FreeBSD Project by ThinkSec AS and Network Associates Laboratories, the Security Research Division of Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (“CBOSS”), as part of the DARPA CHATS research program.

The OpenPAM library is maintained by Dag-Erling Smørgrav ⟨[email protected]⟩.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.