diff options
-rw-r--r-- | source3/winbindd/idmap.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c index d6f37b80b9..a0c083c248 100644 --- a/source3/winbindd/idmap.c +++ b/source3/winbindd/idmap.c @@ -646,74 +646,6 @@ NTSTATUS idmap_allocate_gid(struct unixid *id) return ctx->methods->allocate_id(id); } -NTSTATUS idmap_new_mapping(const struct dom_sid *psid, enum id_type type, - struct unixid *pxid) -{ - struct dom_sid sid; - struct idmap_domain *dom; - struct id_map map; - NTSTATUS status; - - dom = idmap_find_domain(NULL); - if (dom == NULL) { - DEBUG(3, ("no default domain, no place to write\n")); - return NT_STATUS_ACCESS_DENIED; - } - if (dom->methods->set_mapping == NULL) { - DEBUG(3, ("default domain not writable\n")); - return NT_STATUS_MEDIA_WRITE_PROTECTED; - } - - sid_copy(&sid, psid); - map.sid = &sid; - map.xid.type = type; - - switch (type) { - case ID_TYPE_UID: - status = idmap_allocate_uid(&map.xid); - break; - case ID_TYPE_GID: - status = idmap_allocate_gid(&map.xid); - break; - default: - status = NT_STATUS_INVALID_PARAMETER; - break; - } - - if (!NT_STATUS_IS_OK(status)) { - DEBUG(3, ("Could not allocate id: %s\n", nt_errstr(status))); - return status; - } - - map.status = ID_MAPPED; - - DEBUG(10, ("Setting mapping: %s <-> %s %lu\n", - sid_string_dbg(map.sid), - (map.xid.type == ID_TYPE_UID) ? "UID" : "GID", - (unsigned long)map.xid.id)); - - status = dom->methods->set_mapping(dom, &map); - - if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { - struct id_map *ids[2]; - DEBUG(5, ("Mapping for %s exists - retrying to map sid\n", - sid_string_dbg(map.sid))); - ids[0] = ↦ - ids[1] = NULL; - status = dom->methods->sids_to_unixids(dom, ids); - } - - if (!NT_STATUS_IS_OK(status)) { - DEBUG(3, ("Could not store the new mapping: %s\n", - nt_errstr(status))); - return status; - } - - *pxid = map.xid; - - return NT_STATUS_OK; -} - NTSTATUS idmap_backends_unixid_to_sid(const char *domname, struct id_map *id) { struct idmap_domain *dom; |