Commit | Line | Data |
---|---|---|
805e021f CE |
1 | /* |
2 | * Copyright 2000, International Business Machines Corporation and others. | |
3 | * All Rights Reserved. | |
4 | * | |
5 | * This software has been released under the terms of the IBM Public | |
6 | * License. For details, see the LICENSE file in the top-level source | |
7 | * directory or online at http://www.openafs.org/dl/license10.html | |
8 | */ | |
9 | ||
10 | #include <afsconfig.h> | |
11 | #include <afs/param.h> | |
12 | ||
13 | ||
14 | #if defined(AFS_AIX41_ENV) | |
15 | #include <sys/types.h> | |
16 | #include <sys/param.h> | |
17 | #include <stdio.h> | |
18 | #include <locale.h> | |
19 | #include <nl_types.h> | |
20 | #include <pwd.h> | |
21 | #include <netdb.h> | |
22 | #include <sys/socket.h> | |
23 | #include <sys/file.h> | |
24 | #include <errno.h> | |
25 | #include <usersec.h> | |
26 | ||
27 | #include <afs/kauth.h> | |
28 | #include <afs/kautils.h> | |
29 | ||
30 | #include "aix_auth_prototypes.h" | |
31 | ||
32 | int | |
33 | afs_authenticate(char *userName, char *response, int *reenter, char **message) | |
34 | { | |
35 | char *reason, *pword, prompt[256]; | |
36 | struct passwd *pwd; | |
37 | int code, unixauthneeded, password_expires = -1; | |
38 | ||
39 | *reenter = 0; | |
40 | *message = (char *)0; | |
41 | if (response) { | |
42 | pword = response; | |
43 | } else { | |
44 | sprintf(prompt, "Enter AFS password for %s: ", userName); | |
45 | pword = getpass(prompt); | |
46 | if (strlen(pword) == 0) { | |
47 | printf | |
48 | ("Unable to read password because zero length passord is illegal\n"); | |
49 | *message = malloc(256); | |
50 | sprintf(*message, | |
51 | "Unable to read password because zero length passord is illegal\n"); | |
52 | return AUTH_FAILURE; | |
53 | } | |
54 | } | |
55 | ||
56 | if ((pwd = getpwnam(userName)) == NULL) { | |
57 | *message = malloc(256); | |
58 | sprintf(*message, "getpwnam for user failed\n"); | |
59 | return AUTH_FAILURE; | |
60 | } | |
61 | ||
62 | if (code = | |
63 | ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION + KA_USERAUTH_DOSETPAG, | |
64 | userName, (char *)0, (char *)0, pword, 0, | |
65 | &password_expires, 0, &reason)) { | |
66 | if (code == KANOENT) | |
67 | return AUTH_NOTFOUND; | |
68 | *message = malloc(1024); | |
69 | sprintf(*message, "Unable to authenticate to AFS because %s.\n", | |
70 | reason); | |
71 | return AUTH_FAILURE; | |
72 | } | |
73 | aix_ktc_setup_ticket_file(userName); | |
74 | return AUTH_SUCCESS; | |
75 | } | |
76 | ||
77 | int | |
78 | afs_chpass(char *userName, char *oldPasswd, char *newPasswd, char **message) | |
79 | { | |
80 | return AUTH_SUCCESS; | |
81 | } | |
82 | ||
83 | int | |
84 | afs_passwdexpired(char *userName, char **message) | |
85 | { | |
86 | return AUTH_SUCCESS; | |
87 | } | |
88 | ||
89 | int | |
90 | afs_passwdrestrictions(char *userName, char *newPasswd, char *oldPasswd, | |
91 | char **message) | |
92 | { | |
93 | return AUTH_SUCCESS; | |
94 | } | |
95 | ||
96 | char * | |
97 | afs_getpasswd(char * userName) | |
98 | { | |
99 | errno = ENOSYS; | |
100 | return NULL; | |
101 | } | |
102 | ||
103 | #endif /* AFS_AIX41_ENV */ |