sss_idmap 2.12.0
|
Libsss_idmap provides a mechanism to translate a SID to a UNIX UID or GID or the other way round. More...
Data Structures | |
struct | sss_idmap_range |
Structure for id ranges FIXME: this struct might change when it is clear how ranges are handled on the server side. More... | |
struct | sss_idmap_offset_murmurhash3_data |
Structure for private data for offset_murmurhash3. More... | |
Typedefs | |
typedef void * | idmap_alloc_func(size_t size, void *pvt) |
Typedef for memory allocation functions. | |
typedef enum idmap_error_code(* | idmap_store_cb) (const char *dom_name, const char *dom_sid, const char *range_id, uint32_t min_id, uint32_t max_id, uint32_t first_rid, void *pvt) |
Typedef for storing mappings of dynamically created domains. | |
Enumerations | |
enum | idmap_error_code { IDMAP_SUCCESS = 0 , IDMAP_NOT_IMPLEMENTED , IDMAP_ERROR , IDMAP_OUT_OF_MEMORY , IDMAP_NO_DOMAIN , IDMAP_CONTEXT_INVALID , IDMAP_SID_INVALID , IDMAP_SID_UNKNOWN , IDMAP_NO_RANGE , IDMAP_BUILTIN_SID , IDMAP_OUT_OF_SLICES , IDMAP_COLLISION , IDMAP_EXTERNAL , IDMAP_NAME_UNKNOWN , IDMAP_NO_REVERSE , IDMAP_UTF8_ERROR , IDMAP_ERR_LAST } |
Error codes used by libsss_idmap. More... | |
Functions | |
enum idmap_error_code | sss_idmap_init (idmap_alloc_func *alloc_func, void *alloc_pvt, idmap_free_func *free_func, struct sss_idmap_ctx **ctx) |
Initialize idmap context. | |
enum idmap_error_code | sss_idmap_ctx_set_autorid (struct sss_idmap_ctx *ctx, bool use_autorid) |
Set/unset autorid compatibility mode. | |
enum idmap_error_code | sss_idmap_ctx_set_lower (struct sss_idmap_ctx *ctx, id_t lower) |
Set the lower bound of the range of POSIX IDs. | |
enum idmap_error_code | sss_idmap_ctx_set_upper (struct sss_idmap_ctx *ctx, id_t upper) |
Set the upper bound of the range of POSIX IDs. | |
enum idmap_error_code | sss_idmap_ctx_set_rangesize (struct sss_idmap_ctx *ctx, id_t rangesize) |
Set the range size of POSIX IDs available for single domain. | |
enum idmap_error_code | sss_idmap_ctx_set_extra_slice_init (struct sss_idmap_ctx *ctx, int extra_slice_init) |
Set the number of secondary slices available for domain. | |
enum idmap_error_code | sss_idmap_ctx_get_autorid (struct sss_idmap_ctx *ctx, bool *_autorid) |
Check if autorid compatibility mode is set. | |
enum idmap_error_code | sss_idmap_ctx_get_lower (struct sss_idmap_ctx *ctx, id_t *_lower) |
Get the lower bound of the range of POSIX IDs. | |
enum idmap_error_code | sss_idmap_ctx_get_upper (struct sss_idmap_ctx *ctx, id_t *_upper) |
Get the upper bound of the range of POSIX IDs. | |
enum idmap_error_code | sss_idmap_ctx_get_rangesize (struct sss_idmap_ctx *ctx, id_t *rangesize) |
Get the range size of POSIX IDs available for single domain. | |
enum idmap_error_code | sss_idmap_calculate_range (struct sss_idmap_ctx *ctx, const char *dom_sid, id_t *slice_num, struct sss_idmap_range *range) |
Calculate new range of available POSIX IDs. | |
enum idmap_error_code | sss_idmap_add_domain (struct sss_idmap_ctx *ctx, const char *domain_name, const char *domain_sid, struct sss_idmap_range *range) |
Add a domain to the idmap context. | |
enum idmap_error_code | sss_idmap_add_domain_ex (struct sss_idmap_ctx *ctx, const char *domain_name, const char *domain_sid, struct sss_idmap_range *range, const char *range_id, uint32_t rid, bool external_mapping) |
Add a domain with the first mappable RID to the idmap context. | |
enum idmap_error_code | sss_idmap_add_auto_domain_ex (struct sss_idmap_ctx *ctx, const char *domain_name, const char *domain_sid, struct sss_idmap_range *range, const char *range_id, uint32_t rid, bool external_mapping, idmap_store_cb cb, void *pvt) |
Add a domain with the first mappable RID to the idmap context and generate automatically secondary slices. | |
enum idmap_error_code | sss_idmap_check_collision (struct sss_idmap_ctx *ctx, char *n_name, char *n_sid, struct sss_idmap_range *n_range, uint32_t n_first_rid, char *n_range_id, bool n_external_mapping) |
Check if a new range would collide with any existing one. | |
enum idmap_error_code | sss_idmap_check_collision_ex (const char *o_name, const char *o_sid, struct sss_idmap_range *o_range, uint32_t o_first_rid, const char *o_range_id, bool o_external_mapping, const char *n_name, const char *n_sid, struct sss_idmap_range *n_range, uint32_t n_first_rid, const char *n_range_id, bool n_external_mapping) |
Check if two ranges would collide. | |
enum idmap_error_code | sss_idmap_sid_to_unix (struct sss_idmap_ctx *ctx, const char *sid, uint32_t *id) |
Translate SID to a unix UID or GID. | |
enum idmap_error_code | sss_idmap_dom_sid_to_unix (struct sss_idmap_ctx *ctx, struct sss_dom_sid *dom_sid, uint32_t *id) |
Translate a SID stucture to a unix UID or GID. | |
enum idmap_error_code | sss_idmap_bin_sid_to_unix (struct sss_idmap_ctx *ctx, uint8_t *bin_sid, size_t length, uint32_t *id) |
Translate a binary SID to a unix UID or GID. | |
enum idmap_error_code | sss_idmap_smb_sid_to_unix (struct sss_idmap_ctx *ctx, struct dom_sid *smb_sid, uint32_t *id) |
Translate a Samba dom_sid stucture to a unix UID or GID. | |
enum idmap_error_code | sss_idmap_check_sid_unix (struct sss_idmap_ctx *ctx, const char *sid, uint32_t id) |
Check if a SID and a unix UID or GID belong to the same range. | |
enum idmap_error_code | sss_idmap_check_dom_sid_unix (struct sss_idmap_ctx *ctx, struct sss_dom_sid *dom_sid, uint32_t id) |
Check if a SID structure and a unix UID or GID belong to the same range. | |
enum idmap_error_code | sss_idmap_check_bin_sid_unix (struct sss_idmap_ctx *ctx, uint8_t *bin_sid, size_t length, uint32_t id) |
Check if a binary SID and a unix UID or GID belong to the same range. | |
enum idmap_error_code | sss_idmap_check_smb_sid_unix (struct sss_idmap_ctx *ctx, struct dom_sid *smb_sid, uint32_t id) |
Check if a Samba dom_sid structure and a unix UID or GID belong to the same range. | |
enum idmap_error_code | sss_idmap_unix_to_sid (struct sss_idmap_ctx *ctx, uint32_t id, char **sid) |
Translate unix UID or GID to a SID. | |
enum idmap_error_code | sss_idmap_unix_to_dom_sid (struct sss_idmap_ctx *ctx, uint32_t id, struct sss_dom_sid **dom_sid) |
Translate unix UID or GID to a SID structure. | |
enum idmap_error_code | sss_idmap_unix_to_bin_sid (struct sss_idmap_ctx *ctx, uint32_t id, uint8_t **bin_sid, size_t *length) |
Translate unix UID or GID to a binary SID. | |
enum idmap_error_code | sss_idmap_free (struct sss_idmap_ctx *ctx) |
Free all the allocated memory of the idmap context. | |
enum idmap_error_code | sss_idmap_free_sid (struct sss_idmap_ctx *ctx, char *sid) |
Free mapped SID. | |
enum idmap_error_code | sss_idmap_free_dom_sid (struct sss_idmap_ctx *ctx, struct sss_dom_sid *dom_sid) |
Free mapped domain SID. | |
enum idmap_error_code | sss_idmap_free_smb_sid (struct sss_idmap_ctx *ctx, struct dom_sid *smb_sid) |
Free mapped Samba SID. | |
enum idmap_error_code | sss_idmap_free_bin_sid (struct sss_idmap_ctx *ctx, uint8_t *bin_sid) |
Free mapped binary SID. | |
const char * | idmap_error_string (enum idmap_error_code err) |
Translate error code to a string. | |
bool | is_domain_sid (const char *str) |
Check if given string can be used as domain SID. | |
enum idmap_error_code | sss_idmap_domain_has_algorithmic_mapping (struct sss_idmap_ctx *ctx, const char *dom_sid, bool *has_algorithmic_mapping) |
Check if a domain is configured with algorithmic mapping. | |
enum idmap_error_code | sss_idmap_domain_by_name_has_algorithmic_mapping (struct sss_idmap_ctx *ctx, const char *dom_name, bool *has_algorithmic_mapping) |
Check if a domain is configured with algorithmic mapping. | |
enum idmap_error_code | sss_idmap_bin_sid_to_dom_sid (struct sss_idmap_ctx *ctx, const uint8_t *bin_sid, size_t length, struct sss_dom_sid **dom_sid) |
Convert binary SID to SID structure. | |
enum idmap_error_code | sss_idmap_bin_sid_to_sid (struct sss_idmap_ctx *ctx, const uint8_t *bin_sid, size_t length, char **sid) |
Convert binary SID to SID string. | |
enum idmap_error_code | sss_idmap_dom_sid_to_bin_sid (struct sss_idmap_ctx *ctx, struct sss_dom_sid *dom_sid, uint8_t **bin_sid, size_t *length) |
Convert SID structure to binary SID. | |
enum idmap_error_code | sss_idmap_sid_to_bin_sid (struct sss_idmap_ctx *ctx, const char *sid, uint8_t **bin_sid, size_t *length) |
Convert SID string to binary SID. | |
enum idmap_error_code | sss_idmap_dom_sid_to_sid (struct sss_idmap_ctx *ctx, struct sss_dom_sid *dom_sid, char **sid) |
Convert SID structure to SID string. | |
enum idmap_error_code | sss_idmap_sid_to_dom_sid (struct sss_idmap_ctx *ctx, const char *sid, struct sss_dom_sid **dom_sid) |
Convert SID string to SID structure. | |
enum idmap_error_code | sss_idmap_sid_to_smb_sid (struct sss_idmap_ctx *ctx, const char *sid, struct dom_sid **smb_sid) |
Convert SID string to Samba dom_sid structure. | |
enum idmap_error_code | sss_idmap_smb_sid_to_sid (struct sss_idmap_ctx *ctx, struct dom_sid *smb_sid, char **sid) |
Convert Samba dom_sid structure to SID string. | |
enum idmap_error_code | sss_idmap_dom_sid_to_smb_sid (struct sss_idmap_ctx *ctx, struct sss_dom_sid *dom_sid, struct dom_sid **smb_sid) |
Convert SID stucture to Samba dom_sid structure. | |
enum idmap_error_code | sss_idmap_smb_sid_to_dom_sid (struct sss_idmap_ctx *ctx, struct dom_sid *smb_sid, struct sss_dom_sid **dom_sid) |
Convert Samba dom_sid structure to SID structure. | |
enum idmap_error_code | sss_idmap_bin_sid_to_smb_sid (struct sss_idmap_ctx *ctx, const uint8_t *bin_sid, size_t length, struct dom_sid **smb_sid) |
Convert binary SID to Samba dom_sid structure. | |
enum idmap_error_code | sss_idmap_smb_sid_to_bin_sid (struct sss_idmap_ctx *ctx, struct dom_sid *smb_sid, uint8_t **bin_sid, size_t *length) |
Convert Samba dom_sid structure to binary SID. | |
enum idmap_error_code | idmap_offset_func (void *pvt, uint32_t range_size, const char *input, long long *offset) |
Typedef for functions to calculate an offset for id-mapping and, if possible, for the reverse operation. | |
enum idmap_error_code | sss_idmap_add_gen_domain_ex (struct sss_idmap_ctx *ctx, const char *domain_name, const char *domain_id, struct sss_idmap_range *range, const char *range_id, idmap_offset_func *offset_func, idmap_rev_offset_func *rev_offset_func, void *offset_func_pvt, uint32_t shift, bool external_mapping) |
Add a generic domain to the idmap context. | |
enum idmap_error_code | sss_idmap_offset_identity (void *pvt, uint32_t range_size, const char *input, long long *offset) |
Calculate offset from string containing only numbers. | |
enum idmap_error_code | sss_idmap_rev_offset_identity (struct sss_idmap_ctx *ctx, void *pvt, uint32_t id, char **_out) |
Reverse of sss_idmap_offset_identity, return a string containig only numbers representing the given offset. | |
enum idmap_error_code | sss_idmap_offset_murmurhash3 (void *pvt, uint32_t range_size, const char *input, long long *offset) |
Calculate offset from string with the help of murmurhash3. | |
enum idmap_error_code | sss_idmap_gen_to_unix (struct sss_idmap_ctx *ctx, const char *domain_id, const char *input, uint32_t *_id) |
Translate some input to a unix UID or GID. | |
enum idmap_error_code | sss_idmap_unix_to_gen (struct sss_idmap_ctx *ctx, uint32_t id, char **out) |
Translate a unix UID or GID to some original value, if possible. | |
Libsss_idmap provides a mechanism to translate a SID to a UNIX UID or GID or the other way round.
enum idmap_error_code |
Error codes used by libsss_idmap.
const char * idmap_error_string | ( | enum idmap_error_code | err | ) |
Translate error code to a string.
[in] | err | Idmap error code |
bool is_domain_sid | ( | const char * | str | ) |
Check if given string can be used as domain SID.
[in] | str | String to check |
enum idmap_error_code sss_idmap_add_auto_domain_ex | ( | struct sss_idmap_ctx * | ctx, |
const char * | domain_name, | ||
const char * | domain_sid, | ||
struct sss_idmap_range * | range, | ||
const char * | range_id, | ||
uint32_t | rid, | ||
bool | external_mapping, | ||
idmap_store_cb | cb, | ||
void * | pvt ) |
Add a domain with the first mappable RID to the idmap context and generate automatically secondary slices.
[in] | ctx | Idmap context |
[in] | domain_name | Zero-terminated string with the domain name |
[in] | domain_sid | Zero-terminated string representation of the domain SID (S-1-15-.....) |
[in] | range | TBD Some information about the id ranges of this domain |
[in] | range_id | optional unique identifier of a range, it is needed to allow updates at runtime |
[in] | rid | The RID that should be mapped to the first ID of the given range. |
[in] | external_mapping | If set to true the ID will not be mapped algorithmically, but the *_to_unix and *_unix_to_* calls will return IDMAP_EXTERNAL to instruct the caller to check external sources. For a single domain all ranges must be of the same type. It is not possible to mix algorithmic and external mapping. |
[in] | cb | The callback for storing mapping of dynamically created domains. |
[in] | pvt | Private data for callback cb. |
enum idmap_error_code sss_idmap_add_domain | ( | struct sss_idmap_ctx * | ctx, |
const char * | domain_name, | ||
const char * | domain_sid, | ||
struct sss_idmap_range * | range ) |
Add a domain to the idmap context.
[in] | ctx | Idmap context |
[in] | domain_name | Zero-terminated string with the domain name |
[in] | domain_sid | Zero-terminated string representation of the domain SID (S-1-15-.....) |
[in] | range | TBD Some information about the id ranges of this domain |
enum idmap_error_code sss_idmap_add_domain_ex | ( | struct sss_idmap_ctx * | ctx, |
const char * | domain_name, | ||
const char * | domain_sid, | ||
struct sss_idmap_range * | range, | ||
const char * | range_id, | ||
uint32_t | rid, | ||
bool | external_mapping ) |
Add a domain with the first mappable RID to the idmap context.
[in] | ctx | Idmap context |
[in] | domain_name | Zero-terminated string with the domain name |
[in] | domain_sid | Zero-terminated string representation of the domain SID (S-1-15-.....) |
[in] | range | TBD Some information about the id ranges of this domain |
[in] | range_id | optional unique identifier of a range, it is needed to allow updates at runtime |
[in] | rid | The RID that should be mapped to the first ID of the given range. |
[in] | external_mapping | If set to true the ID will not be mapped algorithmically, but the *_to_unix and *_unix_to_* calls will return IDMAP_EXTERNAL to instruct the caller to check external sources. For a single domain all ranges must be of the same type. It is not possible to mix algorithmic and external mapping. |
enum idmap_error_code sss_idmap_add_gen_domain_ex | ( | struct sss_idmap_ctx * | ctx, |
const char * | domain_name, | ||
const char * | domain_id, | ||
struct sss_idmap_range * | range, | ||
const char * | range_id, | ||
idmap_offset_func * | offset_func, | ||
idmap_rev_offset_func * | rev_offset_func, | ||
void * | offset_func_pvt, | ||
uint32_t | shift, | ||
bool | external_mapping ) |
Add a generic domain to the idmap context.
[in] | ctx | Idmap context |
[in] | domain_name | Zero-terminated string with the domain name |
[in] | domain_id | Zero-terminated string representation of a unique identifier of the domain, e.g. if available a domain UUID or the URI of domain specific service |
[in] | range | Id range struct with smallest and largest POSIX id of the range |
[in] | range_id | A name for the id range, currently not used, might become important when we allow multiple ranges for a single domain |
[in] | offset_func | Function to calculate an offset in a given range from some input given as string, if NULL sss_idmap_offset_murmurhash3() will be used if mapping is not done externally. |
[in] | rev_offset_func | Function to calculate the original input from a given offset, i.e. the reverse of offset_func, may be NULL |
[in] | offset_func_pvt | Private data for offset_func and rev_offset_func, may be NULL |
[in] | shift | Currently not used, might become important when we allow multiple ranges for a single domain |
[in] | external_mapping | Indicates that for this domain the mapping should not be done by libsss_idmap, the related calls will return IDMAP_EXTERNAL in this case. Nevertheless it might be important to add the domain to the idmap context so that libsss_idmap will not use the related ranges for mapping. |
enum idmap_error_code sss_idmap_bin_sid_to_dom_sid | ( | struct sss_idmap_ctx * | ctx, |
const uint8_t * | bin_sid, | ||
size_t | length, | ||
struct sss_dom_sid ** | dom_sid ) |
Convert binary SID to SID structure.
[in] | ctx | Idmap context |
[in] | bin_sid | Array with the binary SID |
[in] | length | Size of the array containing the binary SID |
[out] | dom_sid | SID structure, must be freed if not needed anymore |
enum idmap_error_code sss_idmap_bin_sid_to_sid | ( | struct sss_idmap_ctx * | ctx, |
const uint8_t * | bin_sid, | ||
size_t | length, | ||
char ** | sid ) |
Convert binary SID to SID string.
[in] | ctx | Idmap context |
[in] | bin_sid | Array with the binary SID |
[in] | length | Size of the array containing the binary SID |
[out] | sid | Zero-terminated string representation of the SID, must be freed if not needed anymore |
enum idmap_error_code sss_idmap_bin_sid_to_smb_sid | ( | struct sss_idmap_ctx * | ctx, |
const uint8_t * | bin_sid, | ||
size_t | length, | ||
struct dom_sid ** | smb_sid ) |
Convert binary SID to Samba dom_sid structure.
[in] | ctx | Idmap context |
[in] | bin_sid | Array with the binary SID |
[in] | length | Size of the array containing the binary SID |
[out] | smb_sid | Samba dom_sid structure, must be freed if not needed anymore |
enum idmap_error_code sss_idmap_bin_sid_to_unix | ( | struct sss_idmap_ctx * | ctx, |
uint8_t * | bin_sid, | ||
size_t | length, | ||
uint32_t * | id ) |
Translate a binary SID to a unix UID or GID.
[in] | ctx | Idmap context |
[in] | bin_sid | Array with the binary SID |
[in] | length | Size of the array containing the binary SID |
[out] | id | Returned unix UID or GID |
enum idmap_error_code sss_idmap_calculate_range | ( | struct sss_idmap_ctx * | ctx, |
const char * | dom_sid, | ||
id_t * | slice_num, | ||
struct sss_idmap_range * | range ) |
Calculate new range of available POSIX IDs.
[in] | ctx | Idmap context |
[in] | dom_sid | Zero-terminated string representation of the domain SID (S-1-15-.....) |
[in,out] | slice_num | Slice number to be used. Set this pointer to NULL or the addressed value to -1 to calculate slice number automatically. The calculated value will be returned in this parameter. |
[out] | range | Structure containing upper and lower bound of the range of POSIX IDs |
enum idmap_error_code sss_idmap_check_bin_sid_unix | ( | struct sss_idmap_ctx * | ctx, |
uint8_t * | bin_sid, | ||
size_t | length, | ||
uint32_t | id ) |
Check if a binary SID and a unix UID or GID belong to the same range.
[in] | ctx | Idmap context |
[in] | bin_sid | Array with the binary SID |
[in] | length | Size of the array containing the binary SID |
[in] | id | Unix UID or GID |
enum idmap_error_code sss_idmap_check_collision | ( | struct sss_idmap_ctx * | ctx, |
char * | n_name, | ||
char * | n_sid, | ||
struct sss_idmap_range * | n_range, | ||
uint32_t | n_first_rid, | ||
char * | n_range_id, | ||
bool | n_external_mapping ) |
Check if a new range would collide with any existing one.
[in] | ctx | Idmap context |
[in] | n_name | Zero-terminated string with the domain name the new range should belong to |
[in] | n_sid | Zero-terminated string representation of the domain SID (S-1-15-.....) the new range sould belong to |
[in] | n_range | The new id range |
[in] | n_range_id | unique identifier of the new range, it is needed to allow updates at runtime, may be NULL |
[in] | n_first_rid | The RID that should be mapped to the first ID of the new range. |
[in] | n_external_mapping | Mapping type of the new range |
enum idmap_error_code sss_idmap_check_collision_ex | ( | const char * | o_name, |
const char * | o_sid, | ||
struct sss_idmap_range * | o_range, | ||
uint32_t | o_first_rid, | ||
const char * | o_range_id, | ||
bool | o_external_mapping, | ||
const char * | n_name, | ||
const char * | n_sid, | ||
struct sss_idmap_range * | n_range, | ||
uint32_t | n_first_rid, | ||
const char * | n_range_id, | ||
bool | n_external_mapping ) |
Check if two ranges would collide.
[in] | o_name | Zero-terminated string with the domain name the first range should belong to |
[in] | o_sid | Zero-terminated string representation of the domain SID (S-1-15-.....) the first range sould belong to |
[in] | o_range | The first id range |
[in] | o_range_id | unique identifier of the first range, it is needed to allow updates at runtime, may be NULL |
[in] | o_first_rid | The RID that should be mapped to the first ID of the first range. |
[in] | o_external_mapping | Mapping type of the first range |
[in] | n_name | Zero-terminated string with the domain name the second range should belong to |
[in] | n_sid | Zero-terminated string representation of the domain SID (S-1-15-.....) the second range sould belong to |
[in] | n_range | The second id range |
[in] | n_range_id | unique identifier of the second range, it is needed to allow updates at runtime, may be NULL |
[in] | n_first_rid | The RID that should be mapped to the first ID of the second range. |
[in] | n_external_mapping | Mapping type of the second range |
enum idmap_error_code sss_idmap_check_dom_sid_unix | ( | struct sss_idmap_ctx * | ctx, |
struct sss_dom_sid * | dom_sid, | ||
uint32_t | id ) |
Check if a SID structure and a unix UID or GID belong to the same range.
[in] | ctx | Idmap context |
[in] | dom_sid | SID structure |
[in] | id | Unix UID or GID |
enum idmap_error_code sss_idmap_check_sid_unix | ( | struct sss_idmap_ctx * | ctx, |
const char * | sid, | ||
uint32_t | id ) |
Check if a SID and a unix UID or GID belong to the same range.
[in] | ctx | Idmap context |
[in] | sid | Zero-terminated string representation of the SID |
[in] | id | Unix UID or GID |
enum idmap_error_code sss_idmap_check_smb_sid_unix | ( | struct sss_idmap_ctx * | ctx, |
struct dom_sid * | smb_sid, | ||
uint32_t | id ) |
Check if a Samba dom_sid structure and a unix UID or GID belong to the same range.
[in] | ctx | Idmap context |
[in] | smb_sid | Samba dom_sid structure |
[in] | id | Unix UID or GID |
enum idmap_error_code sss_idmap_ctx_get_autorid | ( | struct sss_idmap_ctx * | ctx, |
bool * | _autorid ) |
Check if autorid compatibility mode is set.
[in] | ctx | idmap context |
[out] | _autorid | true if autorid is used |
enum idmap_error_code sss_idmap_ctx_get_lower | ( | struct sss_idmap_ctx * | ctx, |
id_t * | _lower ) |
Get the lower bound of the range of POSIX IDs.
[in] | ctx | idmap context |
[out] | _lower | returned lower bound |
enum idmap_error_code sss_idmap_ctx_get_rangesize | ( | struct sss_idmap_ctx * | ctx, |
id_t * | rangesize ) |
Get the range size of POSIX IDs available for single domain.
[in] | ctx | idmap context |
[out] | rangesize | returned range size |
enum idmap_error_code sss_idmap_ctx_get_upper | ( | struct sss_idmap_ctx * | ctx, |
id_t * | _upper ) |
Get the upper bound of the range of POSIX IDs.
[in] | ctx | idmap context |
[out] | _upper | returned upper bound |
enum idmap_error_code sss_idmap_ctx_set_autorid | ( | struct sss_idmap_ctx * | ctx, |
bool | use_autorid ) |
Set/unset autorid compatibility mode.
[in] | ctx | idmap context |
[in] | use_autorid | If true, autorid compatibility mode will be used |
enum idmap_error_code sss_idmap_ctx_set_extra_slice_init | ( | struct sss_idmap_ctx * | ctx, |
int | extra_slice_init ) |
Set the number of secondary slices available for domain.
[in] | ctx | idmap context |
[in] | extra_slice_init | number of secondary slices to be generated at startup |
enum idmap_error_code sss_idmap_ctx_set_lower | ( | struct sss_idmap_ctx * | ctx, |
id_t | lower ) |
Set the lower bound of the range of POSIX IDs.
[in] | ctx | idmap context |
[in] | lower | lower bound of the range |
enum idmap_error_code sss_idmap_ctx_set_rangesize | ( | struct sss_idmap_ctx * | ctx, |
id_t | rangesize ) |
Set the range size of POSIX IDs available for single domain.
[in] | ctx | idmap context |
[in] | rangesize | range size of IDs |
enum idmap_error_code sss_idmap_ctx_set_upper | ( | struct sss_idmap_ctx * | ctx, |
id_t | upper ) |
Set the upper bound of the range of POSIX IDs.
[in] | ctx | idmap context |
[in] | upper | upper bound of the range |
enum idmap_error_code sss_idmap_dom_sid_to_bin_sid | ( | struct sss_idmap_ctx * | ctx, |
struct sss_dom_sid * | dom_sid, | ||
uint8_t ** | bin_sid, | ||
size_t * | length ) |
Convert SID structure to binary SID.
[in] | ctx | Idmap context |
[in] | dom_sid | SID structure |
[out] | bin_sid | Array with the binary SID, must be freed if not needed anymore |
[out] | length | Size of the array containing the binary SID |
enum idmap_error_code sss_idmap_dom_sid_to_sid | ( | struct sss_idmap_ctx * | ctx, |
struct sss_dom_sid * | dom_sid, | ||
char ** | sid ) |
Convert SID structure to SID string.
[in] | ctx | Idmap context |
[in] | dom_sid | SID structure |
[out] | sid | Zero-terminated string representation of the SID, must be freed if not needed anymore |
enum idmap_error_code sss_idmap_dom_sid_to_smb_sid | ( | struct sss_idmap_ctx * | ctx, |
struct sss_dom_sid * | dom_sid, | ||
struct dom_sid ** | smb_sid ) |
Convert SID stucture to Samba dom_sid structure.
[in] | ctx | Idmap context |
[in] | dom_sid | SID structure |
[out] | smb_sid | Samba dom_sid structure, must be freed if not needed anymore |
enum idmap_error_code sss_idmap_dom_sid_to_unix | ( | struct sss_idmap_ctx * | ctx, |
struct sss_dom_sid * | dom_sid, | ||
uint32_t * | id ) |
Translate a SID stucture to a unix UID or GID.
[in] | ctx | Idmap context |
[in] | dom_sid | SID structure |
[out] | id | Returned unix UID or GID |
enum idmap_error_code sss_idmap_domain_by_name_has_algorithmic_mapping | ( | struct sss_idmap_ctx * | ctx, |
const char * | dom_name, | ||
bool * | has_algorithmic_mapping ) |
Check if a domain is configured with algorithmic mapping.
[in] | ctx | Idmap context |
[in] | dom_name | Name of the domain |
[out] | has_algorithmic_mapping | Boolean value indicating if the given domain is configured for algorithmic mapping or not. |
enum idmap_error_code sss_idmap_domain_has_algorithmic_mapping | ( | struct sss_idmap_ctx * | ctx, |
const char * | dom_sid, | ||
bool * | has_algorithmic_mapping ) |
Check if a domain is configured with algorithmic mapping.
[in] | ctx | Idmap context |
[in] | dom_sid | SID string, can be either a domain SID or an object SID |
[out] | has_algorithmic_mapping | Boolean value indicating if the given domain is configured for algorithmic mapping or not. |
enum idmap_error_code sss_idmap_free | ( | struct sss_idmap_ctx * | ctx | ) |
Free all the allocated memory of the idmap context.
[in] | ctx | Idmap context |
enum idmap_error_code sss_idmap_free_bin_sid | ( | struct sss_idmap_ctx * | ctx, |
uint8_t * | bin_sid ) |
Free mapped binary SID.
[in] | ctx | Idmap context |
[in] | bin_sid | Binary SID to be freed. |
enum idmap_error_code sss_idmap_free_dom_sid | ( | struct sss_idmap_ctx * | ctx, |
struct sss_dom_sid * | dom_sid ) |
Free mapped domain SID.
[in] | ctx | Idmap context |
[in] | dom_sid | Domain SID to be freed. |
enum idmap_error_code sss_idmap_free_sid | ( | struct sss_idmap_ctx * | ctx, |
char * | sid ) |
Free mapped SID.
[in] | ctx | Idmap context |
[in] | sid | SID to be freed. |
enum idmap_error_code sss_idmap_free_smb_sid | ( | struct sss_idmap_ctx * | ctx, |
struct dom_sid * | smb_sid ) |
Free mapped Samba SID.
[in] | ctx | Idmap context |
[in] | smb_sid | Samba SID to be freed. |
enum idmap_error_code sss_idmap_gen_to_unix | ( | struct sss_idmap_ctx * | ctx, |
const char * | domain_id, | ||
const char * | input, | ||
uint32_t * | _id ) |
Translate some input to a unix UID or GID.
[in] | ctx | Idmap context |
[in] | domain_id | Zero-terminated string with the domain ID of a known domain |
[in] | input | Zero-terminated string which should be translated into an offset to calculate the unix UID or GID |
[out] | _id | Returned unix UID or GID |
enum idmap_error_code sss_idmap_init | ( | idmap_alloc_func * | alloc_func, |
void * | alloc_pvt, | ||
idmap_free_func * | free_func, | ||
struct sss_idmap_ctx ** | ctx ) |
Initialize idmap context.
[in] | alloc_func | Function to allocate memory for the context, if NULL malloc() id used |
[in] | alloc_pvt | Private data for allocation routine |
[in] | free_func | Function to free the memory the context, if NULL free() id used |
[out] | ctx | idmap context |
enum idmap_error_code sss_idmap_offset_identity | ( | void * | pvt, |
uint32_t | range_size, | ||
const char * | input, | ||
long long * | offset ) |
Calculate offset from string containing only numbers.
This is an offset function of type idmap_rev_offset_func for sss_idmap_add_gen_domain_ex() which can be used to convert an input string which only contains a decimal integer number into a offset value of type long long. The matching reverse offset function is sss_idmap_rev_offset_identity().
enum idmap_error_code sss_idmap_offset_murmurhash3 | ( | void * | pvt, |
uint32_t | range_size, | ||
const char * | input, | ||
long long * | offset ) |
Calculate offset from string with the help of murmurhash3.
This is an offset function of type idmap_offset_func for sss_idmap_add_gen_domain_ex() which can be used to convert an input string into an offset value of type long long with the help of murmurhash3. This operation is not revertible and hence there is no matching reverse offset function of type idmap_rev_offset_func.
enum idmap_error_code sss_idmap_rev_offset_identity | ( | struct sss_idmap_ctx * | ctx, |
void * | pvt, | ||
uint32_t | id, | ||
char ** | _out ) |
Reverse of sss_idmap_offset_identity, return a string containig only numbers representing the given offset.
This is the matching reverse offset function to sss_idmap_offset_identity() of type idmap_rev_offset_func. The given integer id is translated back into a string which represents the decimal version of the integer.
enum idmap_error_code sss_idmap_sid_to_bin_sid | ( | struct sss_idmap_ctx * | ctx, |
const char * | sid, | ||
uint8_t ** | bin_sid, | ||
size_t * | length ) |
Convert SID string to binary SID.
[in] | ctx | Idmap context |
[in] | sid | Zero-terminated string representation of the SID |
[out] | bin_sid | Array with the binary SID, must be freed if not needed anymore |
[out] | length | Size of the array containing the binary SID |
enum idmap_error_code sss_idmap_sid_to_dom_sid | ( | struct sss_idmap_ctx * | ctx, |
const char * | sid, | ||
struct sss_dom_sid ** | dom_sid ) |
Convert SID string to SID structure.
[in] | ctx | Idmap context |
[in] | sid | Zero-terminated string representation of the SID |
[out] | dom_sid | SID structure, must be freed if not needed anymore |
enum idmap_error_code sss_idmap_sid_to_smb_sid | ( | struct sss_idmap_ctx * | ctx, |
const char * | sid, | ||
struct dom_sid ** | smb_sid ) |
Convert SID string to Samba dom_sid structure.
[in] | ctx | Idmap context |
[in] | sid | Zero-terminated string representation of the SID |
[out] | smb_sid | Samba dom_sid structure, must be freed if not needed anymore |
enum idmap_error_code sss_idmap_sid_to_unix | ( | struct sss_idmap_ctx * | ctx, |
const char * | sid, | ||
uint32_t * | id ) |
Translate SID to a unix UID or GID.
[in] | ctx | Idmap context |
[in] | sid | Zero-terminated string representation of the SID |
[out] | id | Returned unix UID or GID |
enum idmap_error_code sss_idmap_smb_sid_to_bin_sid | ( | struct sss_idmap_ctx * | ctx, |
struct dom_sid * | smb_sid, | ||
uint8_t ** | bin_sid, | ||
size_t * | length ) |
Convert Samba dom_sid structure to binary SID.
[in] | ctx | Idmap context |
[in] | smb_sid | Samba dom_sid structure |
[out] | bin_sid | Array with the binary SID, must be freed if not needed anymore |
[out] | length | Size of the array containing the binary SID |
enum idmap_error_code sss_idmap_smb_sid_to_dom_sid | ( | struct sss_idmap_ctx * | ctx, |
struct dom_sid * | smb_sid, | ||
struct sss_dom_sid ** | dom_sid ) |
Convert Samba dom_sid structure to SID structure.
[in] | ctx | Idmap context |
[in] | smb_sid | Samba dom_sid structure |
[out] | dom_sid | SID structure, must be freed if not needed anymore |
enum idmap_error_code sss_idmap_smb_sid_to_sid | ( | struct sss_idmap_ctx * | ctx, |
struct dom_sid * | smb_sid, | ||
char ** | sid ) |
Convert Samba dom_sid structure to SID string.
[in] | ctx | Idmap context |
[in] | smb_sid | Samba dom_sid structure |
[out] | sid | Zero-terminated string representation of the SID, must be freed if not needed anymore |
enum idmap_error_code sss_idmap_smb_sid_to_unix | ( | struct sss_idmap_ctx * | ctx, |
struct dom_sid * | smb_sid, | ||
uint32_t * | id ) |
Translate a Samba dom_sid stucture to a unix UID or GID.
[in] | ctx | Idmap context |
[in] | smb_sid | Samba dom_sid structure |
[out] | id | Returned unix UID or GID |
enum idmap_error_code sss_idmap_unix_to_bin_sid | ( | struct sss_idmap_ctx * | ctx, |
uint32_t | id, | ||
uint8_t ** | bin_sid, | ||
size_t * | length ) |
Translate unix UID or GID to a binary SID.
[in] | ctx | Idmap context |
[in] | id | unix UID or GID |
[out] | bin_sid | Array with the binary SID, must be freed if not needed anymore |
[out] | length | size of the array containing the binary SID |
enum idmap_error_code sss_idmap_unix_to_dom_sid | ( | struct sss_idmap_ctx * | ctx, |
uint32_t | id, | ||
struct sss_dom_sid ** | dom_sid ) |
Translate unix UID or GID to a SID structure.
[in] | ctx | Idmap context |
[in] | id | unix UID or GID |
[out] | dom_sid | SID structure, must be freed if not needed anymore |
enum idmap_error_code sss_idmap_unix_to_gen | ( | struct sss_idmap_ctx * | ctx, |
uint32_t | id, | ||
char ** | out ) |
Translate a unix UID or GID to some original value, if possible.
[in] | ctx | Idmap context |
[in] | id | Unix UID or GID |
[out] | out | Original value the UID or GID was derived from |
enum idmap_error_code sss_idmap_unix_to_sid | ( | struct sss_idmap_ctx * | ctx, |
uint32_t | id, | ||
char ** | sid ) |
Translate unix UID or GID to a SID.
[in] | ctx | Idmap context |
[in] | id | unix UID or GID |
[out] | sid | Zero-terminated string representation of the SID, must be freed if not needed anymore |