{"id":659,"date":"2010-10-18T02:20:44","date_gmt":"2010-10-18T07:20:44","guid":{"rendered":"http:\/\/yourLinuxGuy.com\/?p=659"},"modified":"2010-10-23T22:24:58","modified_gmt":"2010-10-24T03:24:58","slug":"how-to-do-ldaps-queries-from-linux-to-active-directory-pt-3","status":"publish","type":"post","link":"https:\/\/yourLinuxGuy.com\/?p=659","title":{"rendered":"How to do LDAPS queries from Linux to Active Directory pt. 3"},"content":{"rendered":"<p>Sub-Title:\u00a0 &#8220;Escaping commas in LDAP(S) queries to AD&#8221;<\/p>\n<p><em>This is part 3 in a series of 5 posts on this subject; please also see <a title=\"http:\/\/yourlinuxguy.com\/?p=635\" href=\"http:\/\/yourlinuxguy.com\/?p=635\" target=\"_blank\">part 1<\/a>, <a title=\"http:\/\/yourlinuxguy.com\/?p=649\" href=\"http:\/\/yourlinuxguy.com\/?p=649\" target=\"_blank\">part 2<\/a>, <a title=\"http:\/\/yourlinuxguy.com\/?p=661\" href=\"http:\/\/yourlinuxguy.com\/?p=661\" target=\"_blank\">part 4<\/a>, and <a title=\"http:\/\/yourlinuxguy.com\/?p=663\" href=\"http:\/\/yourlinuxguy.com\/?p=663\" target=\"_blank\">part 5<\/a>.<\/em><\/p>\n<p>If the username in your query has a comma in it, you are going to need to &#8220;escape&#8221; the comma so the system does not confuse it with the standard ldap namespace separator.\u00a0 And please don&#8217;t ask me why somebody would put a comma in there&#8230; It very well could be the result of an Identity Managment driver or something automated process, because certainly no rational human would do such a thing!\u00a0 So here&#8217;s and example of how to use an &#8220;escape&#8221; for those situations:<\/p>\n<pre><code>ldapsearch -x -H ldaps:\/\/CORPDC02.yourlinuxguy.com -b dc=yourlinuxguy,dc=com -D \"cn=Pavlov\\, Jeremy W.,ou=Users,ou=Southfield,dc=yourlinuxguy,dc=com\" -W mail=jwpavlov@yourlinuxguy.com<\/code><\/pre>\n<p>&#8230;for more, see:<br \/>\n<a title=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa746384%28VS.85%29.aspx\" href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa746384%28VS.85%29.aspx\" target=\"_blank\">http:\/\/msdn.microsoft.com\/en-us\/library\/aa746384%28VS.85%29.aspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sub-Title:\u00a0 &#8220;Escaping commas in LDAP(S) queries to AD&#8221; This is part 3 in a series of 5 posts on this subject; please also see part 1, part 2, part 4, and part 5. If the username in your query has&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/yourLinuxGuy.com\/?p=659\">Read more<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10,47,20],"tags":[],"class_list":["post-659","post","type-post","status-publish","format-standard","hentry","category-introductory","category-linuxgeneral","category-windowsgeneral"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pnjn1-aD","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=659"}],"version-history":[{"count":2,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/659\/revisions"}],"predecessor-version":[{"id":665,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/659\/revisions\/665"}],"wp:attachment":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}