sdap_async_netgroups.c revision fd94a375467ade9233e34513863571fc51fec2ed
/*
SSSD
Async LDAP Helper routines for netgroups
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2010 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "providers/ldap/sdap_async_private.h"
#include "providers/ldap/ldap_common.h"
{
int ret;
return (ret == LDAP_SUCCESS ? true : false);
}
struct sdap_options *opts,
struct sss_domain_info *dom,
struct sysdb_attrs *attrs,
char **_timestamp,
{
struct ldb_message_element *el;
struct sysdb_attrs *netgroup_attrs;
int ret;
size_t c;
&el);
if (el->num_values == 0) {
goto fail;
}
if (!netgroup_attrs) {
goto fail;
}
if (ret) {
goto fail;
}
if (el->num_values == 0) {
} else {
if (ret) {
goto fail;
}
}
&el);
if (ret) {
goto fail;
}
if (el->num_values == 0) {
name));
} else {
if (ret) {
goto fail;
}
if (!timestamp) {
goto fail;
}
}
&el);
if (ret) {
goto fail;
}
if (el->num_values == 0) {
} else {
for(c = 0; c < el->num_values; c++) {
if (ret) {
goto fail;
}
}
}
&el);
goto fail;
}
if (el->num_values == 0) {
} else {
for(c = 0; c < el->num_values; c++) {
if (ret) {
goto fail;
}
}
}
goto fail;
}
if (el->num_values == 0) {
} else {
for(c = 0; c < el->num_values; c++) {
if (ret) {
goto fail;
}
}
}
if (_timestamp) {
*_timestamp = timestamp;
}
return EOK;
fail:
return ret;
}
struct dn_item {
const char *dn;
struct sysdb_attrs *netgroup;
char *cn;
};
{
size_t c;
const char *dn;
const char *cn;
bool not_resolved = false;
*all_resolved = false;
continue;
}
for(c = 0; c < count; c++) {
return EINVAL;
}
return EINVAL;
}
break;
}
}
not_resolved = true;
}
}
*all_resolved = !not_resolved;
return EOK;
}
struct netgr_translate_members_state {
struct tevent_context *ev;
struct sdap_options *opts;
struct sdap_handle *sh;
struct sss_domain_info *dom;
struct sysdb_attrs **netgroups;
};
struct tevent_context *ev,
struct sdap_options *opts,
struct sdap_handle *sh,
struct sss_domain_info *dom,
struct sysdb_attrs **netgroups)
{
struct tevent_req *req;
struct netgr_translate_members_state *state;
size_t c;
const char **member_list;
int ret;
struct ldb_message **sysdb_res;
char *dn_filter;
char *sysdb_filter;
struct ldb_dn *netgr_basedn;
bool all_resolved;
struct netgr_translate_members_state);
return NULL;
}
for (c = 0; c < count; c++) {
&member_list);
continue;
}
goto fail;
}
} else {
member_list[mc]);
goto fail;
}
}
}
}
return req;
}
goto fail;
}
goto fail;
}
}
goto fail;
}
if (sysdb_filter == NULL) {
goto fail;
}
if (netgr_basedn == NULL) {
goto fail;
}
goto fail;
}
&all_resolved);
goto fail;
}
if (all_resolved) {
goto fail;
}
}
return req;
}
}
goto fail;
}
}
return req;
fail:
return req;
}
/* netgr_translate_members_ldap_step() returns
* EOK: if everthing is translated, the caller can call tevent_req_done
* EAGAIN: if there are still members waiting to be translated, the caller
* should return to the mainloop
* Exyz: every other return code indicates an error and tevent_req_error
* should be called
*/
{
struct netgr_translate_members_state);
const char **cn_attr;
struct tevent_req *subreq;
int ret;
break;
}
}
return ret;
}
}
return EOK;
}
return ENOMEM;
}
if (!subreq) {
return ENOMEM;
}
return EAGAIN;
}
{
struct tevent_req);
struct netgr_translate_members_state);
int ret;
struct sysdb_attrs **netgroups;
const char *str;
goto fail;
}
switch (count) {
case 0:
DEBUG(0, ("sdap_get_generic_recv found no entry for [%s].\n",
break;
case 1:
break;
}
}
break;
default:
count));
}
}
goto fail;
}
}
return;
fail:
return;
}
struct sysdb_attrs ***netgroups)
{
struct netgr_translate_members_state);
return EOK;
}
/* ==Search-Netgroups-with-filter============================================ */
struct sdap_get_netgroups_state {
struct tevent_context *ev;
struct sdap_options *opts;
struct sdap_handle *sh;
struct sss_domain_info *dom;
const char **attrs;
const char *base_filter;
char *filter;
int timeout;
char *higher_timestamp;
struct sysdb_attrs **netgroups;
struct sdap_search_base **search_bases;
};
struct tevent_context *ev,
struct sss_domain_info *dom,
struct sdap_options *opts,
struct sdap_search_base **search_bases,
struct sdap_handle *sh,
const char **attrs,
const char *filter,
int timeout)
{
struct tevent_req *req;
struct sdap_get_netgroups_state *state;
}
return req;
}
{
struct tevent_req *subreq;
struct sdap_get_netgroups_state *state;
return ENOMEM;
}
("Searching for netgroups with base [%s]\n",
if (!subreq) {
return ENOMEM;
}
return EOK;
}
{
struct tevent_req);
struct sdap_get_netgroups_state);
int ret;
if (ret) {
return;
}
/* No netgroups found in this search */
/* There are more search bases to try */
}
return;
}
return;
}
if (!subreq) {
return;
}
return;
}
{
struct tevent_req);
struct sdap_get_netgroups_state);
int ret;
size_t c;
if (ret) {
return;
}
now);
if (ret) {
return;
}
}
}
struct sysdb_attrs ***reply)
{
struct sdap_get_netgroups_state);
if (timestamp) {
}
if (reply_count) {
}
if (reply) {
}
return EOK;
}