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/>.
26 #include <nsswitch/libwbclient/wbc_err.h>
29 * Data types used by the Winbind Client API
33 #define MAXSUBAUTHS 15 /* max sub authorities in a SID */
37 * @brief Windows Security Identifier
45 uint32_t sub_auths[MAXSUBAUTHS];
49 * @brief Security Identifier type
53 WBC_SID_NAME_USE_NONE=0,
55 WBC_SID_NAME_DOM_GRP=2,
56 WBC_SID_NAME_DOMAIN=3,
58 WBC_SID_NAME_WKN_GRP=5,
59 WBC_SID_NAME_DELETED=6,
60 WBC_SID_NAME_INVALID=7,
61 WBC_SID_NAME_UNKNOWN=8,
62 WBC_SID_NAME_COMPUTER=9
66 * @brief Domain Information
69 struct wbcDomainInfo {
72 struct wbcDomainSid sid;
76 /* wbcDomainInfo->flags */
78 #define WBC_DOMINFO_NATIVE 0x00000001
79 #define WBC_DOMINFO_AD 0x00000002
80 #define WBC_DOMINFO_PRIMARY 0x00000004
86 void wbcFreeMemory(void*);
90 * Utility functions for dealing with SIDs
93 wbcErr wbcSidToString(const struct wbcDomainSid *sid,
96 wbcErr wbcStringToSid(const char *sid_string,
97 struct wbcDomainSid *sid);
102 * Name/SID conversion
105 wbcErr wbcLookupName(const char *dom_name,
107 struct wbcDomainSid *sid,
108 enum wbcSidType *name_type);
110 wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
113 enum wbcSidType *name_type);
115 wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
118 const char **domain_name,
120 enum wbcSidType **types);
123 * SID/uid/gid Mappings
126 wbcErr wbcSidToUid(const struct wbcDomainSid *sid,
129 wbcErr wbcUidToSid(uid_t uid,
130 struct wbcDomainSid *sid);
132 wbcErr wbcSidToGid(const struct wbcDomainSid *sid,
135 wbcErr wbcGidToSid(gid_t gid,
136 struct wbcDomainSid *sid);
138 wbcErr wbcAllocateUid(uid_t *puid);
140 wbcErr wbcAllocateGid(uid_t *pgid);
143 * NSS Lookup User/Group details
146 wbcErr wbcGetpwnam(const char *name, struct passwd **pwd);
148 wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd);
150 wbcErr wbcGetgrnam(const char *name, struct group **grp);
152 wbcErr wbcGetgrgid(gid_t gid, struct group **grp);
154 wbcErr wbcSetpwent(void);
156 wbcErr wbcEndpwent(void);
158 wbcErr wbcGetpwent(struct passwd **pwd);
160 wbcErr wbcSetgrent(void);
162 wbcErr wbcEndgrent(void);
164 wbcErr wbcGetgrent(struct group **grp);
168 * Lookup Domain information
171 wbcErr wbcDomainInfo(const char *domain,
172 struct wbcDomainInfo **info);
174 wbcErr wbcDomainSequenceNumbers(void);
177 * Athenticate functions
180 wbcErr wbcAuthenticateUser(const char *username,
181 const char *password);
184 #endif /* _WBCLIENT_H */