2 * Copyright (c) 2001 Reza Arbab <arbab@austin.ibm.com>
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.
21 #include "kcheckpass.h"
30 * The AIX builtin authenticate() uses whichever method the system
31 * has been configured for. (/etc/passwd, DCE, etc.)
33 int authenticate(const char *, const char *, int *, char **);
35 AuthReturn
Authenticate(const char *method
,
36 const char *login
, char *(*conv
) (ConvRequest
, const char *))
39 int reenter
; /* Tells if authenticate is done processing or not. */
41 char *msg
; /* Contains a prompt message or failure reason. */
43 if (!strcmp(method
, "classic")) {
45 if (!(passwd
= conv(ConvGetHidden
, 0)))
48 if ((result
= authenticate(login
, passwd
, &reenter
, &msg
))) {
50 conv(ConvPutError
, msg
);
58 snprintf(buf
, sizeof(buf
), "More authentication data requested: %s\n", msg
);
59 conv(ConvPutError
, buf
);
62 return result
== ENOENT
|| result
== ESAD
? AuthBad
: AuthError
;
67 } else if (!strcmp(method
, "generic")) {
70 if ((result
= authenticate(login
, passwd
, &reenter
, &msg
))) {
72 conv(ConvPutError
, msg
);
77 return result
== ENOENT
|| result
== ESAD
? AuthBad
: AuthError
;
83 passwd
= conv(ConvGetHidden
, msg
);