885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose Unix SMB/CIFS implementation.
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose Winbind client API - SSSD version
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose Copyright (C) Sumit Bose <sbose@redhat.com> 2014
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose This library is free software; you can redistribute it and/or
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose modify it under the terms of the GNU Lesser General Public
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose License as published by the Free Software Foundation; either
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose version 3 of the License, or (at your option) any later version.
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose This library is distributed in the hope that it will be useful,
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose but WITHOUT ANY WARRANTY; without even the implied warranty of
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose Library General Public License for more details.
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose You should have received a copy of the GNU Lesser General Public License
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose along with this program. If not, see <http://www.gnu.org/licenses/>.
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose/* Required Headers */
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose/* Convert a Windows SID to a Unix uid, allocating an uid if needed */
885386b7e3f1c3e74b354576b98a092b0835d64eSumit BosewbcErr wbcSidToUid(const struct wbcDomainSid *sid, uid_t *puid)
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose if (type != SSS_ID_TYPE_UID && type != SSS_ID_TYPE_BOTH) {
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose/* Convert a Unix uid to a Windows SID, allocating a SID if needed */
885386b7e3f1c3e74b354576b98a092b0835d64eSumit BosewbcErr wbcUidToSid(uid_t uid, struct wbcDomainSid *sid)
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose if (type != SSS_ID_TYPE_UID && type != SSS_ID_TYPE_BOTH) {
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose/** @brief Convert a Windows SID to a Unix gid, allocating a gid if needed
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose * @param *sid Pointer to the domain SID to be resolved
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose * @param *pgid Pointer to the resolved gid_t value
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose * @return #wbcErr
885386b7e3f1c3e74b354576b98a092b0835d64eSumit BosewbcErr wbcSidToGid(const struct wbcDomainSid *sid, gid_t *pgid)
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose if (type != SSS_ID_TYPE_GID && type != SSS_ID_TYPE_BOTH) {
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose/* Convert a Unix gid to a Windows SID, allocating a SID if needed */
885386b7e3f1c3e74b354576b98a092b0835d64eSumit BosewbcErr wbcGidToSid(gid_t gid, struct wbcDomainSid *sid)
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose if (type != SSS_ID_TYPE_GID && type != SSS_ID_TYPE_BOTH) {
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose/* Obtain a new uid from Winbind */
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose /* Not supported by SSSD */
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose/* Obtain a new gid from Winbind */
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose /* Not supported by SSSD */
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose/* Convert a list of SIDs */
885386b7e3f1c3e74b354576b98a092b0835d64eSumit BosewbcErr wbcSidsToUnixIds(const struct wbcDomainSid *sids, uint32_t num_sids,
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose for (c = 0; c < num_sids; c++) {
f3347a0c72afc75b4d829e9981d1bac6b05a8306Sumit BosewbcErr wbcUnixIdsToSids(const struct wbcUnixId *ids, uint32_t num_ids,
f3347a0c72afc75b4d829e9981d1bac6b05a8306Sumit Bose for (c = 0; c < num_ids; c++) {
f3347a0c72afc75b4d829e9981d1bac6b05a8306Sumit Bose wbc_status = wbcUidToSid(ids[c].id.uid, &sids[c]);