LCOV - code coverage report
Current view: top level - util - util_errors.c (source / functions) Hit Total Coverage
Test: .coverage.total Lines: 4 4 100.0 %
Date: 2015-10-19 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :     Copyright (C) 2012 Red Hat
       3             : 
       4             :     This program is free software; you can redistribute it and/or modify
       5             :     it under the terms of the GNU General Public License as published by
       6             :     the Free Software Foundation; either version 3 of the License, or
       7             :     (at your option) any later version.
       8             : 
       9             :     This program is distributed in the hope that it will be useful,
      10             :     but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :     GNU General Public License for more details.
      13             : 
      14             :     You should have received a copy of the GNU General Public License
      15             :     along with this program.  If not, see <http://www.gnu.org/licenses/>.
      16             : 
      17             :     Authors:
      18             :         Simo Sorce <ssorce@redhat.com>
      19             : */
      20             : 
      21             : #include "util/util.h"
      22             : 
      23             : struct err_string {
      24             :     const char *msg;
      25             : };
      26             : 
      27             : struct err_string error_to_str[] = {
      28             :     { "Invalid Error" },        /* ERR_INVALID */
      29             :     { "Internal Error" },       /* ERR_INTERNAL */
      30             :     { "Account Unknown" },      /* ERR_ACCOUNT_UNKNOWN */
      31             :     { "Invalid credential type" },  /* ERR_INVALID_CRED_TYPE */
      32             :     { "No credentials available" }, /* ERR_NO_CREDS */
      33             :     { "Credentials are expired" }, /* ERR_CREDS_EXPIRED */
      34             :     { "Credentials are expired, old ccache was removed" }, /* ERR_CREDS_EXPIRED_CCACHE */
      35             :     { "Failure setting user credentials"}, /* ERR_CREDS_INVALID */
      36             :     { "No cached credentials available" }, /* ERR_NO_CACHED_CREDS */
      37             :     { "Cached credentials are expired" }, /* ERR_CACHED_CREDS_EXPIRED */
      38             :     { "Authentication Denied" }, /* ERR_AUTH_DENIED */
      39             :     { "Authentication Failed" }, /* ERR_AUTH_FAILED */
      40             :     { "Password Change Denied" }, /* ERR_CHPASS_DENIED */
      41             :     { "Password Change Failed" }, /* ERR_CHPASS_FAILED */
      42             :     { "Network I/O Error" }, /* ERR_NETWORK_IO */
      43             :     { "Account Expired" }, /* ERR_ACCOUNT_EXPIRED */
      44             :     { "Password Expired" }, /* ERR_PASSWORD_EXPIRED */
      45             :     { "Password Expired (reject access)" }, /* ERR_PASSWORD_EXPIRED_REJECT */
      46             :     { "Password Expired (warn user)" }, /* ERR_PASSWORD_EXPIRED_WARN */
      47             :     { "Password Expired (ask for new password)" }, /* ERR_PASSWORD_EXPIRED_RENEW */
      48             :     { "Host Access Denied" }, /* ERR_ACCESS_DENIED */
      49             :     { "SRV record not found" }, /* ERR_SRV_NOT_FOUND */
      50             :     { "SRV lookup error" }, /* ERR_SRV_LOOKUP_ERROR */
      51             :     { "SRV lookup did not return any new server" }, /* ERR_SRV_DUPLICATES */
      52             :     { "Dynamic DNS update failed" }, /* ERR_DYNDNS_FAILED */
      53             :     { "Dynamic DNS update timed out" }, /* ERR_DYNDNS_TIMEOUT */
      54             :     { "Dynamic DNS update not possible while offline" }, /* ERR_DYNDNS_OFFLINE */
      55             :     { "Cannot parse input" }, /* ERR_INPUT_PARSE */
      56             :     { "Entry not found" }, /* ERR_NOT_FOUND */
      57             :     { "Domain not found" }, /* ERR_DOMAIN_NOT_FOUND */
      58             :     { "Missing configuration file" }, /* ERR_MISSING_CONF */
      59             :     { "Malformed search filter" }, /* ERR_INVALID_FILTER, */
      60             :     { "No POSIX attributes detected" }, /* ERR_NO_POSIX */
      61             :     { "Extra attribute is a duplicate" }, /* ERR_DUP_EXTRA_ATTR */
      62             :     { "Malformed extra attribute" }, /* ERR_INVALID_EXTRA_ATTR */
      63             :     { "Cannot get bus message sender" }, /* ERR_SBUS_GET_SENDER_ERROR */
      64             :     { "Bus message has no sender" }, /* ERR_SBUS_NO_SENDER */
      65             :     { "Invalid SBUS path provided" }, /* ERR_SBUS_INVALID_PATH */
      66             :     { "User/Group SIDs not found" }, /* ERR_NO_SIDS */
      67             :     { "Bus method not supported" }, /* ERR_SBUS_NOSUP */
      68             :     { "Cannot connect to system bus" }, /* ERR_NO_SYSBUS */
      69             :     { "LDAP search returned a referral" }, /* ERR_REFERRAL */
      70             :     { "Error setting SELinux user context" }, /* ERR_SELINUX_CONTEXT */
      71             :     { "Username format not allowed by re_expression" }, /* ERR_REGEX_NOMATCH */
      72             :     { "Time specification not supported" }, /* ERR_TIMESPEC_NOT_SUPPORTED */
      73             :     { "Invalid SSSD configuration detected" }, /* ERR_INVALID_CONFIG */
      74             :     { "Malformed cache entry" }, /* ERR_MALFORMED_ENTRY */
      75             :     { "Unexpected cache entry type" }, /* ERR_UNEXPECTED_ENTRY_TYPE */
      76             :     { "Failed to resolve one of user groups" }, /* ERR_SIMPLE_GROUPS_MISSING */
      77             :     { "Home directory is NULL" }, /* ERR_HOMEDIR_IS_NULL */
      78             :     { "Unsupported trust direction" }, /* ERR_TRUST_NOT_SUPPORTED */
      79             :     { "Retrieving keytab failed" }, /* ERR_IPA_GETKEYTAB_FAILED */
      80             :     { "Trusted forest root unknown" }, /* ERR_TRUST_FOREST_UNKNOWN */
      81             :     { "p11_child failed" }, /* ERR_P11_CHILD */
      82             :     { "Address family not supported" }, /* ERR_ADDR_FAMILY_NOT_SUPPORTED */
      83             :     { "Message sender is the bus" }, /* ERR_SBUS_SENDER_BUS */
      84             :     { "Subdomain is inactive" }, /* ERR_SUBDOM_INACTIVE */
      85             :     { "ERR_LAST" } /* ERR_LAST */
      86             : };
      87             : 
      88             : 
      89          59 : const char *sss_strerror(errno_t error)
      90             : {
      91          59 :     if (IS_SSSD_ERROR(error)) {
      92          58 :         return error_to_str[SSSD_ERR_IDX(error)].msg;
      93             :     }
      94             : 
      95           1 :     return strerror(error);
      96             : }
      97             : 

Generated by: LCOV version 1.10