diff -up source3/passdb/pdb_ldap.c.orig source3/passdb/pdb_ldap.c --- source3/passdb/pdb_ldap.c.orig 2009-09-09 07:40:43.000000000 -0500 +++ source3/passdb/pdb_ldap.c 2009-09-10 17:47:57.000000000 -0500 @@ -1209,10 +1209,12 @@ static bool init_ldap_from_sam (struct l * it does not exist. */ - if (need_update(sampass, PDB_FULLNAME)) + if (need_update(sampass, PDB_FULLNAME) + && lp_parm_bool(-1, "pdb_ldapsam", "displayNameWritable", true)) { smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods, get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_DISPLAY_NAME), pdb_get_fullname(sampass)); + } if (need_update(sampass, PDB_ACCTDESC)) smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, existing, mods, @@ -3014,8 +3016,10 @@ static NTSTATUS ldapsam_map_posixgroup(T sid_string_talloc(mem_ctx, &map->sid)); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, &mods, "sambaGroupType", talloc_asprintf(mem_ctx, "%d", map->sid_name_use)); - smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, &mods, "displayName", + if (lp_parm_bool(-1, "pdb_ldapsam", "displayNameWritable", true)) { + smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, &mods, "displayName", map->nt_name); + }; smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, &mods, "description", map->comment); talloc_autofree_ldapmod(mem_ctx, mods); @@ -3136,8 +3140,10 @@ static NTSTATUS ldapsam_add_group_mappin sid_string_talloc(mem_ctx, &map->sid)); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "sambaGroupType", talloc_asprintf(mem_ctx, "%d", map->sid_name_use)); - smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "displayName", + if (lp_parm_bool(-1, "pdb_ldapsam", "displayNameWritable", true)) { + smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "displayName", map->nt_name); + } smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "description", map->comment); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "gidNumber", @@ -3213,8 +3219,10 @@ static NTSTATUS ldapsam_update_group_map } mods = NULL; - smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, &mods, "displayName", + if (lp_parm_bool(-1, "pdb_ldapsam", "displayNameWritable", true)) { + smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, &mods, "displayName", map->nt_name); + } smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, &mods, "description", map->comment); talloc_autofree_ldapmod(mem_ctx, mods); @@ -5433,7 +5441,9 @@ static NTSTATUS ldapsam_create_dom_group smbldap_set_mod(&mods, LDAP_MOD_ADD, "objectClass", LDAP_OBJ_GROUPMAP); smbldap_set_mod(&mods, LDAP_MOD_ADD, "sambaSid", groupsidstr); smbldap_set_mod(&mods, LDAP_MOD_ADD, "sambaGroupType", grouptype); - smbldap_set_mod(&mods, LDAP_MOD_ADD, "displayName", name); + if (lp_parm_bool(-1, "pdb_ldapsam", "displayNameWritable", true)) { + smbldap_set_mod(&mods, LDAP_MOD_ADD, "displayName", name); + }; talloc_autofree_ldapmod(tmp_ctx, mods); if (is_new_entry) {