2 * Copyright (c) 1998 Christian Esken <esken@kde.org>
3 * Copyright (c) 2003 Oswald Buddenhagen <ossi@kde.org>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the Free
17 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * Copyright (C) 1998, Christian Esken <esken@kde.org>
22 #include "kcheckpass.h"
26 /*******************************************************************
27 * This is the authentication code for /etc/passwd passwords
28 *******************************************************************/
33 AuthReturn
Authenticate(const char *method
,
34 const char *login
, char *(*conv
) (ConvRequest
, const char *))
39 if (strcmp(method
, "classic"))
42 /* Get the password entry for the user we want */
43 if (!(pw
= getpwnam(login
)))
49 if (!(passwd
= conv(ConvGetHidden
, 0)))
52 if (!strcmp(pw
->pw_passwd
, crypt(passwd
, pw
->pw_passwd
))) {
54 return AuthOk
; /* Success */
57 return AuthBad
; /* Password wrong or account locked */