ldap_id.c revision c4eb21582937362e09aa34e6a18b7f33815d4940
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce LDAP Identity Backend Module
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce Simo Sorce <ssorce@redhat.com>
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce Copyright (C) 2008 Red Hat
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce This program is free software; you can redistribute it and/or modify
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce it under the terms of the GNU General Public License as published by
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce the Free Software Foundation; either version 3 of the License, or
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce (at your option) any later version.
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce This program is distributed in the hope that it will be useful,
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce but WITHOUT ANY WARRANTY; without even the implied warranty of
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce GNU General Public License for more details.
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce You should have received a copy of the GNU General Public License
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce along with this program. If not, see <http://www.gnu.org/licenses/>.
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce/* =Users-Related-Functions-(by-name,by-uid)============================== */
581de96fc30b7fe44070f17a8a73f3374d38d6ffLukas Slebodnik const char **attrs;
581de96fc30b7fe44070f17a8a73f3374d38d6ffLukas Slebodnikstatic int users_get_retry(struct tevent_req *req);
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorcestatic void users_get_connect_done(struct tevent_req *subreq);
4869633dc87dadb2b9a114444d375c39703ac863Pavel Březinastatic void users_get_posix_check_done(struct tevent_req *subreq);
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorcestatic void users_get_search(struct tevent_req *req);
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorcestatic void users_get_done(struct tevent_req *subreq);
13df7b9e400211c717284fb841c849ba034ed348Michal Zidekstruct tevent_req *users_get_send(TALLOC_CTX *memctx,
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce req = tevent_req_create(memctx, &state, struct users_get_state);
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce state->op = sdap_id_op_create(state, state->conn->conn_cache);
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce DEBUG(SSSDBG_OP_FAILURE, "sdap_id_op_create failed\n");
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce state->use_id_mapping = sdap_idmap_domain_has_algorithmic_mapping(
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce attr_name = ctx->opts->user_map[SDAP_AT_USER_NAME].name;
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce ret = sss_filter_sanitize_ex(state, filter_value, &clean_value,
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce if (extra_value && strcmp(extra_value, EXTRA_NAME_IS_UPN) == 0) {
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorce attr_name = ctx->opts->user_map[SDAP_AT_USER_PRINC].name;
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorce ret = sss_filter_sanitize(state, filter_value, &clean_value);
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorce attr_name = ctx->opts->user_map[SDAP_AT_USER_NAME].name;
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorce ret = sss_parse_internal_fqname(state, filter_value,
ebf6735dd4f71bf3dc9105e5d04d11e744c64a59Lukas Slebodnik DEBUG(SSSDBG_OP_FAILURE, "Cannot parse %s\n", filter_value);
225dc6914cdc8920b02a129b98ece1ed97b99c03Lukas Slebodnik ret = sss_filter_sanitize(state, state->shortname, &clean_value);
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce /* If we're ID-mapping, we need to use the objectSID
5f90993426fa2bdc3b3d994c9e85e0805bb92bbcSimo Sorce * in the search filter.
goto done;
goto done;
goto done;
goto done;
goto done;
case BE_FILTER_SECID:
goto done;
case BE_FILTER_UUID:
goto done;
goto done;
case BE_FILTER_CERT:
goto done;
&user_filter);
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
return req;
done:
struct users_get_state);
if (!subreq) {
return ret;
return EOK;
struct tevent_req);
struct users_get_state);
int ret;
bool has_posix;
int dp_error;
struct tevent_req);
struct users_get_state);
struct users_get_state);
if (!subreq) {
struct tevent_req);
struct users_get_state);
char *endptr;
int ret;
SDAP_RFC2307_FALLBACK_TO_LOCAL_USERS) == true)) {
bool fallback;
case BE_FILTER_NAME:
fallback = true;
case BE_FILTER_IDNUM:
fallback = true;
fallback = false;
if (fallback) {
case BE_FILTER_ENUM:
case BE_FILTER_NAME:
case BE_FILTER_IDNUM:
case BE_FILTER_SECID:
case BE_FILTER_UUID:
case BE_FILTER_WILDCARD:
case BE_FILTER_CERT:
struct users_get_state);
if (dp_error_out) {
if (sdap_ret) {
return EOK;
struct groups_get_state {
const char *filter_value;
int filter_type;
char *filter;
const char **attrs;
bool use_id_mapping;
int dp_error;
int sdap_ret;
bool noexist_delete;
bool no_members;
const char *filter_value,
int filter_type,
int attrs_type,
bool noexist_delete,
bool no_members)
char *clean_value;
char *endptr;
int ret;
char *sid;
char *oc_list;
goto done;
switch(filter_type) {
case BE_FILTER_WILDCARD:
goto done;
case BE_FILTER_NAME:
goto done;
goto done;
case BE_FILTER_IDNUM:
goto done;
goto done;
goto done;
goto done;
goto done;
case BE_FILTER_SECID:
goto done;
case BE_FILTER_UUID:
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
goto done;
return req;
done:
struct groups_get_state);
if (!subreq) {
return ret;
return EOK;
struct tevent_req);
struct groups_get_state);
int ret;
bool has_posix;
int dp_error;
struct tevent_req);
struct groups_get_state);
if (has_posix == false) {
struct groups_get_state);
if (!subreq) {
struct tevent_req);
struct groups_get_state);
char *endptr;
int ret;
case BE_FILTER_ENUM:
case BE_FILTER_NAME:
case BE_FILTER_IDNUM:
case BE_FILTER_SECID:
case BE_FILTER_UUID:
case BE_FILTER_WILDCARD:
struct groups_get_state);
if (dp_error_out) {
if (sdap_ret) {
return EOK;
struct groups_by_user_state {
const char *filter_value;
int filter_type;
const char *extra_value;
const char **attrs;
int dp_error;
int sdap_ret;
bool noexist_delete;
const char *name)
return ENOMEM;
goto done;
goto done;
done:
return ret;
const char *filter_value,
int filter_type,
const char *extra_value,
bool noexist_delete)
int ret;
goto fail;
goto fail;
return req;
fail:
return req;
struct groups_by_user_state);
if (!subreq) {
return ret;
return EOK;
struct tevent_req);
struct groups_by_user_state);
int ret;
if (!subreq) {
struct tevent_req);
struct groups_by_user_state);
int ret;
const char *cname;
&cname);
case ENOENT:
case EOK:
struct groups_by_user_state);
if (dp_error_out) {
if (sdap_ret) {
return EOK;
const char *filter_value,
int filter_type,
int attrs_type,
bool noexist_delete);
case BE_REQ_USER:
case BE_REQ_GROUP:
case BE_REQ_SERVICES:
struct sdap_handle_acct_req_state {
const char *err;
int dp_error;
int sdap_ret;
struct tevent_req *
bool noexist_delete)
struct sdap_handle_acct_req_state);
if (!req) {
return NULL;
goto done;
noexist_delete, false);
goto done;
goto done;
case BE_REQ_NETGROUP:
goto done;
case BE_REQ_SERVICES:
goto done;
case BE_REQ_BY_SECID:
goto done;
case BE_REQ_BY_UUID:
goto done;
case BE_REQ_USER_AND_GROUP:
goto done;
case BE_REQ_BY_CERT:
goto done;
if (!subreq) {
goto done;
return req;
done:
return req;
case BE_REQ_NETGROUP:
case BE_REQ_SERVICES:
case BE_REQ_BY_SECID:
case BE_REQ_BY_UUID:
case BE_REQ_USER_AND_GROUP:
case BE_REQ_BY_CERT:
int *sdap_ret)
if (_dp_error) {
if (_err) {
if (sdap_ret) {
return EOK;
struct get_user_and_group_state {
const char *filter_val;
int filter_type;
int attrs_type;
char *filter;
const char **attrs;
int dp_error;
int sdap_ret;
bool noexist_delete;
const char *filter_val,
int filter_type,
int attrs_type,
bool noexist_delete)
int ret;
return NULL;
goto fail;
goto fail;
return req;
fail:
return req;
struct tevent_req);
struct get_user_and_group_state);
int ret;
struct tevent_req);
struct get_user_and_group_state);
int ret;
struct get_user_and_group_state);
if (dp_error_out) {
if (sdap_ret) {
return EOK;
struct sdap_account_info_handler_state {
struct tevent_req *
struct sdap_account_info_handler_state);
return NULL;
goto immediately;
goto immediately;
return req;
return req;
const char *error_msg;
int dp_error;
return EOK;