2 * Copyright 2000, International Business Machines Corporation and others.
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
10 #include <afsconfig.h>
11 #include <afs/param.h>
15 #include <security/pam_appl.h>
16 #include <security/pam_modules.h>
18 #include <afs/kautils.h>
20 #include "afs_message.h"
23 static char *fallback_messages
[] = {
24 "AFS Invalid message requested!", /* 0: none */
25 "AFS Unknown option: %s", /* 1: UNKNOWNOPT */
26 "AFS Username unavailable: code = %d", /* 2: NOUSER */
27 "AFS Username = `%s'", /* 3: USERNAMEDEBUG */
28 "AFS Password required but not supplied by user %s\n",
30 "AFS Password: ", /* 5: PWD_PROMPT */
31 "AFS Cannot issue prompt", /* 6: CANNOT_PROMPT */
32 "AFS Trying first password for user %s", /* 7: GOTPASS */
33 "AFS No first password for user %s\n", /* 8: NOFIRSTPASS */
34 "AFS Couldn't get passwd via prompt", /* 9: GETPASS_FAILED */
35 "AFS not available", /* 10: AFS_UNAVAIL */
36 "AFS error code 0x%x", /* 11: AFS_ERROR */
37 "AFS Authentication succeeded.\n", /* 12: LOGIN_OK */
38 "AFS Authentication failed for user %s. %s\n",
39 /* 13: LOGIN_FAILED */
40 "AFS PAM error, code=%d", /* 14: PAMERROR */
41 "AFS uid exceeds OS bounds.\n", /* 15: UID_OVERFLOW */
42 "The AFS PAM module may not be used from a non-MT program.\n",
44 "AFS Options: nowarn=%d, use_first_pass=%d, try_first_pass=%d, ignore_uid = %d, ignore_uid_id = %d, refresh_token=%d, set_token=%d, dont_fork=%d, use_klog=%d",
46 "AFS No pam_conv conversation structure found; no user interaction",
48 "AFS Deleting creds for user %s\n", /* 19: DELCRED */
49 "AFS Refreshing creds", /* 20: REFRESHCRED */
50 "AFS Won't use illegal password for user %s",
52 "AFS Establishing creds for user %s\n", /* 22: ESTABCRED */
53 "AFS credentials established.\n", /* 23: PUT_CREDS */
54 "AFS Couldn't find local cell name", /* 24: NOCELLNAME */
55 "AFS Foreign users are not valid for login.\n",
57 "AFS Ignoring superuser %s", /* 26: IGNORINGROOT */
58 "AFS/local UIDs do not match", /* 27: UID_MISMATCH */
59 "AFS Rejected foreign user %s", /* 28: REJ_FOREIGN */
60 "AFS Deleting leftover creds from previous attempt",
62 "You have no AFS credentials.\n", /* 30: NO_CREDS */
63 "AFS ReInitializing creds for user %s\n", /* 31: REINITCRED */
64 "AFS Failed to set PASSWORD_EXPIRES for user %s\n",
66 "AFS Failed to chown krb ticketfile\n", /* 33: CHOWNKRB */
67 "AFS Failed to set KRBTKTFILE\n", /* 34: KRBFAIL */
68 "AFS Unknown remaining lifetime %s using default %d seconds\n",
69 /* 35: REMAINLIFETIME */
70 "AFS Session closed", /* 36: SESSIONCLOSED1 */
71 "AFS Session closed, Tokens destroyed\n", /* 37: SESSIONCLOSED2 */
72 "AFS Option conflict dont_fork and use_klog: %s\n",
74 "AFS Unknown uid: %s, option ignored\n",
76 "New AFS Password: ", /* 40: NEW_PWD_PROMPT */
77 "New AFS Password (again): ", /* 41: VERIFY_PWD_PROMPT */
78 "Failed to change AFS password", /* 42: KRBPASS_FAIL */
79 "Missing PAM flag: %s", /* 43: FLAGS */
80 "ka error, code=%d", /* 44: KAERROR */
81 "Passwords are not equal", /* 45: NE_PASSWORD */
82 "AFS ignoring unregistered user %s\n" /* 46: IGNORE_UNREG */
83 "Alternate cell name: %s\n", /* 47: OTHERCELL */
86 static int num_fallbacks
= sizeof(fallback_messages
) / sizeof(char *);
90 pam_afs_message(int msgnum
, int *freeit
)
93 * This really should try to get an NLS message from the message catalog.
94 * For now, just return a fallback message.
97 if (msgnum
> num_fallbacks
|| msgnum
< 1)
102 return fallback_messages
[msgnum
];
107 pam_afs_syslog(int priority
, int msgid
, ...)
113 msg
= pam_afs_message(msgid
, &freeit
);
114 va_start(args
, msgid
);
115 vsyslog(priority
, msg
, args
);