LCOV - code coverage report
Current view: top level - providers/data_provider - dp_iface_failover.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 19 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_failover_list_services(struct sbus_request *sbus_req,
      32             :                                   void *dp_cli,
      33             :                                   const char *domname)
      34             : {
      35             :     struct be_ctx *be_ctx;
      36             :     struct be_svc_data *svc;
      37             :     const char **services;
      38             :     int num_services;
      39             : 
      40           0 :     be_ctx = dp_client_be(dp_cli);
      41             : 
      42           0 :     num_services = 0;
      43           0 :     DLIST_FOR_EACH(svc, be_ctx->be_fo->svcs) {
      44           0 :         num_services++;
      45             :     }
      46             : 
      47           0 :     services = talloc_zero_array(sbus_req, const char *, num_services);
      48           0 :     if (services == NULL) {
      49           0 :         DEBUG(SSSDBG_CRIT_FAILURE, "talloc_zero_array() failed\n");
      50           0 :         return ENOMEM;
      51             :     }
      52             : 
      53           0 :     num_services = 0;
      54           0 :     DLIST_FOR_EACH(svc, be_ctx->be_fo->svcs) {
      55           0 :         services[num_services] = talloc_strdup(services, svc->name);
      56           0 :         if (services[num_services] == NULL) {
      57           0 :             DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup() failed\n");
      58           0 :             talloc_free(services);
      59           0 :             return ENOMEM;
      60             :         }
      61           0 :         num_services++;
      62             :     }
      63             : 
      64           0 :     iface_dp_failover_ListServices_finish(sbus_req, services, num_services);
      65           0 :     return EOK;
      66             : }

Generated by: LCOV version 1.10