Line data Source code
1 : /*
2 : Unix SMB/CIFS implementation.
3 :
4 : Winbind client API - SSSD version
5 :
6 : Copyright (C) Sumit Bose <sbose@redhat.com> 2014
7 :
8 : This library is free software; you can redistribute it and/or
9 : modify it under the terms of the GNU Lesser General Public
10 : License as published by the Free Software Foundation; either
11 : version 3 of the License, or (at your option) any later version.
12 :
13 : This library 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 GNU
16 : Library General Public License for more details.
17 :
18 : You should have received a copy of the GNU Lesser General Public License
19 : along with this program. If not, see <http://www.gnu.org/licenses/>.
20 : */
21 : /* Required Headers */
22 :
23 : #include "libwbclient.h"
24 : #include "wbc_sssd_internal.h"
25 :
26 : #define WINBIND_INTERFACE_VERSION 27
27 :
28 : /** @brief Ping winbindd to see if the daemon is running
29 : *
30 : * @return #wbcErr
31 : **/
32 0 : wbcErr wbcPing(void)
33 : {
34 : /* TODO: add real check */
35 0 : return WBC_ERR_SUCCESS;
36 : }
37 :
38 0 : static void wbcInterfaceDetailsDestructor(void *ptr)
39 : {
40 0 : struct wbcInterfaceDetails *i = (struct wbcInterfaceDetails *)ptr;
41 0 : free(i->winbind_version);
42 0 : free(i->netbios_name);
43 0 : free(i->netbios_domain);
44 0 : free(i->dns_domain);
45 0 : }
46 :
47 : /**
48 : * @brief Query useful information about the winbind service
49 : *
50 : * @param *_details pointer to hold the struct wbcInterfaceDetails
51 : *
52 : * @return #wbcErr
53 : */
54 :
55 0 : wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **_details)
56 : {
57 0 : wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
58 : struct wbcInterfaceDetails *info;
59 0 : info = (struct wbcInterfaceDetails *)wbcAllocateMemory(
60 : 1, sizeof(struct wbcInterfaceDetails),
61 : wbcInterfaceDetailsDestructor);
62 0 : if (info == NULL) {
63 0 : return WBC_ERR_NO_MEMORY;
64 : }
65 :
66 : /* TODO: currently this call just returns a suitable winbind_separator
67 : * for wbinfo. */
68 :
69 0 : info->interface_version = WINBIND_INTERFACE_VERSION;
70 0 : info->winbind_version = strdup("libwbclient for SSSD");
71 0 : if (info->winbind_version == NULL) {
72 0 : wbc_status = WBC_ERR_NO_MEMORY;
73 0 : goto done;
74 : }
75 :
76 0 : info->winbind_separator = '\\';
77 :
78 0 : info->netbios_name = strdup("-not available-");
79 0 : if (info->netbios_name == NULL) {
80 0 : wbc_status = WBC_ERR_NO_MEMORY;
81 0 : goto done;
82 : }
83 :
84 0 : info->netbios_domain = strdup("-not available-");
85 0 : if (info->netbios_domain == NULL) {
86 0 : wbc_status = WBC_ERR_NO_MEMORY;
87 0 : goto done;
88 : }
89 :
90 0 : info->dns_domain = strdup("-not available-");
91 0 : if (info->dns_domain == NULL) {
92 0 : wbc_status = WBC_ERR_NO_MEMORY;
93 0 : goto done;
94 : }
95 :
96 0 : *_details = info;
97 0 : info = NULL;
98 0 : wbc_status = WBC_ERR_SUCCESS;
99 : done:
100 0 : wbcFreeMemory(info);
101 0 : return wbc_status;
102 : }
103 :
104 : /** @brief Lookup the current status of a trusted domain, sync wrapper
105 : *
106 : * @param domain Domain to query
107 : * @param *dinfo Pointer to returned struct wbcDomainInfo
108 : *
109 : * @return #wbcErr
110 : */
111 :
112 0 : wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo)
113 : {
114 0 : WBC_SSSD_NOT_IMPLEMENTED;
115 : }
116 :
117 : /* Get the list of current DCs */
118 0 : wbcErr wbcDcInfo(const char *domain, size_t *num_dcs,
119 : const char ***dc_names, const char ***dc_ips)
120 : {
121 0 : WBC_SSSD_NOT_IMPLEMENTED;
122 : }
123 :
124 : /* Resolve a NetbiosName via WINS */
125 0 : wbcErr wbcResolveWinsByName(const char *name, char **ip)
126 : {
127 : /* SSSD does not support WINS */
128 0 : WBC_SSSD_NOT_IMPLEMENTED;
129 : }
130 :
131 : /* Resolve an IP address via WINS into a NetbiosName */
132 0 : wbcErr wbcResolveWinsByIP(const char *ip, char **name)
133 : {
134 : /* SSSD does not support WINS */
135 0 : WBC_SSSD_NOT_IMPLEMENTED;
136 : }
137 :
138 : /* Enumerate the domain trusts known by Winbind */
139 0 : wbcErr wbcListTrusts(struct wbcDomainInfo **domains, size_t *num_domains)
140 : {
141 0 : WBC_SSSD_NOT_IMPLEMENTED;
142 : }
143 :
144 : /* Enumerate the domain trusts known by Winbind */
145 0 : wbcErr wbcLookupDomainController(const char *domain,
146 : uint32_t flags,
147 : struct wbcDomainControllerInfo **dc_info)
148 : {
149 0 : WBC_SSSD_NOT_IMPLEMENTED;
150 : }
151 :
152 : /* Get extended domain controller information */
153 0 : wbcErr wbcLookupDomainControllerEx(const char *domain,
154 : struct wbcGuid *guid,
155 : const char *site,
156 : uint32_t flags,
157 : struct wbcDomainControllerInfoEx **dc_info)
158 : {
159 0 : WBC_SSSD_NOT_IMPLEMENTED;
160 : }
|