sdap_sudo.c revision b8f6f1e105f323b0debfcf1bb09aead6b3914472
/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2011 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 <string.h>
#include <tevent.h>
#include "providers/dp_backend.h"
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_async.h"
#include "providers/ldap/sdap_sudo.h"
#include "providers/ldap/sdap_sudo_cache.h"
#include "providers/ldap/sdap_sudo_timer.h"
#include "db/sysdb_sudo.h"
struct sdap_sudo_full_refresh_state {
int dp_error;
int error;
};
struct sdap_id_ctx *id_ctx);
int *dp_error,
int *error);
struct sdap_options *opts,
struct sdap_id_conn_cache *conn_cache,
char **rules);
int *dp_error,
int *error);
static void
{
}
struct bet_ops sdap_sudo_ops = {
};
struct sdap_id_ctx *id_ctx,
void **pvt_data)
{
int ret;
*ops = &sdap_sudo_ops;
return ret;
}
return ret;
}
return EOK;
}
{
bool refreshed = false;
/* set up periodical update of sudo rules */
if (refresh_enabled) {
if (refresh_ctx == NULL) {
("sdap_sudo_refresh_ctx_init() failed!\n"));
return ENOMEM;
}
/* If this is the first startup, we need to kick off
* an refresh immediately, to close a window where
* clients requesting sudo information won't get an
* immediate reply with no entries
*/
return ret;
}
if (refreshed) {
/* At least one update has previously run,
* so clients will get cached data. We will delay
* starting to enumerate by 10s so we don't slow
* down the startup process if this is happening
* during system boot.
*/
"for 10 seconds\n"));
} else {
/* This is our first startup. Schedule the
* update to start immediately once we
* enter the mainloop.
*/
tv = tevent_timeval_current();
}
return ret;
}
}
return EOK;
}
{
int dp_error;
int error;
int ret;
case BE_REQ_SUDO_FULL:
break;
default:
}
return;
}
}
{
struct sdap_id_ctx);
case BE_REQ_SUDO_FULL:
break;
default:
goto fail;
}
goto fail;
}
return;
fail:
}
/* issue full refresh of sudo rules */
struct sdap_id_ctx *id_ctx)
{
char *ldap_filter = NULL;
char *sysdb_filter = NULL;
int ret;
return NULL;
}
/* Download all rules from LDAP */
if (ldap_filter == NULL) {
goto immediately;
}
/* Remove all rules from cache */
if (sysdb_filter == NULL) {
goto immediately;
}
goto immediately;
}
/* free filters */
return req;
} else {
}
return req;
}
int *dp_error,
int *error)
{
return EOK;
}
{
int ret;
return;
}
/* save the time in the sysdb */
"a successful full refresh\n"));
/* this is only a minor error that does not affect the functionality,
* therefore there is no need to report it with tevent_req_error()
* which would cause problems in the consumers */
}
}
/* issue refresh of specific sudo rules */
struct sdap_options *opts,
struct sdap_id_conn_cache *conn_cache,
char **rules)
{
char *ldap_filter = NULL;
char *sysdb_filter = NULL;
int ret;
int i;
return NULL;
}
return NULL;
}
/* Download only selected rules from LDAP */
/* Remove all selected rules from cache */
goto done;
}
if (ldap_filter == NULL) {
goto done;
}
if (sysdb_filter == NULL) {
goto done;
}
}
if (ldap_filter == NULL) {
goto done;
}
if (sysdb_filter == NULL) {
goto done;
}
goto done;
}
done:
return req;
}
int *dp_error,
int *error)
{
}