summaryrefslogtreecommitdiff
path: root/source3/nsswitch/idmap_rid.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-12-20 17:56:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:39 -0500
commitced5c1f9aa525addf4c0a4649fdbeb36128157e7 (patch)
tree77ad45ec03a24df04e47534d5faef689463894e2 /source3/nsswitch/idmap_rid.c
parent8b0fce0b0c4fb76d4e89b26eefcd0168f9429f40 (diff)
downloadsamba-ced5c1f9aa525addf4c0a4649fdbeb36128157e7.tar.gz
samba-ced5c1f9aa525addf4c0a4649fdbeb36128157e7.tar.bz2
samba-ced5c1f9aa525addf4c0a4649fdbeb36128157e7.zip
r20289: IDMAP is part of winbind but not the main process.
Make sure we route all request to remote DCs via the main process so that IDMAP can correctly reuse DC connections and use the async interface. This fixes also idmap_nss so that it is able to resolve local group names (requires patch on the samba dc earlier committed to SAMBA_3_0 to make it resolve both the mapped and the unmapped name). Simo. (This used to be commit 4297510f22c3fd60afd062e3c5eb142be2122b16)
Diffstat (limited to 'source3/nsswitch/idmap_rid.c')
-rw-r--r--source3/nsswitch/idmap_rid.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/source3/nsswitch/idmap_rid.c b/source3/nsswitch/idmap_rid.c
index 83818711a2..e74283e22e 100644
--- a/source3/nsswitch/idmap_rid.c
+++ b/source3/nsswitch/idmap_rid.c
@@ -83,8 +83,9 @@ failed:
static NTSTATUS idmap_rid_id_to_sid(TALLOC_CTX *memctx, struct idmap_rid_context *ctx, struct id_map *map)
{
- char *domname, *name;
+ const char *domname, *name;
enum lsa_SidType sid_type;
+ BOOL ret;
/* apply filters before checking */
if ((map->xid.id < ctx->low_id) || (map->xid.id > ctx->high_id)) {
@@ -95,7 +96,13 @@ static NTSTATUS idmap_rid_id_to_sid(TALLOC_CTX *memctx, struct idmap_rid_context
sid_compose(map->sid, &ctx->dom_sid, map->xid.id - ctx->low_id + ctx->base_rid);
- if (winbindd_lookup_name_by_sid(memctx, map->sid, &domname, &name, &sid_type)) {
+ /* by default calls to winbindd are disabled
+ the following call will not recurse so this is safe */
+ winbind_on();
+ ret = winbind_lookup_sid(memctx, map->sid, &domname, &name, &sid_type);
+ winbind_off();
+
+ if (ret) {
switch (sid_type) {
case SID_NAME_USER:
if (map->xid.type != ID_TYPE_UID) {
@@ -134,15 +141,22 @@ static NTSTATUS idmap_rid_id_to_sid(TALLOC_CTX *memctx, struct idmap_rid_context
static NTSTATUS idmap_rid_sid_to_id(TALLOC_CTX *memctx, struct idmap_rid_context *ctx, struct id_map *map)
{
- char *domname, *name;
+ const char *domname, *name;
enum lsa_SidType sid_type;
uint32_t rid;
+ BOOL ret;
sid_peek_rid(map->sid, &rid);
map->xid.id = rid - ctx->base_rid + ctx->low_id;
+ /* by default calls to winbindd are disabled
+ the following call will not recurse so this is safe */
+ winbind_on();
/* check if this is a valid SID and set the type */
- if (winbindd_lookup_name_by_sid(memctx, map->sid, &domname, &name, &sid_type)) {
+ ret = winbind_lookup_sid(memctx, map->sid, &domname, &name, &sid_type);
+ winbind_off();
+
+ if (ret) {
switch (sid_type) {
case SID_NAME_USER:
map->xid.type = ID_TYPE_UID;