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