Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / libpam / libpam / pam_strerror.c
1 /* pam_strerror.c */
2
3 /* $Id: pam_strerror.c,v 1.6 1997/01/04 20:12:02 morgan Exp morgan $
4  * $FreeBSD: src/contrib/libpam/libpam/pam_strerror.c,v 1.1.1.1.6.2 2001/06/11 15:28:12 markm Exp $
5  *
6  * $Log: pam_strerror.c,v $
7  * Revision 1.6  1997/01/04 20:12:02  morgan
8  * replaced conditional FAIL_NOW with ABORT
9  *
10  * Revision 1.5  1996/07/07 23:58:56  morgan
11  * corrected "... " to "..."
12  *
13  * Revision 1.4  1996/06/02 08:03:29  morgan
14  * spelling correction
15  *
16  * Revision 1.3  1996/03/16 23:08:54  morgan
17  * PAM --> Linux-PAM ;)
18  *
19  */
20
21 #include "pam_private.h"
22
23 const char *pam_strerror(pam_handle_t *pamh, int errnum)
24 {
25 #ifdef UGLY_HACK_FOR_PRIOR_BEHAVIOR_SUPPORT  /* will be removed from v 1.0 */
26
27     int possible_error;
28
29     possible_error = (int) pamh;
30     if (!(possible_error >= 0 && possible_error <= PAM_BAD_ITEM)) {
31         possible_error = errnum;
32     }
33
34 /* mask standard behavior to use possible_error variable. */
35 #define errnum possible_error
36
37 #endif /* UGLY_HACK_FOR_PRIOR_BEHAVIOR_SUPPORT */
38
39     switch (errnum) {
40     case PAM_SUCCESS:
41         return "Success";
42     case PAM_ABORT:
43         return "Critical error - immediate abort";
44     case PAM_OPEN_ERR:
45         return "dlopen() failure";
46     case PAM_SYMBOL_ERR:
47         return "Symbol not found";
48     case PAM_SERVICE_ERR:
49         return "Error in service module";
50     case PAM_SYSTEM_ERR:
51         return "System error";
52     case PAM_BUF_ERR:
53         return "Memory buffer error";
54     case PAM_PERM_DENIED:
55         return "Permission denied";
56     case PAM_AUTH_ERR:
57         return "Authentication failure";
58     case PAM_CRED_INSUFFICIENT:
59         return "Insufficient credentials to access authentication data";
60     case PAM_AUTHINFO_UNAVAIL:
61         return "Authentication service cannot retrieve authentication info.";
62     case PAM_USER_UNKNOWN:
63         return "User not known to the underlying authentication module";
64     case PAM_MAXTRIES:
65         return "Have exhasted maximum number of retries for service.";
66     case PAM_NEW_AUTHTOK_REQD:
67         return "Authentication token is no longer valid; new one required.";
68     case PAM_ACCT_EXPIRED:
69         return "User account has expired";
70     case PAM_SESSION_ERR:
71         return "Cannot make/remove an entry for the specified session";
72     case PAM_CRED_UNAVAIL:
73         return "Authentication service cannot retrieve user credentials";
74     case PAM_CRED_EXPIRED:
75         return "User credentials expired";
76     case PAM_CRED_ERR:
77         return "Failure setting user credentials";
78     case PAM_NO_MODULE_DATA:
79         return "No module specific data is present";
80     case PAM_BAD_ITEM:
81         return "Bad item passed to pam_*_item()";
82     case PAM_CONV_ERR:
83         return "Conversation error";
84     case PAM_AUTHTOK_ERR:
85         return "Authentication token manipulation error";
86     case PAM_AUTHTOK_RECOVER_ERR:
87         return "Authentication information cannot be recovered";
88     case PAM_AUTHTOK_LOCK_BUSY:
89         return "Authentication token lock busy";
90     case PAM_AUTHTOK_DISABLE_AGING:
91         return "Authentication token aging disabled";
92     case PAM_TRY_AGAIN:
93         return "Failed preliminary check by password service";
94     case PAM_IGNORE:
95         return "Please ignore underlying account module";
96     case PAM_MODULE_UNKNOWN:
97         return "Module is unknown";
98     case PAM_AUTHTOK_EXPIRED:
99         return "Authentication token expired";
100     case PAM_CONV_AGAIN:
101         return "Conversation is waiting for event";
102     case PAM_INCOMPLETE:
103         return "Application needs to call libpam again";
104     }
105
106     return "Unknown Linux-PAM error (need to upgrde libpam?)";
107 }