I'm scripting some ldap automation and have reached a slight hangup. Basically, I want to check if an attribute being added to an entry actually exists within a given objectClass before I try to add it.
So far the best idea I have for this is just running a regex on the schema definition file for the attribute, but that wouldn't account for the schema file being edited after the config is initialized.
A second thought would be to just catch the error thrown if the attribute can't be added, but that seems less efficient since my next step would then be to add the attribute to the schema and rebuild the config.
Seems like there should be a simple ldapsearch command to do this but I can't figure out the syntax.
so far I've tried:
ldapsearch -x -b 'dc=MY_DOMAIN,dc=com' '(objectclass=mySCHEMA)'
but that just lists any ldap entries that have the mySCHEMA objectclass on them.
Thanks for the help, Cheers!