summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-08-04 20:35:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:38:31 -0500
commitf8aa1c75f4961739863928392c8870c9c9a019d8 (patch)
tree281bd5888f03177195db652157689fc400196d8f /source3/passdb
parent61d5d8ca2b7c00fbd184e7c858796279aa749b5b (diff)
downloadsamba-f8aa1c75f4961739863928392c8870c9c9a019d8.tar.gz
samba-f8aa1c75f4961739863928392c8870c9c9a019d8.tar.bz2
samba-f8aa1c75f4961739863928392c8870c9c9a019d8.zip
r17402: Added lookup_name_smbconf() to be called when looking
up names from smb.conf. If the name is unqualified it causes the lookup to be done in WORKGROUP\name, then "Unix [users|groups]"\name rather than searching the domain. Should fix the problems with "force user" selecting a domain user by preference. Jeremy. (This used to be commit 1e1fcb5eb2ac4bd360461b29f85c07dbf460025d)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/lookup_sid.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
index 31bd4ab762..97cac87984 100644
--- a/source3/passdb/lookup_sid.c
+++ b/source3/passdb/lookup_sid.c
@@ -378,6 +378,56 @@ BOOL lookup_name(TALLOC_CTX *mem_ctx,
return True;
}
+/************************************************************************
+ Names from smb.conf can be unqualified. eg. valid users = foo
+ These names should never map to a remote name. Try lp_workgroup()\foo,
+ and then "Unix Users"\foo (or "Unix Groups"\foo).
+************************************************************************/
+
+BOOL lookup_name_smbconf(TALLOC_CTX *mem_ctx,
+ const char *full_name, int flags,
+ const char **ret_domain, const char **ret_name,
+ DOM_SID *ret_sid, enum SID_NAME_USE *ret_type)
+{
+ char *qualified_name;
+
+ /* NB. No winbindd_separator here as lookup_name needs \\' */
+ if (strchr_m(full_name, '\\')) {
+ /* The name is already qualified with a domain. */
+ return lookup_name(mem_ctx, full_name, flags,
+ ret_domain, ret_name,
+ ret_sid, ret_type);
+ }
+
+ /* Try with our own domain name. */
+ qualified_name = talloc_asprintf(mem_ctx, "%s\\%s",
+ lp_workgroup(),
+ full_name );
+ if (!qualified_name) {
+ return False;
+ }
+
+ if (lookup_name(mem_ctx, qualified_name, flags,
+ ret_domain, ret_name,
+ ret_sid, ret_type)) {
+ return True;
+ }
+
+ /* Finally try with "Unix Users" or "Unix Group" */
+ qualified_name = talloc_asprintf(mem_ctx, "%s\\%s",
+ flags & LOOKUP_NAME_GROUP ?
+ unix_groups_domain_name() :
+ unix_users_domain_name(),
+ full_name );
+ if (!qualified_name) {
+ return False;
+ }
+
+ return lookup_name(mem_ctx, qualified_name, flags,
+ ret_domain, ret_name,
+ ret_sid, ret_type);
+}
+
static BOOL wb_lookup_rids(TALLOC_CTX *mem_ctx,
const DOM_SID *domain_sid,
int num_rids, uint32 *rids,