diff options
-rw-r--r-- | source3/libnet/libnet_samsync_ldif.c | 48 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 39 |
2 files changed, 43 insertions, 44 deletions
diff --git a/source3/libnet/libnet_samsync_ldif.c b/source3/libnet/libnet_samsync_ldif.c index c89fedc2a3..adcf92832d 100644 --- a/source3/libnet/libnet_samsync_ldif.c +++ b/source3/libnet/libnet_samsync_ldif.c @@ -178,8 +178,8 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid, fprintf(add_fd, "# %s, %s\n", lp_workgroup(), suffix); fprintf(add_fd, "dn: sambaDomainName=%s,%s\n", lp_workgroup(), suffix); - fprintf(add_fd, "objectClass: sambaDomain\n"); - fprintf(add_fd, "objectClass: sambaUnixIdPool\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_DOMINFO); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_IDPOOL); fprintf(add_fd, "sambaDomainName: %s\n", lp_workgroup()); fprintf(add_fd, "sambaSID: %s\n", sid); fprintf(add_fd, "uidNumber: %d\n", ++ldif_uid); @@ -192,8 +192,8 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid, suffix); fprintf(add_fd, "dn: cn=Domain Admins,ou=%s,%s\n", group_attr, suffix); - fprintf(add_fd, "objectClass: posixGroup\n"); - fprintf(add_fd, "objectClass: sambaGroupMapping\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXGROUP); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_GROUPMAP); fprintf(add_fd, "cn: Domain Admins\n"); fprintf(add_fd, "memberUid: Administrator\n"); fprintf(add_fd, "description: Netbios Domain Administrators\n"); @@ -209,8 +209,8 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid, suffix); fprintf(add_fd, "dn: cn=Domain Users,ou=%s,%s\n", group_attr, suffix); - fprintf(add_fd, "objectClass: posixGroup\n"); - fprintf(add_fd, "objectClass: sambaGroupMapping\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXGROUP); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_GROUPMAP); fprintf(add_fd, "cn: Domain Users\n"); fprintf(add_fd, "description: Netbios Domain Users\n"); fprintf(add_fd, "gidNumber: 513\n"); @@ -225,8 +225,8 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid, suffix); fprintf(add_fd, "dn: cn=Domain Guests,ou=%s,%s\n", group_attr, suffix); - fprintf(add_fd, "objectClass: posixGroup\n"); - fprintf(add_fd, "objectClass: sambaGroupMapping\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXGROUP); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_GROUPMAP); fprintf(add_fd, "cn: Domain Guests\n"); fprintf(add_fd, "description: Netbios Domain Guests\n"); fprintf(add_fd, "gidNumber: 514\n"); @@ -241,8 +241,8 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid, suffix); fprintf(add_fd, "dn: cn=Domain Computers,ou=%s,%s\n", group_attr, suffix); - fprintf(add_fd, "objectClass: posixGroup\n"); - fprintf(add_fd, "objectClass: sambaGroupMapping\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXGROUP); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_GROUPMAP); fprintf(add_fd, "gidNumber: 515\n"); fprintf(add_fd, "cn: Domain Computers\n"); fprintf(add_fd, "description: Netbios Domain Computers accounts\n"); @@ -257,8 +257,8 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid, suffix); fprintf(add_fd, "dn: cn=Administrators,ou=%s,%s\n", group_attr, suffix); - fprintf(add_fd, "objectClass: posixGroup\n"); - fprintf(add_fd, "objectClass: sambaGroupMapping\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXGROUP); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_GROUPMAP); fprintf(add_fd, "gidNumber: 544\n"); fprintf(add_fd, "cn: Administrators\n"); fprintf(add_fd, "description: Netbios Domain Members can fully administer the computer/sambaDomainName\n"); @@ -272,8 +272,8 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid, suffix); fprintf(add_fd, "dn: cn=Print Operators,ou=%s,%s\n", group_attr, suffix); - fprintf(add_fd, "objectClass: posixGroup\n"); - fprintf(add_fd, "objectClass: sambaGroupMapping\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXGROUP); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_GROUPMAP); fprintf(add_fd, "gidNumber: 550\n"); fprintf(add_fd, "cn: Print Operators\n"); fprintf(add_fd, "description: Netbios Domain Print Operators\n"); @@ -288,8 +288,8 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid, suffix); fprintf(add_fd, "dn: cn=Backup Operators,ou=%s,%s\n", group_attr, suffix); - fprintf(add_fd, "objectClass: posixGroup\n"); - fprintf(add_fd, "objectClass: sambaGroupMapping\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXGROUP); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_GROUPMAP); fprintf(add_fd, "gidNumber: 551\n"); fprintf(add_fd, "cn: Backup Operators\n"); fprintf(add_fd, "description: Netbios Domain Members can bypass file security to back up files\n"); @@ -303,8 +303,8 @@ static NTSTATUS populate_ldap_for_ldif(const char *sid, fprintf(add_fd, "# Replicators, %s, %s\n", group_attr, suffix); fprintf(add_fd, "dn: cn=Replicators,ou=%s,%s\n", group_attr, suffix); - fprintf(add_fd, "objectClass: posixGroup\n"); - fprintf(add_fd, "objectClass: sambaGroupMapping\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXGROUP); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_GROUPMAP); fprintf(add_fd, "gidNumber: 552\n"); fprintf(add_fd, "cn: Replicators\n"); fprintf(add_fd, "description: Netbios Domain Supports file replication in a sambaDomainName\n"); @@ -544,8 +544,8 @@ static NTSTATUS fetch_group_info_to_ldif(TALLOC_CTX *mem_ctx, suffix); fprintf_attr(add_fd, "dn", "cn=%s,ou=%s,%s", groupname, group_attr, suffix); - fprintf(add_fd, "objectClass: posixGroup\n"); - fprintf(add_fd, "objectClass: sambaGroupMapping\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXGROUP); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_GROUPMAP); fprintf_attr(add_fd, "cn", "%s", groupname); fprintf(add_fd, "gidNumber: %d\n", ldif_gid); fprintf(add_fd, "sambaSID: %s\n", groupmap->sambaSID); @@ -670,9 +670,9 @@ static NTSTATUS fetch_account_info_to_ldif(TALLOC_CTX *mem_ctx, SAFE_FREE(user_rdn); fprintf(add_fd, "ObjectClass: top\n"); fprintf(add_fd, "objectClass: inetOrgPerson\n"); - fprintf(add_fd, "objectClass: posixAccount\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXACCOUNT); fprintf(add_fd, "objectClass: shadowAccount\n"); - fprintf(add_fd, "objectClass: sambaSamAccount\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_SAMBASAMACCOUNT); fprintf_attr(add_fd, "cn", "%s", username); fprintf_attr(add_fd, "sn", "%s", username); fprintf_attr(add_fd, "uid", "%s", username); @@ -775,8 +775,8 @@ static NTSTATUS fetch_alias_info_to_ldif(TALLOC_CTX *mem_ctx, suffix); fprintf_attr(add_fd, "dn", "cn=%s,ou=%s,%s", aliasname, group_attr, suffix); - fprintf(add_fd, "objectClass: posixGroup\n"); - fprintf(add_fd, "objectClass: sambaGroupMapping\n"); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_POSIXGROUP); + fprintf(add_fd, "objectClass: %s\n", LDAP_OBJ_GROUPMAP); fprintf(add_fd, "cn: %s\n", aliasname); fprintf(add_fd, "gidNumber: %d\n", ldif_gid); fprintf(add_fd, "sambaSID: %s\n", groupmap->sambaSID); diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index ca2ad18546..2ad9c57e5f 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -2723,8 +2723,8 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods, entry, "sambaSID", mem_ctx); if (!sidstr) { - DEBUG(0, ("Severe DB error, sambaSamAccount can't miss " - "the sambaSID attribute\n")); + DEBUG(0, ("Severe DB error, %s can't miss the sambaSID" + "attribute\n", LDAP_OBJ_SAMBASAMACCOUNT)); ret = NT_STATUS_INTERNAL_DB_CORRUPTION; goto done; } @@ -2774,8 +2774,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods, entry, get_global_sam_sid(), &rid)) { - DEBUG(0, ("Severe DB error, sambaSamAccount can't miss " - "the sambaSID attribute\n")); + DEBUG(0, ("Severe DB error, %s can't miss the samba SID" "attribute\n", LDAP_OBJ_SAMBASAMACCOUNT)); ret = NT_STATUS_INTERNAL_DB_CORRUPTION; goto done; } @@ -2981,8 +2980,8 @@ static NTSTATUS ldapsam_map_posixgroup(TALLOC_CTX *mem_ctx, int rc; filter = talloc_asprintf(mem_ctx, - "(&(objectClass=posixGroup)(gidNumber=%u))", - map->gid); + "(&(objectClass=%s)(gidNumber=%u))", + LDAP_OBJ_POSIXGROUP, map->gid); if (filter == NULL) { return NT_STATUS_NO_MEMORY; } @@ -3005,7 +3004,7 @@ static NTSTATUS ldapsam_map_posixgroup(TALLOC_CTX *mem_ctx, mods = NULL; smbldap_set_mod(&mods, LDAP_MOD_ADD, "objectClass", - "sambaGroupMapping"); + LDAP_OBJ_GROUPMAP); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, &mods, "sambaSid", sid_string_talloc(mem_ctx, &map->sid)); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, entry, &mods, "sambaGroupType", @@ -3125,10 +3124,9 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods, mods = NULL; smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "objectClass", - "sambaSidEntry"); + LDAP_OBJ_SID_ENTRY); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "objectClass", - "sambaGroupMapping"); - + LDAP_OBJ_GROUPMAP); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "sambaSid", sid_string_talloc(mem_ctx, &map->sid)); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "sambaGroupType", @@ -4186,8 +4184,8 @@ static char *get_ldap_filter(TALLOC_CTX *mem_ctx, const char *username) char *escaped = NULL; char *result = NULL; - asprintf(&filter, "(&%s(objectclass=sambaSamAccount))", - "(uid=%u)"); + asprintf(&filter, "(&%s(objectclass=%s))", + "(uid=%u)", LDAP_OBJ_SAMBASAMACCOUNT); if (filter == NULL) goto done; escaped = escape_ldap_string_alloc(username); @@ -4694,9 +4692,10 @@ static bool ldapsam_search_grouptype(struct pdb_methods *methods, state->connection = ldap_state->smbldap_state; state->scope = LDAP_SCOPE_SUBTREE; state->filter = talloc_asprintf(search->mem_ctx, - "(&(objectclass=sambaGroupMapping)" - "(sambaGroupType=%d)(sambaSID=%s*))", - type, sid_to_fstring(tmp, sid)); + "(&(objectclass=%s)" + "(sambaGroupType=%d)(sambaSID=%s*))", + LDAP_OBJ_GROUPMAP, + type, sid_to_fstring(tmp, sid)); state->attrs = talloc_attrs(search->mem_ctx, "cn", "sambaSid", "displayName", "description", "sambaGroupType", NULL); @@ -5828,15 +5827,15 @@ static bool get_trusteddom_pw_int(struct ldapsam_privates *ldap_state, if (num_result > 1) { DEBUG(1, ("ldapsam_get_trusteddom_pw: more than one " - "sambaTrustedDomainPassword object for domain '%s'" - "?!\n", domain)); + "%s object for domain '%s'?!\n", + LDAP_OBJ_TRUSTDOM_PASSWORD, domain)); return False; } if (num_result == 0) { DEBUG(1, ("ldapsam_get_trusteddom_pw: no " - "sambaTrustedDomainPassword object for domain %s.\n", - domain)); + "%s object for domain %s.\n", + LDAP_OBJ_TRUSTDOM_PASSWORD, domain)); *entry = NULL; } else { *entry = ldap_first_entry(priv2ld(ldap_state), result); @@ -5934,7 +5933,7 @@ static bool ldapsam_set_trusteddom_pw(struct pdb_methods *methods, mods = NULL; smbldap_make_mod(priv2ld(ldap_state), entry, &mods, "objectClass", - "sambaTrustedDomainPassword"); + LDAP_OBJ_TRUSTDOM_PASSWORD); smbldap_make_mod(priv2ld(ldap_state), entry, &mods, "sambaDomainName", domain); smbldap_make_mod(priv2ld(ldap_state), entry, &mods, "sambaSID", |