2 Unix SMB/CIFS implementation.
6 Copyright (C) Gerald (Jerry) Carter 2007
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.
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.
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/>.
28 /* Define error types */
31 * @brief Status codes returned from wbc functions
35 WBC_ERR_SUCCESS = 0, /**< Successful completion **/
36 WBC_ERR_NOT_IMPLEMENTED,/**< Function not implemented **/
37 WBC_ERR_UNKNOWN_FAILURE,/**< General failure **/
38 WBC_ERR_NO_MEMORY, /**< Memory allocation error **/
39 WBC_ERR_INVALID_SID, /**< Invalid SID format **/
40 WBC_ERR_INVALID_PARAM, /**< An Invalid parameter was supplied **/
41 WBC_ERR_WINBIND_NOT_AVAILABLE, /**< Winbind daemon is not available **/
42 WBC_ERR_DOMAIN_NOT_FOUND, /**< Domain is not trusted or cannot be found **/
43 WBC_INVALID_RESPONSE, /**< Winbind returned an invalid response **/
44 WBC_ERR_NSS_ERROR /**< NSS_STATUS error **/
47 typedef enum _wbcErrType wbcErr;
49 #define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS)
51 char *wbcErrorString(wbcErr error);
54 * Data types used by the Winbind Client API
58 #define MAXSUBAUTHS 15 /* max sub authorities in a SID */
62 * @brief Windows Security Identifier
70 uint32_t sub_auths[MAXSUBAUTHS];
74 * @brief Security Identifier type
78 WBC_SID_NAME_USE_NONE=0,
80 WBC_SID_NAME_DOM_GRP=2,
81 WBC_SID_NAME_DOMAIN=3,
83 WBC_SID_NAME_WKN_GRP=5,
84 WBC_SID_NAME_DELETED=6,
85 WBC_SID_NAME_INVALID=7,
86 WBC_SID_NAME_UNKNOWN=8,
87 WBC_SID_NAME_COMPUTER=9
91 * @brief Domain Information
94 struct wbcDomainInfo {
97 struct wbcDomainSid sid;
101 /* wbcDomainInfo->flags */
103 #define WBC_DOMINFO_NATIVE 0x00000001
104 #define WBC_DOMINFO_AD 0x00000002
105 #define WBC_DOMINFO_PRIMARY 0x00000004
111 void wbcFreeMemory(void*);
115 * Utility functions for dealing with SIDs
118 wbcErr wbcSidToString(const struct wbcDomainSid *sid,
121 wbcErr wbcStringToSid(const char *sid_string,
122 struct wbcDomainSid *sid);
124 wbcErr wbcPing(void);
127 * Name/SID conversion
130 wbcErr wbcLookupName(const char *dom_name,
132 struct wbcDomainSid *sid,
133 enum wbcSidType *name_type);
135 wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
138 enum wbcSidType *name_type);
140 wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
143 const char **domain_name,
145 enum wbcSidType **types);
148 * SID/uid/gid Mappings
151 wbcErr wbcSidToUid(const struct wbcDomainSid *sid,
154 wbcErr wbcUidToSid(uid_t uid,
155 struct wbcDomainSid *sid);
157 wbcErr wbcSidToGid(const struct wbcDomainSid *sid,
160 wbcErr wbcGidToSid(gid_t gid,
161 struct wbcDomainSid *sid);
163 wbcErr wbcAllocateUid(uid_t *puid);
165 wbcErr wbcAllocateGid(uid_t *pgid);
168 * NSS Lookup User/Group details
171 wbcErr wbcGetpwnam(const char *name, struct passwd **pwd);
173 wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd);
175 wbcErr wbcGetgrnam(const char *name, struct group **grp);
177 wbcErr wbcGetgrgid(gid_t gid, struct group **grp);
179 wbcErr wbcSetpwent(void);
181 wbcErr wbcEndpwent(void);
183 wbcErr wbcGetpwent(struct passwd **pwd);
185 wbcErr wbcSetgrent(void);
187 wbcErr wbcEndgrent(void);
189 wbcErr wbcGetgrent(struct group **grp);
193 * Lookup Domain information
196 wbcErr wbcDomainInfo(const char *domain,
197 struct wbcDomainInfo **info);
199 wbcErr wbcDomainSequenceNumbers(void);
202 * Athenticate functions
205 wbcErr wbcAuthenticateUser(const char *username,
206 const char *password);
209 #endif /* _WBCLIENT_H */