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 <security/pam_appl.h>
11 #include <security/pam_modules.h>
17 #include <afs/param.h>
18 #include <sys/param.h>
19 #include <afs/kautils.h>
21 #include "afs_message.h"
24 static char *fallback_messages[] = {
25 "AFS Invalid message requested!", /* 0: none */
26 "AFS Unknown option: %s", /* 1: UNKNOWNOPT */
27 "AFS Username unavailable: code = %d", /* 2: NOUSER */
28 "AFS Username = `%s'", /* 3: USERNAMEDEBUG */
29 "AFS Password required but not supplied by user %s\n",
31 "AFS Password: ", /* 5: PWD_PROMPT */
32 "AFS Cannot issue prompt", /* 6: CANNOT_PROMPT */
33 "AFS Trying first password for user %s", /* 7: GOTPASS */
34 "AFS No first password for user %s\n", /* 8: NOFIRSTPASS */
35 "AFS Couldn't get passwd via prompt", /* 9: GETPASS_FAILED */
36 "AFS not available", /* 10: AFS_UNAVAIL */
37 "AFS error code 0x%x", /* 11: AFS_ERROR */
38 "AFS Authentication succeeded.\n", /* 12: LOGIN_OK */
39 "AFS Authentication failed for user %s %s\n",
40 /* 13: LOGIN_FAILED */
41 "AFS PAM error, code=%d", /* 14: PAMERROR */
42 "AFS uid exceeds OS bounds.\n", /* 15: UID_OVERFLOW */
43 "The AFS PAM module may not be used from a non-MT program.\n",
45 "AFS Options: nowarn=%d, use_first_pass=%d, try_first_pass=%d",
47 "AFS No pam_conv conversation structure found; no user interaction",
49 "AFS Deleting creds for user %s\n", /* 19: DELCRED */
50 "AFS Refreshing creds", /* 20: REFRESHCRED */
51 "AFS Won't use illegal password for user %s",
53 "AFS Establishing creds for user %s\n", /* 22: ESTABCRED */
54 "AFS credentials established.\n", /* 23: PUT_CREDS */
55 "AFS Couldn't find local cell name", /* 24: NOCELLNAME */
56 "AFS Foreign users are not valid for login.\n",
58 "AFS Ignoring superuser %s", /* 26: IGNORINGROOT */
59 "AFS/local UIDs do not match", /* 27: UID_MISMATCH */
60 "AFS Rejected foreign user %s", /* 28: REJ_FOREIGN */
61 "AFS Deleting leftover creds from previous attempt",
63 "You have no AFS credentials.\n", /* 30: NO_CREDS */
64 "AFS ReInitializing creds for user %s\n", /* 31: REINITCRED */
65 "AFS Failed to set PASSWORD_EXPIRES for user %s\n",
71 "AFS blindly trusting user %s\n", /* 35: TRUSTROOT */
72 "New AFS Password: ", /* 36: NEW_PWD_PROMPT */
73 "New AFS Password (again): ", /* 37: VERIFY_PWD_PROMPT */
74 "Failed to change AFS password", /* 38: KRBPASS_FAIL */
75 "Missing PAM flag: %s", /* 39: FLAGS */
76 "ka error, code=%d", /* 40: KAERROR */
77 "Passwords are not equal" /* 41: NE_PASSWORD */
80 static int num_fallbacks = sizeof(fallback_messages)/sizeof(char *);
83 char *pam_afs_message(int msgnum, int *freeit)
86 * This really should try to get an NLS message from the message catalog.
87 * For now, just return a fallback message.
90 if (msgnum > num_fallbacks || msgnum < 1) msgnum = 0;
92 if (freeit != NULL) *freeit = 0;
93 return fallback_messages[msgnum];
97 void pam_afs_syslog(int priority, int msgid, ...)
103 msg = pam_afs_message(msgid, &freeit);
104 va_start(args, msgid);
105 vsyslog(priority, msg, args);
107 if (freeit) free(msg);