idmap_rid: remove a legacy comment from sid_to_id
[obnox/samba/samba-obnox.git] / source3 / winbindd / idmap_rid.c
index e4490ded1661d7adee3f82b77ae3c0e3d50e81c0..099f68c5ee31562c9f4756908e2aabde216df9d7 100644 (file)
 
 #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;
 };
 
@@ -34,14 +35,13 @@ struct idmap_rid_context {
   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;
@@ -55,8 +55,7 @@ static NTSTATUS idmap_rid_initialize(struct idmap_domain *dom,
        }
 
        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);
@@ -88,11 +87,8 @@ static NTSTATUS idmap_rid_id_to_sid(struct idmap_domain *dom, struct id_map *map
 
        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;
 }
@@ -110,6 +106,7 @@ static NTSTATUS idmap_rid_sid_to_id(struct idmap_domain *dom, struct id_map *map
 
        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 */
 
@@ -120,10 +117,6 @@ static NTSTATUS idmap_rid_sid_to_id(struct idmap_domain *dom, struct id_map *map
                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;
@@ -186,19 +179,10 @@ static NTSTATUS idmap_rid_sids_to_unixids(struct idmap_domain *dom, struct id_ma
        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)