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 "providers/data_provider/dp_private.h"
26 : #include "providers/data_provider/dp_iface.h"
27 : #include "providers/backend.h"
28 : #include "util/util.h"
29 :
30 0 : errno_t dp_host_handler(struct sbus_request *sbus_req,
31 : void *dp_cli,
32 : uint32_t dp_flags,
33 : const char *name,
34 : const char *alias)
35 : {
36 : struct dp_hostid_data *data;
37 : const char *key;
38 :
39 0 : if (name == NULL) {
40 0 : return EINVAL;
41 : }
42 :
43 0 : data = talloc_zero(sbus_req, struct dp_hostid_data);
44 0 : if (data == NULL) {
45 0 : return ENOMEM;
46 : }
47 :
48 0 : data->name = name;
49 0 : data->alias = SBUS_SET_STRING(alias);
50 :
51 0 : key = talloc_asprintf(data, "%s:%s", name,
52 0 : (data->alias == NULL ? "(null)" : data->alias));
53 0 : if (key == NULL) {
54 0 : talloc_free(data);
55 0 : return ENOMEM;
56 : }
57 :
58 0 : dp_req_with_reply(dp_cli, NULL, "HostID", key, sbus_req, DPT_HOSTID,
59 : DPM_HOSTID_HANDLER, dp_flags, data,
60 : dp_req_reply_std, struct dp_reply_std);
61 :
62 0 : return EOK;
63 : }
|