diff options
author | Volker Lendecke <vlendec@samba.org> | 2004-09-27 14:44:07 +0000 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2004-09-27 14:44:07 +0000 |
commit | ac89ba32aef22300078e62b63f914a1a38edcb17 (patch) | |
tree | d88759cf386e86f285989ee35a578a1fa36f4d5b /source/sam | |
parent | 094a43ee179f8da69f50acca685fe3999f6e8709 (diff) | |
download | samba-ac89ba32aef22300078e62b63f914a1a38edcb17.tar.gz samba-ac89ba32aef22300078e62b63f914a1a38edcb17.tar.xz samba-ac89ba32aef22300078e62b63f914a1a38edcb17.zip |
r2691: Increase a debug level for a quite frequent operation.
Optimization for 'idmap backend = ldap': When asking sid2id for the wrong
type, don't ask ldap when we have the opposite mapping in the local tdb.
Volker
Diffstat (limited to 'source/sam')
-rw-r--r-- | source/sam/idmap.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/sam/idmap.c b/source/sam/idmap.c index d541776f391..4de37f0e499 100644 --- a/source/sam/idmap.c +++ b/source/sam/idmap.c @@ -200,6 +200,7 @@ NTSTATUS idmap_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) { NTSTATUS ret; int loc_type; + unid_t loc_id; if (proxyonly) return NT_STATUS_UNSUCCESSFUL; @@ -223,6 +224,32 @@ NTSTATUS idmap_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) return ret; } + /* Before forking out to the possibly slow remote map, lets see if we + * already have the sid as uid when asking for a gid or vice versa. */ + + loc_type = *id_type & ID_TYPEMASK; + + switch (loc_type) { + case ID_USERID: + loc_type = ID_GROUPID; + break; + case ID_GROUPID: + loc_type = ID_USERID; + break; + default: + loc_type = ID_EMPTY; + } + + loc_type |= ID_QUERY_ONLY; + + ret = cache_map->get_id_from_sid(&loc_id, &loc_type, sid); + + if (NT_STATUS_IS_OK(ret)) { + /* Ok, we have the uid as gid or vice versa. The remote map + * would not know anything different, so return here. */ + return NT_STATUS_UNSUCCESSFUL; + } + /* Ok, the mapping was not in the cache, give the remote map a second try. */ |