diff options
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/passdb.c | 14 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 2 | ||||
-rw-r--r-- | source3/passdb/pdb_smbpasswd.c | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index bbccb86d82..c3afcbc7d9 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -26,11 +26,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() +{ + 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. @@ -182,7 +184,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); pdb_set_uid(sam_account, pwd->pw_uid, PDB_SET); pdb_set_gid(sam_account, pwd->pw_gid, PDB_SET); diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 4abc7b569c..021b2e621e 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -3144,7 +3144,7 @@ static NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_met ldap_state->uri = "ldap://localhost"; } - ldap_state->domain_name = talloc_strdup(pdb_context->mem_ctx, lp_workgroup()); + ldap_state->domain_name = talloc_strdup(pdb_context->mem_ctx, get_global_sam_name()); if (!ldap_state->domain_name) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index cd66cf269c..cfbb37ce91 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -1215,7 +1215,7 @@ static BOOL build_sam_account(struct smbpasswd_privates *smbpasswd_state, */ pdb_set_group_sid_from_rid (sam_pass, DOMAIN_GROUP_RID_USERS, PDB_SET); pdb_set_username (sam_pass, pw_buf->smb_name, PDB_SET); - pdb_set_domain (sam_pass, lp_workgroup(), PDB_DEFAULT); + pdb_set_domain (sam_pass, get_global_sam_name(), PDB_DEFAULT); } else { DEBUG(0,("build_sam_account: smbpasswd database is corrupt! username %s with uid %u is not in unix passwd database!\n", pw_buf->smb_name, pw_buf->smb_userid)); |