return ret;
}
+NTSTATUS idmap_backends_unixid_to_sid(struct id_map *id)
+{
+ struct id_map *maps[2];
+ int i;
+
+ maps[0] = id;
+ maps[1] = NULL;
+
+ for (i = num_domains-1; i>=0; i--) {
+ struct idmap_domain *dom = idmap_domains[i];
+ NTSTATUS status;
+
+ DEBUG(10, ("Query sids from domain %s\n", dom->name));
+
+ status = dom->methods->unixids_to_sids(dom, maps);
+ if (NT_STATUS_IS_OK(status)) {
+ return NT_STATUS_OK;
+ }
+ }
+
+ return NT_STATUS_NONE_MAPPED;
+}
+
+NTSTATUS idmap_backends_sid_to_unixid(struct id_map *id)
+{
+ struct idmap_domain *dom;
+ struct id_map *maps[2];
+
+ dom = find_idmap_domain_from_sid(id->sid);
+ if (dom == NULL) {
+ return NT_STATUS_NONE_MAPPED;
+ }
+
+ maps[0] = id;
+ maps[1] = NULL;
+
+ return dom->methods->sids_to_unixids(dom, maps);
+}
+
/**************************************************************************
idmap interface functions
**************************************************************************/
{
NTSTATUS ret;
struct id_map map;
- struct id_map *maps[2];
DEBUG(10,("uid = [%lu]\n", (unsigned long)uid));
map.xid.type = ID_TYPE_UID;
map.xid.id = uid;
- maps[0] = ↦
- maps[1] = NULL;
-
- ret = idmap_unixids_to_sids(maps);
+ ret = idmap_backends_unixid_to_sid(&map);
if ( ! NT_STATUS_IS_OK(ret)) {
DEBUG(10, ("error mapping uid [%lu]\n", (unsigned long)uid));
return ret;
{
NTSTATUS ret;
struct id_map map;
- struct id_map *maps[2];
DEBUG(10,("gid = [%lu]\n", (unsigned long)gid));
map.xid.type = ID_TYPE_GID;
map.xid.id = gid;
- maps[0] = ↦
- maps[1] = NULL;
-
- ret = idmap_unixids_to_sids(maps);
+ ret = idmap_backends_unixid_to_sid(&map);
if ( ! NT_STATUS_IS_OK(ret)) {
DEBUG(10, ("error mapping gid [%lu]\n", (unsigned long)gid));
return ret;
{
NTSTATUS ret;
struct id_map map;
- struct id_map *maps[2];
DEBUG(10,("idmap_sid_to_uid: sid = [%s]\n", sid_string_dbg(sid)));
map.sid = sid;
map.xid.type = ID_TYPE_UID;
-
- maps[0] = ↦
- maps[1] = NULL;
-
- ret = idmap_sids_to_unixids(maps);
+
+ ret = idmap_backends_sid_to_unixid(&map);
if ( ! NT_STATUS_IS_OK(ret)) {
DEBUG(10, ("error mapping sid [%s] to uid\n",
sid_string_dbg(sid)));
{
NTSTATUS ret;
struct id_map map;
- struct id_map *maps[2];
DEBUG(10,("idmap_sid_to_gid: sid = [%s]\n", sid_string_dbg(sid)));
map.sid = sid;
map.xid.type = ID_TYPE_GID;
-
- maps[0] = ↦
- maps[1] = NULL;
-
- ret = idmap_sids_to_unixids(maps);
+
+ ret = idmap_backends_sid_to_unixid(&map);
if ( ! NT_STATUS_IS_OK(ret)) {
DEBUG(10, ("error mapping sid [%s] to gid\n",
sid_string_dbg(sid)));