summaryrefslogtreecommitdiffstats
path: root/nsswitch/libwbclient/wbc_util_sssd.c
blob: 50edc072bc3e7e2ebc82d2baacdee85685c7abd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
   Unix SMB/CIFS implementation.

   Winbind client API - SSSD version

   Copyright (C) Sumit Bose <sbose@redhat.com> 2014

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 3 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
/* Required Headers */

#include "replace.h"
#include "libwbclient.h"
#include "../winbind_client.h"
#include "wbc_sssd_internal.h"

/* For WINBIND_INTERFACE_VERSION */
#include "../winbind_struct_protocol.h"

/** @brief Ping winbindd to see if the daemon is running
 *
 * @return #wbcErr
 **/
wbcErr wbcPing(void)
{
	/* TODO: add real check */
	return WBC_ERR_SUCCESS;
}

static void wbcInterfaceDetailsDestructor(void *ptr)
{
	struct wbcInterfaceDetails *i = (struct wbcInterfaceDetails *)ptr;
	free(i->winbind_version);
	free(i->netbios_name);
	free(i->netbios_domain);
	free(i->dns_domain);
}

/**
 * @brief Query useful information about the winbind service
 *
 * @param *_details	pointer to hold the struct wbcInterfaceDetails
 *
 * @return #wbcErr
 */

wbcErr wbcInterfaceDetails(struct wbcInterfaceDetails **_details)
{
	wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
	struct wbcInterfaceDetails *info;
	info = (struct wbcInterfaceDetails *)wbcAllocateMemory(
		1, sizeof(struct wbcInterfaceDetails),
		wbcInterfaceDetailsDestructor);
	if (info == NULL) {
		return WBC_ERR_NO_MEMORY;
	}

	/* TODO: currently this call just returns a suitable winbind_separator
	 * for wbinfo. */

	info->interface_version = WINBIND_INTERFACE_VERSION;
	info->winbind_version = strdup("libwbclient for SSSD");
	if (info->winbind_version == NULL) {
		wbc_status = WBC_ERR_NO_MEMORY;
		goto done;
	}

	info->winbind_separator = '\\';

	info->netbios_name = strdup("-not available-");
	if (info->netbios_name == NULL) {
		wbc_status = WBC_ERR_NO_MEMORY;
		goto done;
	}

	info->netbios_domain = strdup("-not available-");
	if (info->netbios_domain == NULL) {
		wbc_status = WBC_ERR_NO_MEMORY;
		goto done;
	}

	info->dns_domain = strdup("-not available-");
	if (info->dns_domain == NULL) {
		wbc_status = WBC_ERR_NO_MEMORY;
		goto done;
	}

	*_details = info;
	info = NULL;
	wbc_status = WBC_ERR_SUCCESS;
done:
	wbcFreeMemory(info);
	return wbc_status;
}

/** @brief Lookup the current status of a trusted domain, sync wrapper
 *
 * @param domain      Domain to query
 * @param *dinfo       Pointer to returned struct wbcDomainInfo
 *
 * @return #wbcErr
 */

wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo)
{
	WBC_SSSD_NOT_IMPLEMENTED;
}

/* Get the list of current DCs */
wbcErr wbcDcInfo(const char *domain, size_t *num_dcs,
		 const char ***dc_names, const char ***dc_ips)
{
	WBC_SSSD_NOT_IMPLEMENTED;
}

/* Resolve a NetbiosName via WINS */
wbcErr wbcResolveWinsByName(const char *name, char **ip)
{
	/* SSSD does not support WINS */
	WBC_SSSD_NOT_IMPLEMENTED;
}

/* Resolve an IP address via WINS into a NetbiosName */
wbcErr wbcResolveWinsByIP(const char *ip, char **name)
{
	/* SSSD does not support WINS */
	WBC_SSSD_NOT_IMPLEMENTED;
}

/* Enumerate the domain trusts known by Winbind */
wbcErr wbcListTrusts(struct wbcDomainInfo **domains, size_t *num_domains)
{
	WBC_SSSD_NOT_IMPLEMENTED;
}

/* Enumerate the domain trusts known by Winbind */
wbcErr wbcLookupDomainController(const char *domain,
				 uint32_t flags,
				struct wbcDomainControllerInfo **dc_info)
{
	WBC_SSSD_NOT_IMPLEMENTED;
}

/* Get extended domain controller information */
wbcErr wbcLookupDomainControllerEx(const char *domain,
				   struct wbcGuid *guid,
				   const char *site,
				   uint32_t flags,
				   struct wbcDomainControllerInfoEx **dc_info)
{
	WBC_SSSD_NOT_IMPLEMENTED;
}