LCOV - code coverage report
Current view: top level - providers/data_provider - dp_iface_backend.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 15 0.0 %
Date: 2016-06-29 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /*
       2             :     Authors:
       3             :         Pavel Březina <pbrezina@redhat.com>
       4             : 
       5             :     Copyright (C) 2016 Red Hat
       6             : 
       7             :     This program is free software; you can redistribute it and/or modify
       8             :     it under the terms of the GNU General Public License as published by
       9             :     the Free Software Foundation; either version 3 of the License, or
      10             :     (at your option) any later version.
      11             : 
      12             :     This program is distributed in the hope that it will be useful,
      13             :     but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :     GNU General Public License for more details.
      16             : 
      17             :     You should have received a copy of the GNU General Public License
      18             :     along with this program.  If not, see <http://www.gnu.org/licenses/>.
      19             : */
      20             : 
      21             : #include <talloc.h>
      22             : #include <tevent.h>
      23             : 
      24             : #include "sbus/sssd_dbus.h"
      25             : #include "sbus/sssd_dbus_errors.h"
      26             : #include "providers/data_provider/dp_private.h"
      27             : #include "providers/data_provider/dp_iface.h"
      28             : #include "providers/backend.h"
      29             : #include "util/util.h"
      30             : 
      31           0 : errno_t dp_backend_is_online(struct sbus_request *sbus_req,
      32             :                              void *dp_cli,
      33             :                              const char *domname)
      34             : {
      35             :     struct be_ctx *be_ctx;
      36             :     struct sss_domain_info *domain;
      37             :     DBusError *error;
      38             :     bool online;
      39             : 
      40           0 :     be_ctx = dp_client_be(dp_cli);
      41             : 
      42           0 :     if (SBUS_IS_STRING_EMPTY(domname)) {
      43           0 :         domain = be_ctx->domain;
      44             :     } else {
      45           0 :         domain = find_domain_by_name(be_ctx->domain, domname, false);
      46           0 :         if (domain == NULL) {
      47           0 :             error = sbus_error_new(sbus_req, SBUS_ERROR_UNKNOWN_DOMAIN,
      48             :                                    "Unknown domain %s", domname);
      49           0 :             if (error == NULL) {
      50           0 :                 return ENOMEM;
      51             :             }
      52             : 
      53           0 :             return sbus_request_fail_and_finish(sbus_req, error);
      54             :         }
      55             :     }
      56             : 
      57           0 :     if (domain == be_ctx->domain) {
      58           0 :         online = be_is_offline(be_ctx) == false;
      59             :     } else {
      60           0 :         online = domain->state == DOM_ACTIVE;
      61             :     }
      62             : 
      63           0 :     iface_dp_backend_IsOnline_finish(sbus_req, online);
      64           0 :     return EOK;
      65             : }

Generated by: LCOV version 1.10