1*0d9d0fd8Schristos /* $NetBSD: openpam_constants.c,v 1.4 2023/06/30 21:46:20 christos Exp $ */ 2201780c4Schristos 376e8c542Schristos /*- 476e8c542Schristos * Copyright (c) 2001-2003 Networks Associates Technology, Inc. 54cb4af11Schristos * Copyright (c) 2004-2017 Dag-Erling Smørgrav 676e8c542Schristos * All rights reserved. 776e8c542Schristos * 876e8c542Schristos * This software was developed for the FreeBSD Project by ThinkSec AS and 976e8c542Schristos * Network Associates Laboratories, the Security Research Division of 1076e8c542Schristos * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 1176e8c542Schristos * ("CBOSS"), as part of the DARPA CHATS research program. 1276e8c542Schristos * 1376e8c542Schristos * Redistribution and use in source and binary forms, with or without 1476e8c542Schristos * modification, are permitted provided that the following conditions 1576e8c542Schristos * are met: 1676e8c542Schristos * 1. Redistributions of source code must retain the above copyright 1776e8c542Schristos * notice, this list of conditions and the following disclaimer. 1876e8c542Schristos * 2. Redistributions in binary form must reproduce the above copyright 1976e8c542Schristos * notice, this list of conditions and the following disclaimer in the 2076e8c542Schristos * documentation and/or other materials provided with the distribution. 2176e8c542Schristos * 3. The name of the author may not be used to endorse or promote 2276e8c542Schristos * products derived from this software without specific prior written 2376e8c542Schristos * permission. 2476e8c542Schristos * 2576e8c542Schristos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2676e8c542Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2776e8c542Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2876e8c542Schristos * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2976e8c542Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3076e8c542Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3176e8c542Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3276e8c542Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3376e8c542Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3476e8c542Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3576e8c542Schristos * SUCH DAMAGE. 3676e8c542Schristos */ 3776e8c542Schristos 3876e8c542Schristos #ifdef HAVE_CONFIG_H 3976e8c542Schristos # include "config.h" 4076e8c542Schristos #endif 4176e8c542Schristos 42201780c4Schristos #include <sys/cdefs.h> 43*0d9d0fd8Schristos __RCSID("$NetBSD: openpam_constants.c,v 1.4 2023/06/30 21:46:20 christos Exp $"); 44201780c4Schristos 4576e8c542Schristos #include <security/pam_appl.h> 4676e8c542Schristos 4776e8c542Schristos #include "openpam_impl.h" 4876e8c542Schristos 4976e8c542Schristos const char *pam_err_name[PAM_NUM_ERRORS] = { 504cb4af11Schristos [PAM_SUCCESS] = "PAM_SUCCESS", 514cb4af11Schristos [PAM_OPEN_ERR] = "PAM_OPEN_ERR", 524cb4af11Schristos [PAM_SYMBOL_ERR] = "PAM_SYMBOL_ERR", 534cb4af11Schristos [PAM_SERVICE_ERR] = "PAM_SERVICE_ERR", 544cb4af11Schristos [PAM_SYSTEM_ERR] = "PAM_SYSTEM_ERR", 554cb4af11Schristos [PAM_BUF_ERR] = "PAM_BUF_ERR", 564cb4af11Schristos [PAM_CONV_ERR] = "PAM_CONV_ERR", 574cb4af11Schristos [PAM_PERM_DENIED] = "PAM_PERM_DENIED", 584cb4af11Schristos [PAM_MAXTRIES] = "PAM_MAXTRIES", 594cb4af11Schristos [PAM_AUTH_ERR] = "PAM_AUTH_ERR", 604cb4af11Schristos [PAM_NEW_AUTHTOK_REQD] = "PAM_NEW_AUTHTOK_REQD", 614cb4af11Schristos [PAM_CRED_INSUFFICIENT] = "PAM_CRED_INSUFFICIENT", 624cb4af11Schristos [PAM_AUTHINFO_UNAVAIL] = "PAM_AUTHINFO_UNAVAIL", 634cb4af11Schristos [PAM_USER_UNKNOWN] = "PAM_USER_UNKNOWN", 644cb4af11Schristos [PAM_CRED_UNAVAIL] = "PAM_CRED_UNAVAIL", 654cb4af11Schristos [PAM_CRED_EXPIRED] = "PAM_CRED_EXPIRED", 664cb4af11Schristos [PAM_CRED_ERR] = "PAM_CRED_ERR", 674cb4af11Schristos [PAM_ACCT_EXPIRED] = "PAM_ACCT_EXPIRED", 684cb4af11Schristos [PAM_AUTHTOK_EXPIRED] = "PAM_AUTHTOK_EXPIRED", 694cb4af11Schristos [PAM_SESSION_ERR] = "PAM_SESSION_ERR", 704cb4af11Schristos [PAM_AUTHTOK_ERR] = "PAM_AUTHTOK_ERR", 714cb4af11Schristos [PAM_AUTHTOK_RECOVERY_ERR] = "PAM_AUTHTOK_RECOVERY_ERR", 724cb4af11Schristos [PAM_AUTHTOK_LOCK_BUSY] = "PAM_AUTHTOK_LOCK_BUSY", 734cb4af11Schristos [PAM_AUTHTOK_DISABLE_AGING] = "PAM_AUTHTOK_DISABLE_AGING", 744cb4af11Schristos [PAM_NO_MODULE_DATA] = "PAM_NO_MODULE_DATA", 754cb4af11Schristos [PAM_IGNORE] = "PAM_IGNORE", 764cb4af11Schristos [PAM_ABORT] = "PAM_ABORT", 774cb4af11Schristos [PAM_TRY_AGAIN] = "PAM_TRY_AGAIN", 784cb4af11Schristos [PAM_MODULE_UNKNOWN] = "PAM_MODULE_UNKNOWN", 794cb4af11Schristos [PAM_DOMAIN_UNKNOWN] = "PAM_DOMAIN_UNKNOWN", 804cb4af11Schristos [PAM_BAD_HANDLE] = "PAM_BAD_HANDLE", 814cb4af11Schristos [PAM_BAD_ITEM] = "PAM_BAD_ITEM", 824cb4af11Schristos [PAM_BAD_FEATURE] = "PAM_BAD_FEATURE", 834cb4af11Schristos [PAM_BAD_CONSTANT] = "PAM_BAD_CONSTANT", 844cb4af11Schristos }; 854cb4af11Schristos 864cb4af11Schristos const char *pam_err_text[PAM_NUM_ERRORS] = { 874cb4af11Schristos [PAM_SUCCESS] = "Success", 884cb4af11Schristos [PAM_OPEN_ERR] = "Failed to load module", 894cb4af11Schristos [PAM_SYMBOL_ERR] = "Invalid symbol", 904cb4af11Schristos [PAM_SERVICE_ERR] = "Error in service module", 914cb4af11Schristos [PAM_SYSTEM_ERR] = "System error", 924cb4af11Schristos [PAM_BUF_ERR] = "Memory buffer error", 934cb4af11Schristos [PAM_CONV_ERR] = "Conversation failure", 944cb4af11Schristos [PAM_PERM_DENIED] = "Permission denied", 954cb4af11Schristos [PAM_MAXTRIES] = "Maximum number of tries exceeded", 964cb4af11Schristos [PAM_AUTH_ERR] = "Authentication error", 974cb4af11Schristos [PAM_NEW_AUTHTOK_REQD] = "New authentication token required", 984cb4af11Schristos [PAM_CRED_INSUFFICIENT] = "Insufficient credentials", 994cb4af11Schristos [PAM_AUTHINFO_UNAVAIL] = "Authentication information is unavailable", 1004cb4af11Schristos [PAM_USER_UNKNOWN] = "Unknown user", 1014cb4af11Schristos [PAM_CRED_UNAVAIL] = "Failed to retrieve user credentials", 1024cb4af11Schristos [PAM_CRED_EXPIRED] = "User credentials have expired", 1034cb4af11Schristos [PAM_CRED_ERR] = "Failed to set user credentials", 1044cb4af11Schristos [PAM_ACCT_EXPIRED] = "User account has expired", 1054cb4af11Schristos [PAM_AUTHTOK_EXPIRED] = "Password has expired", 1064cb4af11Schristos [PAM_SESSION_ERR] = "Session failure", 1074cb4af11Schristos [PAM_AUTHTOK_ERR] = "Authentication token failure", 1084cb4af11Schristos [PAM_AUTHTOK_RECOVERY_ERR] = "Failed to recover old authentication token", 1094cb4af11Schristos [PAM_AUTHTOK_LOCK_BUSY] = "Authentication token lock busy", 1104cb4af11Schristos [PAM_AUTHTOK_DISABLE_AGING] = "Authentication token aging disabled", 1114cb4af11Schristos [PAM_NO_MODULE_DATA] = "Module data not found", 1124cb4af11Schristos [PAM_IGNORE] = "Ignore this module", 1134cb4af11Schristos [PAM_ABORT] = "General failure", 1144cb4af11Schristos [PAM_TRY_AGAIN] = "Try again", 1154cb4af11Schristos [PAM_MODULE_UNKNOWN] = "Unknown module type", 1164cb4af11Schristos [PAM_DOMAIN_UNKNOWN] = "Unknown authentication domain", 1174cb4af11Schristos [PAM_BAD_HANDLE] = "Invalid PAM handle", 1184cb4af11Schristos [PAM_BAD_ITEM] = "Unrecognized or restricted item", 1194cb4af11Schristos [PAM_BAD_FEATURE] = "Unrecognized or restricted feature", 1204cb4af11Schristos [PAM_BAD_CONSTANT] = "Invalid constant", 12176e8c542Schristos }; 12276e8c542Schristos 12376e8c542Schristos const char *pam_item_name[PAM_NUM_ITEMS] = { 1244cb4af11Schristos [PAM_SERVICE] = "PAM_SERVICE", 1254cb4af11Schristos [PAM_USER] = "PAM_USER", 1264cb4af11Schristos [PAM_TTY] = "PAM_TTY", 1274cb4af11Schristos [PAM_RHOST] = "PAM_RHOST", 1284cb4af11Schristos [PAM_CONV] = "PAM_CONV", 1294cb4af11Schristos [PAM_AUTHTOK] = "PAM_AUTHTOK", 1304cb4af11Schristos [PAM_OLDAUTHTOK] = "PAM_OLDAUTHTOK", 1314cb4af11Schristos [PAM_RUSER] = "PAM_RUSER", 1324cb4af11Schristos [PAM_USER_PROMPT] = "PAM_USER_PROMPT", 1334cb4af11Schristos [PAM_REPOSITORY] = "PAM_REPOSITORY", 1344cb4af11Schristos [PAM_AUTHTOK_PROMPT] = "PAM_AUTHTOK_PROMPT", 1354cb4af11Schristos [PAM_OLDAUTHTOK_PROMPT] = "PAM_OLDAUTHTOK_PROMPT", 1364cb4af11Schristos [PAM_HOST] = "PAM_HOST", 13776e8c542Schristos }; 13876e8c542Schristos 13976e8c542Schristos const char *pam_facility_name[PAM_NUM_FACILITIES] = { 14076e8c542Schristos [PAM_ACCOUNT] = "account", 14176e8c542Schristos [PAM_AUTH] = "auth", 14276e8c542Schristos [PAM_PASSWORD] = "password", 14376e8c542Schristos [PAM_SESSION] = "session", 14476e8c542Schristos }; 14576e8c542Schristos 14676e8c542Schristos const char *pam_control_flag_name[PAM_NUM_CONTROL_FLAGS] = { 14776e8c542Schristos [PAM_BINDING] = "binding", 14876e8c542Schristos [PAM_OPTIONAL] = "optional", 14976e8c542Schristos [PAM_REQUIRED] = "required", 15076e8c542Schristos [PAM_REQUISITE] = "requisite", 15176e8c542Schristos [PAM_SUFFICIENT] = "sufficient", 15276e8c542Schristos }; 15376e8c542Schristos 15476e8c542Schristos const char *pam_func_name[PAM_NUM_PRIMITIVES] = { 1554cb4af11Schristos [PAM_SM_AUTHENTICATE] = "pam_authenticate", 1564cb4af11Schristos [PAM_SM_SETCRED] = "pam_setcred", 1574cb4af11Schristos [PAM_SM_ACCT_MGMT] = "pam_acct_mgmt", 1584cb4af11Schristos [PAM_SM_OPEN_SESSION] = "pam_open_session", 1594cb4af11Schristos [PAM_SM_CLOSE_SESSION] = "pam_close_session", 1604cb4af11Schristos [PAM_SM_CHAUTHTOK] = "pam_chauthtok" 16176e8c542Schristos }; 16276e8c542Schristos 16376e8c542Schristos const char *pam_sm_func_name[PAM_NUM_PRIMITIVES] = { 1644cb4af11Schristos [PAM_SM_AUTHENTICATE] = "pam_sm_authenticate", 1654cb4af11Schristos [PAM_SM_SETCRED] = "pam_sm_setcred", 1664cb4af11Schristos [PAM_SM_ACCT_MGMT] = "pam_sm_acct_mgmt", 1674cb4af11Schristos [PAM_SM_OPEN_SESSION] = "pam_sm_open_session", 1684cb4af11Schristos [PAM_SM_CLOSE_SESSION] = "pam_sm_close_session", 1694cb4af11Schristos [PAM_SM_CHAUTHTOK] = "pam_sm_chauthtok" 17076e8c542Schristos }; 17176e8c542Schristos 17276e8c542Schristos const char *openpam_policy_path[] = { 17376e8c542Schristos "/etc/pam.d/", 17476e8c542Schristos "/etc/pam.conf", 175201780c4Schristos #ifndef __NetBSD__ 17676e8c542Schristos "/usr/local/etc/pam.d/", 17776e8c542Schristos "/usr/local/etc/pam.conf", 178201780c4Schristos #endif 17976e8c542Schristos NULL 18076e8c542Schristos }; 18176e8c542Schristos 18276e8c542Schristos const char *openpam_module_path[] = { 18376e8c542Schristos #ifdef OPENPAM_MODULES_DIRECTORY 18476e8c542Schristos OPENPAM_MODULES_DIRECTORY, 18576e8c542Schristos #else 18676e8c542Schristos "/usr/lib", 18776e8c542Schristos "/usr/local/lib", 18876e8c542Schristos #endif 18976e8c542Schristos NULL 19076e8c542Schristos }; 191