Deleted Added
sdiff udiff text old ( 228690 ) new ( 236099 )
full compact
1/*-
2 * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
3 * Copyright (c) 2004-2011 Dag-Erling Sm��rgrav
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by ThinkSec AS and
7 * Network Associates Laboratories, the Security Research Division of
8 * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035

--- 18 unchanged lines hidden (view full) ---

27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * $Id: pam_get_authtok.c 455 2011-10-29 18:31:11Z des $
36 */
37
38#ifdef HAVE_CONFIG_H
39# include "config.h"
40#endif
41
42#include <sys/param.h>
43
44#include <stdlib.h>
45#include <string.h>
46
47#include <security/pam_appl.h>
48#include <security/openpam.h>
49
50#include "openpam_impl.h"
51
52static const char authtok_prompt[] = "Password:";
53static const char oldauthtok_prompt[] = "Old Password:";
54static const char newauthtok_prompt[] = "New Password:";
55
56/*
57 * OpenPAM extension
58 *
59 * Retrieve authentication token
60 */
61
62int
63pam_get_authtok(pam_handle_t *pamh,
64 int item,
65 const char **authtok,
66 const char *prompt)
67{
68 char prompt_buf[1024];
69 size_t prompt_size;
70 const void *oldauthtok, *prevauthtok, *promptp;
71 const char *prompt_option, *default_prompt;
72 char *resp, *resp2;
73 int pitem, r, style, twice;
74
75 ENTER();
76 if (pamh == NULL || authtok == NULL)
77 RETURNC(PAM_SYSTEM_ERR);
78 *authtok = NULL;
79 twice = 0;
80 switch (item) {
81 case PAM_AUTHTOK:
82 pitem = PAM_AUTHTOK_PROMPT;
83 prompt_option = "authtok_prompt";
84 default_prompt = authtok_prompt;
85 r = pam_get_item(pamh, PAM_OLDAUTHTOK, &oldauthtok);
86 if (r == PAM_SUCCESS && oldauthtok != NULL) {
87 default_prompt = newauthtok_prompt;
88 twice = 1;
89 }
90 break;
91 case PAM_OLDAUTHTOK:
92 pitem = PAM_OLDAUTHTOK_PROMPT;

--- 103 unchanged lines hidden ---