nsssrv_dp.c revision 57df88bb0b4ce656855410a8c2969d93475c2f11
/*
SSSD
NSS Responder - Data Provider Interfaces
Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
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 <time.h>
#include "providers/data_provider.h"
#include "sbus/sbus_client.h"
struct nss_dp_req {
void *callback_ctx;
struct timed_event *te;
};
static int nss_dp_req_destructor(void *ptr)
{
if (req->pending_reply) {
}
return 0;
}
struct timed_event *te,
{
struct nss_dp_req *ndp_req;
const char *err_msg = "Request timed out";
}
const char **err_msg);
{
struct nss_dp_req *ndp_req;
const char *err_msg;
int ret;
/* free timeout event and remove request destructor */
err_msg = "Failed to get reply from Data Provider";
}
}
{
struct nss_dp_req *ndp_req;
const char *attrs = "core";
char *filter;
/* either, or, not both */
return EINVAL;
}
if (!domain) {
return EINVAL;
}
switch (type) {
case NSS_DP_USER:
break;
case NSS_DP_GROUP:
break;
case NSS_DP_INITGROUPS:
break;
default:
return EINVAL;
}
if (opt_name) {
} else if (opt_id) {
} else {
}
if (!filter) {
return ENOMEM;
}
/* create the message */
DEBUG(0,("Out of memory?!\n"));
return ENOMEM;
}
if (!ret) {
return EIO;
}
600000 /* TODO: set timeout */);
if (!ret) {
/*
* Critical Failure
* We can't communicate on this connection
* We'll drop it using the default destructor.
*/
DEBUG(0, ("D-BUS send failed.\n"));
return EIO;
}
if (!ndp_req) {
return ENOMEM;
}
/* set up destructor */
/* setup the timeout handler */
/* Set up the reply handler */
return EOK;
}
const char **err_msg)
{
int type;
if (!reply) {
/* reply should never be null. This function shouldn't be called
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
/* FIXME: Destroy this connection ? */
goto done;
}
switch (type) {
if (!ret) {
/* FIXME: Destroy this connection ? */
goto done;
}
break;
case DBUS_MESSAGE_TYPE_ERROR:
DEBUG(0,("The Data Provider returned an error [%s]\n",
/* Falling through to default intentionally*/
default:
/*
* Timeout or other error occurred or something
* unexpected happened.
* It doesn't matter which, because either way we
* know that this connection isn't trustworthy.
* We'll destroy it now.
*/
/* FIXME: Destroy this connection ? */
}
done:
return err;
}
{
const char *cliname = "NSS";
const char *nullname = "";
if (!ret) {
return EIO;
}
/* send reply back */
return EOK;
}
struct sbus_method nss_dp_methods[] = {
};
struct nss_dp_pvt_ctx {
struct sbus_method *methods;
int retries;
};
static int nss_dp_conn_destructor(void *data);
struct timed_event *te,
{
struct timed_event *te;
struct sbus_method_ctx *sm_ctx;
char *sbus_address;
int ret;
/* reset retry if last reconnect was > 60 sec. ago */
return;
}
DEBUG(0, ("Could not locate data provider address.\n"));
return;
}
DEBUG(0, ("Could not initialize SBUS methods.\n"));
return;
}
} else {
}
}
}
struct timed_event *te,
{
struct nss_dp_pvt_ctx *pvt;
}
int nss_dp_conn_destructor(void *data)
{
struct nss_dp_pvt_ctx *pvt;
struct sbus_conn_ctx *scon;
if (!scon) return 0;
/* if this is a regular disconnect just quit */
if (sbus_conn_disconnecting(scon)) return 0;
struct nss_dp_pvt_ctx);
if (pvt) return 0;
return 0;
}
{
struct nss_dp_pvt_ctx *pvt;
return EOK;
}