LCOV - code coverage report
Current view: top level - responder/ifp - ifp_iface.c (source / functions) Hit Total Coverage
Test: .coverage.total Lines: 0 6 0.0 %
Date: 2015-10-19 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /*
       2             :     Authors:
       3             :         Pavel Březina <pbrezina@redhat.com>
       4             : 
       5             :     Copyright (C) 2015 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 <dbus/dbus.h>
      22             : 
      23             : #include "sbus/sssd_dbus.h"
      24             : #include "responder/ifp/ifp_iface_generated.h"
      25             : #include "responder/ifp/ifp_domains.h"
      26             : #include "responder/ifp/ifp_components.h"
      27             : #include "responder/ifp/ifp_users.h"
      28             : #include "responder/ifp/ifp_groups.h"
      29             : 
      30             : struct iface_ifp iface_ifp = {
      31             :     { &iface_ifp_meta, 0 },
      32             :     .Ping = ifp_ping,
      33             : 
      34             :     /* components */
      35             :     .ListComponents = ifp_list_components,
      36             :     .ListResponders = ifp_list_responders,
      37             :     .ListBackends = ifp_list_backends,
      38             :     .FindMonitor = ifp_find_monitor,
      39             :     .FindResponderByName = ifp_find_responder_by_name,
      40             :     .FindBackendByName = ifp_find_backend_by_name,
      41             : 
      42             :     .GetUserAttr = ifp_user_get_attr,
      43             :     .GetUserGroups = ifp_user_get_groups,
      44             :     .ListDomains = ifp_list_domains,
      45             :     .FindDomainByName = ifp_find_domain_by_name,
      46             : };
      47             : 
      48             : struct iface_ifp_components iface_ifp_components = {
      49             :     { &iface_ifp_components_meta, 0 },
      50             :     .Enable = ifp_component_enable,
      51             :     .Disable = ifp_component_disable,
      52             :     .ChangeDebugLevel = ifp_component_change_debug_level,
      53             :     .ChangeDebugLevelTemporarily = ifp_component_change_debug_level_tmp,
      54             :     .get_name = ifp_component_get_name,
      55             :     .get_debug_level = ifp_component_get_debug_level,
      56             :     .get_enabled = ifp_component_get_enabled,
      57             :     .get_type = ifp_component_get_type,
      58             :     /* FIXME: This should be part of Components.Backends interface, onece
      59             :      * SSSD supports multiple interfaces per object path. */
      60             :     .get_providers = ifp_backend_get_providers
      61             : };
      62             : 
      63             : struct iface_ifp_domains iface_ifp_domains = {
      64             :     { &iface_ifp_domains_meta, 0 },
      65             :     .get_name = ifp_dom_get_name,
      66             :     .get_provider = ifp_dom_get_provider,
      67             :     .get_primary_servers = ifp_dom_get_primary_servers,
      68             :     .get_backup_servers = ifp_dom_get_backup_servers,
      69             :     .get_min_id = ifp_dom_get_min_id,
      70             :     .get_max_id = ifp_dom_get_max_id,
      71             :     .get_realm = ifp_dom_get_realm,
      72             :     .get_forest = ifp_dom_get_forest,
      73             :     .get_login_format = ifp_dom_get_login_format,
      74             :     .get_fully_qualified_name_format = ifp_dom_get_fqdn_format,
      75             :     .get_enumerable = ifp_dom_get_enumerable,
      76             :     .get_use_fully_qualified_names = ifp_dom_get_use_fqdn,
      77             :     .get_subdomain = ifp_dom_get_subdomain,
      78             :     .get_parent_domain = ifp_dom_get_parent_domain
      79             : };
      80             : 
      81             : struct iface_ifp_users iface_ifp_users = {
      82             :     { &iface_ifp_users_meta, 0 },
      83             :     .FindByName = ifp_users_find_by_name,
      84             :     .FindByID = ifp_users_find_by_id,
      85             :     .FindByCertificate = ifp_users_find_by_cert,
      86             :     .ListByName = ifp_users_list_by_name,
      87             :     .ListByDomainAndName = ifp_users_list_by_domain_and_name
      88             : };
      89             : 
      90             : struct iface_ifp_users_user iface_ifp_users_user = {
      91             :     { &iface_ifp_users_user_meta, 0 },
      92             :     .UpdateGroupsList = ifp_users_user_update_groups_list,
      93             :     .get_name = ifp_users_user_get_name,
      94             :     .get_uidNumber = ifp_users_user_get_uid_number,
      95             :     .get_gidNumber = ifp_users_user_get_gid_number,
      96             :     .get_gecos = ifp_users_user_get_gecos,
      97             :     .get_homeDirectory = ifp_users_user_get_home_directory,
      98             :     .get_loginShell = ifp_users_user_get_login_shell,
      99             :     .get_groups = ifp_users_user_get_groups,
     100             :     .get_extraAttributes = ifp_users_user_get_extra_attributes
     101             : };
     102             : 
     103             : struct iface_ifp_groups iface_ifp_groups = {
     104             :     { &iface_ifp_groups_meta, 0 },
     105             :     .FindByName = ifp_groups_find_by_name,
     106             :     .FindByID = ifp_groups_find_by_id,
     107             :     .ListByName = ifp_groups_list_by_name,
     108             :     .ListByDomainAndName = ifp_groups_list_by_domain_and_name
     109             : };
     110             : 
     111             : struct iface_ifp_groups_group iface_ifp_groups_group = {
     112             :     { &iface_ifp_groups_group_meta, 0 },
     113             :     .UpdateMemberList = ifp_groups_group_update_member_list,
     114             :     .get_name = ifp_groups_group_get_name,
     115             :     .get_gidNumber = ifp_groups_group_get_gid_number,
     116             :     .get_users = ifp_groups_group_get_users,
     117             :     .get_groups = ifp_groups_group_get_groups
     118             : };
     119             : 
     120             : struct iface_ifp_cache iface_ifp_cache_user = {
     121             :     { &iface_ifp_cache_meta, 0 },
     122             :     .List = ifp_cache_list_user,
     123             :     .ListByDomain = ifp_cache_list_by_domain_user
     124             : };
     125             : 
     126             : struct iface_ifp_cache_object iface_ifp_cache_object_user = {
     127             :     { &iface_ifp_cache_object_meta, 0 },
     128             :     .Store = ifp_cache_object_store_user,
     129             :     .Remove = ifp_cache_object_remove_user
     130             : };
     131             : 
     132             : struct iface_ifp_cache iface_ifp_cache_group = {
     133             :     { &iface_ifp_cache_meta, 0 },
     134             :     .List = ifp_cache_list_group,
     135             :     .ListByDomain = ifp_cache_list_by_domain_group
     136             : };
     137             : 
     138             : struct iface_ifp_cache_object iface_ifp_cache_object_group = {
     139             :     { &iface_ifp_cache_object_meta, 0 },
     140             :     .Store = ifp_cache_object_store_group,
     141             :     .Remove = ifp_cache_object_remove_group
     142             : };
     143             : 
     144             : struct iface_map {
     145             :     const char *path;
     146             :     struct sbus_vtable *vtable;
     147             : };
     148             : 
     149             : static struct iface_map iface_map[] = {
     150             :     { IFP_PATH, &iface_ifp.vtable },
     151             :     { IFP_PATH_DOMAINS_TREE, &iface_ifp_domains.vtable },
     152             :     { IFP_PATH_COMPONENTS_TREE, &iface_ifp_components.vtable },
     153             :     { IFP_PATH_USERS, &iface_ifp_users.vtable },
     154             :     { IFP_PATH_USERS, &iface_ifp_cache_user.vtable },
     155             :     { IFP_PATH_USERS_TREE, &iface_ifp_users_user.vtable },
     156             :     { IFP_PATH_USERS_TREE, &iface_ifp_cache_object_user.vtable },
     157             :     { IFP_PATH_GROUPS, &iface_ifp_groups.vtable },
     158             :     { IFP_PATH_GROUPS, &iface_ifp_cache_group.vtable },
     159             :     { IFP_PATH_GROUPS_TREE, &iface_ifp_groups_group.vtable },
     160             :     { IFP_PATH_GROUPS_TREE, &iface_ifp_cache_object_group.vtable },
     161             :     { NULL, NULL },
     162             : };
     163             : 
     164           0 : errno_t ifp_register_sbus_interface(struct sbus_connection *conn, void *pvt)
     165             : {
     166             :     errno_t ret;
     167             :     int i;
     168             : 
     169           0 :     for (i = 0; iface_map[i].path != NULL; i++) {
     170           0 :         ret = sbus_conn_register_iface(conn, iface_map[i].vtable,
     171             :                                        iface_map[i].path, pvt);
     172           0 :         if (ret != EOK) {
     173           0 :             return ret;
     174             :         }
     175             :     }
     176             : 
     177           0 :     return EOK;
     178             : }

Generated by: LCOV version 1.10