sudosrv.c revision 39d36216a1692eee6cc5359f6c7ccaa7789be76d
/*
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 <popt.h>
#include "monitor/monitor_interfaces.h"
#include "responder/common/responder.h"
#include "responder/common/responder_sbus.h"
#include "responder/sudo/sudosrv_private.h"
#include "providers/data_provider.h"
#include "responder/common/negcache.h"
struct mon_cli_iface monitor_sudo_methods = {
{ &mon_cli_iface_meta, 0 },
.resetOffline = NULL,
.clearMemcache = NULL,
.clearEnumCache = NULL,
.sysbusReconnect = NULL,
};
static struct data_provider_iface sudo_dp_methods = {
{ &data_provider_iface_meta, 0 },
.RegisterService = NULL,
.pamHandler = NULL,
.sudoHandler = NULL,
.autofsHandler = NULL,
.hostHandler = NULL,
.getDomains = NULL,
.getAccountInfo = NULL,
};
int status,
void *pvt)
{
int ret;
/* Did we reconnect successfully? */
if (status == SBUS_RECONNECT_SUCCESS) {
/* Identify ourselves to the data provider */
"SUDO");
/* all fine */
return;
}
}
/* Failed to reconnect */
}
struct tevent_context *ev,
struct confdb_ctx *cdb)
{
struct sss_cmd_table *sudo_cmds;
int ret;
int max_retries;
sudo_cmds = get_sudo_cmds();
"SUDO",
&rctx);
return ret;
}
if (!sudo_ctx) {
goto fail;
}
"fatal error initializing ncache\n");
goto fail;
}
&sudo_ctx->neg_timeout);
"fatal error getting ncache timeout\n");
goto fail;
}
"failed to set ncache for sudo's filter_users\n");
goto fail;
}
/* Enable automatic reconnection to the Data Provider */
3, &max_retries);
"Failed to set up automatic reconnection\n");
goto fail;
}
}
/* Get sudo_timed option */
goto fail;
}
/* Get sudo_inverse_order option */
goto fail;
}
goto fail;
}
return EOK;
fail:
return ret;
}
{
int opt;
struct main_context *main_ctx;
int ret;
struct poptOption long_options[] = {
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
/* set up things like debug, signals, daemonization, etc... */
debug_log_file = "sssd_sudo";
&main_ctx);
return 2;
}
ret = die_if_parent_died();
/* This is not fatal, don't return */
"when parent process does\n");
}
return 3;
}
/* loop on main */
return 0;
}