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