For a DN that ends in 'OU=DC,DC=example,DC=com' the strstr match in ldapSearch() will match the 'DC' value of the OU and will build a DN of 'DC,DC=example,DC=com' which is invalid. This naturally also applies to the letter sequence 'DC' anywhere in the DN.
For a DN that ends in 'OU=DC,DC=example,DC=com' the strstr match in ldapSearch() will match the 'DC' value of the OU and will build a DN of 'DC,DC=example,DC=com' which is invalid. This naturally also applies to the letter sequence 'DC' anywhere in the DN.