/*
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 sss_domain_info *dom,
struct sdap_options *opts,
struct sysdb_attrs *attrs,
char **_timestamp,
{
int ret;
goto fail;
}
if (!netgroup_attrs) {
goto fail;
}
"original DN",
goto fail;
}
&el);
if (ret) {
goto fail;
}
if (el->num_values == 0) {
"Original mod-Timestamp is not available for [%s].\n",
name);
} else {
if (ret) {
goto fail;
}
if (!timestamp) {
goto fail;
}
}
"netgroup triple",
goto fail;
}
"original members",
goto fail;
}
goto fail;
}
goto fail;
}
/* Make sure that any attributes we requested from LDAP that we
* did not receive are also removed from the sysdb
*/
goto fail;
}
/* We store memberNisNetgroup from LDAP as originalMemberNisNetgroup in
* sysdb. It may contain simple name or DN. That's the reason why we always
* (memberNisNetgroup) in sysdb which is internally used for searching
* netgropus.
* We need to ensure if originalMemberNisNetgroup is missing,
* memberNisNetgroup is missing too.
*/
goto fail;
}
}
if (_timestamp) {
*_timestamp = timestamp;
}
return EOK;
fail:
return ret;
}
{
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)
{
size_t c;
const char **member_list;
int ret;
char *dn_filter;
char *sysdb_filter;
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]);
"sysdb_attrs_add_string failed.\n");
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) {
"sysdb_attrs_add_string failed.\n");
goto fail;
}
}
return req;
}
}
"netgr_translate_members_ldap_step failed.\n");
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;
int ret;
break;
}
}
"sysdb_attrs_add_string failed.\n");
return ret;
}
}
return EOK;
}
&filter)) {
/* not in search base, skip it */
return netgr_translate_members_ldap_step(req);
}
return ENOMEM;
}
false);
if (!subreq) {
return ENOMEM;
}
return EAGAIN;
}
{
struct tevent_req);
struct netgr_translate_members_state);
int ret;
const char *str;
goto fail;
}
switch (count) {
case 0:
"sdap_get_generic_recv found no entry for [%s].\n",
break;
case 1:
break;
}
}
break;
default:
"Unexpected number of results [%zu] for base search.\n",
count);
}
"Failed to resolve netgroup name for DN [%s], using DN.\n",
}
"netgr_translate_members_ldap_step failed.\n");
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 {
const char **attrs;
const char *base_filter;
char *filter;
int timeout;
char *higher_timestamp;
};
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)
{
if (!state->search_bases) {
"Netgroup lookup request without a netgroup search base\n");
goto done;
}
done:
}
return req;
}
{
return ENOMEM;
}
"Searching for netgroups with base [%s]\n",
false);
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;
}