110b5fe87SSascha Wildner.\" Generated from openpam_subst.c by gendoc.pl 210b5fe87SSascha Wildner.\" $OpenPAM: openpam_subst.c 938 2017-04-30 21:34:42Z des $ 3*4c84ab30SSascha Wildner.Dd February 24, 2019 4a474e9feSPeter Avalos.Dt OPENPAM_SUBST 3 5a474e9feSPeter Avalos.Os 6a474e9feSPeter Avalos.Sh NAME 7a474e9feSPeter Avalos.Nm openpam_subst 8a474e9feSPeter Avalos.Nd substitute PAM item values in a string 9a474e9feSPeter Avalos.Sh SYNOPSIS 10a474e9feSPeter Avalos.In sys/types.h 11a474e9feSPeter Avalos.In security/pam_appl.h 12a474e9feSPeter Avalos.In security/openpam.h 13a474e9feSPeter Avalos.Ft "int" 14a474e9feSPeter Avalos.Fn openpam_subst "const pam_handle_t *pamh" "char *buf" "size_t *bufsize" "const char *template" 15a474e9feSPeter Avalos.Sh DESCRIPTION 16a474e9feSPeter AvalosThe 17577efdeeSPeter Avalos.Fn openpam_subst 18a474e9feSPeter Avalosfunction expands a string, substituting PAM item 19a474e9feSPeter Avalosvalues for all occurrences of specific substitution codes. 20a474e9feSPeter AvalosThe 21a474e9feSPeter Avalos.Fa template 22a474e9feSPeter Avalosargument points to the initial string. 23a474e9feSPeter AvalosThe result is stored in the buffer pointed to by the 24a474e9feSPeter Avalos.Fa buf 25a474e9feSPeter Avalosargument; the 26a474e9feSPeter Avalos.Fa bufsize 27a474e9feSPeter Avalosargument specifies the size of that buffer. 28a474e9feSPeter AvalosThe actual size of the resulting string, including the terminating NUL 29a474e9feSPeter Avaloscharacter, is stored in the location pointed to by the 30a474e9feSPeter Avalos.Fa bufsize 31a474e9feSPeter Avalosargument. 32a474e9feSPeter Avalos.Pp 33a474e9feSPeter AvalosIf 34a474e9feSPeter Avalos.Fa buf 35a474e9feSPeter Avalosis NULL, or if the buffer is too small to hold the expanded 36a474e9feSPeter Avalosstring, 37a474e9feSPeter Avalos.Fa bufsize 38a474e9feSPeter Avalosis updated to reflect the amount of space required to 39a474e9feSPeter Avaloshold the entire string, and 40577efdeeSPeter Avalos.Fn openpam_subst 41a474e9feSPeter Avalosreturns 42a474e9feSPeter Avalos.Dv PAM_TRY_AGAIN . 43a474e9feSPeter Avalos.Pp 44a474e9feSPeter AvalosIf 45577efdeeSPeter Avalos.Fn openpam_subst 46a474e9feSPeter Avalosfails for any other reason, the 47a474e9feSPeter Avalos.Fa bufsize 48a474e9feSPeter Avalosargument is 49a474e9feSPeter Avalosuntouched, but part of the buffer may still have been overwritten. 50a474e9feSPeter Avalos.Pp 51a474e9feSPeter AvalosSubstitution codes are introduced by a percent character and correspond 52a474e9feSPeter Avalosto PAM items: 53a474e9feSPeter Avalos.Bl -tag -width 18n 54a474e9feSPeter Avalos.It \&%H 55a474e9feSPeter AvalosReplaced by the current value of the 56a474e9feSPeter Avalos.Dv PAM_RHOST 57a474e9feSPeter Avalositem. 58a474e9feSPeter Avalos.It \&%h 59a474e9feSPeter AvalosReplaced by the current value of the 60a474e9feSPeter Avalos.Dv PAM_HOST 61a474e9feSPeter Avalositem. 62a474e9feSPeter Avalos.It \&%s 63a474e9feSPeter AvalosReplaced by the current value of the 64a474e9feSPeter Avalos.Dv PAM_SERVICE 65a474e9feSPeter Avalositem. 66a474e9feSPeter Avalos.It \&%t 67a474e9feSPeter AvalosReplaced by the current value of the 68a474e9feSPeter Avalos.Dv PAM_TTY 69a474e9feSPeter Avalositem. 70a474e9feSPeter Avalos.It \&%U 71a474e9feSPeter AvalosReplaced by the current value of the 72a474e9feSPeter Avalos.Dv PAM_RUSER 73a474e9feSPeter Avalositem. 74a474e9feSPeter Avalos.It \&%u 75a474e9feSPeter AvalosReplaced by the current value of the 76a474e9feSPeter Avalos.Dv PAM_USER 77a474e9feSPeter Avalositem. 78a474e9feSPeter Avalos.El 79a474e9feSPeter Avalos.Sh RETURN VALUES 80a474e9feSPeter AvalosThe 81577efdeeSPeter Avalos.Fn openpam_subst 82a474e9feSPeter Avalosfunction returns one of the following values: 83a474e9feSPeter Avalos.Bl -tag -width 18n 8410b5fe87SSascha Wildner.It Bq Er PAM_SUCCESS 8510b5fe87SSascha WildnerSuccess. 8610b5fe87SSascha Wildner.It Bq Er PAM_BAD_ITEM 8710b5fe87SSascha WildnerUnrecognized or restricted item. 88a474e9feSPeter Avalos.It Bq Er PAM_TRY_AGAIN 89a474e9feSPeter AvalosTry again. 90a474e9feSPeter Avalos.El 91a474e9feSPeter Avalos.Sh SEE ALSO 92a474e9feSPeter Avalos.Xr pam 3 , 93a474e9feSPeter Avalos.Xr pam_get_authtok 3 , 94a474e9feSPeter Avalos.Xr pam_get_item 3 , 95a474e9feSPeter Avalos.Xr pam_get_user 3 , 96a474e9feSPeter Avalos.Xr pam_strerror 3 97a474e9feSPeter Avalos.Sh STANDARDS 98a474e9feSPeter AvalosThe 99577efdeeSPeter Avalos.Fn openpam_subst 100a474e9feSPeter Avalosfunction is an OpenPAM extension. 101a474e9feSPeter Avalos.Sh AUTHORS 102a474e9feSPeter AvalosThe 103577efdeeSPeter Avalos.Fn openpam_subst 104577efdeeSPeter Avalosfunction and this manual page were 105577efdeeSPeter Avalosdeveloped by 10610b5fe87SSascha Wildner.An Dag-Erling Sm\(/orgrav Aq Mt des@des.no . 107