I can recommend LDAP for rocket scientists, very nice and thorough intro to the protocol
To answer your question:
distinguishedname: full path of the object in the tree. So if the ldap server has a base of dc=domain,dc=tld and the object is in the container ou=users, then the dn could be cn=object,ou=users,dc=domain,dc=tld
rdn is in the example cn=object, because it is relative to ou=users,dc=domain,dc=tld.
If the object was in ou=otherusers,dc=domain,dc=tld, then the rdn would still be cn=object, but then it would have a different dn: cn=object,ou=otherusers,dc=domain,dc=tld.
So the rdn is relative to its parent.
And the common name cn is just an attribute. Sometimes the cn and the rdn have the same value. Other times, the rdn is uid=user (instead of cn=user), like most unix ldap servers do. So the dn would then be uid=user,ou=users,dc=domain,dc=tld. And that object could have a cn attribute as well to make it even fuzzier.
The differences have to do on what kind of object is being referenced, because every type of object has a different set of objectclasses that define what attributes it may (or may not) have.
The book is free to read, by the way.
cnis "common name", not "canonical name". – Sam Morris Jun 27 '23 at 13:15cnis the LDAP projection of AD'sCommon-Nameattribute: https://learn.microsoft.com/en-us/windows/win32/adschema/a-cn; this aligns with the standard LDAP schema defined in RFC 4519: https://datatracker.ietf.org/doc/html/rfc4519#section-2.3 – Sam Morris Jun 28 '23 at 10:03Canonical-Name(constructed) attribute in AD, btw, but it is projected to LDAP ascanonicalName: https://learn.microsoft.com/en-us/windows/win32/adschema/a-canonicalname – Sam Morris Jun 28 '23 at 10:39