So I had a problem with the ldapusersearch string as some eejit has created an OU with spaces and an apostrophe in the name. So the characters are represented as:
comma %2c
space %27
apostrophe %27
For example (entirely fictional organisation):
src staff {
ldapusersearch ldap://dc.ads.domain.uk:3268/dc=ads,dc=domain,dc=uk?sAMAccountName?sub?(&(sAMAccountName=%s)(memberOf=cn=All%20Staff%2cOU=King%27s%20College%20Dublin%2cdc=ads%2cdc=domain%2cdc=uk))
}

