summaryrefslogtreecommitdiff
path: root/server/nss/nsssrv_cmd.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2009-01-06 18:30:04 -0500
committerSimo Sorce <idra@samba.org>2009-01-06 18:30:04 -0500
commit054321c995958ecc7f8e5a92f8d35c6a6bd6e809 (patch)
treeb02fec790d5f2af9b68a4a0cf72278f59b37b719 /server/nss/nsssrv_cmd.c
parent2ef9239a6a33890b4ea077ceee8d3e8d8a18cc3c (diff)
downloadsssd-054321c995958ecc7f8e5a92f8d35c6a6bd6e809.tar.gz
sssd-054321c995958ecc7f8e5a92f8d35c6a6bd6e809.tar.bz2
sssd-054321c995958ecc7f8e5a92f8d35c6a6bd6e809.zip
Add initial support to connect nss to the data provider as a frontend
Diffstat (limited to 'server/nss/nsssrv_cmd.c')
-rw-r--r--server/nss/nsssrv_cmd.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/server/nss/nsssrv_cmd.c b/server/nss/nsssrv_cmd.c
index f688b283..a345c3a3 100644
--- a/server/nss/nsssrv_cmd.c
+++ b/server/nss/nsssrv_cmd.c
@@ -24,6 +24,7 @@
#include "util/util.h"
#include "nss/nsssrv.h"
#include "nss/nsssrv_ldb.h"
+#include "providers/data_provider.h"
struct nss_cmd_ctx {
struct cli_ctx *cctx;
@@ -207,6 +208,12 @@ done:
return EOK;
}
+static int nss_dispatch_getpwnam(struct cli_ctx *cctx)
+{
+
+ return EOK;
+}
+
static int nss_cmd_getpwnam(struct cli_ctx *cctx)
{
struct nss_cmd_ctx *nctx;
@@ -999,3 +1006,53 @@ int nss_cmd_execute(struct cli_ctx *cctx)
return EINVAL;
}
+
+static int cmd_identity(DBusMessage *message, void *data, DBusMessage **r)
+{
+ dbus_uint16_t version = DATA_PROVIDER_VERSION;
+ dbus_uint16_t clitype = DP_CLI_FRONTEND;
+ const char *cliname = "NSS";
+ const char *nullname = "";
+ DBusMessage *reply;
+ dbus_bool_t ret;
+
+ DEBUG(4,("Sending ID reply: (%d,%d,%s)\n",
+ clitype, version, cliname));
+
+ reply = dbus_message_new_method_return(message);
+ ret = dbus_message_append_args(reply,
+ DBUS_TYPE_UINT16, &clitype,
+ DBUS_TYPE_UINT16, &version,
+ DBUS_TYPE_STRING, &cliname,
+ DBUS_TYPE_STRING, &nullname,
+ DBUS_TYPE_INVALID);
+ if (!ret) {
+ return EIO;
+ }
+
+ *r = reply;
+ return EOK;
+}
+
+struct sbus_method nss_dp_methods[] = {
+ { DP_CLI_METHOD_IDENTITY, cmd_identity },
+ { NULL, NULL }
+};
+
+int nss_cmd_init(struct nss_ctx *nctx)
+{
+ int ret;
+
+ /* Set up SBUS connection to the data provider */
+ ret = dp_sbus_cli_init(nctx, nctx->ev, nctx->cdb,
+ nss_dp_methods, &nctx->dp_ctx);
+ if (ret != EOK) {
+ return ret;
+ }
+
+ /* attach context to the connection */
+ sbus_conn_set_private_data(nctx->dp_ctx->scon_ctx, nctx);
+
+ return EOK;
+}
+