LCOV - code coverage report
Current view: top level - util - util_errors.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 4 4 100.0 %
Date: 2016-06-29 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             :     { "SSSD is running" },  /* ERR_SSSD_RUNNING */
      31             :     { "SSSD is not running" },  /* ERR_SSSD_NOT_RUNNING */
      32             :     { "SSSD is offline" },       /* ERR_OFFLINE */
      33             :     { "Terminated" },       /* ERR_TERMINATED */
      34             :     { "Invalid data type" },       /* ERR_INVALID_DATA_TYPE */
      35             :     { "DP target is not configured" }, /* ERR_MISSING_DP_TARGET */
      36             :     { "Account Unknown" },      /* ERR_ACCOUNT_UNKNOWN */
      37             :     { "Invalid credential type" },  /* ERR_INVALID_CRED_TYPE */
      38             :     { "No credentials available" }, /* ERR_NO_CREDS */
      39             :     { "Credentials are expired" }, /* ERR_CREDS_EXPIRED */
      40             :     { "Credentials are expired, old ccache was removed" }, /* ERR_CREDS_EXPIRED_CCACHE */
      41             :     { "Failure setting user credentials"}, /* ERR_CREDS_INVALID */
      42             :     { "No cached credentials available" }, /* ERR_NO_CACHED_CREDS */
      43             :     { "Cached credentials are expired" }, /* ERR_CACHED_CREDS_EXPIRED */
      44             :     { "Authentication Denied" }, /* ERR_AUTH_DENIED */
      45             :     { "Authentication Failed" }, /* ERR_AUTH_FAILED */
      46             :     { "Password Change Denied" }, /* ERR_CHPASS_DENIED */
      47             :     { "Password Change Failed" }, /* ERR_CHPASS_FAILED */
      48             :     { "Network I/O Error" }, /* ERR_NETWORK_IO */
      49             :     { "Account Expired" }, /* ERR_ACCOUNT_EXPIRED */
      50             :     { "Password Expired" }, /* ERR_PASSWORD_EXPIRED */
      51             :     { "Password Expired (reject access)" }, /* ERR_PASSWORD_EXPIRED_REJECT */
      52             :     { "Password Expired (warn user)" }, /* ERR_PASSWORD_EXPIRED_WARN */
      53             :     { "Password Expired (ask for new password)" }, /* ERR_PASSWORD_EXPIRED_RENEW */
      54             :     { "Host Access Denied" }, /* ERR_ACCESS_DENIED */
      55             :     { "SRV record not found" }, /* ERR_SRV_NOT_FOUND */
      56             :     { "SRV lookup error" }, /* ERR_SRV_LOOKUP_ERROR */
      57             :     { "SRV lookup did not return any new server" }, /* ERR_SRV_DUPLICATES */
      58             :     { "Dynamic DNS update failed" }, /* ERR_DYNDNS_FAILED */
      59             :     { "Dynamic DNS update timed out" }, /* ERR_DYNDNS_TIMEOUT */
      60             :     { "Dynamic DNS update not possible while offline" }, /* ERR_DYNDNS_OFFLINE */
      61             :     { "Cannot parse input" }, /* ERR_INPUT_PARSE */
      62             :     { "Entry not found" }, /* ERR_NOT_FOUND */
      63             :     { "Domain not found" }, /* ERR_DOMAIN_NOT_FOUND */
      64             :     { "Missing configuration file" }, /* ERR_MISSING_CONF */
      65             :     { "Malformed search filter" }, /* ERR_INVALID_FILTER, */
      66             :     { "No POSIX attributes detected" }, /* ERR_NO_POSIX */
      67             :     { "Extra attribute is a duplicate" }, /* ERR_DUP_EXTRA_ATTR */
      68             :     { "Malformed extra attribute" }, /* ERR_INVALID_EXTRA_ATTR */
      69             :     { "Cannot get bus message sender" }, /* ERR_SBUS_GET_SENDER_ERROR */
      70             :     { "Bus message has no sender" }, /* ERR_SBUS_NO_SENDER */
      71             :     { "Invalid SBUS path provided" }, /* ERR_SBUS_INVALID_PATH */
      72             :     { "User/Group SIDs not found" }, /* ERR_NO_SIDS */
      73             :     { "Bus method not supported" }, /* ERR_SBUS_NOSUP */
      74             :     { "Cannot connect to system bus" }, /* ERR_NO_SYSBUS */
      75             :     { "LDAP search returned a referral" }, /* ERR_REFERRAL */
      76             :     { "Error setting SELinux user context" }, /* ERR_SELINUX_CONTEXT */
      77             :     { "Username format not allowed by re_expression" }, /* ERR_REGEX_NOMATCH */
      78             :     { "Time specification not supported" }, /* ERR_TIMESPEC_NOT_SUPPORTED */
      79             :     { "Invalid SSSD configuration detected" }, /* ERR_INVALID_CONFIG */
      80             :     { "Malformed cache entry" }, /* ERR_MALFORMED_ENTRY */
      81             :     { "Unexpected cache entry type" }, /* ERR_UNEXPECTED_ENTRY_TYPE */
      82             :     { "Failed to resolve one of user groups" }, /* ERR_SIMPLE_GROUPS_MISSING */
      83             :     { "Home directory is NULL" }, /* ERR_HOMEDIR_IS_NULL */
      84             :     { "Unsupported trust direction" }, /* ERR_TRUST_NOT_SUPPORTED */
      85             :     { "Retrieving keytab failed" }, /* ERR_IPA_GETKEYTAB_FAILED */
      86             :     { "Trusted forest root unknown" }, /* ERR_TRUST_FOREST_UNKNOWN */
      87             :     { "p11_child failed" }, /* ERR_P11_CHILD */
      88             :     { "Address family not supported" }, /* ERR_ADDR_FAMILY_NOT_SUPPORTED */
      89             :     { "Message sender is the bus" }, /* ERR_SBUS_SENDER_BUS */
      90             :     { "Subdomain is inactive" }, /* ERR_SUBDOM_INACTIVE */
      91             :     { "Account is locked" }, /* ERR_ACCOUNT_LOCKED */
      92             :     { "AD renewal child failed" }, /* ERR_RENEWAL_CHILD */
      93             :     { "SBUS request already handled" }, /* ERR_SBUS_REQUEST_HANDLED */
      94             :     { "Sysdb version is too old" },  /* ERR_SYSDB_VERSION_TOO_OLD */
      95             :     { "Sysdb version is too new" },  /* ERR_SYSDB_VERSION_TOO_NEW */
      96             :     { "Domain has to timestamp cache" }, /* ERR_NO_TS */
      97             :     { "No timestamp cache record" }, /* ERR_TS_CACHE_MISS */
      98             :     { "Dereference threshold reached" }, /* ERR_DEREF_THRESHOLD */
      99             :     { "ERR_LAST" } /* ERR_LAST */
     100             : };
     101             : 
     102             : 
     103          82 : const char *sss_strerror(errno_t error)
     104             : {
     105          82 :     if (IS_SSSD_ERROR(error)) {
     106          73 :         return error_to_str[SSSD_ERR_IDX(error)].msg;
     107             :     }
     108             : 
     109           9 :     return strerror(error);
     110             : }
     111             : 

Generated by: LCOV version 1.10