2 * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
5 * This software was developed for the FreeBSD Project by ThinkSec AS and
6 * Network Associates Laboratories, the Security Research Division of
7 * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
8 * ("CBOSS"), as part of the DARPA CHATS research program.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote
19 * products derived from this software without specific prior written
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * $P4: //depot/projects/openpam/lib/pam_strerror.c#13 $
39 #include <security/pam_appl.h>
41 #include "openpam_impl.h"
43 const char *_pam_err_name
[PAM_NUM_ERRORS
] = {
54 "PAM_NEW_AUTHTOK_REQD",
55 "PAM_CRED_INSUFFICIENT",
56 "PAM_AUTHINFO_UNAVAIL",
62 "PAM_AUTHTOK_EXPIRED",
65 "PAM_AUTHTOK_RECOVERY_ERR",
66 "PAM_AUTHTOK_LOCK_BUSY",
67 "PAM_AUTHTOK_DISABLE_AGING",
80 * Get PAM standard error message string
84 pam_strerror(pam_handle_t
*pamh
,
87 static char unknown
[16];
91 switch (error_number
) {
95 return ("failed to load module");
97 return ("invalid symbol");
99 return ("error in service module");
101 return ("system error");
103 return ("memory buffer error");
105 return ("conversation failure");
106 case PAM_PERM_DENIED
:
107 return ("permission denied");
109 return ("maximum number of tries exceeded");
111 return ("authentication error");
112 case PAM_NEW_AUTHTOK_REQD
:
113 return ("new authentication token required");
114 case PAM_CRED_INSUFFICIENT
:
115 return ("insufficient credentials");
116 case PAM_AUTHINFO_UNAVAIL
:
117 return ("authentication information is unavailable");
118 case PAM_USER_UNKNOWN
:
119 return ("unknown user");
120 case PAM_CRED_UNAVAIL
:
121 return ("failed to retrieve user credentials");
122 case PAM_CRED_EXPIRED
:
123 return ("user credentials have expired");
125 return ("failed to set user credentials");
126 case PAM_ACCT_EXPIRED
:
127 return ("user account has expired");
128 case PAM_AUTHTOK_EXPIRED
:
129 return ("password has expired");
130 case PAM_SESSION_ERR
:
131 return ("session failure");
132 case PAM_AUTHTOK_ERR
:
133 return ("authentication token failure");
134 case PAM_AUTHTOK_RECOVERY_ERR
:
135 return ("failed to recover old authentication token");
136 case PAM_AUTHTOK_LOCK_BUSY
:
137 return ("authentication token lock busy");
138 case PAM_AUTHTOK_DISABLE_AGING
:
139 return ("authentication token aging disabled");
140 case PAM_NO_MODULE_DATA
:
141 return ("module data not found");
143 return ("ignore this module");
145 return ("general failure");
147 return ("try again");
148 case PAM_MODULE_UNKNOWN
:
149 return ("unknown module type");
150 case PAM_DOMAIN_UNKNOWN
:
151 return ("unknown authentication domain");
153 snprintf(unknown
, sizeof unknown
, "#%d", error_number
);
159 * The =pam_strerror function returns a pointer to a string containing a
160 * textual description of the error indicated by the =error_number
161 * argument, in the context of the PAM transaction described by the =pamh