mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
s3:idmap: remove idmap_new_mapping() - now implemented in the backends
This commit is contained in:
parent
e2968160a4
commit
95617a03db
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user