LCOV - code coverage report
Current view: top level - sbus - sbus_client.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 15 0.0 %
Date: 2012-11-29 Functions: 0 1 0.0 %
Branches: 0 28 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :    SSSD
       3                 :            : 
       4                 :            :    Data Provider Helpers
       5                 :            : 
       6                 :            :    Copyright (C) Stephen Gallagher <sgallagh@redhat.com>  2009
       7                 :            : 
       8                 :            :    This program is free software; you can redistribute it and/or modify
       9                 :            :    it under the terms of the GNU General Public License as published by
      10                 :            :    the Free Software Foundation; either version 3 of the License, or
      11                 :            :    (at your option) any later version.
      12                 :            : 
      13                 :            :    This program is distributed in the hope that it will be useful,
      14                 :            :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      15                 :            :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16                 :            :    GNU General Public License for more details.
      17                 :            : 
      18                 :            :    You should have received a copy of the GNU General Public License
      19                 :            :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      20                 :            : */
      21                 :            : 
      22                 :            : #include "util/util.h"
      23                 :            : #include "talloc.h"
      24                 :            : #include "sbus_client.h"
      25                 :            : 
      26                 :          0 : int sbus_client_init(TALLOC_CTX *mem_ctx,
      27                 :            :                      struct tevent_context *ev,
      28                 :            :                      const char *server_address,
      29                 :            :                      struct sbus_interface *intf,
      30                 :            :                      struct sbus_connection **_conn,
      31                 :            :                      sbus_conn_destructor_fn destructor,
      32                 :            :                      void *conn_pvt_data)
      33                 :            : {
      34                 :          0 :     struct sbus_connection *conn = NULL;
      35                 :            :     int ret;
      36                 :            :     char *filename;
      37                 :            : 
      38                 :            :     /* Validate input */
      39         [ #  # ]:          0 :     if (server_address == NULL) {
      40                 :            :         return EINVAL;
      41                 :            :     }
      42                 :            : 
      43                 :          0 :     filename = strchr(server_address, '/');
      44         [ #  # ]:          0 :     if (filename == NULL) {
      45 [ #  # ][ #  # ]:          0 :         DEBUG(1, ("Unexpected dbus address [%s].\n", server_address));
         [ #  # ][ #  # ]
                 [ #  # ]
      46                 :            :         return EIO;
      47                 :            :     }
      48                 :            : 
      49                 :          0 :     ret = check_file(filename, 0, 0, 0600, CHECK_SOCK, NULL, true);
      50         [ #  # ]:          0 :     if (ret != EOK) {
      51 [ #  # ][ #  # ]:          0 :         DEBUG(1, ("check_file failed for [%s].\n", filename));
         [ #  # ][ #  # ]
                 [ #  # ]
      52                 :            :         return EIO;
      53                 :            :     }
      54                 :            : 
      55                 :          0 :     ret = sbus_new_connection(mem_ctx, ev, server_address, intf, &conn);
      56         [ #  # ]:          0 :     if (ret != EOK) {
      57                 :            :         goto fail;
      58                 :            :     }
      59                 :            : 
      60                 :            :     /* Set connection destructor and private data */
      61                 :          0 :     sbus_conn_set_destructor(conn, destructor);
      62                 :          0 :     sbus_conn_set_private_data(conn, conn_pvt_data);
      63                 :            : 
      64                 :          0 :     *_conn = conn;
      65                 :            :     return EOK;
      66                 :            : 
      67                 :            : fail:
      68                 :          0 :     talloc_free(conn);
      69                 :            :     return ret;
      70                 :            : }

Generated by: LCOV version 1.9