Lines Matching refs:state
83 struct users_get_state *state;
94 req = tevent_req_create(memctx, &state, struct users_get_state);
97 state->ev = ev;
98 state->ctx = ctx;
99 state->sdom = sdom;
100 state->conn = conn;
101 state->dp_error = DP_ERR_FATAL;
102 state->noexist_delete = noexist_delete;
104 state->op = sdap_id_op_create(state, state->conn->conn_cache);
105 if (!state->op) {
111 state->domain = sdom->dom;
112 state->sysdb = sdom->dom->sysdb;
113 state->filter_value = filter_value;
114 state->filter_type = filter_type;
116 state->use_id_mapping = sdap_idmap_domain_has_algorithmic_mapping(
123 ret = sss_filter_sanitize_ex(state, filter_value, &clean_value,
131 ret = sss_filter_sanitize(state, filter_value, &clean_value);
136 ep_filter = get_enterprise_principal_string_filter(state,
140 user_filter = talloc_asprintf(state, "(|(%s=%s)(%s=%s)%s)",
155 ret = sss_parse_internal_fqname(state, filter_value,
156 &state->shortname, NULL);
162 ret = sss_filter_sanitize(state, state->shortname, &clean_value);
169 if (state->use_id_mapping) {
187 ret = sysdb_delete_user(state->domain, NULL, uid);
203 ret = sss_filter_sanitize(state, sid, &clean_value);
211 ret = sss_filter_sanitize(state, filter_value, &clean_value);
220 ret = sss_filter_sanitize(state, filter_value, &clean_value);
234 ret = sss_filter_sanitize(state, filter_value, &clean_value);
248 ret = sss_cert_derb64_to_ldap_filter(state, filter_value, attr_name,
268 user_filter = talloc_asprintf(state, "(%s=%s)", attr_name, clean_value);
277 if (state->use_id_mapping || filter_type == BE_FILTER_SECID) {
282 state->filter = talloc_asprintf(state,
290 state->filter = talloc_asprintf(state,
300 if (!state->filter) {
307 ret = build_attrs_from_map(state, ctx->opts->user_map,
309 NULL, &state->attrs, NULL);
330 struct users_get_state *state = tevent_req_data(req,
335 subreq = sdap_id_op_connect_send(state->op, state, &ret);
348 struct users_get_state *state = tevent_req_data(req,
357 state->dp_error = dp_error;
365 if (state->use_id_mapping == false &&
366 state->ctx->opts->schema_type == SDAP_SCHEMA_AD &&
367 state->ctx->srv_opts &&
368 state->ctx->srv_opts->posix_checked == false) {
369 subreq = sdap_posix_check_send(state, state->ev, state->ctx->opts,
370 sdap_id_op_handle(state->op),
371 state->sdom->user_search_bases,
372 dp_opt_get_int(state->ctx->opts->basic,
393 struct users_get_state *state = tevent_req_data(req,
402 ret2 = sdap_id_op_done(state->op, ret, &dp_error);
413 state->ctx->srv_opts->posix_checked = true;
418 state->sdap_ret = ERR_NO_POSIX;
428 struct users_get_state *state = tevent_req_data(req,
433 if (state->filter_type == BE_FILTER_WILDCARD) {
439 subreq = sdap_get_users_send(state, state->ev,
440 state->domain, state->sysdb,
441 state->ctx->opts,
442 state->sdom->user_search_bases,
443 sdap_id_op_handle(state->op),
444 state->attrs, state->filter,
445 dp_opt_get_int(state->ctx->opts->basic,
459 struct users_get_state *state = tevent_req_data(req,
471 ret = sdap_id_op_done(state->op, ret, &dp_error);
484 (state->ctx->opts->schema_type == SDAP_SCHEMA_RFC2307) &&
485 (dp_opt_get_bool(state->ctx->opts->basic,
490 switch (state->filter_type) {
496 uid = (uid_t) strtouint32(state->filter_value, &endptr, 10);
497 if (errno || *endptr || (state->filter_value == endptr)) {
509 ret = sdap_fallback_local_user(state, state->shortname, uid, &usr_attrs);
511 ret = sdap_save_user(state, state->ctx->opts, state->domain,
516 state->sdap_ret = ret;
519 state->dp_error = dp_error;
524 if (ret == ENOENT && state->noexist_delete == true) {
525 switch (state->filter_type) {
530 if (state->name_is_upn == true) {
531 ret = sysdb_search_user_by_upn(state, state->domain,
532 state->filter_value,
539 del_name = state->filter_value;
546 ret = sysdb_delete_user(state->domain, state->filter_value, 0);
554 uid = (uid_t) strtouint32(state->filter_value, &endptr, 10);
555 if (errno || *endptr || (state->filter_value == endptr)) {
560 ret = sysdb_delete_user(state->domain, NULL, uid);
581 ret = sysdb_remove_cert(state->domain, state->filter_value);
596 state->dp_error = DP_ERR_OK;
603 struct users_get_state *state = tevent_req_data(req,
607 *dp_error_out = state->dp_error;
611 *sdap_ret = state->sdap_ret;
661 struct groups_get_state *state;
673 req = tevent_req_create(memctx, &state, struct groups_get_state);
676 state->ev = ev;
677 state->ctx = ctx;
678 state->sdom = sdom;
679 state->conn = conn;
680 state->dp_error = DP_ERR_FATAL;
681 state->noexist_delete = noexist_delete;
682 state->no_members = no_members;
684 state->op = sdap_id_op_create(state, state->conn->conn_cache);
685 if (!state->op) {
691 state->domain = sdom->dom;
692 state->sysdb = sdom->dom->sysdb;
693 state->filter_value = filter_value;
694 state->filter_type = filter_type;
696 state->use_id_mapping = sdap_idmap_domain_has_algorithmic_mapping(
704 ret = sss_filter_sanitize_ex(state, filter_value, &clean_value,
713 ret = sss_parse_internal_fqname(state, filter_value,
720 ret = sss_filter_sanitize(state, shortname, &clean_value);
726 if (state->use_id_mapping) {
744 ret = sysdb_delete_group(state->domain, NULL, gid);
760 ret = sss_filter_sanitize(state, sid, &clean_value);
768 ret = sss_filter_sanitize(state, filter_value, &clean_value);
777 ret = sss_filter_sanitize(state, filter_value, &clean_value);
791 ret = sss_filter_sanitize(state, filter_value, &clean_value);
807 oc_list = sdap_make_oc_list(state, ctx->opts->group_map);
814 if (state->use_id_mapping || filter_type == BE_FILTER_SECID) {
819 state->filter = talloc_asprintf(state,
824 state->filter = talloc_asprintf(state,
833 if (!state->filter) {
843 ret = build_attrs_from_map(state, ctx->opts->group_map, SDAP_OPTS_GROUP,
844 (state->domain->ignore_group_members
845 || state->no_members) ?
847 &state->attrs, NULL);
869 struct groups_get_state *state = tevent_req_data(req,
874 subreq = sdap_id_op_connect_send(state->op, state, &ret);
887 struct groups_get_state *state = tevent_req_data(req,
896 state->dp_error = dp_error;
904 if (state->use_id_mapping == false &&
905 state->ctx->opts->schema_type == SDAP_SCHEMA_AD &&
906 state->ctx->srv_opts &&
907 state->ctx->srv_opts->posix_checked == false) {
908 subreq = sdap_posix_check_send(state, state->ev, state->ctx->opts,
909 sdap_id_op_handle(state->op),
910 state->sdom->user_search_bases,
911 dp_opt_get_int(state->ctx->opts->basic,
931 struct groups_get_state *state = tevent_req_data(req,
940 ret = sdap_id_op_done(state->op, ret, &dp_error);
951 state->ctx->srv_opts->posix_checked = true;
956 state->sdap_ret = ERR_NO_POSIX;
966 struct groups_get_state *state = tevent_req_data(req,
971 if (state->filter_type == BE_FILTER_WILDCARD) {
977 subreq = sdap_get_groups_send(state, state->ev,
978 state->sdom,
979 state->ctx->opts,
980 sdap_id_op_handle(state->op),
981 state->attrs, state->filter,
982 dp_opt_get_int(state->ctx->opts->basic,
985 state->no_members);
997 struct groups_get_state *state = tevent_req_data(req,
1006 ret = sdap_id_op_done(state->op, ret, &dp_error);
1018 state->sdap_ret = ret;
1021 state->dp_error = dp_error;
1026 if (ret == ENOENT && state->noexist_delete == true) {
1027 switch (state->filter_type) {
1032 ret = sysdb_delete_group(state->domain, state->filter_value, 0);
1040 gid = (gid_t) strtouint32(state->filter_value, &endptr, 10);
1041 if (errno || *endptr || (state->filter_value == endptr)) {
1046 ret = sysdb_delete_group(state->domain, NULL, gid);
1073 state->dp_error = DP_ERR_OK;
1079 struct groups_get_state *state = tevent_req_data(req,
1083 *dp_error_out = state->dp_error;
1087 *sdap_ret = state->sdap_ret;
1166 struct groups_by_user_state *state;
1169 req = tevent_req_create(memctx, &state, struct groups_by_user_state);
1172 state->ev = ev;
1173 state->ctx = ctx;
1174 state->dp_error = DP_ERR_FATAL;
1175 state->conn = conn;
1176 state->sdom = sdom;
1177 state->noexist_delete = noexist_delete;
1179 state->op = sdap_id_op_create(state, state->conn->conn_cache);
1180 if (!state->op) {
1186 state->filter_value = filter_value;
1187 state->filter_type = filter_type;
1188 state->extra_value = extra_value;
1189 state->domain = sdom->dom;
1190 state->sysdb = sdom->dom->sysdb;
1192 ret = build_attrs_from_map(state, ctx->opts->group_map, SDAP_OPTS_GROUP,
1193 NULL, &state->attrs, NULL);
1211 struct groups_by_user_state *state = tevent_req_data(req,
1216 subreq = sdap_id_op_connect_send(state->op, state, &ret);
1229 struct groups_by_user_state *state = tevent_req_data(req,
1238 state->dp_error = dp_error;
1243 subreq = sdap_get_initgr_send(state,
1244 state->ev,
1245 state->sdom,
1246 sdap_id_op_handle(state->op),
1247 state->ctx,
1248 state->conn,
1249 state->filter_value,
1250 state->filter_type,
1251 state->extra_value,
1252 state->attrs);
1264 struct groups_by_user_state *state = tevent_req_data(req,
1272 ret = sdap_id_op_done(state->op, ret, &dp_error);
1284 state->sdap_ret = ret;
1287 /* state->filter_value is still the name used for the original req. The cached
1289 ret = sysdb_get_real_name(state,
1290 state->domain,
1291 state->filter_value,
1294 cname = state->filter_value;
1301 switch (state->sdap_ret) {
1303 if (state->noexist_delete == true) {
1304 ret = sysdb_delete_user(state->domain, cname, 0);
1312 ret = set_initgroups_expire_attribute(state->domain, cname);
1314 state->dp_error = DP_ERR_FATAL;
1320 state->dp_error = dp_error;
1325 state->dp_error = DP_ERR_OK;
1331 struct groups_by_user_state *state = tevent_req_data(req,
1335 *dp_error_out = state->dp_error;
1339 *sdap_ret = state->sdap_ret;
1400 struct sdap_handle_acct_req_state *state;
1404 req = tevent_req_create(mem_ctx, &state,
1409 state->ar = ar;
1417 state->ar->entry_type & BE_REQ_TYPE_MASK,
1418 state->ar->filter_type, state->ar->filter_value,
1419 PROBE_SAFE_STR(state->ar->extra_value));
1423 subreq = users_get_send(state, be_ctx->ev, id_ctx,
1433 subreq = groups_get_send(state, be_ctx->ev, id_ctx,
1446 state->err = "Invalid filter type";
1451 state->err = "Invalid attr type";
1455 subreq = groups_by_user_send(state, be_ctx->ev, id_ctx,
1466 state->err = "Invalid filter type";
1470 subreq = ldap_netgroup_get_send(state, be_ctx->ev, id_ctx,
1480 state->err = "Invalid filter type";
1484 subreq = services_get_send(state, be_ctx->ev, id_ctx,
1495 state->err = "Invalid filter type";
1499 subreq = get_user_and_group_send(state, be_ctx->ev, id_ctx,
1510 state->err = "Invalid filter type";
1514 subreq = get_user_and_group_send(state, be_ctx->ev, id_ctx,
1526 state->err = "Invalid filter type";
1530 subreq = get_user_and_group_send(state, be_ctx->ev, id_ctx,
1539 subreq = users_get_send(state, be_ctx->ev, id_ctx,
1550 state->err = "Invalid request type";
1577 struct sdap_handle_acct_req_state *state;
1581 state = tevent_req_data(req, struct sdap_handle_acct_req_state);
1583 switch (state->ar->entry_type & BE_REQ_TYPE_MASK) {
1586 ret = users_get_recv(subreq, &state->dp_error, &state->sdap_ret);
1590 ret = groups_get_recv(subreq, &state->dp_error, &state->sdap_ret);
1594 ret = groups_by_user_recv(subreq, &state->dp_error, &state->sdap_ret);
1598 ret = ldap_netgroup_get_recv(subreq, &state->dp_error, &state->sdap_ret);
1602 ret = services_get_recv(subreq, &state->dp_error, &state->sdap_ret);
1610 ret = sdap_get_user_and_group_recv(subreq, &state->dp_error,
1611 &state->sdap_ret);
1615 ret = users_get_recv(subreq, &state->dp_error, &state->sdap_ret);
1624 state->err = err;
1629 state->err = "Success";
1638 struct sdap_handle_acct_req_state *state;
1640 state = tevent_req_data(req, struct sdap_handle_acct_req_state);
1643 state->ar->entry_type & BE_REQ_TYPE_MASK,
1644 state->ar->filter_type, state->ar->filter_value,
1645 PROBE_SAFE_STR(state->ar->extra_value));
1648 *_dp_error = state->dp_error;
1652 *_err = state->err;
1656 *sdap_ret = state->sdap_ret;
1699 struct get_user_and_group_state *state;
1702 req = tevent_req_create(memctx, &state, struct get_user_and_group_state);
1708 state->ev = ev;
1709 state->id_ctx = id_ctx;
1710 state->sdom = sdom;
1711 state->conn = conn;
1712 state->dp_error = DP_ERR_FATAL;
1713 state->noexist_delete = noexist_delete;
1715 state->op = sdap_id_op_create(state, state->conn->conn_cache);
1716 if (!state->op) {
1722 state->domain = sdom->dom;
1723 state->sysdb = sdom->dom->sysdb;
1724 state->filter_val = filter_val;
1725 state->filter_type = filter_type;
1726 state->attrs_type = attrs_type;
1728 subreq = groups_get_send(req, state->ev, state->id_ctx,
1729 state->sdom, state->conn,
1730 state->filter_val, state->filter_type,
1731 state->attrs_type, state->noexist_delete, false);
1752 struct get_user_and_group_state *state = tevent_req_data(req,
1758 ret = groups_get_recv(subreq, &state->dp_error, &state->sdap_ret);
1766 if (state->sdap_ret == EOK) { /* Matching group found */
1769 } else if (state->sdap_ret != ENOENT) {
1777 user_conn = state->conn;
1779 if (state->id_ctx->opts->schema_type == SDAP_SCHEMA_AD
1780 && state->sdom->pvt != NULL) {
1781 ad_id_ctx = talloc_get_type(state->sdom->pvt, struct ad_id_ctx);
1783 && state->conn == ad_id_ctx->gc_ctx) {
1790 subreq = users_get_send(req, state->ev, state->id_ctx,
1791 state->sdom, user_conn,
1792 state->filter_val, state->filter_type, NULL,
1793 state->attrs_type, state->noexist_delete);
1807 struct get_user_and_group_state *state = tevent_req_data(req,
1811 ret = users_get_recv(subreq, &state->dp_error, &state->sdap_ret);
1818 if (state->sdap_ret == ENOENT) {
1819 if (state->noexist_delete == true) {
1822 ret = sysdb_delete_by_sid(state->sysdb, state->domain,
1823 state->filter_val);
1830 } else if (state->sdap_ret != EOK) {
1843 struct get_user_and_group_state *state = tevent_req_data(req,
1847 *dp_error_out = state->dp_error;
1851 *sdap_ret = state->sdap_ret;
1871 struct sdap_account_info_handler_state *state;
1876 req = tevent_req_create(mem_ctx, &state,
1889 subreq = sdap_handle_acct_req_send(state, params->be_ctx, data, id_ctx,
1901 dp_reply_std_set(&state->reply, DP_ERR_DECIDE, ret, NULL);
1912 struct sdap_account_info_handler_state *state;
1919 state = tevent_req_data(req, struct sdap_account_info_handler_state);
1925 dp_reply_std_set(&state->reply, dp_error, ret, error_msg);
1933 struct sdap_account_info_handler_state *state = NULL;
1935 state = tevent_req_data(req, struct sdap_account_info_handler_state);
1939 *data = state->reply;