1.\" $NetBSD: openpam_readline.3,v 1.3 2013/04/06 02:20:25 christos Exp $ 2.\" 3.\"- 4.\" Copyright (c) 2001-2003 Networks Associates Technology, Inc. 5.\" Copyright (c) 2004-2011 Dag-Erling Smørgrav 6.\" All rights reserved. 7.\" 8.\" This software was developed for the FreeBSD Project by ThinkSec AS and 9.\" Network Associates Laboratories, the Security Research Division of 10.\" Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 11.\" ("CBOSS"), as part of the DARPA CHATS research program. 12.\" 13.\" Redistribution and use in source and binary forms, with or without 14.\" modification, are permitted provided that the following conditions 15.\" are met: 16.\" 1. Redistributions of source code must retain the above copyright 17.\" notice, this list of conditions and the following disclaimer. 18.\" 2. Redistributions in binary form must reproduce the above copyright 19.\" notice, this list of conditions and the following disclaimer in the 20.\" documentation and/or other materials provided with the distribution. 21.\" 3. The name of the author may not be used to endorse or promote 22.\" products derived from this software without specific prior written 23.\" permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35.\" SUCH DAMAGE. 36.\" 37.\" Id 38.\" 39.Dd May 26, 2012 40.Dt OPENPAM_READLINE 3 41.Os 42.Sh NAME 43.Nm openpam_readline 44.Nd read a line from a file 45.Sh LIBRARY 46.Lb libpam 47.Sh SYNOPSIS 48.In sys/types.h 49.In stdio.h 50.In security/pam_appl.h 51.In security/openpam.h 52.Ft "char *" 53.Fn openpam_readline "FILE *f" "int *lineno" "size_t *lenp" 54.Sh DESCRIPTION 55.Bf Sy 56This function is deprecated and may be removed in a future release without further warning. 57The 58.Fn openpam_readlinev 59function may be used to achieve similar results. 60.Ef 61.Pp 62The 63.Fn openpam_readline 64function reads a line from a file, and returns it 65in a NUL-terminated buffer allocated with 66.Xr malloc 3 . 67.Pp 68The 69.Fn openpam_readline 70function performs a certain amount of processing 71on the data it reads: 72.Bl -bullet 73.It 74Comments (introduced by a hash sign) are stripped. 75.It 76Blank lines are ignored. 77.It 78If a line ends in a backslash, the backslash is stripped and the 79next line is appended. 80.El 81.Pp 82If 83.Fa lineno 84is not 85.Dv NULL , 86the integer variable it points to is 87incremented every time a newline character is read. 88.Pp 89If 90.Fa lenp 91is not 92.Dv NULL , 93the length of the line (not including the 94terminating NUL character) is stored in the variable it points to. 95.Pp 96The caller is responsible for releasing the returned buffer by passing 97it to 98.Xr free 3 . 99.Pp 100.Sh RETURN VALUES 101The 102.Fn openpam_readline 103function returns 104.Dv NULL 105on failure. 106.Sh SEE ALSO 107.Xr openpam_readlinev 3 , 108.Xr openpam_readword 3 , 109.Xr pam 3 110.Sh STANDARDS 111The 112.Fn openpam_readline 113function is an OpenPAM extension. 114.Sh AUTHORS 115The 116.Fn openpam_readline 117function and this manual page were 118developed for the 119.Fx 120Project by ThinkSec AS and Network Associates Laboratories, the 121Security Research Division of Network Associates, Inc.\& under 122DARPA/SPAWAR contract N66001-01-C-8035 123.Pq Dq CBOSS , 124as part of the DARPA CHATS research program. 125