#include "libcli/wbclient/wbclient.h"
#include "system/passwd.h"
+static NTSTATUS dcerpc_unixinfo_bind(struct dcesrv_call_state *dce_call,
+ const struct dcesrv_interface *iface)
+{
+ struct wbc_context *wbc_ctx;
+
+ wbc_ctx = wbc_init(dce_call->context, dce_call->msg_ctx,
+ dce_call->event_ctx);
+ NT_STATUS_HAVE_NO_MEMORY(wbc_ctx);
+
+ dce_call->context->private_data = wbc_ctx;
+
+ return NT_STATUS_OK;
+}
+
+#define DCESRV_INTERFACE_UNIXINFO_BIND dcerpc_unixinfo_bind
+
static NTSTATUS dcesrv_unixinfo_SidToUid(struct dcesrv_call_state *dce_call,
TALLOC_CTX *mem_ctx,
struct unixinfo_SidToUid *r)
{
NTSTATUS status;
+ struct wbc_context *wbc_ctx = talloc_get_type_abort(
+ dce_call->context->private_data,
+ struct wbc_context);
struct id_map *ids;
DEBUG(5, ("dcesrv_unixinfo_SidToUid called\n"));
ids->sid = &r->in.sid;
ids->status = ID_UNKNOWN;
ZERO_STRUCT(ids->xid);
- status = wbc_sids_to_xids(dce_call->event_ctx, ids, 1);
+ status = wbc_sids_to_xids(wbc_ctx->event_ctx, ids, 1);
NT_STATUS_NOT_OK_RETURN(status);
if (ids->xid.type == ID_TYPE_BOTH ||
TALLOC_CTX *mem_ctx,
struct unixinfo_UidToSid *r)
{
+ struct wbc_context *wbc_ctx = talloc_get_type_abort(
+ dce_call->context->private_data,
+ struct wbc_context);
struct id_map *ids;
uint32_t uid;
NTSTATUS status;
ids->xid.id = uid;
ids->xid.type = ID_TYPE_UID;
- status = wbc_xids_to_sids(dce_call->event_ctx, ids, 1);
+ status = wbc_xids_to_sids(wbc_ctx->event_ctx, ids, 1);
NT_STATUS_NOT_OK_RETURN(status);
r->out.sid = ids->sid;
struct unixinfo_SidToGid *r)
{
NTSTATUS status;
+ struct wbc_context *wbc_ctx = talloc_get_type_abort(
+ dce_call->context->private_data,
+ struct wbc_context);
struct id_map *ids;
DEBUG(5, ("dcesrv_unixinfo_SidToGid called\n"));
ids->sid = &r->in.sid;
ids->status = ID_UNKNOWN;
ZERO_STRUCT(ids->xid);
- status = wbc_sids_to_xids(dce_call->event_ctx, ids, 1);
+ status = wbc_sids_to_xids(wbc_ctx->event_ctx, ids, 1);
NT_STATUS_NOT_OK_RETURN(status);
if (ids->xid.type == ID_TYPE_BOTH ||
TALLOC_CTX *mem_ctx,
struct unixinfo_GidToSid *r)
{
+ struct wbc_context *wbc_ctx = talloc_get_type_abort(
+ dce_call->context->private_data,
+ struct wbc_context);
struct id_map *ids;
uint32_t gid;
NTSTATUS status;
ids->xid.id = gid;
ids->xid.type = ID_TYPE_GID;
- status = wbc_xids_to_sids(dce_call->event_ctx, ids, 1);
+ status = wbc_xids_to_sids(wbc_ctx->event_ctx, ids, 1);
NT_STATUS_NOT_OK_RETURN(status);
r->out.sid = ids->sid;