diff options
Diffstat (limited to 'source3/passdb/passdb.c')
-rw-r--r-- | source3/passdb/passdb.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index ccfc9a1693..f34513b225 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -27,11 +27,13 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_PASSDB -/* - * This is set on startup - it defines the SID for this - * machine, and therefore the SAM database for which it is - * responsible. - */ +const char *get_global_sam_name(void) +{ + if ((lp_server_role() == ROLE_DOMAIN_PDC) || (lp_server_role() == ROLE_DOMAIN_BDC)) { + return lp_workgroup(); + } + return global_myname(); +} /************************************************************ Fill the SAM_ACCOUNT with default values. @@ -175,7 +177,7 @@ NTSTATUS pdb_fill_sam_pw(SAM_ACCOUNT *sam_account, const struct passwd *pwd) pdb_set_unix_homedir(sam_account, pwd->pw_dir, PDB_SET); - pdb_set_domain (sam_account, lp_workgroup(), PDB_DEFAULT); + pdb_set_domain (sam_account, get_global_sam_name(), PDB_DEFAULT); /* When we get a proper uid -> SID and SID -> uid allocation mechinism, we should call it here. @@ -291,7 +293,7 @@ NTSTATUS pdb_init_sam_new(SAM_ACCOUNT **new_sam_acct, const char *username) return nt_status; } - pdb_set_domain (*new_sam_acct, lp_workgroup(), PDB_DEFAULT); + pdb_set_domain (*new_sam_acct, get_global_sam_name(), PDB_DEFAULT); /* set Domain Users by default ! */ sid_copy(&g_sid, get_global_sam_sid()); |