#include "includes.h"
#include "winbindd.h"
+#include "idmap.h"
+#include "../libcli/security/dom_sid.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_IDMAP
struct idmap_rid_context {
- const char *domain_name;
uint32_t base_rid;
};
we support multiple domains in the new idmap
*****************************************************************************/
-static NTSTATUS idmap_rid_initialize(struct idmap_domain *dom,
- const char *params)
+static NTSTATUS idmap_rid_initialize(struct idmap_domain *dom)
{
NTSTATUS ret;
struct idmap_rid_context *ctx;
char *config_option = NULL;
- ctx = TALLOC_ZERO_P(dom, struct idmap_rid_context);
+ ctx = talloc_zero(dom, struct idmap_rid_context);
if (ctx == NULL) {
DEBUG(0, ("Out of memory!\n"));
return NT_STATUS_NO_MEMORY;
}
ctx->base_rid = lp_parm_int(-1, config_option, "base_rid", 0);
- ctx->domain_name = talloc_strdup( ctx, dom->name );
-
+
dom->private_data = ctx;
talloc_free(config_option);
sid_compose(map->sid, &domain->sid, map->xid.id - dom->low_id + ctx->base_rid);
- /* We **really** should have some way of validating
- the SID exists and is the correct type here. But
- that is a deficiency in the idmap_rid design. */
-
map->status = ID_MAPPED;
+ map->xid.type = ID_TYPE_BOTH;
return NT_STATUS_OK;
}
sid_peek_rid(map->sid, &rid);
map->xid.id = rid - ctx->base_rid + dom->low_id;
+ map->xid.type = ID_TYPE_BOTH;
/* apply filters before returning result */
return NT_STATUS_NONE_MAPPED;
}
- /* We **really** should have some way of validating
- the SID exists and is the correct type here. But
- that is a deficiency in the idmap_rid design. */
-
map->status = ID_MAPPED;
return NT_STATUS_OK;
return NT_STATUS_OK;
}
-static NTSTATUS idmap_rid_close(struct idmap_domain *dom)
-{
- if (dom->private_data) {
- TALLOC_FREE(dom->private_data);
- }
- return NT_STATUS_OK;
-}
-
static struct idmap_methods rid_methods = {
.init = idmap_rid_initialize,
.unixids_to_sids = idmap_rid_unixids_to_sids,
.sids_to_unixids = idmap_rid_sids_to_unixids,
- .close_fn = idmap_rid_close
};
NTSTATUS idmap_rid_init(void)