xref: /freebsd/contrib/openpam/lib/libpam/pam_sm_chauthtok.c (revision 3ba4c8c81a28de3e00ccf6d7f92c6f8e58bef456)
1*f7e6344dSDag-Erling Smørgrav /*-
2*f7e6344dSDag-Erling Smørgrav  * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
3*f7e6344dSDag-Erling Smørgrav  * Copyright (c) 2004-2011 Dag-Erling Smørgrav
4*f7e6344dSDag-Erling Smørgrav  * All rights reserved.
5*f7e6344dSDag-Erling Smørgrav  *
6*f7e6344dSDag-Erling Smørgrav  * This software was developed for the FreeBSD Project by ThinkSec AS and
7*f7e6344dSDag-Erling Smørgrav  * Network Associates Laboratories, the Security Research Division of
8*f7e6344dSDag-Erling Smørgrav  * Network Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035
9*f7e6344dSDag-Erling Smørgrav  * ("CBOSS"), as part of the DARPA CHATS research program.
10*f7e6344dSDag-Erling Smørgrav  *
11*f7e6344dSDag-Erling Smørgrav  * Redistribution and use in source and binary forms, with or without
12*f7e6344dSDag-Erling Smørgrav  * modification, are permitted provided that the following conditions
13*f7e6344dSDag-Erling Smørgrav  * are met:
14*f7e6344dSDag-Erling Smørgrav  * 1. Redistributions of source code must retain the above copyright
15*f7e6344dSDag-Erling Smørgrav  *    notice, this list of conditions and the following disclaimer.
16*f7e6344dSDag-Erling Smørgrav  * 2. Redistributions in binary form must reproduce the above copyright
17*f7e6344dSDag-Erling Smørgrav  *    notice, this list of conditions and the following disclaimer in the
18*f7e6344dSDag-Erling Smørgrav  *    documentation and/or other materials provided with the distribution.
19*f7e6344dSDag-Erling Smørgrav  * 3. The name of the author may not be used to endorse or promote
20*f7e6344dSDag-Erling Smørgrav  *    products derived from this software without specific prior written
21*f7e6344dSDag-Erling Smørgrav  *    permission.
22*f7e6344dSDag-Erling Smørgrav  *
23*f7e6344dSDag-Erling Smørgrav  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24*f7e6344dSDag-Erling Smørgrav  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25*f7e6344dSDag-Erling Smørgrav  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26*f7e6344dSDag-Erling Smørgrav  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27*f7e6344dSDag-Erling Smørgrav  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28*f7e6344dSDag-Erling Smørgrav  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29*f7e6344dSDag-Erling Smørgrav  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30*f7e6344dSDag-Erling Smørgrav  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31*f7e6344dSDag-Erling Smørgrav  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32*f7e6344dSDag-Erling Smørgrav  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33*f7e6344dSDag-Erling Smørgrav  * SUCH DAMAGE.
34*f7e6344dSDag-Erling Smørgrav  */
35*f7e6344dSDag-Erling Smørgrav 
36*f7e6344dSDag-Erling Smørgrav #ifdef HAVE_CONFIG_H
37*f7e6344dSDag-Erling Smørgrav # include "config.h"
38*f7e6344dSDag-Erling Smørgrav #endif
39*f7e6344dSDag-Erling Smørgrav 
40*f7e6344dSDag-Erling Smørgrav #include <sys/param.h>
41*f7e6344dSDag-Erling Smørgrav 
42*f7e6344dSDag-Erling Smørgrav #include <security/pam_appl.h>
43*f7e6344dSDag-Erling Smørgrav #include <security/pam_modules.h>
44*f7e6344dSDag-Erling Smørgrav 
45*f7e6344dSDag-Erling Smørgrav /*
46*f7e6344dSDag-Erling Smørgrav  * XSSO 4.2.2
47*f7e6344dSDag-Erling Smørgrav  * XSSO 6 page 72
48*f7e6344dSDag-Erling Smørgrav  *
49*f7e6344dSDag-Erling Smørgrav  * Service module implementation for pam_chauthtok
50*f7e6344dSDag-Erling Smørgrav  */
51*f7e6344dSDag-Erling Smørgrav 
52*f7e6344dSDag-Erling Smørgrav int
pam_sm_chauthtok(pam_handle_t * pamh,int flags,int argc,const char ** argv)53*f7e6344dSDag-Erling Smørgrav pam_sm_chauthtok(pam_handle_t *pamh,
54*f7e6344dSDag-Erling Smørgrav 	int flags,
55*f7e6344dSDag-Erling Smørgrav 	int argc,
56*f7e6344dSDag-Erling Smørgrav 	const char **argv)
57*f7e6344dSDag-Erling Smørgrav {
58*f7e6344dSDag-Erling Smørgrav 
59*f7e6344dSDag-Erling Smørgrav 	ENTER();
60*f7e6344dSDag-Erling Smørgrav 	RETURNC(PAM_SYSTEM_ERR);
61*f7e6344dSDag-Erling Smørgrav }
62*f7e6344dSDag-Erling Smørgrav 
63*f7e6344dSDag-Erling Smørgrav /*
64*f7e6344dSDag-Erling Smørgrav  * Error codes:
65*f7e6344dSDag-Erling Smørgrav  *
66*f7e6344dSDag-Erling Smørgrav  *	PAM_SERVICE_ERR
67*f7e6344dSDag-Erling Smørgrav  *	PAM_SYSTEM_ERR
68*f7e6344dSDag-Erling Smørgrav  *	PAM_BUF_ERR
69*f7e6344dSDag-Erling Smørgrav  *	PAM_CONV_ERR
70*f7e6344dSDag-Erling Smørgrav  *	PAM_PERM_DENIED
71*f7e6344dSDag-Erling Smørgrav  *	PAM_IGNORE
72*f7e6344dSDag-Erling Smørgrav  *	PAM_ABORT
73*f7e6344dSDag-Erling Smørgrav  *
74*f7e6344dSDag-Erling Smørgrav  *	PAM_PERM_DENIED
75*f7e6344dSDag-Erling Smørgrav  *	PAM_AUTHTOK_ERR
76*f7e6344dSDag-Erling Smørgrav  *	PAM_AUTHTOK_RECOVERY_ERR
77*f7e6344dSDag-Erling Smørgrav  *	PAM_AUTHTOK_LOCK_BUSY
78*f7e6344dSDag-Erling Smørgrav  *	PAM_AUTHTOK_DISABLE_AGING
79*f7e6344dSDag-Erling Smørgrav  *	PAM_TRY_AGAIN
80*f7e6344dSDag-Erling Smørgrav  */
81*f7e6344dSDag-Erling Smørgrav 
82*f7e6344dSDag-Erling Smørgrav /**
83*f7e6344dSDag-Erling Smørgrav  * The =pam_sm_chauthtok function is the service module's implementation
84*f7e6344dSDag-Erling Smørgrav  * of the =pam_chauthtok API function.
85*f7e6344dSDag-Erling Smørgrav  *
86*f7e6344dSDag-Erling Smørgrav  * When the application calls =pam_chauthtok, the service function is
87*f7e6344dSDag-Erling Smørgrav  * called twice, first with the =PAM_PRELIM_CHECK flag set and then again
88*f7e6344dSDag-Erling Smørgrav  * with the =PAM_UPDATE_AUTHTOK flag set.
89*f7e6344dSDag-Erling Smørgrav  */
90