ipa_sudo_refresh.c revision 43bbf5b158ec3152806791ca49ae224ee978de24
/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2015 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/dp_ptask.h"
#include "providers/ipa/ipa_sudo.h"
#include "providers/ldap/sdap_sudo_shared.h"
#include "db/sysdb_sudo.h"
struct ipa_sudo_full_refresh_state {
struct ipa_sudo_ctx *sudo_ctx;
struct sss_domain_info *domain;
int dp_error;
};
struct tevent_req *
struct tevent_context *ev,
struct ipa_sudo_ctx *sudo_ctx)
{
struct ipa_sudo_full_refresh_state *state;
struct tevent_req *subreq;
struct tevent_req *req;
char *delete_filter;
int ret;
struct ipa_sudo_full_refresh_state);
return NULL;
}
/* Remove all rules from cache */
if (delete_filter == NULL) {
goto immediately;
}
goto immediately;
}
return req;
} else {
}
return req;
}
static void
{
struct ipa_sudo_full_refresh_state *state;
struct tevent_req *req;
int ret;
goto done;
}
"a successful full refresh\n");
}
done:
return;
}
}
int
int *dp_error)
{
struct ipa_sudo_full_refresh_state *state;
return EOK;
}
struct ipa_sudo_smart_refresh_state {
int dp_error;
};
static struct tevent_req *
struct tevent_context *ev,
struct ipa_sudo_ctx *sudo_ctx)
{
struct ipa_sudo_smart_refresh_state *state;
struct tevent_req *subreq;
struct tevent_req *req;
char *cmdgroups_filter;
char *search_filter;
const char *usn;
struct ipa_sudo_smart_refresh_state);
return NULL;
}
if (!sudo_ctx->full_refresh_done
/* Perform full refresh first */
"waiting for full refresh!\n");
goto immediately;
}
/* Download all rules from LDAP that are newer than usn */
"(&(%s>=%s)(!(%s=%s)))",
if (cmdgroups_filter == NULL) {
goto immediately;
}
"(&(%s>=%s)(!(%s=%s)))",
if (search_filter == NULL) {
goto immediately;
}
/* Do not remove any rules that are already in the sysdb. */
"(USN > %s)\n", usn);
goto immediately;
}
return req;
} else {
}
return req;
}
{
int ret;
goto done;
}
done:
return;
}
}
int *dp_error)
{
return EOK;
}
struct ipa_sudo_rules_refresh_state {
int dp_error;
bool deleted;
};
struct tevent_req *
struct tevent_context *ev,
struct ipa_sudo_ctx *sudo_ctx,
char **rules)
{
struct ipa_sudo_rules_refresh_state *state;
struct tevent_req *subreq;
struct tevent_req *req;
char *search_filter;
char *delete_filter;
char *safe_rule;
int i;
return NULL;
}
goto immediately;
}
goto immediately;
}
/* Download only selected rules from LDAP. */
/* Remove all selected rules from cache. */
goto immediately;
}
if (search_filter == NULL) {
goto immediately;
}
if (delete_filter == NULL) {
goto immediately;
}
}
if (search_filter == NULL) {
goto immediately;
}
if (delete_filter == NULL) {
goto immediately;
}
goto immediately;
}
}
return req;
}
static void
{
struct ipa_sudo_rules_refresh_state *state;
int ret;
goto done;
}
done:
return;
}
}
int
int *dp_error,
bool *deleted)
{
struct ipa_sudo_rules_refresh_state *state;
return EOK;
}
static struct tevent_req *
struct tevent_context *ev,
void *pvt)
{
struct ipa_sudo_ctx *sudo_ctx;
}
static errno_t
{
int dp_error;
}
static struct tevent_req *
struct tevent_context *ev,
void *pvt)
{
struct ipa_sudo_ctx *sudo_ctx;
}
static errno_t
{
int dp_error;
}
{
sudo_ctx);
}