title: How to query LDAP for email addresses of posixGroup members?
body: <p>I am running an OpenLDAP server with groups of type posixGroup and users of type inetOrgPerson.</p>
  
  <p>I need to extract the email address attribute for the users in a specified group.</p>
  
  <p>The posixGroup type only stores the uid of the members in an attribute called memberUid.</p>
  
  <p>The inetOrgPerson type does not store group membership information.</p>
  
  <p>So basically I need to query for a group, extract the user ids, use those user ids to find the matching inetOrgPerson nodes and then grab the mail attribute.</p>
  
  <p>I was hoping to be able to do all of this in one single filtered query, but I don't seem to able to find the right syntax to make it happen. This scenario seems to be more complex than most of the example queries I can find Googling.</p>
  
  <p>Also, I am trying to do this all from an sh script if possible (on Ubuntu), so I have the ldapsearch command available.</p>
  
  <p>Any ideas?</p>