xref: /netbsd-src/external/bsd/openpam/dist/doc/man/pam_get_authtok.3 (revision 0d9d0fd8a30be9a1924e715bbcf67a4a83efd262)
1*0d9d0fd8Schristos.\"	$NetBSD: pam_get_authtok.3,v 1.10 2023/06/30 21:46:20 christos Exp $
244269bb5Schristos.\"
38fa0fefeSchristos.\" Generated from pam_get_authtok.c by gendoc.pl
4*0d9d0fd8Schristos.Dd June 27, 2023
544269bb5Schristos.Dt PAM_GET_AUTHTOK 3
644269bb5Schristos.Os
744269bb5Schristos.Sh NAME
844269bb5Schristos.Nm pam_get_authtok
944269bb5Schristos.Nd retrieve authentication token
1044269bb5Schristos.Sh SYNOPSIS
1144269bb5Schristos.In sys/types.h
1244269bb5Schristos.In security/pam_appl.h
1344269bb5Schristos.Ft "int"
1444269bb5Schristos.Fn pam_get_authtok "pam_handle_t *pamh" "int item" "const char **authtok" "const char *prompt"
1544269bb5Schristos.Sh DESCRIPTION
1644269bb5SchristosThe
17e1b25b17Schristos.Fn pam_get_authtok
188fa0fefeSchristosfunction either prompts the user for an
198fa0fefeSchristosauthentication token or retrieves a cached authentication token,
208fa0fefeSchristosdepending on circumstances.
2144269bb5SchristosEither way, a pointer to the authentication token is stored in the
2244269bb5Schristoslocation pointed to by the
2344269bb5Schristos.Fa authtok
248fa0fefeSchristosargument, and the corresponding PAM
258fa0fefeSchristositem is updated.
2644269bb5Schristos.Pp
2744269bb5SchristosThe
2844269bb5Schristos.Fa item
2944269bb5Schristosargument must have one of the following values:
3044269bb5Schristos.Bl -tag -width 18n
3144269bb5Schristos.It Dv PAM_AUTHTOK
3244269bb5SchristosReturns the current authentication token, or the new token
3344269bb5Schristoswhen changing authentication tokens.
3444269bb5Schristos.It Dv PAM_OLDAUTHTOK
3544269bb5SchristosReturns the previous authentication token when changing
3644269bb5Schristosauthentication tokens.
3744269bb5Schristos.El
3844269bb5Schristos.Pp
3944269bb5SchristosThe
4044269bb5Schristos.Fa prompt
4144269bb5Schristosargument specifies a prompt to use if no token is cached.
4244269bb5SchristosIf it is
4344269bb5Schristos.Dv NULL ,
4444269bb5Schristosthe
4544269bb5Schristos.Dv PAM_AUTHTOK_PROMPT
4644269bb5Schristosor
4744269bb5Schristos.Dv PAM_OLDAUTHTOK_PROMPT
4844269bb5Schristositem,
4944269bb5Schristosas appropriate, will be used.
5044269bb5SchristosIf that item is also
5144269bb5Schristos.Dv NULL ,
5244269bb5Schristosa hardcoded default prompt will be used.
538fa0fefeSchristosAdditionally, when
54e1b25b17Schristos.Fn pam_get_authtok
558fa0fefeSchristosis called from a service module,
568fa0fefeSchristosthe prompt may be affected by module options as described below.
578fa0fefeSchristosThe prompt is then expanded using
588fa0fefeSchristos.Xr openpam_subst 3
598fa0fefeSchristosbefore it is passed to
608fa0fefeSchristosthe conversation function.
6144269bb5Schristos.Pp
6244269bb5SchristosIf
6344269bb5Schristos.Fa item
6444269bb5Schristosis set to
6544269bb5Schristos.Dv PAM_AUTHTOK
6644269bb5Schristosand there is a non-null
6744269bb5Schristos.Dv PAM_OLDAUTHTOK
6844269bb5Schristositem,
69e1b25b17Schristos.Fn pam_get_authtok
7044269bb5Schristoswill ask the user to confirm the new token by
7144269bb5Schristosretyping it.
7244269bb5SchristosIf there is a mismatch,
73e1b25b17Schristos.Fn pam_get_authtok
7444269bb5Schristoswill return
7544269bb5Schristos.Dv PAM_TRY_AGAIN .
768fa0fefeSchristos.Sh MODULE OPTIONS
778fa0fefeSchristosWhen called by a service module,
788fa0fefeSchristos.Fn pam_get_authtok
798fa0fefeSchristoswill recognize the
808fa0fefeSchristosfollowing module options:
818fa0fefeSchristos.Bl -tag -width 18n
828fa0fefeSchristos.It Dv authtok_prompt
838fa0fefeSchristosPrompt to use when
848fa0fefeSchristos.Fa item
858fa0fefeSchristosis set to
868fa0fefeSchristos.Dv PAM_AUTHTOK .
878fa0fefeSchristosThis option overrides both the
888fa0fefeSchristos.Fa prompt
898fa0fefeSchristosargument and the
908fa0fefeSchristos.Dv PAM_AUTHTOK_PROMPT
918fa0fefeSchristositem.
928fa0fefeSchristos.It Dv echo_pass
938fa0fefeSchristosIf the application's conversation function allows it, this
948fa0fefeSchristoslets the user see what they are typing.
958fa0fefeSchristosThis should only be used for non-reusable authentication
968fa0fefeSchristostokens.
978fa0fefeSchristos.It Dv oldauthtok_prompt
988fa0fefeSchristosPrompt to use when
998fa0fefeSchristos.Fa item
1008fa0fefeSchristosis set to
1018fa0fefeSchristos.Dv PAM_OLDAUTHTOK .
1028fa0fefeSchristosThis option overrides both the
1038fa0fefeSchristos.Fa prompt
1048fa0fefeSchristosargument and the
1058fa0fefeSchristos.Dv PAM_OLDAUTHTOK_PROMPT
1068fa0fefeSchristositem.
1078fa0fefeSchristos.It Dv try_first_pass
1088fa0fefeSchristosIf the requested item is non-null, return it without
1098fa0fefeSchristosprompting the user.
1108fa0fefeSchristosTypically, the service module will verify the token, and
1118fa0fefeSchristosif it does not match, clear the item before calling
1128fa0fefeSchristos.Fn pam_get_authtok
1138fa0fefeSchristosa second time.
1148fa0fefeSchristos.It Dv use_first_pass
1158fa0fefeSchristosDo not prompt the user at all; just return the cached
1168fa0fefeSchristosvalue, or
1178fa0fefeSchristos.Dv PAM_AUTH_ERR
1188fa0fefeSchristosif there is none.
1198fa0fefeSchristos.El
12044269bb5Schristos.Sh RETURN VALUES
12144269bb5SchristosThe
122e1b25b17Schristos.Fn pam_get_authtok
12344269bb5Schristosfunction returns one of the following values:
12444269bb5Schristos.Bl -tag -width 18n
1254cb4af11Schristos.It Bq Er PAM_SUCCESS
1264cb4af11SchristosSuccess.
1274cb4af11Schristos.It Bq Er PAM_BAD_CONSTANT
1284cb4af11SchristosBad constant.
1294cb4af11Schristos.It Bq Er PAM_BAD_ITEM
1304cb4af11SchristosUnrecognized or restricted item.
13144269bb5Schristos.It Bq Er PAM_BUF_ERR
13244269bb5SchristosMemory buffer error.
13344269bb5Schristos.It Bq Er PAM_CONV_ERR
13444269bb5SchristosConversation failure.
13544269bb5Schristos.It Bq Er PAM_SYSTEM_ERR
13644269bb5SchristosSystem error.
13744269bb5Schristos.It Bq Er PAM_TRY_AGAIN
13844269bb5SchristosTry again.
13944269bb5Schristos.El
14044269bb5Schristos.Sh SEE ALSO
1418fa0fefeSchristos.Xr openpam_get_option 3 ,
14244269bb5Schristos.Xr openpam_subst 3 ,
14344269bb5Schristos.Xr pam 3 ,
1448fa0fefeSchristos.Xr pam_conv 3 ,
14544269bb5Schristos.Xr pam_get_item 3 ,
14644269bb5Schristos.Xr pam_get_user 3 ,
14744269bb5Schristos.Xr pam_strerror 3
14844269bb5Schristos.Sh STANDARDS
14944269bb5SchristosThe
150e1b25b17Schristos.Fn pam_get_authtok
15144269bb5Schristosfunction is an OpenPAM extension.
15244269bb5Schristos.Sh AUTHORS
15344269bb5SchristosThe
154e1b25b17Schristos.Fn pam_get_authtok
155e1b25b17Schristosfunction and this manual page were
156e1b25b17Schristosdeveloped for the
15744269bb5Schristos.Fx
158e1b25b17SchristosProject by ThinkSec AS and Network Associates Laboratories, the
15944269bb5SchristosSecurity Research Division of Network Associates, Inc.\& under
16044269bb5SchristosDARPA/SPAWAR contract N66001-01-C-8035
16144269bb5Schristos.Pq Dq CBOSS ,
16244269bb5Schristosas part of the DARPA CHATS research program.
1638fa0fefeSchristos.Pp
1648fa0fefeSchristosThe OpenPAM library is maintained by
1654cb4af11Schristos.An Dag-Erling Sm\(/orgrav Aq Mt des@des.no .
166