sss_idmap.h revision 46222e5191473f9a46aec581273eb2eef22e23be
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose ID-mapping library
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose Sumit Bose <sbose@redhat.com>
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose Copyright (C) 2012 Red Hat
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose This program is free software; you can redistribute it and/or modify
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose it under the terms of the GNU General Public License as published by
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose the Free Software Foundation; either version 3 of the License, or
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose (at your option) any later version.
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose This program is distributed in the hope that it will be useful,
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose but WITHOUT ANY WARRANTY; without even the implied warranty of
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose GNU General Public License for more details.
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose You should have received a copy of the GNU General Public License
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose along with this program. If not, see <http://www.gnu.org/licenses/>.
45f75fc8e98092fa48faa3d180fd42f7efd51486Stephen Gallagher#define DOM_SID_PREFIX_LEN (sizeof(DOM_SID_PREFIX) - 1)
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @defgroup sss_idmap Map Unix UIDs and GIDs to SIDs and back
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * Libsss_idmap provides a mechanism to translate a SID to a UNIX UID or GID
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * or the other way round.
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * Error codes used by libsss_idmap
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose /** Success */
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose /** Function is not yet implemented */
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose /** General error */
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose /** Ran out of memory during processing */
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose /** No domain added */
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose /** The provided idmap context is invalid */
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose /** The provided SID is invalid */
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose /** The provided SID was not found */
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose /** The provided UID or GID could not be mapped */
d6f283302268520c1506fb3da4f2a22f5a741be5Michal Zidek /** The provided SID is a built-in one */
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek /* No more free slices */
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * Typedef for memory allocation functions
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bosetypedef void *(idmap_alloc_func)(size_t size, void *pvt);
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bosetypedef void (idmap_free_func)(void *ptr, void *pvt);
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * Structure for id ranges
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * FIXME: this struct might change when it is clear how ranges are handled on
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * the server side
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * Opaque type for SIDs
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * Opaque type for the idmap context
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * Placeholder for Samba's struct dom_sid. Consumers of libsss_idmap should
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * include an appropriate Samba header file to define struct dom_sid. We use
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * it here to avoid a hard dependency on Samba devel packages.
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @brief Initialize idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] alloc_func Function to allocate memory for the context, if
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * NULL malloc() id used
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] alloc_pvt Private data for allocation routine
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] free_func Function to free the memory the context, if
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * NULL free() id used
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[out] ctx idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - #IDMAP_OUT_OF_MEMORY: Insufficient memory to create the context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Boseenum idmap_error_code sss_idmap_init(idmap_alloc_func *alloc_func,
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @brief Set/unset autorid compatibility mode
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] ctx idmap context
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] use_autorid If true, autorid compatibility mode will be used
46222e5191473f9a46aec581273eb2eef22e23beMichal Zideksss_idmap_ctx_set_autorid(struct sss_idmap_ctx *ctx, bool use_autorid);
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @brief Set the lower bound of the range of POSIX IDs
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] ctx idmap context
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] lower lower bound of the range
46222e5191473f9a46aec581273eb2eef22e23beMichal Zideksss_idmap_ctx_set_lower(struct sss_idmap_ctx *ctx, id_t lower);
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @brief Set the upper bound of the range of POSIX IDs
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] ctx idmap context
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] upper upper bound of the range
46222e5191473f9a46aec581273eb2eef22e23beMichal Zideksss_idmap_ctx_set_upper(struct sss_idmap_ctx *ctx, id_t upper);
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @brief Set the range size of POSIX IDs available for single domain
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] ctx idmap context
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] rangesize range size of IDs
46222e5191473f9a46aec581273eb2eef22e23beMichal Zideksss_idmap_ctx_set_rangesize(struct sss_idmap_ctx *ctx, id_t rangesize);
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @brief Check if autorid compatibility mode is set
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] ctx idmap context
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[out] _autorid true if autorid is used
46222e5191473f9a46aec581273eb2eef22e23beMichal Zideksss_idmap_ctx_get_autorid(struct sss_idmap_ctx *ctx, bool *_autorid);
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @brief Get the lower bound of the range of POSIX IDs
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] ctx idmap context
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[out] _lower returned lower bound
46222e5191473f9a46aec581273eb2eef22e23beMichal Zideksss_idmap_ctx_get_lower(struct sss_idmap_ctx *ctx, id_t *_lower);
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @brief Get the upper bound of the range of POSIX IDs
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] ctx idmap context
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[out] _upper returned upper bound
46222e5191473f9a46aec581273eb2eef22e23beMichal Zideksss_idmap_ctx_get_upper(struct sss_idmap_ctx *ctx, id_t *_upper);
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @brief Get the range size of POSIX IDs available for single domain
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] ctx idmap context
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[out] _rangesize returned range size
46222e5191473f9a46aec581273eb2eef22e23beMichal Zideksss_idmap_ctx_get_rangesize(struct sss_idmap_ctx *ctx, id_t *rangesize);
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @brief Calculate new range of available POSIX IDs
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] ctx Idmap context
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in] dom_sid Zero-terminated string representation of the domain
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * SID (S-1-15-.....)
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[in/out] slice_num Slice number to be used. Set this pointer to NULL or
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * the addressed value to -1 to calculate slice number
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * automatically. The calculated value will be
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * returned in this parameter.
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * @param[out] range Structure containing upper and lower bound of the
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * range of POSIX IDs
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidek * - #IDMAP_OUT_OF_SLICES: Cannot calculate new range because all slices are
46222e5191473f9a46aec581273eb2eef22e23beMichal Zidekenum idmap_error_code sss_idmap_calculate_range(struct sss_idmap_ctx *ctx,
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @brief Add a domain to the idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] ctx Idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] domain_name Zero-terminated string with the domain name
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] domain_sid Zero-terminated string representation of the domain
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * SID (S-1-15-.....)
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] range TBD Some information about the id ranges of this
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - #IDMAP_OUT_OF_MEMORY: Insufficient memory to store the data in the idmap
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - #IDMAP_SID_INVALID: Invalid SID provided
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - #IDMAP_NO_DOMAIN: No domain domain name given
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Boseenum idmap_error_code sss_idmap_add_domain(struct sss_idmap_ctx *ctx,
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @brief Translate SID to a unix UID or GID
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] ctx Idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] sid Zero-terminated string representation of the SID
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[out] id Returned unix UID or GID
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - #IDMAP_NO_DOMAIN: No domains are added to the idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - #IDMAP_SID_INVALID: Invalid SID provided
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - #IDMAP_SID_UNKNOWN: SID cannot be found in the domains added to the
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Boseenum idmap_error_code sss_idmap_sid_to_unix(struct sss_idmap_ctx *ctx,
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose const char *sid,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @brief Translate a SID stucture to a unix UID or GID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] ctx Idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] dom_sid SID structure
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] id Returned unix UID or GID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_NO_DOMAIN: No domains are added to the idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_SID_INVALID: Invalid SID provided
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_SID_UNKNOWN: SID cannot be found in the domains added to the
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Boseenum idmap_error_code sss_idmap_dom_sid_to_unix(struct sss_idmap_ctx *ctx,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @brief Translate a binary SID to a unix UID or GID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] ctx Idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] bin_sid Array with the binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] length Size of the array containing the binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] id Returned unix UID or GID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_NO_DOMAIN: No domains are added to the idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_SID_INVALID: Invalid SID provided
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_SID_UNKNOWN: SID cannot be found in the domains added to the
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Boseenum idmap_error_code sss_idmap_bin_sid_to_unix(struct sss_idmap_ctx *ctx,
6f504738cad1ee9daa1bd6eec721caceef65f21dSumit Bose * @brief Translate a Samba dom_sid stucture to a unix UID or GID
6f504738cad1ee9daa1bd6eec721caceef65f21dSumit Bose * @param[in] ctx Idmap context
6f504738cad1ee9daa1bd6eec721caceef65f21dSumit Bose * @param[in] smb_sid Samba dom_sid structure
6f504738cad1ee9daa1bd6eec721caceef65f21dSumit Bose * @param[out] id Returned unix UID or GID
6f504738cad1ee9daa1bd6eec721caceef65f21dSumit Bose * - #IDMAP_NO_DOMAIN: No domains are added to the idmap context
6f504738cad1ee9daa1bd6eec721caceef65f21dSumit Bose * - #IDMAP_SID_INVALID: Invalid SID provided
6f504738cad1ee9daa1bd6eec721caceef65f21dSumit Bose * - #IDMAP_SID_UNKNOWN: SID cannot be found in the domains added to the
6f504738cad1ee9daa1bd6eec721caceef65f21dSumit Bose * idmap context
6f504738cad1ee9daa1bd6eec721caceef65f21dSumit Boseenum idmap_error_code sss_idmap_smb_sid_to_unix(struct sss_idmap_ctx *ctx,
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @brief Translate unix UID or GID to a SID
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] ctx Idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] id unix UID or GID
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[out] sid Zero-terminated string representation of the SID, must be
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * freed if not needed anymore
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - #IDMAP_NO_DOMAIN: No domains are added to the idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - #IDMAP_NO_RANGE: The provided ID cannot be found in the domains added
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * to the idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Boseenum idmap_error_code sss_idmap_unix_to_sid(struct sss_idmap_ctx *ctx,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @brief Translate unix UID or GID to a SID structure
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] ctx Idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] id unix UID or GID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] dom_sid SID structure, must be freed if not needed anymore
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_NO_DOMAIN: No domains are added to the idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_NO_RANGE: The provided ID cannot be found in the domains added
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * to the idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Boseenum idmap_error_code sss_idmap_unix_to_dom_sid(struct sss_idmap_ctx *ctx,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @brief Translate unix UID or GID to a binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] ctx Idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] id unix UID or GID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] bin_sid Array with the binary SID,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * must be freed if not needed anymore
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] length size of the array containing the binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_NO_DOMAIN: No domains are added to the idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_NO_RANGE: The provided ID cannot be found in the domains added
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * to the idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Boseenum idmap_error_code sss_idmap_unix_to_bin_sid(struct sss_idmap_ctx *ctx,
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @brief Free all the allocated memory of the idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] ctx Idmap context
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - #IDMAP_CONTEXT_INVALID: Provided context is invalid
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Boseenum idmap_error_code sss_idmap_free(struct sss_idmap_ctx *ctx);
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @brief Translate error code to a string
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] err Idmap error code
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - Error description as a zero-terminated string
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Boseconst char *idmap_error_string(enum idmap_error_code err);
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @brief Check if given string can be used as domain SID
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * @param[in] str String to check
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - true: String can be used as domain SID
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose * - false: String can not be used as domain SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @brief Convert binary SID to SID structure
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] ctx Idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] bin_sid Array with the binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] length Size of the array containing the binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] dom_sid SID structure,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * must be freed if not needed anymore
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Boseenum idmap_error_code sss_idmap_bin_sid_to_dom_sid(struct sss_idmap_ctx *ctx,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @brief Convert binary SID to SID string
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] ctx Idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] bin_sid Array with the binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] length Size of the array containing the binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] sid Zero-terminated string representation of the SID,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * must be freed if not needed anymore
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Boseenum idmap_error_code sss_idmap_bin_sid_to_sid(struct sss_idmap_ctx *ctx,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @brief Convert SID structure to binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] ctx Idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] dom_sid SID structure
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] bin_sid Array with the binary SID,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * must be freed if not needed anymore
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] length Size of the array containing the binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Boseenum idmap_error_code sss_idmap_dom_sid_to_bin_sid(struct sss_idmap_ctx *ctx,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @brief Convert SID string to binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] ctx Idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] sid Zero-terminated string representation of the SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] bin_sid Array with the binary SID,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * must be freed if not needed anymore
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] length Size of the array containing the binary SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Boseenum idmap_error_code sss_idmap_sid_to_bin_sid(struct sss_idmap_ctx *ctx,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose const char *sid,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @brief Convert SID structure to SID string
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] ctx Idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] dom_sid SID structure
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] sid Zero-terminated string representation of the SID,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * must be freed if not needed anymore
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Boseenum idmap_error_code sss_idmap_dom_sid_to_sid(struct sss_idmap_ctx *ctx,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @brief Convert SID string to SID structure
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] ctx Idmap context
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[in] sid Zero-terminated string representation of the SID
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * @param[out] dom_sid SID structure,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * must be freed if not needed anymore
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Boseenum idmap_error_code sss_idmap_sid_to_dom_sid(struct sss_idmap_ctx *ctx,
b6dfbf81c61d4431aaa81687ec53e892f8b71edbSumit Bose const char *sid,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @brief Convert SID string to Samba dom_sid structure
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] ctx Idmap context
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] sid Zero-terminated string representation of the SID
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[out] smb_sid Samba dom_sid structure,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * must be freed if not needed anymore
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
2998435fcc95857b73049b3955af9889ab595f24Sumit Boseenum idmap_error_code sss_idmap_sid_to_smb_sid(struct sss_idmap_ctx *ctx,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose const char *sid,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @brief Convert Samba dom_sid structure to SID string
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] ctx Idmap context
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] smb_sid Samba dom_sid structure
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[out] sid Zero-terminated string representation of the SID,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * must be freed if not needed anymore
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
2998435fcc95857b73049b3955af9889ab595f24Sumit Boseenum idmap_error_code sss_idmap_smb_sid_to_sid(struct sss_idmap_ctx *ctx,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @brief Convert SID stucture to Samba dom_sid structure
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] ctx Idmap context
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] dom_sid SID structure
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[out] smb_sid Samba dom_sid structure,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * must be freed if not needed anymore
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
2998435fcc95857b73049b3955af9889ab595f24Sumit Boseenum idmap_error_code sss_idmap_dom_sid_to_smb_sid(struct sss_idmap_ctx *ctx,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @brief Convert Samba dom_sid structure to SID structure
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] ctx Idmap context
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] smb_sid Samba dom_sid structure
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[out] dom_sid SID structure,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * must be freed if not needed anymore
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
2998435fcc95857b73049b3955af9889ab595f24Sumit Boseenum idmap_error_code sss_idmap_smb_sid_to_dom_sid(struct sss_idmap_ctx *ctx,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @brief Convert binary SID to Samba dom_sid structure
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] ctx Idmap context
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] bin_sid Array with the binary SID
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] length Size of the array containing the binary SID
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[out] smb_sid Samba dom_sid structure,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * must be freed if not needed anymore
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
2998435fcc95857b73049b3955af9889ab595f24Sumit Boseenum idmap_error_code sss_idmap_bin_sid_to_smb_sid(struct sss_idmap_ctx *ctx,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @brief Convert Samba dom_sid structure to binary SID
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] ctx Idmap context
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[in] smb_sid Samba dom_sid structure
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[out] bin_sid Array with the binary SID,
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * must be freed if not needed anymore
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * @param[out] length Size of the array containing the binary SID
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_SID_INVALID: Given SID is invalid
2998435fcc95857b73049b3955af9889ab595f24Sumit Bose * - #IDMAP_OUT_OF_MEMORY: Failed to allocate memory for the result
2998435fcc95857b73049b3955af9889ab595f24Sumit Boseenum idmap_error_code sss_idmap_smb_sid_to_bin_sid(struct sss_idmap_ctx *ctx,
a6098862048d4bb469130b9ff21be3020d6f2c54Sumit Bose#endif /* SSS_IDMAP_H_ */