/*
SSSD
Async LDAP Helper routines for sudo
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2012 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 <errno.h>
#include <talloc.h>
#include <tevent.h>
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_ops.h"
#include "providers/ldap/sdap_sudo.h"
#include "providers/ldap/sdap_sudo_shared.h"
#include "db/sysdb_sudo.h"
struct sdap_sudo_load_sudoers_state {
};
static struct tevent_req *
struct tevent_context *ev,
struct sdap_options *opts,
struct sdap_handle *sh,
const char *ldap_filter)
{
int ret;
struct sdap_sudo_load_sudoers_state);
if (!req) {
return NULL;
}
"SUDOERS lookup request without a search base\n");
goto immediately;
}
opts->sudorule_map, true, 0,
ldap_filter, NULL);
goto immediately;
}
}
return req;
}
{
return;
}
return;
}
struct sysdb_attrs ***rules)
{
return EOK;
}
struct sdap_attr_map *map,
char **hostnames,
char **ip_addr,
bool netgroups,
bool regexp)
{
int i;
return NULL;
}
goto done;
}
/* sudoHost is not specified and it is a cn=defaults rule */
goto done;
}
/* ALL */
goto done;
}
/* hostnames */
hostnames[i]);
goto done;
}
}
}
/* ip addresses and networks */
ip_addr[i]);
goto done;
}
}
}
/* sudoHost contains netgroup - will be filtered more by sudo */
if (netgroups) {
"*");
goto done;
}
}
/* sudoHost contains regexp - will be filtered more by sudo */
/* from sudo match.c :
* #define has_meta(s) (strpbrk(s, "\\?*[]") != NULL)
*/
if (regexp) {
"(|(%s=*\\\\*)(%s=*?*)(%s=*\\2A*)"
"(%s=*[*]*))",
goto done;
}
}
goto done;
}
done:
return filter;
}
struct sdap_attr_map *map,
struct sdap_sudo_ctx *sudo_ctx,
const char *rule_filter)
{
if (!sudo_ctx->use_host_filter) {
}
return NULL;
}
if (host_filter == NULL) {
goto done;
}
goto done;
}
done:
return filter;
}
struct sdap_sudo_refresh_state {
const char *search_filter;
const char *delete_filter;
int dp_error;
};
struct sdap_sudo_ctx *sudo_ctx,
const char *search_filter,
const char *delete_filter)
{
int ret;
if (!req) {
return NULL;
}
/* if we don't have a search filter, this request is meaningless */
if (search_filter == NULL) {
goto immediately;
}
goto immediately;
}
goto immediately;
}
goto immediately;
}
/* asynchronous processing */
return req;
}
} else {
}
return req;
}
{
int ret;
return ret;
}
return EAGAIN;
}
{
int dp_error;
int ret;
return;
}
/* Renew host information if needed. */
return;
}
return;
}
}
}
{
"host filter will be disabled [%d]: %s\n",
sudo_ctx->use_host_filter = false;
} else {
sudo_ctx->use_host_filter = true;
}
}
}
{
char *filter;
/* We are connected. Host information may have changed during transition
* from offline to online state. At this point we can combine search
* and host filter. */
return ENOMEM;
}
filter);
return ENOMEM;
}
return EAGAIN;
}
struct sysdb_attrs **rules,
{
bool qualify;
char *domain;
char *name;
const char *orig_name;
for (size_t i = 0; i < rules_count; i++) {
false, &el);
continue;
}
if (qualify) {
continue;
}
return ENOMEM;
}
}
name,
domain);
return ENOMEM;
}
}
}
}
return EOK;
}
{
int dp_error;
int ret;
bool in_transaction = false;
/* retry */
}
return;
return;
}
/* Save users and groups fully qualified */
goto done;
}
/* start transaction */
goto done;
}
in_transaction = true;
/* purge cache */
rules, rules_count);
goto done;
}
/* store rules */
goto done;
}
/* commit transaction */
goto done;
}
in_transaction = false;
/* remember new usn */
} else {
}
done:
if (in_transaction) {
}
}
} else {
}
}
struct tevent_req *req,
int *dp_error,
{
}
return EOK;
}