mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
extdom: handle INP_POSIX_UID and INP_POSIX_GID requests
Fixes https://fedorahosted.org/freeipa/ticket/3166
This commit is contained in:
@@ -329,20 +329,46 @@ int handle_request(struct ipa_extdom_ctx *ctx, struct extdom_req *req,
|
|||||||
char *name;
|
char *name;
|
||||||
enum wbcSidType name_type;
|
enum wbcSidType name_type;
|
||||||
struct domain_info *domain_info = NULL;
|
struct domain_info *domain_info = NULL;
|
||||||
|
uint32_t id;
|
||||||
|
enum idmap_error_code err;
|
||||||
|
char *sid_str;
|
||||||
|
|
||||||
ret = get_domain_info(ctx, req->data.name.domain_name, &domain_info);
|
ret = get_domain_info(ctx, req->data.name.domain_name, &domain_info);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
return LDAP_OPERATIONS_ERROR;
|
return LDAP_OPERATIONS_ERROR;
|
||||||
}
|
}
|
||||||
|
if (req->input_type == INP_POSIX_UID || req->input_type == INP_POSIX_GID) {
|
||||||
|
if (req->input_type == INP_POSIX_UID) {
|
||||||
|
id = req->data.posix_uid.uid;
|
||||||
|
} else {
|
||||||
|
id = req->data.posix_gid.gid;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = sss_idmap_unix_to_sid(domain_info->idmap_ctx, id, &sid_str);
|
||||||
|
if (err != IDMAP_SUCCESS) {
|
||||||
|
ret = LDAP_OPERATIONS_ERROR;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
werr = wbcStringToSid(sid_str, &sid);
|
||||||
|
free(sid_str);
|
||||||
|
if (!WBC_ERROR_IS_OK(werr)) {
|
||||||
|
ret = LDAP_OPERATIONS_ERROR;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (req->input_type == INP_SID) {
|
||||||
|
werr = wbcStringToSid(req->data.sid, &sid);
|
||||||
|
if (!WBC_ERROR_IS_OK(werr)) {
|
||||||
|
ret = LDAP_OPERATIONS_ERROR;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (req->input_type) {
|
switch (req->input_type) {
|
||||||
|
case INP_POSIX_UID:
|
||||||
|
case INP_POSIX_GID:
|
||||||
case INP_SID:
|
case INP_SID:
|
||||||
werr = wbcStringToSid(req->data.sid, &sid);
|
|
||||||
if (!WBC_ERROR_IS_OK(werr)) {
|
|
||||||
ret = LDAP_OPERATIONS_ERROR;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
werr = wbcLookupSid(&sid, &domain_name, &name, &name_type);
|
werr = wbcLookupSid(&sid, &domain_name, &name, &name_type);
|
||||||
if (!WBC_ERROR_IS_OK(werr)) {
|
if (!WBC_ERROR_IS_OK(werr)) {
|
||||||
ret = LDAP_OPERATIONS_ERROR;
|
ret = LDAP_OPERATIONS_ERROR;
|
||||||
|
|||||||
Reference in New Issue
Block a user