proxy_init.c revision 769347ad4d35d43488eb98f980143495b0db415d
/*
SSSD
Authors:
Stephen Gallagher <sgallagh@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 "config.h"
#include "util/sss_format.h"
struct sbus_connection *conn);
static struct data_provider_iface proxy_methods = {
{ &data_provider_iface_meta, 0 },
.pamHandler = NULL,
.sudoHandler = NULL,
.autofsHandler = NULL,
.hostHandler = NULL,
.getDomains = NULL,
.getAccountInfo = NULL,
};
struct sbus_interface proxy_interface = {
};
{
/* TODO: Clean up any internal data */
}
{
}
struct bet_ops proxy_id_ops = {
.check_online = NULL
};
struct bet_ops proxy_auth_ops = {
};
struct bet_ops proxy_access_ops = {
};
struct bet_ops proxy_chpass_ops = {
};
{
char *funcname;
void *funcptr;
return funcptr;
}
{
struct proxy_id_ctx *ctx;
char *libname;
char *libpath;
int ret;
if (!ctx) {
return ENOMEM;
}
goto done;
}
if (!libpath) {
goto done;
}
"Unable to load %s module with path, error: %s\n",
goto done;
}
libname);
"Failed to load NSS fns, error: %s\n", dlerror());
goto done;
}
libname);
"Failed to load NSS fns, error: %s\n", dlerror());
goto done;
}
"Failed to load NSS fns, error: %s\n", dlerror());
goto done;
}
libname);
"Failed to load NSS fns, error: %s\n", dlerror());
goto done;
}
"Failed to load NSS fns, error: %s\n", dlerror());
goto done;
}
libname);
"Failed to load NSS fns, error: %s\n", dlerror());
goto done;
}
libname);
"Failed to load NSS fns, error: %s\n", dlerror());
goto done;
}
"Failed to load NSS fns, error: %s\n", dlerror());
goto done;
}
libname);
"Failed to load NSS fns, error: %s\n", dlerror());
goto done;
}
"Failed to load NSS fns, error: %s\n", dlerror());
goto done;
}
libname);
"_nss_XXX_initgroups_dyn function!\n"
"initgroups will be slow as it will require "
"full groups enumeration!\n", libname);
}
libname);
"Failed to load _nss_%s_setnetgrent, error: %s. "
"The library does not support netgroups.\n", libname,
dlerror());
}
libname);
"Failed to load _nss_%s_getnetgrent_r, error: %s. "
"The library does not support netgroups.\n", libname,
dlerror());
}
libname);
"Failed to load _nss_%s_endnetgrent, error: %s. "
"The library does not support netgroups.\n", libname,
dlerror());
}
"_nss_%s_getservbyname_r",
libname);
"Failed to load _nss_%s_getservbyname_r, error: %s. "
"The library does not support services.\n",
dlerror());
}
"_nss_%s_getservbyport_r",
libname);
"Failed to load _nss_%s_getservbyport_r, error: %s. "
"The library does not support services.\n",
dlerror());
}
"_nss_%s_setservent",
libname);
"Failed to load _nss_%s_setservent, error: %s. "
"The library does not support services.\n",
dlerror());
}
"_nss_%s_getservent_r",
libname);
"Failed to load _nss_%s_getservent_r, error: %s. "
"The library does not support services.\n",
dlerror());
}
"_nss_%s_endservent",
libname);
"Failed to load _nss_%s_endservent, error: %s. "
"The library does not support services.\n",
dlerror());
}
*ops = &proxy_id_ops;
done:
}
return ret;
}
struct proxy_client {
struct proxy_auth_ctx *proxy_auth_ctx;
struct sbus_connection *conn;
struct tevent_timer *timeout;
bool initialized;
};
struct tevent_timer *te,
{
struct proxy_auth_ctx *proxy_auth_ctx;
struct proxy_client *proxy_cli;
/* hang off this memory to the connection so that when the connection
* is freed we can potentially call a destructor */
if (!proxy_cli) {
return ENOMEM;
}
proxy_cli->initialized = false;
/* 5 seconds should be plenty */
return ENOMEM;
}
/* Attach the client context to the connection context, so that it is
* always available when we need to manage the connection. */
return EOK;
}
struct tevent_timer *te,
{
struct proxy_client *proxy_cli;
"Client timed out before Identification [%p]!\n", te);
/* If we time out here, we will also time out to
* pc_init_timeout(), so we'll finish the request
* there.
*/
}
struct sbus_connection *conn)
{
struct proxy_client *proxy_cli;
void *data;
int hret;
struct tevent_req *req;
struct proxy_child_ctx *child_ctx;
struct pc_init_ctx *init_ctx;
if (!proxy_cli) {
return EINVAL;
}
/* First thing, cancel the timeout */
if (!dbret) {
"Failed to parse message, killing connection\n");
/* FIXME: should we just talloc_zfree(conn) ? */
return EIO;
}
/* Check the hash table */
"Unknown child ID. Killing the connection\n");
return EIO;
}
/* reply that all is ok */
if (!reply) {
return ENOMEM;
}
if (!dbret) {
return EIO;
}
/* send reply back */
if (hret != HASH_SUCCESS) {
}
/* Signal that the child is up and ready to receive the request */
/* This should hopefully be impossible, but protect
* against it anyway. If we're not marked running, then
* the init_req will be NULL below and things will
* break.
*/
"that's not marked as running\n");
return EIO;
}
return EOK;
}
{
struct proxy_auth_ctx *ctx;
int ret;
int hret;
char *sbus_address;
/* If we're already set up, just return that */
"Re-using proxy_auth_ctx for this provider\n");
return EOK;
}
if (!ctx) {
return ENOMEM;
}
&ctx->pam_target);
if (!ctx->pam_target) {
goto done;
}
if (sbus_address == NULL) {
goto done;
}
goto done;
}
/* Set up request hash table */
/* FIXME: get max_children from configuration file */
if (hret != HASH_SUCCESS) {
goto done;
}
*ops = &proxy_auth_ops;
done:
}
return ret;
}
{
int ret;
*ops = &proxy_access_ops;
return ret;
}
{
int ret;
*ops = &proxy_chpass_ops;
return ret;
}