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