summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-02-09 12:57:01 +0100
committerKarolin Seeger <kseeger@samba.org>2010-02-15 14:46:55 +0100
commit7b6b5c40e79e50c6affb52325b775ddfd28654f9 (patch)
tree7be447ab599ee487835a7437ae474f4afb89c5b7
parent2c08182a687f2fade833b8ef9f6db0cc946c5999 (diff)
downloadsamba-7b6b5c40e79e50c6affb52325b775ddfd28654f9.tar.gz
samba-7b6b5c40e79e50c6affb52325b775ddfd28654f9.tar.xz
samba-7b6b5c40e79e50c6affb52325b775ddfd28654f9.zip
s3:passdb: only use gid_to_sid() result if the result is a group of our local sam
Otherwise retry with pdb_gid_to_sid(). metze (cherry picked from commit 4dc2be2264926fe415e4e40e212f94793c9831d1) Last seven patches address bug #7116 (pdb_ldap performance fixes). (cherry picked from commit 8946a47fcebe57f459c59ee2cb163e15901ff996) Signed-off-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit 5b5df3d1223d15d4fde9a2a2db83c60aaa266ca4)
-rw-r--r--source3/passdb/pdb_get_set.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 39a85fa91ba..1155050d799 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -183,6 +183,7 @@ const DOM_SID *pdb_get_group_sid(struct samu *sampass)
{
DOM_SID *gsid;
struct passwd *pwd;
+ bool need_lookup_sid = false;
/* Return the cached group SID if we have that */
if ( sampass->group_sid ) {
@@ -213,10 +214,6 @@ const DOM_SID *pdb_get_group_sid(struct samu *sampass)
gid_to_sid(gsid, pwd->pw_gid);
if (!is_null_sid(gsid)) {
- enum lsa_SidType type = SID_NAME_UNKNOWN;
- TALLOC_CTX *mem_ctx;
- bool lookup_ret;
- const DOM_SID *usid = pdb_get_user_sid(sampass);
DOM_SID dgsid;
uint32_t rid;
@@ -232,8 +229,23 @@ const DOM_SID *pdb_get_group_sid(struct samu *sampass)
case DOMAIN_RID_USERS:
sampass->group_sid = gsid;
return sampass->group_sid;
+ default:
+ need_lookup_sid = true;
+ break;
+ }
+ } else {
+ ZERO_STRUCTP(gsid);
+ if (pdb_gid_to_sid(pwd->pw_gid, gsid)) {
+ need_lookup_sid = true;
}
}
+ }
+
+ if (need_lookup_sid) {
+ enum lsa_SidType type = SID_NAME_UNKNOWN;
+ TALLOC_CTX *mem_ctx;
+ bool lookup_ret;
+ const DOM_SID *usid = pdb_get_user_sid(sampass);
mem_ctx = talloc_init("pdb_get_group_sid");
if (!mem_ctx) {